diff options
Diffstat (limited to 'src/eclipseAgent/lombok/eclipse/agent/PatchFixes.java')
-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 77257931..e7d6c04b 100644 --- a/src/eclipseAgent/lombok/eclipse/agent/PatchFixes.java +++ b/src/eclipseAgent/lombok/eclipse/agent/PatchFixes.java @@ -134,19 +134,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); } |