aboutsummaryrefslogtreecommitdiff
path: root/test/transform/resource/before/VarComplex.java
diff options
context:
space:
mode:
Diffstat (limited to 'test/transform/resource/before/VarComplex.java')
-rw-r--r--test/transform/resource/before/VarComplex.java23
1 files changed, 23 insertions, 0 deletions
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