aboutsummaryrefslogtreecommitdiff
path: root/test/transform
diff options
context:
space:
mode:
Diffstat (limited to 'test/transform')
-rw-r--r--test/transform/resource/after-delombok/ValAnonymousSubclassSelfReference.java17
-rw-r--r--test/transform/resource/after-delombok/ValSwitchExpression.java11
-rw-r--r--test/transform/resource/after-delombok/ValToNative.java15
-rw-r--r--test/transform/resource/after-ecj/ValAnonymousSubclassSelfReference.java23
-rw-r--r--test/transform/resource/after-ecj/ValSwitchExpression.java16
-rw-r--r--test/transform/resource/after-ecj/ValToNative.java19
-rw-r--r--test/transform/resource/before/MixGetterVal.java1
-rw-r--r--test/transform/resource/before/TrickyTypeResolution.java1
-rw-r--r--test/transform/resource/before/ValAnonymousSubclassSelfReference.java21
-rw-r--r--test/transform/resource/before/ValAnonymousSubclassWithGenerics.java1
-rw-r--r--test/transform/resource/before/ValComplex.java1
-rw-r--r--test/transform/resource/before/ValDefault.java2
-rw-r--r--test/transform/resource/before/ValDelegateMethodReference.java2
-rw-r--r--test/transform/resource/before/ValErrors.java1
-rw-r--r--test/transform/resource/before/ValFinal.java1
-rw-r--r--test/transform/resource/before/ValInBasicFor.java1
-rw-r--r--test/transform/resource/before/ValInFor.java1
-rw-r--r--test/transform/resource/before/ValInLambda.java2
-rw-r--r--test/transform/resource/before/ValInMultiDeclaration.java1
-rw-r--r--test/transform/resource/before/ValInTryWithResources.java2
-rw-r--r--test/transform/resource/before/ValLambda.java2
-rw-r--r--test/transform/resource/before/ValLessSimple.java1
-rw-r--r--test/transform/resource/before/ValLub.java1
-rw-r--r--test/transform/resource/before/ValNullInit.java1
-rw-r--r--test/transform/resource/before/ValOutersWithGenerics.java1
-rw-r--r--test/transform/resource/before/ValRawType.java1
-rw-r--r--test/transform/resource/before/ValSimple.java1
-rw-r--r--test/transform/resource/before/ValSwitchExpression.java13
-rw-r--r--test/transform/resource/before/ValToNative.java19
-rw-r--r--test/transform/resource/before/ValWeirdTypes.java2
-rw-r--r--test/transform/resource/before/ValWithLabel.java1
-rw-r--r--test/transform/resource/before/ValWithLocalClasses.java1
-rw-r--r--test/transform/resource/before/ValWithSelfRefGenerics.java1
33 files changed, 178 insertions, 6 deletions
diff --git a/test/transform/resource/after-delombok/ValAnonymousSubclassSelfReference.java b/test/transform/resource/after-delombok/ValAnonymousSubclassSelfReference.java
new file mode 100644
index 00000000..a1176a3c
--- /dev/null
+++ b/test/transform/resource/after-delombok/ValAnonymousSubclassSelfReference.java
@@ -0,0 +1,17 @@
+import java.util.Map;
+import java.util.HashMap;
+
+public class ValAnonymousSubclassSelfReference {
+ public <T> void test(T arg) {
+ T d = arg;
+ Integer[] e = new Integer[1];
+ int[] f = new int[0];
+ java.util.Map<java.lang.String, Integer> g = new HashMap<String, Integer>();
+ Integer h = 0;
+ 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-delombok/ValSwitchExpression.java b/test/transform/resource/after-delombok/ValSwitchExpression.java
new file mode 100644
index 00000000..ba26c137
--- /dev/null
+++ b/test/transform/resource/after-delombok/ValSwitchExpression.java
@@ -0,0 +1,11 @@
+// version 14:
+public class ValSwitchExpression {
+ public void method(int arg) {
+ final var x = switch (arg) {
+ default -> {
+ final var s = "string";
+ yield arg;
+ }
+ };
+ }
+} \ No newline at end of file
diff --git a/test/transform/resource/after-delombok/ValToNative.java b/test/transform/resource/after-delombok/ValToNative.java
new file mode 100644
index 00000000..64aff9e5
--- /dev/null
+++ b/test/transform/resource/after-delombok/ValToNative.java
@@ -0,0 +1,15 @@
+// version 10:
+import java.io.IOException;
+import java.util.Arrays;
+
+public class ValToNative {
+ private void test() throws IOException {
+ final var intField = 1;
+ for (final var s : Arrays.asList("1")) {
+ final var s2 = s;
+ }
+ try (var in = getClass().getResourceAsStream("ValToNative.class")) {
+ final var j = in.read();
+ }
+ }
+} \ 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..12b0f640
--- /dev/null
+++ b/test/transform/resource/after-ecj/ValAnonymousSubclassSelfReference.java
@@ -0,0 +1,23 @@
+import java.util.Map;
+import java.util.HashMap;
+import lombok.val;
+public class ValAnonymousSubclassSelfReference {
+ public ValAnonymousSubclassSelfReference() {
+ super();
+ }
+ public <T>void test(T arg) {
+ T d = arg;
+ Integer[] e = new Integer[1];
+ int[] f = new int[0];
+ java.util.Map<java.lang.String, Integer> g = new HashMap<String, Integer>();
+ Integer h = 0;
+ 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/after-ecj/ValSwitchExpression.java b/test/transform/resource/after-ecj/ValSwitchExpression.java
new file mode 100644
index 00000000..4e848572
--- /dev/null
+++ b/test/transform/resource/after-ecj/ValSwitchExpression.java
@@ -0,0 +1,16 @@
+// version 14:
+import lombok.val;
+public class ValSwitchExpression {
+ public ValSwitchExpression() {
+ super();
+ }
+ public void method(int arg) {
+ final @val var x = switch (arg) {
+ default ->
+ {
+ final @val var s = "string";
+ yield arg;
+ }
+ };
+ }
+} \ No newline at end of file
diff --git a/test/transform/resource/after-ecj/ValToNative.java b/test/transform/resource/after-ecj/ValToNative.java
new file mode 100644
index 00000000..2c8d721c
--- /dev/null
+++ b/test/transform/resource/after-ecj/ValToNative.java
@@ -0,0 +1,19 @@
+import java.io.IOException;
+import java.util.Arrays;
+import lombok.val;
+public class ValToNative {
+ public ValToNative() {
+ super();
+ }
+ private void test() throws IOException {
+ final @val var intField = 1;
+ for (final @val var s : Arrays.asList("1"))
+ {
+ final @val var s2 = s;
+ }
+ try (final @val var in = getClass().getResourceAsStream("ValToNative.class"))
+ {
+ final @val var j = in.read();
+ }
+ }
+} \ No newline at end of file
diff --git a/test/transform/resource/before/MixGetterVal.java b/test/transform/resource/before/MixGetterVal.java
index 3f06b1a8..4568902b 100644
--- a/test/transform/resource/before/MixGetterVal.java
+++ b/test/transform/resource/before/MixGetterVal.java
@@ -1,3 +1,4 @@
+// version :9
import lombok.Getter;
import lombok.val;
diff --git a/test/transform/resource/before/TrickyTypeResolution.java b/test/transform/resource/before/TrickyTypeResolution.java
index 94d97fe0..7f3866ee 100644
--- a/test/transform/resource/before/TrickyTypeResolution.java
+++ b/test/transform/resource/before/TrickyTypeResolution.java
@@ -1,3 +1,4 @@
+// version :9
import lombok.*;
class TrickyDoNothing {
@interface Getter {}
diff --git a/test/transform/resource/before/ValAnonymousSubclassSelfReference.java b/test/transform/resource/before/ValAnonymousSubclassSelfReference.java
new file mode 100644
index 00000000..e7c30c84
--- /dev/null
+++ b/test/transform/resource/before/ValAnonymousSubclassSelfReference.java
@@ -0,0 +1,21 @@
+// issue 2420: to trigger the problem 2 var/val, at least one normal variable and a anonymous self reference is required
+import java.util.Map;
+import java.util.HashMap;
+
+import lombok.val;
+
+public class ValAnonymousSubclassSelfReference {
+ public <T> void test(T arg) {
+ T d = arg;
+ Integer[] e = new Integer[1];
+ int[] f = new int[0];
+ java.util.Map<java.lang.String, Integer> g = new HashMap<String, Integer>();
+ Integer h = 0;
+ int i = 0;
+
+ val j = 1;
+ val k = 2;
+
+ new ValAnonymousSubclassSelfReference() { };
+ }
+} \ No newline at end of file
diff --git a/test/transform/resource/before/ValAnonymousSubclassWithGenerics.java b/test/transform/resource/before/ValAnonymousSubclassWithGenerics.java
index c0f8157a..a434ba9d 100644
--- a/test/transform/resource/before/ValAnonymousSubclassWithGenerics.java
+++ b/test/transform/resource/before/ValAnonymousSubclassWithGenerics.java
@@ -1,3 +1,4 @@
+// version :9
// issue 205: val inside anonymous inner classes is a bit tricky in javac, this test ensures we don't break it.
import java.util.*;
import lombok.val;
diff --git a/test/transform/resource/before/ValComplex.java b/test/transform/resource/before/ValComplex.java
index e20124a2..f1898cfd 100644
--- a/test/transform/resource/before/ValComplex.java
+++ b/test/transform/resource/before/ValComplex.java
@@ -1,3 +1,4 @@
+// version :9
import lombok.val;
public class ValComplex {
diff --git a/test/transform/resource/before/ValDefault.java b/test/transform/resource/before/ValDefault.java
index 75124c3c..ded4b074 100644
--- a/test/transform/resource/before/ValDefault.java
+++ b/test/transform/resource/before/ValDefault.java
@@ -1,4 +1,4 @@
-// version 8:
+// version 8:9
interface ValDefault {
int size();
diff --git a/test/transform/resource/before/ValDelegateMethodReference.java b/test/transform/resource/before/ValDelegateMethodReference.java
index 3d1f082c..8cfc2c33 100644
--- a/test/transform/resource/before/ValDelegateMethodReference.java
+++ b/test/transform/resource/before/ValDelegateMethodReference.java
@@ -1,4 +1,4 @@
-//version 8:
+//version 8:9
//platform !eclipse: Requires a 'full' eclipse with intialized workspace, and we don't (yet) have that set up properly in the test run.
import lombok.Getter;
import lombok.Setter;
diff --git a/test/transform/resource/before/ValErrors.java b/test/transform/resource/before/ValErrors.java
index 87383719..290a1f72 100644
--- a/test/transform/resource/before/ValErrors.java
+++ b/test/transform/resource/before/ValErrors.java
@@ -1,3 +1,4 @@
+// version :9
// unchanged
import lombok.val;
diff --git a/test/transform/resource/before/ValFinal.java b/test/transform/resource/before/ValFinal.java
index 3c5af366..293c9bce 100644
--- a/test/transform/resource/before/ValFinal.java
+++ b/test/transform/resource/before/ValFinal.java
@@ -1,3 +1,4 @@
+// version :9
import lombok.val;
public class ValFinal {
public void test() {
diff --git a/test/transform/resource/before/ValInBasicFor.java b/test/transform/resource/before/ValInBasicFor.java
index a109bcd3..b137f0d7 100644
--- a/test/transform/resource/before/ValInBasicFor.java
+++ b/test/transform/resource/before/ValInBasicFor.java
@@ -1,3 +1,4 @@
+// version :9
// unchanged
import lombok.val;
diff --git a/test/transform/resource/before/ValInFor.java b/test/transform/resource/before/ValInFor.java
index 35332b34..f2c50139 100644
--- a/test/transform/resource/before/ValInFor.java
+++ b/test/transform/resource/before/ValInFor.java
@@ -1,3 +1,4 @@
+// version :9
import lombok.val;
public class ValInFor {
diff --git a/test/transform/resource/before/ValInLambda.java b/test/transform/resource/before/ValInLambda.java
index 6750d045..a13c79d2 100644
--- a/test/transform/resource/before/ValInLambda.java
+++ b/test/transform/resource/before/ValInLambda.java
@@ -1,4 +1,4 @@
-// version 8:
+// version 8:9
import java.util.function.Function;
import java.util.function.Supplier;
diff --git a/test/transform/resource/before/ValInMultiDeclaration.java b/test/transform/resource/before/ValInMultiDeclaration.java
index 1c333ebb..0f4e604b 100644
--- a/test/transform/resource/before/ValInMultiDeclaration.java
+++ b/test/transform/resource/before/ValInMultiDeclaration.java
@@ -1,3 +1,4 @@
+// version :9
import lombok.val;
public class ValInMultiDeclaration {
public void test() {
diff --git a/test/transform/resource/before/ValInTryWithResources.java b/test/transform/resource/before/ValInTryWithResources.java
index a7820062..5c885f79 100644
--- a/test/transform/resource/before/ValInTryWithResources.java
+++ b/test/transform/resource/before/ValInTryWithResources.java
@@ -1,4 +1,4 @@
-//version 7:
+//version 7:9
import lombok.val;
import java.io.IOException;
diff --git a/test/transform/resource/before/ValLambda.java b/test/transform/resource/before/ValLambda.java
index e956bcd3..8f55d222 100644
--- a/test/transform/resource/before/ValLambda.java
+++ b/test/transform/resource/before/ValLambda.java
@@ -1,4 +1,4 @@
-// version 8:
+// version 8:9
import java.io.Serializable;
class ValLambda {
diff --git a/test/transform/resource/before/ValLessSimple.java b/test/transform/resource/before/ValLessSimple.java
index b81cc22c..1ed738cc 100644
--- a/test/transform/resource/before/ValLessSimple.java
+++ b/test/transform/resource/before/ValLessSimple.java
@@ -1,3 +1,4 @@
+// version :9
import lombok.val;
public class ValLessSimple {
diff --git a/test/transform/resource/before/ValLub.java b/test/transform/resource/before/ValLub.java
index 509a4f8b..e3b55950 100644
--- a/test/transform/resource/before/ValLub.java
+++ b/test/transform/resource/before/ValLub.java
@@ -1,3 +1,4 @@
+// version :9
class ValLub {
public void easyLub() {
java.util.Map<String, Number> m = java.util.Collections.emptyMap();
diff --git a/test/transform/resource/before/ValNullInit.java b/test/transform/resource/before/ValNullInit.java
index 649bc0cd..c1610af3 100644
--- a/test/transform/resource/before/ValNullInit.java
+++ b/test/transform/resource/before/ValNullInit.java
@@ -1,3 +1,4 @@
+// version :9
import lombok.val;
class ValNullInit {
diff --git a/test/transform/resource/before/ValOutersWithGenerics.java b/test/transform/resource/before/ValOutersWithGenerics.java
index 1b29d37c..99b71735 100644
--- a/test/transform/resource/before/ValOutersWithGenerics.java
+++ b/test/transform/resource/before/ValOutersWithGenerics.java
@@ -1,3 +1,4 @@
+// version :9
import java.util.*;
import lombok.val;
diff --git a/test/transform/resource/before/ValRawType.java b/test/transform/resource/before/ValRawType.java
index 3ef8527e..fa47c536 100644
--- a/test/transform/resource/before/ValRawType.java
+++ b/test/transform/resource/before/ValRawType.java
@@ -1,3 +1,4 @@
+// version :9
import java.util.List;
import lombok.val;
diff --git a/test/transform/resource/before/ValSimple.java b/test/transform/resource/before/ValSimple.java
index 04763be2..5d1911da 100644
--- a/test/transform/resource/before/ValSimple.java
+++ b/test/transform/resource/before/ValSimple.java
@@ -1,3 +1,4 @@
+// version :9
import lombok.val;
public class ValSimple {
diff --git a/test/transform/resource/before/ValSwitchExpression.java b/test/transform/resource/before/ValSwitchExpression.java
new file mode 100644
index 00000000..c3838acc
--- /dev/null
+++ b/test/transform/resource/before/ValSwitchExpression.java
@@ -0,0 +1,13 @@
+// version 14:
+import lombok.val;
+
+public class ValSwitchExpression {
+ public void method(int arg) {
+ val x = switch (arg) {
+ default -> {
+ val s = "string";
+ yield arg;
+ }
+ };
+ }
+}
diff --git a/test/transform/resource/before/ValToNative.java b/test/transform/resource/before/ValToNative.java
new file mode 100644
index 00000000..3b4e6fa8
--- /dev/null
+++ b/test/transform/resource/before/ValToNative.java
@@ -0,0 +1,19 @@
+// version 10:
+import java.io.IOException;
+import java.util.Arrays;
+
+import lombok.val;
+
+public class ValToNative {
+ private void test() throws IOException {
+ val intField = 1;
+
+ for (val s : Arrays.asList("1")) {
+ val s2 = s;
+ }
+
+ try (val in = getClass().getResourceAsStream("ValToNative.class")) {
+ val j = in.read();
+ }
+ }
+}
diff --git a/test/transform/resource/before/ValWeirdTypes.java b/test/transform/resource/before/ValWeirdTypes.java
index f62feca6..710e236b 100644
--- a/test/transform/resource/before/ValWeirdTypes.java
+++ b/test/transform/resource/before/ValWeirdTypes.java
@@ -1,4 +1,4 @@
-// version 8: In java6/7, lub types worked differently, so, the `arraysAsList` method has a slightly different inferred type there.
+// version 8:9 In java6/7, lub types worked differently, so, the `arraysAsList` method has a slightly different inferred type there.
import java.math.BigDecimal;
import java.util.*;
import lombok.val;
diff --git a/test/transform/resource/before/ValWithLabel.java b/test/transform/resource/before/ValWithLabel.java
index f7c3402a..9e15f937 100644
--- a/test/transform/resource/before/ValWithLabel.java
+++ b/test/transform/resource/before/ValWithLabel.java
@@ -1,3 +1,4 @@
+// version :9
import lombok.val;
public class ValWithLabel {
diff --git a/test/transform/resource/before/ValWithLocalClasses.java b/test/transform/resource/before/ValWithLocalClasses.java
index 572a1e7d..0d145aa9 100644
--- a/test/transform/resource/before/ValWithLocalClasses.java
+++ b/test/transform/resource/before/ValWithLocalClasses.java
@@ -1,3 +1,4 @@
+// version :9
//issue 694: In javac, resolving the RHS (which is what val does) can cause an entire class to be resolved, breaking all usage of val inside that class. This tests that we handle that better.
class ValWithLocalClasses1 {
{
diff --git a/test/transform/resource/before/ValWithSelfRefGenerics.java b/test/transform/resource/before/ValWithSelfRefGenerics.java
index d0532606..fdb30d32 100644
--- a/test/transform/resource/before/ValWithSelfRefGenerics.java
+++ b/test/transform/resource/before/ValWithSelfRefGenerics.java
@@ -1,3 +1,4 @@
+// version :9
import lombok.val;
public class ValWithSelfRefGenerics {
public void run(Thing<? extends Comparable<?>> thing, Thing<?> thing2, java.util.List<? extends Number> z) {