aboutsummaryrefslogtreecommitdiff
path: root/src/lombok/core
diff options
context:
space:
mode:
authorReinier Zwitserloot <reinier@tipit.to>2009-07-01 03:36:52 +0200
committerReinier Zwitserloot <reinier@tipit.to>2009-07-01 03:36:52 +0200
commit43992ff596cd3beb2b6b3f4cfaa686671f06fc2a (patch)
tree4128617005eca9f5ec235a2236702fdd83067f6c /src/lombok/core
parent23ba6c2628f893678924d66382f962557514f66b (diff)
downloadlombok-43992ff596cd3beb2b6b3f4cfaa686671f06fc2a.tar.gz
lombok-43992ff596cd3beb2b6b3f4cfaa686671f06fc2a.tar.bz2
lombok-43992ff596cd3beb2b6b3f4cfaa686671f06fc2a.zip
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.
Diffstat (limited to 'src/lombok/core')
-rw-r--r--src/lombok/core/AST.java13
1 files changed, 5 insertions, 8 deletions
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<N> {
nodeMap = new IdentityHashMap<N, Node>();
}
- 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<N> {
protected Node(N node, List<? extends Node> children, Kind kind) {
this.kind = kind;
this.node = node;
- this.children = children == null ? Collections.<Node>emptyList() : children;
+ this.children = children == null ? new ArrayList<Node>() : children;
for ( Node child : this.children ) child.parent = this;
this.isStructurallySignificant = calculateIsStructurallySignificant();
}
@@ -218,8 +215,8 @@ public abstract class AST<N> {
private void gatherAndRemoveChildren(Map<N, Node> map) {
for ( Node child : children ) child.gatherAndRemoveChildren(map);
- map.put(get(), this);
identityDetector.remove(get());
+ map.put(get(), this);
children.clear();
nodeMap.remove(get());
}