Improved the matching of builder chain calls in commit
builder.entity(batchCreateIdResponse);
return builder.headers(responseData.getHeaders()).build();
>
return builder.headers(responseData.getHeaders()).entity(batchCreateIdResponse).build();
@@ -2806,6 +2806,7 @@ public class UMLOperationBodyMapper implements Comparable<UMLOperationBodyMapper
}
if(invocationCoveringTheEntireStatement2 != null) {
int commonArguments = 0;
+ Set<AbstractCodeFragment> additionallyMatchedStatements2 = new LinkedHashSet<AbstractCodeFragment>();
for(String key1 : methodInvocationMap1.keySet()) {
if(invocationCoveringTheEntireStatement1.actualString().startsWith(key1)) {
for(AbstractCall invocation1 : methodInvocationMap1.get(key1)) {
@@ -2819,13 +2820,30 @@ public class UMLOperationBodyMapper implements Comparable<UMLOperationBodyMapper
commonArguments += argumentIntersection.size();
}
}
+ for(AbstractCodeFragment codeFragment : replacementInfo.statements2) {
+ OperationInvocation invocation = codeFragment.invocationCoveringEntireFragment();
+ if(invocation != null) {
+ if(invocation.identical(invocation1, replacementInfo.getReplacements(), lambdaMappers)) {
+ additionallyMatchedStatements2.add(codeFragment);
+ }
+ if(invocation.getExpression() != null && invocation.getExpression().equals(invocation1.actualString())) {
+ additionallyMatchedStatements2.add(codeFragment);
+ }
+ }
+ }
}
}
}
if(commonArguments > 0) {
+ if(additionallyMatchedStatements2.size() > 0) {
+ Replacement composite = new CompositeReplacement(statement1.getString(), statement2.getString(), new LinkedHashSet<AbstractCodeFragment>(), additionallyMatchedStatements2);
+ replacementInfo.addReplacement(composite);
+ }
+ else {
Replacement replacement = new MethodInvocationReplacement(invocationCoveringTheEntireStatement1.getName(), invocationCoveringTheEntireStatement2.getName(),
invocationCoveringTheEntireStatement1, invocationCoveringTheEntireStatement2, ReplacementType.METHOD_INVOCATION);
replacementInfo.addReplacement(replacement);
+ }
return replacementInfo.getReplacements();
}
}
@@ -2851,6 +2869,7 @@ public class UMLOperationBodyMapper implements Comparable<UMLOperationBodyMapper
}
if(invocationCoveringTheEntireStatement1 != null) {
int commonArguments = 0;
+ Set<AbstractCodeFragment> additionallyMatchedStatements1 = new LinkedHashSet<AbstractCodeFragment>();
for(String key2 : methodInvocationMap2.keySet()) {
if(invocationCoveringTheEntireStatement2.actualString().startsWith(key2)) {
for(AbstractCall invocation2 : methodInvocationMap2.get(key2)) {
@@ -2864,13 +2883,30 @@ public class UMLOperationBodyMapper implements Comparable<UMLOperationBodyMapper
commonArguments += argumentIntersection.size();
}
}
+ for(AbstractCodeFragment codeFragment : replacementInfo.statements1) {
+ OperationInvocation invocation = codeFragment.invocationCoveringEntireFragment();
+ if(invocation != null) {
+ if(invocation.identical(invocation2, replacementInfo.getReplacements(), lambdaMappers)) {
+ additionallyMatchedStatements1.add(codeFragment);
+ }
+ if(invocation.getExpression() != null && invocation.getExpression().equals(invocation2.actualString())) {
+ additionallyMatchedStatements1.add(codeFragment);
+ }
+ }
+ }
}
}
}
if(commonArguments > 0) {
+ if(additionallyMatchedStatements1.size() > 0) {
+ Replacement composite = new CompositeReplacement(statement1.getString(), statement2.getString(), additionallyMatchedStatements1, new LinkedHashSet<AbstractCodeFragment>());
+ replacementInfo.addReplacement(composite);
+ }
+ else {
Replacement replacement = new MethodInvocationReplacement(invocationCoveringTheEntireStatement1.getName(), invocationCoveringTheEntireStatement2.getName(),
invocationCoveringTheEntireStatement1, invocationCoveringTheEntireStatement2, ReplacementType.METHOD_INVOCATION);
replacementInfo.addReplacement(replacement);
+ }
return replacementInfo.getReplacements();
}
}
