Skip to content

Commit

Permalink
Insert correct parameter if there is more than one
Browse files Browse the repository at this point in the history
  • Loading branch information
Rawi01 authored and rspilker committed Dec 4, 2023
1 parent 3c80b44 commit f8191d5
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/eclipseAgent/lombok/launch/PatchFixesHider.java
Original file line number Diff line number Diff line change
Expand Up @@ -918,12 +918,14 @@ public static String[] getRealCodeBlocks(String[] blocks, SourceProvider sourceP
try {
// Replace parameter references with actual argument
AST ast = methodDeclaration.getAST();
for (Object param : methodDeclaration.parameters()) {
Object data = ((SingleVariableDeclaration)param).getProperty("org.eclipse.jdt.internal.corext.refactoring.code.ParameterData");
List<?> parameters = methodDeclaration.parameters();
for (int i = 0; i < parameters.size(); i++) {
SingleVariableDeclaration param = (SingleVariableDeclaration) parameters.get(i);
Object data = param.getProperty("org.eclipse.jdt.internal.corext.refactoring.code.ParameterData");
List<SimpleName> names = Permit.get(Permit.permissiveGetField(data.getClass(), "fReferences"), data);

for (SimpleName simpleName : names) {
ASTNode copy = ASTNode.copySubtree(ast, callContext.arguments[0]);
ASTNode copy = ASTNode.copySubtree(ast, callContext.arguments[i]);
simpleName.getParent().setStructuralProperty(simpleName.getLocationInParent(), copy);
}
}
Expand Down

0 comments on commit f8191d5

Please sign in to comment.