diff --git a/src/core/lombok/core/AST.java b/src/core/lombok/core/AST.java index e6721b80..6fed0252 100644 --- a/src/core/lombok/core/AST.java +++ b/src/core/lombok/core/AST.java @@ -174,7 +174,7 @@ public abstract class AST, L extends LombokNode, oldChild.parent = targetNode; } - targetNode.children = ImmutableList.copyOf(children); + targetNode.children = LombokImmutableList.copyOf(children); return targetNode; } diff --git a/src/core/lombok/core/LombokNode.java b/src/core/lombok/core/LombokNode.java index 30bacc56..07c62151 100644 --- a/src/core/lombok/core/LombokNode.java +++ b/src/core/lombok/core/LombokNode.java @@ -42,7 +42,7 @@ public abstract class LombokNode, L extends LombokNode children; + protected LombokImmutableList children; protected L parent; /** structurally significant are those nodes that can be annotated in java 1.6 or are method-like toplevels, @@ -62,7 +62,7 @@ public abstract class LombokNode, L extends LombokNodeof(); + this.children = children != null ? LombokImmutableList.copyOf(children) : LombokImmutableList.of(); for (L child : this.children) { child.parent = (L) this; if (!child.isStructurallySignificant) @@ -176,7 +176,7 @@ public abstract class LombokNode, L extends LombokNode down() { + public LombokImmutableList down() { return children; } @@ -253,7 +253,7 @@ public abstract class LombokNode, L extends LombokNode { } void traverseChildren(EclipseASTVisitor visitor, EclipseNode node) { - ImmutableList children = node.down(); + LombokImmutableList children = node.down(); int len = children.size(); for (int i = 0; i < len; i++) { children.get(i).traverse(visitor); diff --git a/src/utils/lombok/core/JavaIdentifiers.java b/src/utils/lombok/core/JavaIdentifiers.java index dfec8815..cbe90eed 100644 --- a/src/utils/lombok/core/JavaIdentifiers.java +++ b/src/utils/lombok/core/JavaIdentifiers.java @@ -27,7 +27,7 @@ package lombok.core; public class JavaIdentifiers { private JavaIdentifiers() {} - private static final ImmutableList KEYWORDS = ImmutableList.of( + private static final LombokImmutableList KEYWORDS = LombokImmutableList.of( "public", "private", "protected", "default", "switch", "case", "for", "do", "goto", "const", "strictfp", "while", "if", "else", diff --git a/src/utils/lombok/core/ImmutableList.java b/src/utils/lombok/core/LombokImmutableList.java similarity index 67% rename from src/utils/lombok/core/ImmutableList.java rename to src/utils/lombok/core/LombokImmutableList.java index 8b478dbc..e0e1136c 100644 --- a/src/utils/lombok/core/ImmutableList.java +++ b/src/utils/lombok/core/LombokImmutableList.java @@ -28,36 +28,36 @@ import java.util.Iterator; import java.util.List; import java.util.NoSuchElementException; -public final class ImmutableList implements Iterable { +public final class LombokImmutableList implements Iterable { private Object[] content; - private static final ImmutableList EMPTY = new ImmutableList(new Object[0]); + private static final LombokImmutableList EMPTY = new LombokImmutableList(new Object[0]); @SuppressWarnings("unchecked") - public static ImmutableList of() { - return (ImmutableList) EMPTY; + public static LombokImmutableList of() { + return (LombokImmutableList) EMPTY; } - public static ImmutableList of(T a) { - return new ImmutableList(new Object[] {a}); + public static LombokImmutableList of(T a) { + return new LombokImmutableList(new Object[] {a}); } - public static ImmutableList of(T a, T b) { - return new ImmutableList(new Object[] {a, b}); + public static LombokImmutableList of(T a, T b) { + return new LombokImmutableList(new Object[] {a, b}); } - public static ImmutableList of(T a, T b, T c) { - return new ImmutableList(new Object[] {a, b, c}); + public static LombokImmutableList of(T a, T b, T c) { + return new LombokImmutableList(new Object[] {a, b, c}); } - public static ImmutableList of(T a, T b, T c, T d) { - return new ImmutableList(new Object[] {a, b, c, d}); + public static LombokImmutableList of(T a, T b, T c, T d) { + return new LombokImmutableList(new Object[] {a, b, c, d}); } - public static ImmutableList of(T a, T b, T c, T d, T e) { - return new ImmutableList(new Object[] {a, b, c, d, e}); + public static LombokImmutableList of(T a, T b, T c, T d, T e) { + return new LombokImmutableList(new Object[] {a, b, c, d, e}); } - public static ImmutableList of(T a, T b, T c, T d, T e, T f, T... g) { + public static LombokImmutableList of(T a, T b, T c, T d, T e, T f, T... g) { Object[] rest = g == null ? new Object[] {null} : g; Object[] val = new Object[rest.length + 6]; System.arraycopy(rest, 0, val, 6, rest.length); @@ -67,43 +67,43 @@ public final class ImmutableList implements Iterable { val[3] = d; val[4] = e; val[5] = f; - return new ImmutableList(val); + return new LombokImmutableList(val); } - public static ImmutableList copyOf(Collection list) { - return new ImmutableList(list.toArray()); + public static LombokImmutableList copyOf(Collection list) { + return new LombokImmutableList(list.toArray()); } - public static ImmutableList copyOf(Iterable iterable) { + public static LombokImmutableList copyOf(Iterable iterable) { List list = new ArrayList(); for (T o : iterable) list.add(o); return copyOf(list); } - private ImmutableList(Object[] content) { + private LombokImmutableList(Object[] content) { this.content = content; } - public ImmutableList replaceElementAt(int idx, T newValue) { + public LombokImmutableList replaceElementAt(int idx, T newValue) { Object[] newContent = content.clone(); newContent[idx] = newValue; - return new ImmutableList(newContent); + return new LombokImmutableList(newContent); } - public ImmutableList append(T newValue) { + public LombokImmutableList append(T newValue) { int len = content.length; Object[] newContent = new Object[len + 1]; System.arraycopy(content, 0, newContent, 0, len); newContent[len] = newValue; - return new ImmutableList(newContent); + return new LombokImmutableList(newContent); } - public ImmutableList prepend(T newValue) { + public LombokImmutableList prepend(T newValue) { int len = content.length; Object[] newContent = new Object[len + 1]; System.arraycopy(content, 0, newContent, 1, len); newContent[0] = newValue; - return new ImmutableList(newContent); + return new LombokImmutableList(newContent); } public int indexOf(T val) { @@ -117,17 +117,17 @@ public final class ImmutableList implements Iterable { return -1; } - public ImmutableList removeElement(T val) { + public LombokImmutableList removeElement(T val) { int idx = indexOf(val); return idx == -1 ? this : removeElementAt(idx); } - public ImmutableList removeElementAt(int idx) { + public LombokImmutableList removeElementAt(int idx) { int len = content.length; Object[] newContent = new Object[len - 1]; if (idx > 0) System.arraycopy(content, 0, newContent, 0, idx); if (idx < len - 1) System.arraycopy(content, idx + 1, newContent, idx, len - idx - 1); - return new ImmutableList(newContent); + return new LombokImmutableList(newContent); } public boolean isEmpty() { @@ -177,9 +177,9 @@ public final class ImmutableList implements Iterable { } @Override public boolean equals(Object obj) { - if (!(obj instanceof ImmutableList)) return false; + if (!(obj instanceof LombokImmutableList)) return false; if (obj == this) return true; - return Arrays.equals(content, ((ImmutableList) obj).content); + return Arrays.equals(content, ((LombokImmutableList) obj).content); } @Override public int hashCode() {