Skip to content

Commit

Permalink
Fix for issue #88
Browse files Browse the repository at this point in the history
  • Loading branch information
tsantalis committed Jan 5, 2025
1 parent 395f359 commit 8e8c087
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2419,8 +2419,10 @@ else if(methods1.size() == 1 && methods2.size() == 1) {
checkIfStatementIsSuperConstructorInvocation(nodeMapping, nodeMapping.getNodeG2());
checkIfStatementIsThisConstructorInvocation(nodeMapping, nodeMapping.getNodeG1());
checkIfStatementIsThisConstructorInvocation(nodeMapping, nodeMapping.getNodeG2());
checkIfStatementContainsSuperMethodInvocation(nodeMapping, nodeMapping.getNodeG1());
checkIfStatementContainsSuperMethodInvocation(nodeMapping, nodeMapping.getNodeG2());
if(!iCompilationUnit1.equals(iCompilationUnit2)) {
checkIfStatementContainsSuperMethodInvocation(nodeMapping, nodeMapping.getNodeG1());
checkIfStatementContainsSuperMethodInvocation(nodeMapping, nodeMapping.getNodeG2());
}
//skip examining the conditional return precondition, if the number of examined nodes is equal to the number of PDG nodes
if(getAllNodesInSubTreePDG1().size() != pdg1.getNodes().size()) {
conditionalReturnStatement(nodeMapping, nodeMapping.getNodeG1());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3825,15 +3825,28 @@ else if(oldASTNode instanceof Statement) {
SuperMethodInvocation oldSuperMethodInvocation = (SuperMethodInvocation)oldExpression;
SuperMethodInvocation newSuperMethodInvocation = (SuperMethodInvocation)newSuperMethodInvocations.get(j);
if(oldSuperMethodInvocation.resolveMethodBinding().getDeclaringClass().isEqualTo(commonSuperTypeOfSourceTypeDeclarations)) {
MethodInvocation newMethodInvocation = ast.newMethodInvocation();
sourceRewriter.set(newMethodInvocation, MethodInvocation.NAME_PROPERTY, oldSuperMethodInvocation.getName(), null);
ListRewrite argumentRewrite = sourceRewriter.getListRewrite(newMethodInvocation, MethodInvocation.ARGUMENTS_PROPERTY);
List<Expression> oldArguments = oldSuperMethodInvocation.arguments();
for(Expression oldArgument : oldArguments) {
argumentRewrite.insertLast(oldArgument, null);
if(typeBinding1.isEqualTo(typeBinding2)) {
SuperMethodInvocation newMethodInvocation = ast.newSuperMethodInvocation();
sourceRewriter.set(newMethodInvocation, SuperMethodInvocation.NAME_PROPERTY, oldSuperMethodInvocation.getName(), null);
ListRewrite argumentRewrite = sourceRewriter.getListRewrite(newMethodInvocation, SuperMethodInvocation.ARGUMENTS_PROPERTY);
List<Expression> oldArguments = oldSuperMethodInvocation.arguments();
for(Expression oldArgument : oldArguments) {
argumentRewrite.insertLast(oldArgument, null);
}
sourceRewriter.replace(newSuperMethodInvocation, newMethodInvocation, null);
replacement = true;
}
else {
MethodInvocation newMethodInvocation = ast.newMethodInvocation();
sourceRewriter.set(newMethodInvocation, MethodInvocation.NAME_PROPERTY, oldSuperMethodInvocation.getName(), null);
ListRewrite argumentRewrite = sourceRewriter.getListRewrite(newMethodInvocation, MethodInvocation.ARGUMENTS_PROPERTY);
List<Expression> oldArguments = oldSuperMethodInvocation.arguments();
for(Expression oldArgument : oldArguments) {
argumentRewrite.insertLast(oldArgument, null);
}
sourceRewriter.replace(newSuperMethodInvocation, newMethodInvocation, null);
replacement = true;
}
sourceRewriter.replace(newSuperMethodInvocation, newMethodInvocation, null);
replacement = true;
break;
}
j++;
Expand Down

0 comments on commit 8e8c087

Please sign in to comment.