aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorReinier Zwitserloot <reinier@tipit.to>2009-10-09 02:30:39 +0200
committerReinier Zwitserloot <reinier@tipit.to>2009-10-09 02:30:39 +0200
commitf7db5c02eba332c69971ad59b3543774ba25285d (patch)
tree58fd9fb1496c10aa9558e3229ec8a68783710fae
parente88b49fdf77ba363645a95ace41023c16913b51e (diff)
downloadlombok-f7db5c02eba332c69971ad59b3543774ba25285d.tar.gz
lombok-f7db5c02eba332c69971ad59b3543774ba25285d.tar.bz2
lombok-f7db5c02eba332c69971ad59b3543774ba25285d.zip
After a 4 hour crazy search, we found it! Rename Compilation Unit refactor script now works fine, even if your class has a @Data annotation.
-rw-r--r--src_eclipseagent/lombok/eclipse/agent/EclipsePatcher.java7
-rw-r--r--src_eclipseagent/lombok/eclipse/agent/PatchFixes.java4
2 files changed, 11 insertions, 0 deletions
diff --git a/src_eclipseagent/lombok/eclipse/agent/EclipsePatcher.java b/src_eclipseagent/lombok/eclipse/agent/EclipsePatcher.java
index 029d7994..7752bfb4 100644
--- a/src_eclipseagent/lombok/eclipse/agent/EclipsePatcher.java
+++ b/src_eclipseagent/lombok/eclipse/agent/EclipsePatcher.java
@@ -70,9 +70,16 @@ public class EclipsePatcher {
private static void patchHideGeneratedNodes(ScriptManager sm) {
sm.addScript(ScriptBuilder.wrapReturnValue()
.target(new MethodTarget("org.eclipse.jdt.internal.corext.dom.LinkedNodeFinder", "findByNode"))
+ .target(new MethodTarget("org.eclipse.jdt.internal.corext.dom.LinkedNodeFinder", "findByBinding"))
.wrapMethod(new Hook("lombok/eclipse/agent/PatchFixes", "removeGeneratedSimpleNames",
"([Lorg/eclipse/jdt/core/dom/SimpleName;)[Lorg/eclipse/jdt/core/dom/SimpleName;"))
.request(StackRequest.RETURN_VALUE).build());
+
+ sm.addScript(ScriptBuilder.exitEarly()
+ .target(new MethodTarget("org.eclipse.jdt.core.dom.rewrite.ASTRewrite", "replace"))
+ .decisionMethod(new Hook("lombok/eclipse/agent/PatchFixes", "skipRewritingGeneratedNodes",
+ "(Lorg/eclipse/jdt/core/dom/ASTNode;)Z"))
+ .transplant().request(StackRequest.PARAM1).build());
}
private static void patchCatchReparse(ScriptManager sm) {
diff --git a/src_eclipseagent/lombok/eclipse/agent/PatchFixes.java b/src_eclipseagent/lombok/eclipse/agent/PatchFixes.java
index 1914bba7..c8459a5f 100644
--- a/src_eclipseagent/lombok/eclipse/agent/PatchFixes.java
+++ b/src_eclipseagent/lombok/eclipse/agent/PatchFixes.java
@@ -16,6 +16,10 @@ public class PatchFixes {
return (bits & BIT24) != 0;
}
+ public static boolean skipRewritingGeneratedNodes(org.eclipse.jdt.core.dom.ASTNode node) throws Exception {
+ return ((Boolean)node.getClass().getField("$isGenerated").get(node)).booleanValue();
+ }
+
public static void setIsGeneratedFlag(org.eclipse.jdt.core.dom.ASTNode domNode,
org.eclipse.jdt.internal.compiler.ast.ASTNode internalNode) throws Exception {
boolean isGenerated = internalNode.getClass().getField("$generatedBy").get(internalNode) != null;