diff options
author | Roel Spilker <r.spilker@gmail.com> | 2016-11-21 22:05:32 +0100 |
---|---|---|
committer | Roel Spilker <r.spilker@gmail.com> | 2016-11-21 22:05:32 +0100 |
commit | 369518c92ce4e79ce62ce334497c9309e074f44c (patch) | |
tree | 3cb84cf0975e2f66d030b027fa73505c9dd0e574 /test/transform/resource/before | |
parent | 192c569128d1ffb879fb104f44483e394032a790 (diff) | |
parent | bae2018180e9eaf31b8a71a1f7d06e2265452f5c (diff) | |
download | lombok-369518c92ce4e79ce62ce334497c9309e074f44c.tar.gz lombok-369518c92ce4e79ce62ce334497c9309e074f44c.tar.bz2 lombok-369518c92ce4e79ce62ce334497c9309e074f44c.zip |
Merge branch 'bulgakovalexander-feature/var'
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 |