diff options
author | jvanderhel <Jappe.vanderhel@gmail.com> | 2011-11-24 21:02:50 +0100 |
---|---|---|
committer | jvanderhel <Jappe.vanderhel@gmail.com> | 2011-11-24 21:02:50 +0100 |
commit | 20b729509f351c812ec2753a80364dd859b70f34 (patch) | |
tree | 7072e89aaa4d1ef0e49364cab1a70600c20732cc /src/eclipseAgent | |
parent | 088f7bfbba75088e59b70f3cb51aae010b1d2893 (diff) | |
download | lombok-20b729509f351c812ec2753a80364dd859b70f34.tar.gz lombok-20b729509f351c812ec2753a80364dd859b70f34.tar.bz2 lombok-20b729509f351c812ec2753a80364dd859b70f34.zip |
Fix for issue 51. We now ignore unchanged generated nodes, so their position isn't used to determine insertion point
Diffstat (limited to 'src/eclipseAgent')
-rw-r--r-- | src/eclipseAgent/lombok/eclipse/agent/PatchFixes.java | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/src/eclipseAgent/lombok/eclipse/agent/PatchFixes.java b/src/eclipseAgent/lombok/eclipse/agent/PatchFixes.java index 0fc48807..fd02e0e0 100644 --- a/src/eclipseAgent/lombok/eclipse/agent/PatchFixes.java +++ b/src/eclipseAgent/lombok/eclipse/agent/PatchFixes.java @@ -110,19 +110,14 @@ public class PatchFixes { List<RewriteEvent> modifiedChildren = new ArrayList<RewriteEvent>(); for (int i=0; i<children.length; i++) { RewriteEvent child = children[i]; - boolean isGenerated = false; - try { - org.eclipse.jdt.core.dom.ASTNode originalValue = (org.eclipse.jdt.core.dom.ASTNode)child.getOriginalValue(); - isGenerated = (Boolean) originalValue.getClass().getField("$isGenerated").get(originalValue); - } catch (Exception e) { - // If this fails, better to break some refactor scripts than to crash eclipse. - } - if (isGenerated - && (child.getChangeKind() == RewriteEvent.REPLACED || child.getChangeKind() == RewriteEvent.REMOVED) - && child.getOriginalValue() instanceof org.eclipse.jdt.core.dom.MethodDeclaration - ) { - if (child.getNewValue() != null) + boolean isGenerated = isGenerated( (org.eclipse.jdt.core.dom.ASTNode)child.getOriginalValue() ); + if (isGenerated) { + if ((child.getChangeKind() == RewriteEvent.REPLACED || child.getChangeKind() == RewriteEvent.REMOVED) + && child.getOriginalValue() instanceof org.eclipse.jdt.core.dom.MethodDeclaration + && child.getNewValue() != null + ) { modifiedChildren.add(new NodeRewriteEvent(null, child.getNewValue())); + } } else { newChildren.add(child); } |