From 43992ff596cd3beb2b6b3f4cfaa686671f06fc2a Mon Sep 17 00:00:00 2001 From: Reinier Zwitserloot Date: Wed, 1 Jul 2009 03:36:52 +0200 Subject: Pretty big fix for reparse() - now uses rebuild(), which also received a pretty big fix in making the loop detection algorithm far more robust. Still not sure what was the problem, but the robustificationization helped. --- src/lombok/core/AST.java | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'src/lombok/core') diff --git a/src/lombok/core/AST.java b/src/lombok/core/AST.java index febe53ab..2f92ad6d 100644 --- a/src/lombok/core/AST.java +++ b/src/lombok/core/AST.java @@ -9,7 +9,6 @@ import java.lang.reflect.ParameterizedType; import java.lang.reflect.Type; import java.util.ArrayList; import java.util.Collection; -import java.util.Collections; import java.util.HashMap; import java.util.IdentityHashMap; import java.util.List; @@ -52,12 +51,10 @@ public abstract class AST { nodeMap = new IdentityHashMap(); } - protected boolean alreadyHandled(N node) { - return identityDetector.containsKey(node); - } - - protected void setAsHandled(N node) { + protected boolean setAndGetAsHandled(N node) { + if ( identityDetector.containsKey(node) ) return true; identityDetector.put(node, null); + return false; } public String getFileName() { @@ -100,7 +97,7 @@ public abstract class AST { protected Node(N node, List children, Kind kind) { this.kind = kind; this.node = node; - this.children = children == null ? Collections.emptyList() : children; + this.children = children == null ? new ArrayList() : children; for ( Node child : this.children ) child.parent = this; this.isStructurallySignificant = calculateIsStructurallySignificant(); } @@ -218,8 +215,8 @@ public abstract class AST { private void gatherAndRemoveChildren(Map map) { for ( Node child : children ) child.gatherAndRemoveChildren(map); - map.put(get(), this); identityDetector.remove(get()); + map.put(get(), this); children.clear(); nodeMap.remove(get()); } -- cgit