diff options
Diffstat (limited to 'test/transform/resource/before')
-rw-r--r-- | test/transform/resource/before/ValNullInit.java | 7 | ||||
-rw-r--r-- | test/transform/resource/before/VarComplex.java | 23 | ||||
-rw-r--r-- | test/transform/resource/before/VarInFor.java | 12 | ||||
-rw-r--r-- | test/transform/resource/before/VarInForOld.java | 10 | ||||
-rw-r--r-- | test/transform/resource/before/VarModifier.java | 11 | ||||
-rw-r--r-- | test/transform/resource/before/VarNullInit.java | 8 |
6 files changed, 71 insertions, 0 deletions
diff --git a/test/transform/resource/before/ValNullInit.java b/test/transform/resource/before/ValNullInit.java new file mode 100644 index 00000000..649bc0cd --- /dev/null +++ b/test/transform/resource/before/ValNullInit.java @@ -0,0 +1,7 @@ +import lombok.val; + +class ValNullInit { + void method() { + val x = null; + } +}
\ No newline at end of file diff --git a/test/transform/resource/before/VarComplex.java b/test/transform/resource/before/VarComplex.java new file mode 100644 index 00000000..bfaa8804 --- /dev/null +++ b/test/transform/resource/before/VarComplex.java @@ -0,0 +1,23 @@ +//CONF: lombok.var.flagUsage = ALLOW +import lombok.experimental.var; + +public class VarComplex { + private String field = ""; + private static final int CONSTANT = 20; + + public void testComplex() { + var shouldBeCharArray = field.toCharArray(); + var shouldBeInt = CONSTANT; + var lock = new Object(); + synchronized (lock) { + var field = 20; //Shadowing + var inner = 10; + switch (field) { + case 5: + var shouldBeCharArray2 = shouldBeCharArray; + var innerInner = inner; + } + } + var shouldBeString = field; //Unshadowing + } +}
\ No newline at end of file diff --git a/test/transform/resource/before/VarInFor.java b/test/transform/resource/before/VarInFor.java new file mode 100644 index 00000000..cc8c387e --- /dev/null +++ b/test/transform/resource/before/VarInFor.java @@ -0,0 +1,12 @@ +//CONF: lombok.var.flagUsage = ALLOW +import lombok.experimental.var; + +public class VarInFor { + public void enhancedFor() { + int[] list = new int[] {1, 2}; + for (var shouldBeInt : list) { + System.out.println(shouldBeInt); + var shouldBeInt2 = shouldBeInt; + } + } +}
\ No newline at end of file diff --git a/test/transform/resource/before/VarInForOld.java b/test/transform/resource/before/VarInForOld.java new file mode 100644 index 00000000..f90aba7f --- /dev/null +++ b/test/transform/resource/before/VarInForOld.java @@ -0,0 +1,10 @@ +//CONF: lombok.var.flagUsage = ALLOW +import lombok.experimental.var; + +public class VarInForOld { + public void oldFor() { + for (var i = 0; i < 100; ++i) { + System.out.println(i); + } + } +}
\ No newline at end of file diff --git a/test/transform/resource/before/VarModifier.java b/test/transform/resource/before/VarModifier.java new file mode 100644 index 00000000..7250c1c5 --- /dev/null +++ b/test/transform/resource/before/VarModifier.java @@ -0,0 +1,11 @@ +//CONF: lombok.var.flagUsage = ALLOW +import lombok.experimental.var; + +public class VarModifier { + private String field = ""; + + public void testComplex() { + final var shouldBeFinalCharArray = field.toCharArray(); + var shouldBeCharArray = field.toCharArray(); + } +}
\ No newline at end of file diff --git a/test/transform/resource/before/VarNullInit.java b/test/transform/resource/before/VarNullInit.java new file mode 100644 index 00000000..efdc9d9e --- /dev/null +++ b/test/transform/resource/before/VarNullInit.java @@ -0,0 +1,8 @@ +//CONF: lombok.var.flagUsage = ALLOW +import lombok.experimental.var; + +public class VarNullInit { + void method() { + var x = null; + } +}
\ No newline at end of file |