mirror of
https://github.com/tiennm99/lombok.git
synced 2026-10-14 00:16:47 +00:00
Renaming an inner type, or a type in a linked file, still failed. Now it works.
This commit is contained in:
1 parent
61d2011f1f
commit
2f80f9eff4
2 files changed
+18
No files matched your search
@@ -81,6 +81,13 @@ public class EclipsePatcher {
|
||||
.decisionMethod(new Hook("lombok/eclipse/agent/PatchFixes", "skipRewritingGeneratedNodes",
|
||||
"(Lorg/eclipse/jdt/core/dom/ASTNode;)Z"))
|
||||
.transplant().request(StackRequest.PARAM1).build());
|
||||
|
||||
sm.addScript(ScriptBuilder.wrapMethodCall()
|
||||
.target(new MethodTarget("org.eclipse.jdt.internal.corext.refactoring.rename.RenameTypeProcessor", "addConstructorRenames"))
|
||||
.methodToWrap(new Hook("org/eclipse/jdt/core/IType", "getMethods", "()[Lorg/eclipse/jdt/core/IMethod;"))
|
||||
.wrapMethod(new Hook("lombok/eclipse/agent/PatchFixes", "removeGeneratedMethods",
|
||||
"([Lorg/eclipse/jdt/core/IMethod;)[Lorg/eclipse/jdt/core/IMethod;"))
|
||||
.transplant().build());
|
||||
}
|
||||
|
||||
private static void patchCatchReparse(ScriptManager sm) {
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
package lombok.eclipse.agent;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.jdt.core.IMethod;
|
||||
import org.eclipse.jdt.core.dom.SimpleName;
|
||||
|
||||
public class PatchFixes {
|
||||
@@ -34,6 +37,14 @@ public class PatchFixes {
|
||||
}
|
||||
}
|
||||
|
||||
public static IMethod[] removeGeneratedMethods(IMethod[] methods) throws Exception {
|
||||
List<IMethod> result = new ArrayList<IMethod>();
|
||||
for (IMethod m : methods) {
|
||||
if (m.getNameRange().getLength() > 0) result.add(m);
|
||||
}
|
||||
return result.size() == methods.length ? methods : result.toArray(new IMethod[0]);
|
||||
}
|
||||
|
||||
public static SimpleName[] removeGeneratedSimpleNames(SimpleName[] in) throws Exception {
|
||||
Field f = SimpleName.class.getField("$isGenerated");
|
||||
|
||||
|
||||
Reference in new issue
Block a user