aboutsummaryrefslogtreecommitdiff
path: root/src/eclipseAgent/lombok/eclipse/agent/EclipsePatcher.java
diff options
context:
space:
mode:
authorRoel Spilker <r.spilker@gmail.com>2012-01-02 20:45:30 +0100
committerRoel Spilker <r.spilker@gmail.com>2012-01-02 20:45:30 +0100
commit9f3b92c6acb768d94773a822335c626898396a03 (patch)
tree79ddfa433afd3e203ba775255d6cdf4731635c7a /src/eclipseAgent/lombok/eclipse/agent/EclipsePatcher.java
parent6c9b3d54de988665b64a0114cac5c20059e4af2a (diff)
parent8749b4b547a30503568c304a011ab25ea4af2be2 (diff)
downloadlombok-9f3b92c6acb768d94773a822335c626898396a03.tar.gz
lombok-9f3b92c6acb768d94773a822335c626898396a03.tar.bz2
lombok-9f3b92c6acb768d94773a822335c626898396a03.zip
Merge branch 'Issue_86_Extract_Interface' of https://github.com/jvanderhel/lombok into jvanderhel-Issue_86_Extract_Interface
Diffstat (limited to 'src/eclipseAgent/lombok/eclipse/agent/EclipsePatcher.java')
-rw-r--r--src/eclipseAgent/lombok/eclipse/agent/EclipsePatcher.java19
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)