aboutsummaryrefslogtreecommitdiff
path: root/test/transform
diff options
context:
space:
mode:
Diffstat (limited to 'test/transform')
-rw-r--r--test/transform/resource/after-delombok/BuilderWithTolerate.java59
-rw-r--r--test/transform/resource/after-delombok/FieldDefaults.java2
-rw-r--r--test/transform/resource/after-delombok/GetterLazyTransient.java26
-rw-r--r--test/transform/resource/after-delombok/NoArgsConstructorForce.java14
-rw-r--r--test/transform/resource/after-delombok/ValNullInit.java5
-rw-r--r--test/transform/resource/after-delombok/ValueStaticField.java4
-rw-r--r--test/transform/resource/after-delombok/VarComplex.java20
-rw-r--r--test/transform/resource/after-delombok/VarInFor.java9
-rw-r--r--test/transform/resource/after-delombok/VarInForOld.java7
-rw-r--r--test/transform/resource/after-delombok/VarModifier.java7
-rw-r--r--test/transform/resource/after-delombok/VarNullInit.java6
-rw-r--r--test/transform/resource/after-ecj/BuilderWithTolerate.java34
-rw-r--r--test/transform/resource/after-ecj/FieldDefaults.java6
-rw-r--r--test/transform/resource/after-ecj/GetterLazyTransient.java28
-rw-r--r--test/transform/resource/after-ecj/NoArgsConstructorForce.java12
-rw-r--r--test/transform/resource/after-ecj/ValNullInit.java10
-rw-r--r--test/transform/resource/after-ecj/ValueStaticField.java4
-rw-r--r--test/transform/resource/after-ecj/VarComplex.java26
-rw-r--r--test/transform/resource/after-ecj/VarInFor.java14
-rw-r--r--test/transform/resource/after-ecj/VarInForOld.java12
-rw-r--r--test/transform/resource/after-ecj/VarModifier.java12
-rw-r--r--test/transform/resource/after-ecj/VarNullInit.java9
-rw-r--r--test/transform/resource/before/BuilderWithTolerate.java18
-rw-r--r--test/transform/resource/before/FieldDefaults.java2
-rw-r--r--test/transform/resource/before/GetterLazyTransient.java10
-rw-r--r--test/transform/resource/before/NoArgsConstructorForce.java8
-rw-r--r--test/transform/resource/before/ValNullInit.java7
-rw-r--r--test/transform/resource/before/VarComplex.java23
-rw-r--r--test/transform/resource/before/VarInFor.java12
-rw-r--r--test/transform/resource/before/VarInForOld.java10
-rw-r--r--test/transform/resource/before/VarModifier.java11
-rw-r--r--test/transform/resource/before/VarNullInit.java8
-rw-r--r--test/transform/resource/before/VarWarning.java10
-rw-r--r--test/transform/resource/messages-delombok/GetterLazyTransient.java.messages1
-rw-r--r--test/transform/resource/messages-delombok/VarNullInit.java.messages1
-rw-r--r--test/transform/resource/messages-delombok/VarWarning.java.messages1
-rw-r--r--test/transform/resource/messages-ecj/GetterLazyTransient.java.messages1
-rw-r--r--test/transform/resource/messages-ecj/VarNullInit.java.messages1
-rw-r--r--test/transform/resource/messages-ecj/VarWarning.java.messages1
39 files changed, 447 insertions, 4 deletions
diff --git a/test/transform/resource/after-delombok/BuilderWithTolerate.java b/test/transform/resource/after-delombok/BuilderWithTolerate.java
new file mode 100644
index 00000000..6dc7e248
--- /dev/null
+++ b/test/transform/resource/after-delombok/BuilderWithTolerate.java
@@ -0,0 +1,59 @@
+
+import lombok.experimental.Tolerate;
+
+public class BuilderWithTolerate {
+ private final int value;
+
+ public static void main(String[] args) {
+ BuilderWithTolerate.builder().value("42").build();
+ }
+
+
+ public static class BuilderWithTolerateBuilder {
+ @java.lang.SuppressWarnings("all")
+ @javax.annotation.Generated("lombok")
+ private int value;
+
+ @Tolerate
+ public BuilderWithTolerateBuilder value(String s) {
+ return this.value(Integer.parseInt(s));
+ }
+
+ @java.lang.SuppressWarnings("all")
+ @javax.annotation.Generated("lombok")
+ BuilderWithTolerateBuilder() {
+ }
+
+ @java.lang.SuppressWarnings("all")
+ @javax.annotation.Generated("lombok")
+ public BuilderWithTolerateBuilder value(final int value) {
+ this.value = value;
+ return this;
+ }
+
+ @java.lang.SuppressWarnings("all")
+ @javax.annotation.Generated("lombok")
+ public BuilderWithTolerate build() {
+ return new BuilderWithTolerate(value);
+ }
+
+ @java.lang.Override
+ @java.lang.SuppressWarnings("all")
+ @javax.annotation.Generated("lombok")
+ public java.lang.String toString() {
+ return "BuilderWithTolerate.BuilderWithTolerateBuilder(value=" + this.value + ")";
+ }
+ }
+
+ @java.lang.SuppressWarnings("all")
+ @javax.annotation.Generated("lombok")
+ BuilderWithTolerate(final int value) {
+ this.value = value;
+ }
+
+ @java.lang.SuppressWarnings("all")
+ @javax.annotation.Generated("lombok")
+ public static BuilderWithTolerateBuilder builder() {
+ return new BuilderWithTolerateBuilder();
+ }
+} \ No newline at end of file
diff --git a/test/transform/resource/after-delombok/FieldDefaults.java b/test/transform/resource/after-delombok/FieldDefaults.java
index 8a84f442..6f866a9a 100644
--- a/test/transform/resource/after-delombok/FieldDefaults.java
+++ b/test/transform/resource/after-delombok/FieldDefaults.java
@@ -1,4 +1,5 @@
class FieldDefaults1 {
+ static int STATIC = 3;
final int x;
int y;
FieldDefaults1(int x) {
@@ -6,6 +7,7 @@ class FieldDefaults1 {
}
}
class FieldDefaults2 {
+ static int STATIC = 3;
int x;
private int y;
} \ No newline at end of file
diff --git a/test/transform/resource/after-delombok/GetterLazyTransient.java b/test/transform/resource/after-delombok/GetterLazyTransient.java
new file mode 100644
index 00000000..dbebad90
--- /dev/null
+++ b/test/transform/resource/after-delombok/GetterLazyTransient.java
@@ -0,0 +1,26 @@
+class GetterLazyTransient {
+ private final java.util.concurrent.atomic.AtomicReference<java.lang.Object> nonTransientField = new java.util.concurrent.atomic.AtomicReference<java.lang.Object>();
+ private final transient int transientField = 2;
+ private final transient int nonLazyTransientField = 3;
+ @java.lang.SuppressWarnings("all")
+ @javax.annotation.Generated("lombok")
+ public int getNonTransientField() {
+ java.lang.Object value = this.nonTransientField.get();
+ if (value == null) {
+ synchronized (this.nonTransientField) {
+ value = this.nonTransientField.get();
+ if (value == null) {
+ final int actualValue = 1;
+ value = actualValue;
+ this.nonTransientField.set(value);
+ }
+ }
+ }
+ return (java.lang.Integer) value;
+ }
+ @java.lang.SuppressWarnings("all")
+ @javax.annotation.Generated("lombok")
+ public int getNonLazyTransientField() {
+ return this.nonLazyTransientField;
+ }
+}
diff --git a/test/transform/resource/after-delombok/NoArgsConstructorForce.java b/test/transform/resource/after-delombok/NoArgsConstructorForce.java
new file mode 100644
index 00000000..c1127c7c
--- /dev/null
+++ b/test/transform/resource/after-delombok/NoArgsConstructorForce.java
@@ -0,0 +1,14 @@
+
+public class NoArgsConstructorForce {
+ private final int[] i;
+ private final Object[] o;
+ private final java.util.List<?>[] fullQualifiedList;
+
+ @java.lang.SuppressWarnings("all")
+ @javax.annotation.Generated("lombok")
+ public NoArgsConstructorForce() {
+ this.i = null;
+ this.o = null;
+ this.fullQualifiedList = null;
+ }
+} \ No newline at end of file
diff --git a/test/transform/resource/after-delombok/ValNullInit.java b/test/transform/resource/after-delombok/ValNullInit.java
new file mode 100644
index 00000000..f0834a63
--- /dev/null
+++ b/test/transform/resource/after-delombok/ValNullInit.java
@@ -0,0 +1,5 @@
+class ValNullInit {
+ void method() {
+ final java.lang.Object x = null;
+ }
+} \ No newline at end of file
diff --git a/test/transform/resource/after-delombok/ValueStaticField.java b/test/transform/resource/after-delombok/ValueStaticField.java
index cec136f4..b4d60724 100644
--- a/test/transform/resource/after-delombok/ValueStaticField.java
+++ b/test/transform/resource/after-delombok/ValueStaticField.java
@@ -1,6 +1,6 @@
final class ValueStaticField {
- private static int x;
- private static final String PASSWORD = "Ken sent me";
+ static int x;
+ static String PASSWORD = "Ken sent me";
@java.lang.SuppressWarnings("all")
@javax.annotation.Generated("lombok")
public ValueStaticField() {
diff --git a/test/transform/resource/after-delombok/VarComplex.java b/test/transform/resource/after-delombok/VarComplex.java
new file mode 100644
index 00000000..10b33943
--- /dev/null
+++ b/test/transform/resource/after-delombok/VarComplex.java
@@ -0,0 +1,20 @@
+public class VarComplex {
+ private String field = "";
+ private static final int CONSTANT = 20;
+ public void testComplex() {
+ char[] shouldBeCharArray = field.toCharArray();
+ int shouldBeInt = CONSTANT;
+ java.lang.Object lock = new Object();
+ synchronized (lock) {
+ int field = 20; //Shadowing
+ int inner = 10;
+ switch (field) {
+ case 5:
+ char[] shouldBeCharArray2 = shouldBeCharArray;
+ int innerInner = inner;
+
+ }
+ }
+ java.lang.String shouldBeString = field; //Unshadowing
+ }
+} \ No newline at end of file
diff --git a/test/transform/resource/after-delombok/VarInFor.java b/test/transform/resource/after-delombok/VarInFor.java
new file mode 100644
index 00000000..363aeeff
--- /dev/null
+++ b/test/transform/resource/after-delombok/VarInFor.java
@@ -0,0 +1,9 @@
+public class VarInFor {
+ public void enhancedFor() {
+ int[] list = new int[] {1, 2};
+ for (int shouldBeInt : list) {
+ System.out.println(shouldBeInt);
+ int shouldBeInt2 = shouldBeInt;
+ }
+ }
+} \ No newline at end of file
diff --git a/test/transform/resource/after-delombok/VarInForOld.java b/test/transform/resource/after-delombok/VarInForOld.java
new file mode 100644
index 00000000..bb510c0b
--- /dev/null
+++ b/test/transform/resource/after-delombok/VarInForOld.java
@@ -0,0 +1,7 @@
+public class VarInForOld {
+ public void oldFor() {
+ for (int i = 0; i < 100; ++i) {
+ System.out.println(i);
+ }
+ }
+} \ No newline at end of file
diff --git a/test/transform/resource/after-delombok/VarModifier.java b/test/transform/resource/after-delombok/VarModifier.java
new file mode 100644
index 00000000..9838cdf7
--- /dev/null
+++ b/test/transform/resource/after-delombok/VarModifier.java
@@ -0,0 +1,7 @@
+public class VarModifier {
+ private String field = "";
+ public void testComplex() {
+ final char[] shouldBeFinalCharArray = field.toCharArray();
+ char[] shouldBeCharArray = field.toCharArray();
+ }
+} \ No newline at end of file
diff --git a/test/transform/resource/after-delombok/VarNullInit.java b/test/transform/resource/after-delombok/VarNullInit.java
new file mode 100644
index 00000000..8ec2ea73
--- /dev/null
+++ b/test/transform/resource/after-delombok/VarNullInit.java
@@ -0,0 +1,6 @@
+
+public class VarNullInit {
+ void method() {
+ java.lang.Object x = null;
+ }
+} \ No newline at end of file
diff --git a/test/transform/resource/after-ecj/BuilderWithTolerate.java b/test/transform/resource/after-ecj/BuilderWithTolerate.java
new file mode 100644
index 00000000..0b9b46a0
--- /dev/null
+++ b/test/transform/resource/after-ecj/BuilderWithTolerate.java
@@ -0,0 +1,34 @@
+import lombok.Builder;
+import lombok.experimental.Tolerate;
+public @Builder class BuilderWithTolerate {
+ public static class BuilderWithTolerateBuilder {
+ private @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") int value;
+ public @Tolerate BuilderWithTolerateBuilder value(String s) {
+ return this.value(Integer.parseInt(s));
+ }
+ @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") BuilderWithTolerateBuilder() {
+ super();
+ }
+ public @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") BuilderWithTolerateBuilder value(final int value) {
+ this.value = value;
+ return this;
+ }
+ public @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") BuilderWithTolerate build() {
+ return new BuilderWithTolerate(value);
+ }
+ public @java.lang.Override @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") java.lang.String toString() {
+ return (("BuilderWithTolerate.BuilderWithTolerateBuilder(value=" + this.value) + ")");
+ }
+ }
+ private final int value;
+ public static void main(String[] args) {
+ BuilderWithTolerate.builder().value("42").build();
+ }
+ @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") BuilderWithTolerate(final int value) {
+ super();
+ this.value = value;
+ }
+ public static @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") BuilderWithTolerateBuilder builder() {
+ return new BuilderWithTolerateBuilder();
+ }
+} \ No newline at end of file
diff --git a/test/transform/resource/after-ecj/FieldDefaults.java b/test/transform/resource/after-ecj/FieldDefaults.java
index e76c1251..a6941b7b 100644
--- a/test/transform/resource/after-ecj/FieldDefaults.java
+++ b/test/transform/resource/after-ecj/FieldDefaults.java
@@ -1,14 +1,20 @@
@lombok.experimental.FieldDefaults(makeFinal = true) class FieldDefaults1 {
+ static int STATIC = 3;
final int x;
@lombok.experimental.NonFinal int y;
+ <clinit>() {
+ }
FieldDefaults1(int x) {
super();
this.x = x;
}
}
@lombok.experimental.FieldDefaults(level = lombok.AccessLevel.PRIVATE) class FieldDefaults2 {
+ static int STATIC = 3;
@lombok.experimental.PackagePrivate int x;
private int y;
+ <clinit>() {
+ }
FieldDefaults2() {
super();
}
diff --git a/test/transform/resource/after-ecj/GetterLazyTransient.java b/test/transform/resource/after-ecj/GetterLazyTransient.java
new file mode 100644
index 00000000..9bc0d9ae
--- /dev/null
+++ b/test/transform/resource/after-ecj/GetterLazyTransient.java
@@ -0,0 +1,28 @@
+class GetterLazyTransient {
+ private final @lombok.Getter(lazy = true) java.util.concurrent.atomic.AtomicReference<java.lang.Object> nonTransientField = new java.util.concurrent.atomic.AtomicReference<java.lang.Object>();
+ private final transient @lombok.Getter(lazy = true) int transientField = 2;
+ private final transient @lombok.Getter int nonLazyTransientField = 3;
+ GetterLazyTransient() {
+ super();
+ }
+ public @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") int getNonTransientField() {
+ java.lang.Object value = this.nonTransientField.get();
+ if ((value == null))
+ {
+ synchronized (this.nonTransientField)
+ {
+ value = this.nonTransientField.get();
+ if ((value == null))
+ {
+ final int actualValue = 1;
+ value = actualValue;
+ this.nonTransientField.set(value);
+ }
+ }
+ }
+ return (java.lang.Integer) value;
+ }
+ public @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") int getNonLazyTransientField() {
+ return this.nonLazyTransientField;
+ }
+} \ No newline at end of file
diff --git a/test/transform/resource/after-ecj/NoArgsConstructorForce.java b/test/transform/resource/after-ecj/NoArgsConstructorForce.java
new file mode 100644
index 00000000..d0e69b0d
--- /dev/null
+++ b/test/transform/resource/after-ecj/NoArgsConstructorForce.java
@@ -0,0 +1,12 @@
+import lombok.NoArgsConstructor;
+public @NoArgsConstructor(force = true) class NoArgsConstructorForce {
+ private final int[] i;
+ private final Object[] o;
+ private final java.util.List<?>[] fullQualifiedList;
+ public @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") NoArgsConstructorForce() {
+ super();
+ this.i = null;
+ this.o = null;
+ this.fullQualifiedList = null;
+ }
+} \ No newline at end of file
diff --git a/test/transform/resource/after-ecj/ValNullInit.java b/test/transform/resource/after-ecj/ValNullInit.java
new file mode 100644
index 00000000..bd89c023
--- /dev/null
+++ b/test/transform/resource/after-ecj/ValNullInit.java
@@ -0,0 +1,10 @@
+import lombok.val;
+
+class ValNullInit {
+ ValNullInit() {
+ super();
+ }
+ void method() {
+ final @val java.lang.Object x = null;
+ }
+} \ No newline at end of file
diff --git a/test/transform/resource/after-ecj/ValueStaticField.java b/test/transform/resource/after-ecj/ValueStaticField.java
index 4ce84a02..75e337ce 100644
--- a/test/transform/resource/after-ecj/ValueStaticField.java
+++ b/test/transform/resource/after-ecj/ValueStaticField.java
@@ -1,7 +1,7 @@
import lombok.Value;
final @Value class ValueStaticField {
- private static int x;
- private static final String PASSWORD = "Ken sent me";
+ static int x;
+ static String PASSWORD = "Ken sent me";
<clinit>() {
}
public @java.lang.Override @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") boolean equals(final java.lang.Object o) {
diff --git a/test/transform/resource/after-ecj/VarComplex.java b/test/transform/resource/after-ecj/VarComplex.java
new file mode 100644
index 00000000..10c456eb
--- /dev/null
+++ b/test/transform/resource/after-ecj/VarComplex.java
@@ -0,0 +1,26 @@
+import lombok.experimental.var;
+public class VarComplex {
+ private String field = "";
+ private static final int CONSTANT = 20;
+ <clinit>() {
+ }
+ public VarComplex() {
+ super();
+ }
+ public void testComplex() {
+ @var char[] shouldBeCharArray = field.toCharArray();
+ @var int shouldBeInt = CONSTANT;
+ @var java.lang.Object lock = new Object();
+ synchronized (lock)
+ {
+ @var int field = 20;
+ @var int inner = 10;
+ switch (field) {
+ case 5 :
+ @var char[] shouldBeCharArray2 = shouldBeCharArray;
+ @var int innerInner = inner;
+ }
+ }
+ @var java.lang.String shouldBeString = field;
+ }
+} \ No newline at end of file
diff --git a/test/transform/resource/after-ecj/VarInFor.java b/test/transform/resource/after-ecj/VarInFor.java
new file mode 100644
index 00000000..0192aaed
--- /dev/null
+++ b/test/transform/resource/after-ecj/VarInFor.java
@@ -0,0 +1,14 @@
+import lombok.experimental.var;
+public class VarInFor {
+ public VarInFor() {
+ super();
+ }
+ public void enhancedFor() {
+ int[] list = new int[]{1, 2};
+ for (@var int shouldBeInt : list)
+ {
+ System.out.println(shouldBeInt);
+ @var int shouldBeInt2 = shouldBeInt;
+ }
+ }
+} \ No newline at end of file
diff --git a/test/transform/resource/after-ecj/VarInForOld.java b/test/transform/resource/after-ecj/VarInForOld.java
new file mode 100644
index 00000000..98fedf03
--- /dev/null
+++ b/test/transform/resource/after-ecj/VarInForOld.java
@@ -0,0 +1,12 @@
+import lombok.experimental.var;
+public class VarInForOld {
+ public VarInForOld() {
+ super();
+ }
+ public void oldFor() {
+ for (@var int i = 0;; (i < 100); ++ i)
+ {
+ System.out.println(i);
+ }
+ }
+} \ No newline at end of file
diff --git a/test/transform/resource/after-ecj/VarModifier.java b/test/transform/resource/after-ecj/VarModifier.java
new file mode 100644
index 00000000..d11142ca
--- /dev/null
+++ b/test/transform/resource/after-ecj/VarModifier.java
@@ -0,0 +1,12 @@
+import lombok.experimental.var;
+public class VarModifier {
+ private String field = "";
+ public VarModifier() {
+ super();
+ }
+ public void testComplex() {
+ final @var char[] shouldBeFinalCharArray = field.toCharArray();
+ @var char[] shouldBeCharArray = field.toCharArray();
+
+ }
+} \ No newline at end of file
diff --git a/test/transform/resource/after-ecj/VarNullInit.java b/test/transform/resource/after-ecj/VarNullInit.java
new file mode 100644
index 00000000..3eb2d506
--- /dev/null
+++ b/test/transform/resource/after-ecj/VarNullInit.java
@@ -0,0 +1,9 @@
+import lombok.experimental.var;
+public class VarNullInit {
+ public VarNullInit() {
+ super();
+ }
+ void method() {
+ @var java.lang.Object x = null;
+ }
+} \ No newline at end of file
diff --git a/test/transform/resource/before/BuilderWithTolerate.java b/test/transform/resource/before/BuilderWithTolerate.java
new file mode 100644
index 00000000..48fefce5
--- /dev/null
+++ b/test/transform/resource/before/BuilderWithTolerate.java
@@ -0,0 +1,18 @@
+import lombok.Builder;
+import lombok.experimental.Tolerate;
+
+@Builder
+public class BuilderWithTolerate {
+ private final int value;
+
+ public static void main(String[] args) {
+ BuilderWithTolerate.builder().value("42").build();
+ }
+
+ public static class BuilderWithTolerateBuilder {
+ @Tolerate
+ public BuilderWithTolerateBuilder value(String s) {
+ return this.value(Integer.parseInt(s));
+ }
+ }
+} \ No newline at end of file
diff --git a/test/transform/resource/before/FieldDefaults.java b/test/transform/resource/before/FieldDefaults.java
index ffe89734..97389411 100644
--- a/test/transform/resource/before/FieldDefaults.java
+++ b/test/transform/resource/before/FieldDefaults.java
@@ -1,5 +1,6 @@
@lombok.experimental.FieldDefaults(makeFinal = true)
class FieldDefaults1 {
+ static int STATIC = 3;
int x;
@lombok.experimental.NonFinal int y;
@@ -10,6 +11,7 @@ class FieldDefaults1 {
@lombok.experimental.FieldDefaults(level = lombok.AccessLevel.PRIVATE)
class FieldDefaults2 {
+ static int STATIC = 3;
@lombok.experimental.PackagePrivate int x;
int y;
} \ No newline at end of file
diff --git a/test/transform/resource/before/GetterLazyTransient.java b/test/transform/resource/before/GetterLazyTransient.java
new file mode 100644
index 00000000..1a913669
--- /dev/null
+++ b/test/transform/resource/before/GetterLazyTransient.java
@@ -0,0 +1,10 @@
+class GetterLazyTransient {
+ @lombok.Getter(lazy=true)
+ private final int nonTransientField = 1;
+
+ @lombok.Getter(lazy=true)
+ private final transient int transientField = 2;
+
+ @lombok.Getter
+ private final transient int nonLazyTransientField = 3;
+}
diff --git a/test/transform/resource/before/NoArgsConstructorForce.java b/test/transform/resource/before/NoArgsConstructorForce.java
new file mode 100644
index 00000000..48df1a37
--- /dev/null
+++ b/test/transform/resource/before/NoArgsConstructorForce.java
@@ -0,0 +1,8 @@
+import lombok.NoArgsConstructor;
+
+@NoArgsConstructor(force = true)
+public class NoArgsConstructorForce {
+ private final int[] i;
+ private final Object[] o;
+ private final java.util.List<?>[] fullQualifiedList;
+} \ No newline at end of file
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
diff --git a/test/transform/resource/before/VarWarning.java b/test/transform/resource/before/VarWarning.java
new file mode 100644
index 00000000..85559587
--- /dev/null
+++ b/test/transform/resource/before/VarWarning.java
@@ -0,0 +1,10 @@
+//CONF: lombok.var.flagUsage = WARNING
+//skip compare contents
+import lombok.experimental.var;
+
+public class VarWarning {
+ public void isOkay() {
+ var x = "Warning";
+ x.toLowerCase();
+ }
+} \ No newline at end of file
diff --git a/test/transform/resource/messages-delombok/GetterLazyTransient.java.messages b/test/transform/resource/messages-delombok/GetterLazyTransient.java.messages
new file mode 100644
index 00000000..8c1873eb
--- /dev/null
+++ b/test/transform/resource/messages-delombok/GetterLazyTransient.java.messages
@@ -0,0 +1 @@
+5 'lazy' is not supported on transient fields. \ No newline at end of file
diff --git a/test/transform/resource/messages-delombok/VarNullInit.java.messages b/test/transform/resource/messages-delombok/VarNullInit.java.messages
new file mode 100644
index 00000000..190ab7c4
--- /dev/null
+++ b/test/transform/resource/messages-delombok/VarNullInit.java.messages
@@ -0,0 +1 @@
+6 variable initializer is 'null' \ No newline at end of file
diff --git a/test/transform/resource/messages-delombok/VarWarning.java.messages b/test/transform/resource/messages-delombok/VarWarning.java.messages
new file mode 100644
index 00000000..48c89581
--- /dev/null
+++ b/test/transform/resource/messages-delombok/VarWarning.java.messages
@@ -0,0 +1 @@
+7 Use of var is flagged according to lombok configuration \ No newline at end of file
diff --git a/test/transform/resource/messages-ecj/GetterLazyTransient.java.messages b/test/transform/resource/messages-ecj/GetterLazyTransient.java.messages
new file mode 100644
index 00000000..8c1873eb
--- /dev/null
+++ b/test/transform/resource/messages-ecj/GetterLazyTransient.java.messages
@@ -0,0 +1 @@
+5 'lazy' is not supported on transient fields. \ No newline at end of file
diff --git a/test/transform/resource/messages-ecj/VarNullInit.java.messages b/test/transform/resource/messages-ecj/VarNullInit.java.messages
new file mode 100644
index 00000000..190ab7c4
--- /dev/null
+++ b/test/transform/resource/messages-ecj/VarNullInit.java.messages
@@ -0,0 +1 @@
+6 variable initializer is 'null' \ No newline at end of file
diff --git a/test/transform/resource/messages-ecj/VarWarning.java.messages b/test/transform/resource/messages-ecj/VarWarning.java.messages
new file mode 100644
index 00000000..48c89581
--- /dev/null
+++ b/test/transform/resource/messages-ecj/VarWarning.java.messages
@@ -0,0 +1 @@
+7 Use of var is flagged according to lombok configuration \ No newline at end of file