diff options
author | Reinier Zwitserloot <reinier@zwitserloot.com> | 2021-09-16 02:03:29 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-16 02:03:29 +0200 |
commit | 602a68b8f8ad0504b2aaf7c939328617dc2f2326 (patch) | |
tree | a71716d6a1cb520884b5ba98d25a3adb9e3a6d68 /src/utils/lombok/javac | |
parent | 8ed91a03622a083bd0062d8a236527d25f3ac178 (diff) | |
parent | bd00fc4b83dd758c4369c8da97243691c04ac3fa (diff) | |
download | lombok-602a68b8f8ad0504b2aaf7c939328617dc2f2326.tar.gz lombok-602a68b8f8ad0504b2aaf7c939328617dc2f2326.tar.bz2 lombok-602a68b8f8ad0504b2aaf7c939328617dc2f2326.zip |
Merge pull request #2840 from Rawi01/copy-vartype
Also copy vartype.type in TreeMirrorMaker
Diffstat (limited to 'src/utils/lombok/javac')
-rw-r--r-- | src/utils/lombok/javac/TreeMirrorMaker.java | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/utils/lombok/javac/TreeMirrorMaker.java b/src/utils/lombok/javac/TreeMirrorMaker.java index a67a4ec1..44e26ab6 100644 --- a/src/utils/lombok/javac/TreeMirrorMaker.java +++ b/src/utils/lombok/javac/TreeMirrorMaker.java @@ -32,8 +32,10 @@ import lombok.javac.JavacTreeMaker.TypeTag; import com.sun.source.tree.LabeledStatementTree; import com.sun.source.tree.VariableTree; import com.sun.tools.javac.tree.JCTree; +import com.sun.tools.javac.tree.JCTree.JCFieldAccess; import com.sun.tools.javac.tree.JCTree.JCVariableDecl; import com.sun.tools.javac.tree.TreeCopier; +import com.sun.tools.javac.tree.TreeScanner; import com.sun.tools.javac.util.Context; import com.sun.tools.javac.util.List; @@ -109,6 +111,21 @@ public class TreeMirrorMaker extends TreeCopier<Void> { if (wipeSymAndType) { copy.sym = null; copy.type = null; + } else { + if (original.vartype != null) { + copy.vartype.type = original.vartype.type; + original.vartype.accept(new TreeScanner() { + @Override public void scan(JCTree tree) { + super.scan(tree); + originalToCopy.get(tree).type = tree.type; + } + + @Override public void visitSelect(JCFieldAccess tree) { + super.visitSelect(tree); + ((JCFieldAccess) originalToCopy.get(tree)).sym = tree.sym; + } + }); + } } } |