diff options
4 files changed, 39 insertions, 0 deletions
diff --git a/src/utils/lombok/javac/TreeMirrorMaker.java b/src/utils/lombok/javac/TreeMirrorMaker.java index 3cb79412..4b2ad171 100644 --- a/src/utils/lombok/javac/TreeMirrorMaker.java +++ b/src/utils/lombok/javac/TreeMirrorMaker.java @@ -109,6 +109,8 @@ 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; } } diff --git a/test/transform/resource/after-delombok/ValAnonymousSubclassSelfReference.java b/test/transform/resource/after-delombok/ValAnonymousSubclassSelfReference.java new file mode 100644 index 00000000..4532ec28 --- /dev/null +++ b/test/transform/resource/after-delombok/ValAnonymousSubclassSelfReference.java @@ -0,0 +1,9 @@ +public class ValAnonymousSubclassSelfReference { + public void test() { + int i = 0; + final int j = 1; + final int k = 2; + new ValAnonymousSubclassSelfReference() { + }; + } +}
\ No newline at end of file diff --git a/test/transform/resource/after-ecj/ValAnonymousSubclassSelfReference.java b/test/transform/resource/after-ecj/ValAnonymousSubclassSelfReference.java new file mode 100644 index 00000000..8a3c7fa8 --- /dev/null +++ b/test/transform/resource/after-ecj/ValAnonymousSubclassSelfReference.java @@ -0,0 +1,16 @@ +import lombok.val; +public class ValAnonymousSubclassSelfReference { + public ValAnonymousSubclassSelfReference() { + super(); + } + public void test() { + int i = 0; + final @val int j = 1; + final @val int k = 2; + new ValAnonymousSubclassSelfReference() { + x() { + super(); + } + }; + } +}
\ No newline at end of file diff --git a/test/transform/resource/before/ValAnonymousSubclassSelfReference.java b/test/transform/resource/before/ValAnonymousSubclassSelfReference.java new file mode 100644 index 00000000..6ca05b3c --- /dev/null +++ b/test/transform/resource/before/ValAnonymousSubclassSelfReference.java @@ -0,0 +1,12 @@ +// issue 2420: to trigger the problem 2 var/val, one normal variable and a anonymous self reference is required +import lombok.val; + +public class ValAnonymousSubclassSelfReference { + public void test() { + int i = 0; + val j = 1; + val k = 2; + + new ValAnonymousSubclassSelfReference() { }; + } +}
\ No newline at end of file |