aboutsummaryrefslogtreecommitdiff
path: root/test/transform/resource
diff options
context:
space:
mode:
authorReinier Zwitserloot <reinier@zwitserloot.com>2018-04-17 04:19:37 +0200
committerReinier Zwitserloot <reinier@zwitserloot.com>2018-04-17 04:19:37 +0200
commitf540335ef972d84f02efba6dcaf608aec0e19129 (patch)
tree90b3c96253dc86171c6e948739a95ddc431e91b6 /test/transform/resource
parent7e81ac623831c3147e8fba4ca4ebfa021f4f5bd5 (diff)
downloadlombok-f540335ef972d84f02efba6dcaf608aec0e19129.tar.gz
lombok-f540335ef972d84f02efba6dcaf608aec0e19129.tar.bz2
lombok-f540335ef972d84f02efba6dcaf608aec0e19129.zip
[Fixes #1656] Lombok would silently do the wrong thing when using references to `public static final String` fields, instead of actual string literals, there where you can specify strings in lombok annotation parameters, such as `@ToString(of = MyClass.CONSTANT_FIELD)`. We can’t really fix it, but at least now lombok will error when you do that and describe in detail what’s going wrong.
Diffstat (limited to 'test/transform/resource')
-rw-r--r--test/transform/resource/before/ToStringWithConstantRefInOf.java10
-rw-r--r--test/transform/resource/messages-delombok/ToStringWithConstantRefInOf.java.messages1
-rw-r--r--test/transform/resource/messages-ecj/ToStringWithConstantRefInOf.java.messages1
3 files changed, 12 insertions, 0 deletions
diff --git a/test/transform/resource/before/ToStringWithConstantRefInOf.java b/test/transform/resource/before/ToStringWithConstantRefInOf.java
new file mode 100644
index 00000000..6246dcaf
--- /dev/null
+++ b/test/transform/resource/before/ToStringWithConstantRefInOf.java
@@ -0,0 +1,10 @@
+//skip compare contents
+import lombok.ToString;
+
+@ToString(of = ToStringWithConstantRefInOf.FIELD_NAME)
+public class ToStringWithConstantRefInOf {
+ static final String FIELD_NAME = "id";
+ private String id;
+ private int whatever;
+}
+
diff --git a/test/transform/resource/messages-delombok/ToStringWithConstantRefInOf.java.messages b/test/transform/resource/messages-delombok/ToStringWithConstantRefInOf.java.messages
new file mode 100644
index 00000000..d88e2754
--- /dev/null
+++ b/test/transform/resource/messages-delombok/ToStringWithConstantRefInOf.java.messages
@@ -0,0 +1 @@
+4 You must use constant literals in lombok annotations; they cannot be references to (static) fields.
diff --git a/test/transform/resource/messages-ecj/ToStringWithConstantRefInOf.java.messages b/test/transform/resource/messages-ecj/ToStringWithConstantRefInOf.java.messages
new file mode 100644
index 00000000..d88e2754
--- /dev/null
+++ b/test/transform/resource/messages-ecj/ToStringWithConstantRefInOf.java.messages
@@ -0,0 +1 @@
+4 You must use constant literals in lombok annotations; they cannot be references to (static) fields.