diff options
author | Jappe van der Hel <jappe.vanderhel@gmail.com> | 2011-12-21 20:32:03 +0100 |
---|---|---|
committer | Jappe van der Hel <jappe.vanderhel@gmail.com> | 2011-12-21 20:32:03 +0100 |
commit | 8749b4b547a30503568c304a011ab25ea4af2be2 (patch) | |
tree | 79ddfa433afd3e203ba775255d6cdf4731635c7a /src/eclipseAgent/lombok/eclipse/agent/EclipsePatcher.java | |
parent | 02d7e29dd9e821ae1ff51762bb02f002d93bbd4e (diff) | |
download | lombok-8749b4b547a30503568c304a011ab25ea4af2be2.tar.gz lombok-8749b4b547a30503568c304a011ab25ea4af2be2.tar.bz2 lombok-8749b4b547a30503568c304a011ab25ea4af2be2.zip |
Extract interface now works when @Data is present.
For all methods even generated by lombok;
comments for generated methods are placed above the "managing" annotations
@Override for generated methods are skipped (since there is no valid position for this annotation)
Diffstat (limited to 'src/eclipseAgent/lombok/eclipse/agent/EclipsePatcher.java')
-rw-r--r-- | src/eclipseAgent/lombok/eclipse/agent/EclipsePatcher.java | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/eclipseAgent/lombok/eclipse/agent/EclipsePatcher.java b/src/eclipseAgent/lombok/eclipse/agent/EclipsePatcher.java index a75157f3..b04419f6 100644 --- a/src/eclipseAgent/lombok/eclipse/agent/EclipsePatcher.java +++ b/src/eclipseAgent/lombok/eclipse/agent/EclipsePatcher.java @@ -94,6 +94,7 @@ public class EclipsePatcher extends Agent { patchListRewriteHandleGeneratedMethods(sm); patchSyntaxAndOccurrencesHighlighting(sm); patchSortMembersOperation(sm); + patchExtractInterface(sm); } else { patchPostCompileHookEcj(sm); } @@ -104,6 +105,24 @@ public class EclipsePatcher extends Agent { if (reloadExistingClasses) sm.reloadClasses(instrumentation); } + private static void patchExtractInterface(ScriptManager sm) { + /* get real generated node in stead of a random one generated by the annotation */ + sm.addScript(ScriptBuilder.replaceMethodCall() + .target(new MethodTarget("org.eclipse.jdt.internal.corext.refactoring.structure.ExtractInterfaceProcessor", "createMemberDeclarations")) + .target(new MethodTarget("org.eclipse.jdt.internal.corext.refactoring.structure.ExtractInterfaceProcessor", "createMethodComments")) + .methodToReplace(new Hook("org.eclipse.jdt.internal.corext.refactoring.structure.ASTNodeSearchUtil", "getMethodDeclarationNode", "org.eclipse.jdt.core.dom.MethodDeclaration", "org.eclipse.jdt.core.IMethod", "org.eclipse.jdt.core.dom.CompilationUnit")) + .replacementMethod(new Hook("lombok.eclipse.agent.PatchFixes", "getRealMethodDeclarationNode", "org.eclipse.jdt.core.dom.MethodDeclaration", "org.eclipse.jdt.core.IMethod", "org.eclipse.jdt.core.dom.CompilationUnit")) + .build()); + + /* Do not add @Override's for generated methods */ + sm.addScript(ScriptBuilder.exitEarly() + .target(new MethodTarget("org.eclipse.jdt.core.dom.rewrite.ListRewrite", "insertFirst")) + .decisionMethod(new Hook("lombok.eclipse.agent.PatchFixes", "isListRewriteOnGeneratedNode", "boolean", "org.eclipse.jdt.core.dom.rewrite.ListRewrite")) + .request(StackRequest.THIS) + .build()); + + } + private static void patchSyntaxAndOccurrencesHighlighting(ScriptManager sm) { /* * Skip generated nodes for "visual effects" (syntax highlighting && highlight occurrences) |