diff --git a/src/main/java/gr/uom/java/xmi/decomposition/AbstractCall.java b/src/main/java/gr/uom/java/xmi/decomposition/AbstractCall.java index 292b2f660..761f40945 100644 --- a/src/main/java/gr/uom/java/xmi/decomposition/AbstractCall.java +++ b/src/main/java/gr/uom/java/xmi/decomposition/AbstractCall.java @@ -1270,12 +1270,24 @@ private static boolean equalsIgnoringExtraParenthesis(String s1, String s2) { if(s2.endsWith(methodReferenceName + "()")) { return true; } + if(methodReferenceName.equals("new")) { + String type = s1.substring(0, s1.indexOf(JAVA.METHOD_REFERENCE)); + if(s2.startsWith("new " + type)) { + return true; + } + } } if(s2.contains(JAVA.METHOD_REFERENCE) && !s1.contains(JAVA.METHOD_REFERENCE)) { String methodReferenceName = s2.substring(s2.indexOf(JAVA.METHOD_REFERENCE) + 2, s2.length()); if(s1.endsWith(methodReferenceName + "()")) { return true; } + if(methodReferenceName.equals("new")) { + String type = s2.substring(0, s2.indexOf(JAVA.METHOD_REFERENCE)); + if(s1.startsWith("new " + type)) { + return true; + } + } } String reservedTokens1 = ReplacementUtil.keepReservedTokens(s1); String reservedTokens2 = ReplacementUtil.keepReservedTokens(s2);