Fixes issue 205: NullPointerException in javac's Check$Validator with val

This commit is contained in:
Philipp Eichhorn authored and Roel Spilker committed 2011-05-16 20:35:22 +02:00
1 parent 52e7100060
commit 12b0753336
1 file changed
+10
@@ -5,7 +5,9 @@ import java.util.IdentityHashMap;
import java.util.Iterator;
import java.util.Map;
import com.sun.source.tree.VariableTree;
import com.sun.tools.javac.tree.JCTree;
import com.sun.tools.javac.tree.JCTree.JCVariableDecl;
import com.sun.tools.javac.tree.TreeCopier;
import com.sun.tools.javac.util.List;
@@ -51,4 +53,12 @@ public class TreeMirrorMaker extends TreeCopier<Void> {
public Map<JCTree, JCTree> getOriginalToCopyMap() {
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...
@Override public JCTree visitVariable(VariableTree node, Void p) {
JCVariableDecl copy = (JCVariableDecl) super.visitVariable(node, p);
copy.sym = ((JCVariableDecl) node).sym;
return copy;
}
}