Skip to content

Commit 34fab8c

Browse files
committed
manage static call with clas name EE9
Signed-off-by: Olivier Lamy <[email protected]>
1 parent d4787eb commit 34fab8c

File tree

1 file changed

+18
-6
lines changed

1 file changed

+18
-6
lines changed

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

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,17 @@ public Visitable visit(MethodCallExpr n, Void arg) {
257257
n.setScope(nameExpr);
258258
}
259259
}
260+
261+
if(StringUtils.startsWith(fullString, "EE9") && n.getScope().isPresent()) {
262+
// org.eclipse.jetty.ee9.nested.Response.unwrap(event.getSuppliedResponse())
263+
Expression expression = n.getScope().get();
264+
if(expression.isNameExpr()) {
265+
NameExpr nameExpr = n.getScope().get().asNameExpr();;
266+
String oldExp = nameExpr.getNameAsString();
267+
n.setScope(new NameExpr(oldExp.replaceFirst("EE9", "EE8")));
268+
}
269+
}
270+
260271
if(StringUtils.contains(fullString, "Jakarta") && n.getScope().isPresent()){
261272

262273
n.getArguments().stream().filter(node -> node instanceof NodeWithSimpleName)
@@ -595,14 +606,15 @@ public static String changeEE9TypeToEE8(String currentType) {
595606
//org.eclipse.jetty.ee9.nested to org.eclipse.jetty.ee8.nested
596607
if (currentType.startsWith("org.eclipse.jetty.ee9")) {
597608
String newType = StringUtils.replace(currentType, "org.eclipse.jetty.ee9", "org.eclipse.jetty.ee8");
609+
if(StringUtils.contains(newType, "EE9")) {
610+
newType = StringUtils.replace(newType, "EE9", "EE8");
611+
}
612+
if(StringUtils.contains(newType, "ee9")) {
613+
newType = StringUtils.replace(newType, "ee9", "ee8");
614+
}
615+
598616
return newType;
599617
}
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-
}
606618
return null;
607619
}
608620

0 commit comments

Comments
 (0)