aboutsummaryrefslogtreecommitdiff
path: root/src/utils
diff options
context:
space:
mode:
authorReinier Zwitserloot <reinier@zwitserloot.com>2015-02-01 06:52:52 +0100
committerReinier Zwitserloot <reinier@zwitserloot.com>2015-02-01 06:53:10 +0100
commite5860edabe31f3b6ceabd91f9cbcadf3d4d0315a (patch)
treeb1d52306c826f384aed0ff9228029feb3f0ff88d /src/utils
parenta6170f5298daf42931877a2d9c98e6f2ad1985be (diff)
downloadlombok-e5860edabe31f3b6ceabd91f9cbcadf3d4d0315a.tar.gz
lombok-e5860edabe31f3b6ceabd91f9cbcadf3d4d0315a.tar.bz2
lombok-e5860edabe31f3b6ceabd91f9cbcadf3d4d0315a.zip
Fixed issues with val in inner classes, and re-enabled a test that caught it that we ignored earlier.
Diffstat (limited to 'src/utils')
-rw-r--r--src/utils/lombok/javac/TreeMirrorMaker.java13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/utils/lombok/javac/TreeMirrorMaker.java b/src/utils/lombok/javac/TreeMirrorMaker.java
index 621e4e00..093839d7 100644
--- a/src/utils/lombok/javac/TreeMirrorMaker.java
+++ b/src/utils/lombok/javac/TreeMirrorMaker.java
@@ -38,6 +38,7 @@ 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.Context;
import com.sun.tools.javac.util.List;
/**
@@ -53,7 +54,7 @@ import com.sun.tools.javac.util.List;
public class TreeMirrorMaker extends TreeCopier<Void> {
private final IdentityHashMap<JCTree, JCTree> originalToCopy = new IdentityHashMap<JCTree, JCTree>();
- public TreeMirrorMaker(JavacTreeMaker maker) {
+ public TreeMirrorMaker(JavacTreeMaker maker, Context context) {
super(maker.getUnderlyingTreeMaker());
}
@@ -93,12 +94,14 @@ public class TreeMirrorMaker extends TreeCopier<Void> {
return Collections.unmodifiableMap(originalToCopy);
}
- // Fix for NPE in HandleVal. See http://code.google.com/p/projectlombok/issues/detail?id=205
- // Maybe this should be done elsewhere...
+ // Monitor issue 205 and issue 694 when making changes here.
@Override public JCTree visitVariable(VariableTree node, Void p) {
+ JCVariableDecl original = node instanceof JCVariableDecl ? (JCVariableDecl) node : null;
JCVariableDecl copy = (JCVariableDecl) super.visitVariable(node, p);
- copy.sym = ((JCVariableDecl) node).sym;
- if (copy.sym != null) copy.type = ((JCVariableDecl) node).type;
+ if (original == null) return copy;
+
+ copy.sym = original.sym;
+ if (copy.sym != null) copy.type = original.type;
if (copy.type != null) {
boolean wipeSymAndType = copy.type.isErroneous();
if (!wipeSymAndType) {