aboutsummaryrefslogtreecommitdiff
path: root/src/utils
diff options
context:
space:
mode:
authorReinier Zwitserloot <reinier@zwitserloot.com>2014-07-01 21:21:00 +0200
committerReinier Zwitserloot <reinier@zwitserloot.com>2015-01-31 04:40:00 +0100
commit6a91c013ca2b20cc378515b83e3584f1dad958c0 (patch)
treea8aec0106d8ed34fe54f62aa9b14d5135cf21b78 /src/utils
parente5705f94cd3778a2e0d25060f1e013d0c33bfb90 (diff)
downloadlombok-6a91c013ca2b20cc378515b83e3584f1dad958c0.tar.gz
lombok-6a91c013ca2b20cc378515b83e3584f1dad958c0.tar.bz2
lombok-6a91c013ca2b20cc378515b83e3584f1dad958c0.zip
[i694] When we resolve anything with inner classes, supertype references in those inner classes
that also have val will break, depending on compile order. This should fix it.
Diffstat (limited to 'src/utils')
-rw-r--r--src/utils/lombok/javac/Javac.java3
-rw-r--r--src/utils/lombok/javac/TreeMirrorMaker.java31
2 files changed, 34 insertions, 0 deletions
diff --git a/src/utils/lombok/javac/Javac.java b/src/utils/lombok/javac/Javac.java
index 41ff8242..5b4a4fb2 100644
--- a/src/utils/lombok/javac/Javac.java
+++ b/src/utils/lombok/javac/Javac.java
@@ -162,6 +162,9 @@ public class Javac {
public static final TypeTag CTC_VOID = typeTag("VOID");
public static final TypeTag CTC_NONE = typeTag("NONE");
public static final TypeTag CTC_BOT = typeTag("BOT");
+ public static final TypeTag CTC_ERROR = typeTag("ERROR");
+ public static final TypeTag CTC_UNKNOWN = typeTag("UNKNOWN");
+ public static final TypeTag CTC_UNDETVAR = typeTag("UNDETVAR");
public static final TypeTag CTC_CLASS = typeTag("CLASS");
public static final TreeTag CTC_NOT_EQUAL = treeTag("NE");
diff --git a/src/utils/lombok/javac/TreeMirrorMaker.java b/src/utils/lombok/javac/TreeMirrorMaker.java
index 23ec2406..a31c6477 100644
--- a/src/utils/lombok/javac/TreeMirrorMaker.java
+++ b/src/utils/lombok/javac/TreeMirrorMaker.java
@@ -26,9 +26,16 @@ import java.util.IdentityHashMap;
import java.util.Iterator;
import java.util.Map;
+import static lombok.javac.Javac.*;
+import lombok.javac.JavacTreeMaker.TypeTag;
+
+import com.sun.source.tree.ClassTree;
import com.sun.source.tree.LabeledStatementTree;
+import com.sun.source.tree.NewClassTree;
import com.sun.source.tree.VariableTree;
import com.sun.tools.javac.tree.JCTree;
+import com.sun.tools.javac.tree.JCTree.JCClassDecl;
+import com.sun.tools.javac.tree.JCTree.JCNewClass;
import com.sun.tools.javac.tree.JCTree.JCVariableDecl;
import com.sun.tools.javac.tree.TreeCopier;
import com.sun.tools.javac.util.List;
@@ -91,6 +98,20 @@ public class TreeMirrorMaker extends TreeCopier<Void> {
@Override public JCTree visitVariable(VariableTree node, Void p) {
JCVariableDecl copy = (JCVariableDecl) super.visitVariable(node, p);
copy.sym = ((JCVariableDecl) node).sym;
+ if (copy.sym != null) copy.type = ((JCVariableDecl) node).type;
+ if (copy.type != null) {
+ boolean wipeSymAndType = copy.type.isErroneous();
+ if (!wipeSymAndType) {
+ TypeTag typeTag = TypeTag.typeTag(copy.type);
+ wipeSymAndType = (CTC_NONE.equals(typeTag) || CTC_ERROR.equals(typeTag) || CTC_UNKNOWN.equals(typeTag) || CTC_UNDETVAR.equals(typeTag));
+ }
+
+ if (wipeSymAndType) {
+ copy.sym = null;
+ copy.type = null;
+ }
+ }
+
return copy;
}
@@ -99,4 +120,14 @@ public class TreeMirrorMaker extends TreeCopier<Void> {
@Override public JCTree visitLabeledStatement(LabeledStatementTree node, Void p) {
return node.getStatement().accept(this, p);
}
+
+ @Override public JCTree visitNewClass(NewClassTree node, Void p) {
+ JCNewClass copy = (JCNewClass) super.visitNewClass(node, p);
+ return copy;
+ }
+
+ @Override public JCTree visitClass(ClassTree node, Void p) {
+ JCClassDecl copy = (JCClassDecl) super.visitClass(node, p);
+ return copy;
+ }
}