Skip to content

Commit

Permalink
MethodDeclarations and their SimpleName(s) are now marked as generate…
Browse files Browse the repository at this point in the history
…d when using eclipse 3.7 M5 or higher (when appropriate)
  • Loading branch information
jvanderhel committed Nov 11, 2011
1 parent 9433db4 commit 9c469dc
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/eclipseAgent/lombok/eclipse/agent/EclipsePatcher.java
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,13 @@ private static void patchSetGeneratedFlag(ScriptManager sm) {
"org.eclipse.jdt.core.dom.ASTNode", "org.eclipse.jdt.internal.compiler.ast.ASTNode"))
.transplant().build());

sm.addScript(ScriptBuilder.wrapReturnValue()
.target(new MethodTarget("org.eclipse.jdt.core.dom.ASTConverter", "convert", "org.eclipse.jdt.core.dom.ASTNode", "boolean", "org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration"))
.request(StackRequest.PARAM2, StackRequest.RETURN_VALUE)
.wrapMethod(new Hook("lombok.eclipse.agent.PatchFixes", "setIsGeneratedFlag", "void",
"org.eclipse.jdt.core.dom.ASTNode", "org.eclipse.jdt.internal.compiler.ast.ASTNode"))
.transplant().build());

sm.addScript(ScriptBuilder.wrapMethodCall()
.target(new TargetMatcher() {
@Override public boolean matches(String classSpec, String methodName, String descriptor) {
Expand All @@ -245,6 +252,14 @@ private static void patchSetGeneratedFlag(ScriptManager sm) {
.wrapMethod(new Hook("lombok.eclipse.agent.PatchFixes", "setIsGeneratedFlagForSimpleName", "void",
"org.eclipse.jdt.core.dom.SimpleName", "java.lang.Object"))
.transplant().build());

sm.addScript(ScriptBuilder.wrapMethodCall()
.target(new MethodTarget("org.eclipse.jdt.core.dom.ASTConverter", "convert", "org.eclipse.jdt.core.dom.ASTNode", "boolean", "org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration"))
.methodToWrap(new Hook("org.eclipse.jdt.core.dom.SimpleName", "<init>", "void", "org.eclipse.jdt.core.dom.AST"))
.requestExtra(StackRequest.PARAM2)
.wrapMethod(new Hook("lombok.eclipse.agent.PatchFixes", "setIsGeneratedFlagForSimpleName", "void",
"org.eclipse.jdt.core.dom.SimpleName", "java.lang.Object"))
.transplant().build());
}

private static void patchAvoidReparsingGeneratedCode(ScriptManager sm) {
Expand Down

0 comments on commit 9c469dc

Please sign in to comment.