aboutsummaryrefslogtreecommitdiff
path: root/src/eclipseAgent
diff options
context:
space:
mode:
authorjvanderhel <Jappe.vanderhel@gmail.com>2011-11-24 21:02:50 +0100
committerjvanderhel <Jappe.vanderhel@gmail.com>2011-11-24 21:02:50 +0100
commit20b729509f351c812ec2753a80364dd859b70f34 (patch)
tree7072e89aaa4d1ef0e49364cab1a70600c20732cc /src/eclipseAgent
parent088f7bfbba75088e59b70f3cb51aae010b1d2893 (diff)
downloadlombok-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.java19
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);
}