From 99a38d4d08cb020182663ffaf9418d28becf1fd6 Mon Sep 17 00:00:00 2001 From: Reinier Zwitserloot Date: Wed, 24 Jun 2009 01:22:08 +0200 Subject: Added proper support for changing the AST as its being visited, both removal and addition. The rule is now: children traversal traverses through the tree mostly as it was when it started. --- src/lombok/eclipse/EclipseAST.java | 2 +- src/lombok/eclipse/handlers/PKG.java | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) (limited to 'src/lombok/eclipse') diff --git a/src/lombok/eclipse/EclipseAST.java b/src/lombok/eclipse/EclipseAST.java index 07ca5f11..df0020bc 100644 --- a/src/lombok/eclipse/EclipseAST.java +++ b/src/lombok/eclipse/EclipseAST.java @@ -256,7 +256,7 @@ public class EclipseAST extends AST { /** {@inheritDoc} */ @SuppressWarnings("unchecked") @Override public Collection down() { - return (Collection) children; + return (Collection) super.down(); } /** {@inheritDoc} */ diff --git a/src/lombok/eclipse/handlers/PKG.java b/src/lombok/eclipse/handlers/PKG.java index 1e391ef2..3cfbf9c6 100644 --- a/src/lombok/eclipse/handlers/PKG.java +++ b/src/lombok/eclipse/handlers/PKG.java @@ -135,7 +135,9 @@ class PKG { for ( int i = 0 ; i < parent.methods.length ; i++ ) { if ( parent.methods[i] instanceof ConstructorDeclaration && (parent.methods[i].bits & ASTNode.IsDefaultConstructor) != 0 ) { + EclipseAST.Node tossMe = type.getNodeFor(parent.methods[i]); parent.methods[i] = method; + if ( tossMe != null ) tossMe.up().removeChild(tossMe); injectionComplete = true; break; } -- cgit