aboutsummaryrefslogtreecommitdiff
path: root/test/transform/resource
diff options
context:
space:
mode:
authorReinier Zwitserloot <r.zwitserloot@projectlombok.org>2020-02-14 01:20:14 +0100
committerReinier Zwitserloot <r.zwitserloot@projectlombok.org>2020-02-14 01:21:24 +0100
commit89f98da78d3ffd9e9f6f7151fcaf5e4329d2e8dd (patch)
tree7e77630855e4a66851f4c3972a54263f024e58a7 /test/transform/resource
parent15b09ee27466baa9107ce6556e9302191f1cd7b5 (diff)
downloadlombok-89f98da78d3ffd9e9f6f7151fcaf5e4329d2e8dd.tar.gz
lombok-89f98da78d3ffd9e9f6f7151fcaf5e4329d2e8dd.tar.bz2
lombok-89f98da78d3ffd9e9f6f7151fcaf5e4329d2e8dd.zip
[fixes #678] `@Synchronize` an instance method on static variable no longer emits a warning.
Diffstat (limited to 'test/transform/resource')
-rw-r--r--test/transform/resource/after-delombok/SynchronizedName.java2
-rw-r--r--test/transform/resource/after-delombok/SynchronizedNameStaticToInstanceRef.java4
-rw-r--r--test/transform/resource/after-delombok/SynchronizedOnStatic.java18
-rw-r--r--test/transform/resource/after-ecj/SynchronizedName.java2
-rw-r--r--test/transform/resource/after-ecj/SynchronizedNameStaticToInstanceRef.java5
-rw-r--r--test/transform/resource/after-ecj/SynchronizedOnStatic.java31
-rw-r--r--test/transform/resource/before/SynchronizedOnStatic.java16
-rw-r--r--test/transform/resource/messages-delombok/SynchronizedNameStaticToInstanceRef.java.messages2
-rw-r--r--test/transform/resource/messages-ecj/SynchronizedName.java.messages1
-rw-r--r--test/transform/resource/messages-ecj/SynchronizedNameNoSuchField.java.messages2
-rw-r--r--test/transform/resource/messages-ecj/SynchronizedNameStaticToInstanceRef.java.messages2
-rw-r--r--test/transform/resource/messages-idempotent/SynchronizedNameStaticToInstanceRef.java.messages1
12 files changed, 72 insertions, 14 deletions
diff --git a/test/transform/resource/after-delombok/SynchronizedName.java b/test/transform/resource/after-delombok/SynchronizedName.java
index 91fd7ea7..9c160166 100644
--- a/test/transform/resource/after-delombok/SynchronizedName.java
+++ b/test/transform/resource/after-delombok/SynchronizedName.java
@@ -8,7 +8,7 @@ class SynchronizedName {
}
}
void test4() {
- synchronized (this.READ) {
+ synchronized (SynchronizedName.READ) {
System.out.println("four");
}
}
diff --git a/test/transform/resource/after-delombok/SynchronizedNameStaticToInstanceRef.java b/test/transform/resource/after-delombok/SynchronizedNameStaticToInstanceRef.java
index effa036f..2bc056e9 100644
--- a/test/transform/resource/after-delombok/SynchronizedNameStaticToInstanceRef.java
+++ b/test/transform/resource/after-delombok/SynchronizedNameStaticToInstanceRef.java
@@ -2,8 +2,6 @@ class SynchronizedNameStaticToInstanceRef {
private Object read = new Object();
private static Object READ = new Object();
static void test3() {
- synchronized (SynchronizedNameStaticToInstanceRef.read) {
- System.out.println("three");
- }
+ System.out.println("three");
}
}
diff --git a/test/transform/resource/after-delombok/SynchronizedOnStatic.java b/test/transform/resource/after-delombok/SynchronizedOnStatic.java
new file mode 100644
index 00000000..30ec16f7
--- /dev/null
+++ b/test/transform/resource/after-delombok/SynchronizedOnStatic.java
@@ -0,0 +1,18 @@
+class SynchronizedOnStatic<Z> {
+ static class Inner {
+ private static Object LCK = new Object[0];
+ public void foo() {
+ synchronized (SynchronizedOnStatic.Inner.LCK) {
+ System.out.println();
+ }
+ }
+ }
+ class Inner2 {
+ private Object LCK = new Object[0];
+ public void foo() {
+ synchronized (this.LCK) {
+ System.out.println();
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/test/transform/resource/after-ecj/SynchronizedName.java b/test/transform/resource/after-ecj/SynchronizedName.java
index b7474373..f2c3fea3 100644
--- a/test/transform/resource/after-ecj/SynchronizedName.java
+++ b/test/transform/resource/after-ecj/SynchronizedName.java
@@ -13,7 +13,7 @@ class SynchronizedName {
}
}
@lombok.Synchronized("READ") void test4() {
- synchronized (this.READ)
+ synchronized (SynchronizedName.READ)
{
System.out.println("four");
}
diff --git a/test/transform/resource/after-ecj/SynchronizedNameStaticToInstanceRef.java b/test/transform/resource/after-ecj/SynchronizedNameStaticToInstanceRef.java
index 103c714c..72557c4b 100644
--- a/test/transform/resource/after-ecj/SynchronizedNameStaticToInstanceRef.java
+++ b/test/transform/resource/after-ecj/SynchronizedNameStaticToInstanceRef.java
@@ -7,9 +7,6 @@ class SynchronizedNameStaticToInstanceRef {
super();
}
static @lombok.Synchronized("read") void test3() {
- synchronized (SynchronizedNameStaticToInstanceRef.read)
- {
- System.out.println("three");
- }
+ System.out.println("three");
}
}
diff --git a/test/transform/resource/after-ecj/SynchronizedOnStatic.java b/test/transform/resource/after-ecj/SynchronizedOnStatic.java
new file mode 100644
index 00000000..20dd3514
--- /dev/null
+++ b/test/transform/resource/after-ecj/SynchronizedOnStatic.java
@@ -0,0 +1,31 @@
+class SynchronizedOnStatic<Z> {
+ static class Inner {
+ private static Object LCK = new Object[0];
+ <clinit>() {
+ }
+ Inner() {
+ super();
+ }
+ public @lombok.Synchronized("LCK") void foo() {
+ synchronized (SynchronizedOnStatic.Inner.LCK)
+ {
+ System.out.println();
+ }
+ }
+ }
+ class Inner2 {
+ private Object LCK = new Object[0];
+ Inner2() {
+ super();
+ }
+ public @lombok.Synchronized("LCK") void foo() {
+ synchronized (this.LCK)
+ {
+ System.out.println();
+ }
+ }
+ }
+ SynchronizedOnStatic() {
+ super();
+ }
+} \ No newline at end of file
diff --git a/test/transform/resource/before/SynchronizedOnStatic.java b/test/transform/resource/before/SynchronizedOnStatic.java
new file mode 100644
index 00000000..23c4818d
--- /dev/null
+++ b/test/transform/resource/before/SynchronizedOnStatic.java
@@ -0,0 +1,16 @@
+class SynchronizedOnStatic<Z> {
+ static class Inner {
+ private static Object LCK = new Object[0];
+ @lombok.Synchronized("LCK")
+ public void foo() {
+ System.out.println();
+ }
+ }
+ class Inner2 {
+ private Object LCK = new Object[0];
+ @lombok.Synchronized("LCK")
+ public void foo() {
+ System.out.println();
+ }
+ }
+}
diff --git a/test/transform/resource/messages-delombok/SynchronizedNameStaticToInstanceRef.java.messages b/test/transform/resource/messages-delombok/SynchronizedNameStaticToInstanceRef.java.messages
index fe0653c8..6fedd538 100644
--- a/test/transform/resource/messages-delombok/SynchronizedNameStaticToInstanceRef.java.messages
+++ b/test/transform/resource/messages-delombok/SynchronizedNameStaticToInstanceRef.java.messages
@@ -1 +1 @@
-5 non-static variable read cannot be referenced from a static context \ No newline at end of file
+5 The field read is non-static and this cannot be used on this static method \ No newline at end of file
diff --git a/test/transform/resource/messages-ecj/SynchronizedName.java.messages b/test/transform/resource/messages-ecj/SynchronizedName.java.messages
deleted file mode 100644
index 5322f9d2..00000000
--- a/test/transform/resource/messages-ecj/SynchronizedName.java.messages
+++ /dev/null
@@ -1 +0,0 @@
-8 The static field SynchronizedName.READ should be accessed in a static way
diff --git a/test/transform/resource/messages-ecj/SynchronizedNameNoSuchField.java.messages b/test/transform/resource/messages-ecj/SynchronizedNameNoSuchField.java.messages
index ae351773..e72c4166 100644
--- a/test/transform/resource/messages-ecj/SynchronizedNameNoSuchField.java.messages
+++ b/test/transform/resource/messages-ecj/SynchronizedNameNoSuchField.java.messages
@@ -1 +1 @@
-5 The field write does not exist.
+5 The field write does not exist
diff --git a/test/transform/resource/messages-ecj/SynchronizedNameStaticToInstanceRef.java.messages b/test/transform/resource/messages-ecj/SynchronizedNameStaticToInstanceRef.java.messages
index 98b9c948..68cb9d6c 100644
--- a/test/transform/resource/messages-ecj/SynchronizedNameStaticToInstanceRef.java.messages
+++ b/test/transform/resource/messages-ecj/SynchronizedNameStaticToInstanceRef.java.messages
@@ -1 +1 @@
-5 Cannot make a static reference to the non-static field SynchronizedNameStaticToInstanceRef.read
+5 The field read is non-static and thus cannot be used on this static method
diff --git a/test/transform/resource/messages-idempotent/SynchronizedNameStaticToInstanceRef.java.messages b/test/transform/resource/messages-idempotent/SynchronizedNameStaticToInstanceRef.java.messages
deleted file mode 100644
index 53b39d98..00000000
--- a/test/transform/resource/messages-idempotent/SynchronizedNameStaticToInstanceRef.java.messages
+++ /dev/null
@@ -1 +0,0 @@
-5 non-static variable read cannot be referenced from a static context