Skip to content

Commit bf4e23f

Browse files
committed
manage type renaming of classes with ee9 or EE9
Signed-off-by: Olivier Lamy <[email protected]>
1 parent 1c96e55 commit bf4e23f

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

src/main/java/org/eclipse/jetty/toolchain/modifysources/ModifyEE9ToEE8.java

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -482,7 +482,9 @@ public Visitable visit(JavadocComment n, Void arg) {
482482
}, null );
483483

484484

485-
if (cu.getPrimaryTypeName().isPresent() && cu.getPrimaryTypeName().get().startsWith("Jakarta")) {
485+
if (cu.getPrimaryTypeName().isPresent() && ( cu.getPrimaryTypeName().get().contains("Jakarta")
486+
|| cu.getPrimaryTypeName().get().contains("ee9"))
487+
|| cu.getPrimaryTypeName().get().contains("EE9") ) {
486488
// we cannot as we have some demo packages as well
487489
//&& cu.getPackageDeclaration().get().getName().toString().startsWith("org.eclipse.jetty.ee8")) {
488490
compilationUnitsToRename.add(cu);
@@ -516,9 +518,9 @@ public Visitable visit(JavadocComment n, Void arg) {
516518
// at this stage everything has been renamed but the old file will be still save as we cannot change that
517519
String previousPackage = cu.getPackageDeclaration().get().getName().toString();
518520
String previousFullClassName = previousPackage + "." + cu.getPrimaryTypeName().get();
519-
String fullClassName = previousPackage + "." + //
520-
StringUtils.replaceFirst(cu.getPrimaryTypeName().get(), "Jakarta", "Javax");
521521
String className = replaceClassName(cu.getPrimaryTypeName().get());
522+
String fullClassName = previousPackage + "." + className;
523+
522524
cu.getPrimaryType().get().setName(className);
523525

524526
Path newPath = out.resolve(fullClassName.replace('.', '/') + ".java");
@@ -595,7 +597,12 @@ public static String changeEE9TypeToEE8(String currentType) {
595597
String newType = StringUtils.replace(currentType, "org.eclipse.jetty.ee9", "org.eclipse.jetty.ee8");
596598
return newType;
597599
}
598-
600+
if(StringUtils.contains(currentType, "EE9")) {
601+
return StringUtils.replace(currentType, "EE9", "EE8");
602+
}
603+
if(StringUtils.contains(currentType, "ee9")) {
604+
return StringUtils.replace(currentType, "ee9", "ee8");
605+
}
599606
return null;
600607
}
601608

0 commit comments

Comments
 (0)