mirror of
https://github.com/tiennm99/lombok.git
synced 2026-10-14 22:17:41 +00:00
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.
This commit is contained in:
1 parent
e88b49fdf7
commit
f7db5c02eb
2 files changed
+11
No files matched your search
@@ -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) {
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in new issue
Block a user