aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorRawi01 <Rawi01@users.noreply.github.com>2020-09-12 14:35:40 +0200
committerRawi01 <Rawi01@users.noreply.github.com>2020-09-12 14:35:40 +0200
commitfa0b5249cf5fee28d9be13ecdf0225f651f686aa (patch)
tree881cc34c60f69d7895be222201a059d268d91cf0 /test
parent0064c534273d9fb877f7e570f7a430060c88a5fb (diff)
downloadlombok-fa0b5249cf5fee28d9be13ecdf0225f651f686aa.tar.gz
lombok-fa0b5249cf5fee28d9be13ecdf0225f651f686aa.tar.bz2
lombok-fa0b5249cf5fee28d9be13ecdf0225f651f686aa.zip
Support With(By) on records and record components
This also replaces the javac/eclipse specific code for searching the parent fields of an annotation by a search based on the lombok AST.
Diffstat (limited to 'test')
-rw-r--r--test/transform/resource/after-delombok/WithByOnRecord.java5
-rw-r--r--test/transform/resource/after-delombok/WithByOnRecordComponent.java6
-rw-r--r--test/transform/resource/after-delombok/WithOnRecordComponent.java6
-rw-r--r--test/transform/resource/after-ecj/WithByOnRecord.java7
-rw-r--r--test/transform/resource/after-ecj/WithByOnRecordComponent.java13
-rw-r--r--test/transform/resource/after-ecj/WithOnRecordComponent.java13
-rw-r--r--test/transform/resource/before/WithByOnRecord.java3
-rw-r--r--test/transform/resource/before/WithByOnRecordComponent.java6
-rw-r--r--test/transform/resource/before/WithOnRecordComponent.java6
9 files changed, 62 insertions, 3 deletions
diff --git a/test/transform/resource/after-delombok/WithByOnRecord.java b/test/transform/resource/after-delombok/WithByOnRecord.java
index 43a4c8c3..d6a24a9a 100644
--- a/test/transform/resource/after-delombok/WithByOnRecord.java
+++ b/test/transform/resource/after-delombok/WithByOnRecord.java
@@ -3,4 +3,9 @@ record WithByOnRecord(String a, String b) {
public WithByOnRecord withABy(final java.util.function.Function<? super String, ? extends String> transformer) {
return new WithByOnRecord(transformer.apply(this.a), this.b);
}
+
+ @java.lang.SuppressWarnings("all")
+ public WithByOnRecord withBBy(final java.util.function.Function<? super String, ? extends String> transformer) {
+ return new WithByOnRecord(this.a, transformer.apply(this.b));
+ }
}
diff --git a/test/transform/resource/after-delombok/WithByOnRecordComponent.java b/test/transform/resource/after-delombok/WithByOnRecordComponent.java
new file mode 100644
index 00000000..5af50625
--- /dev/null
+++ b/test/transform/resource/after-delombok/WithByOnRecordComponent.java
@@ -0,0 +1,6 @@
+record WithByOnRecordComponent(String a, String b) {
+ @java.lang.SuppressWarnings("all")
+ public WithByOnRecordComponent withABy(final java.util.function.Function<? super String, ? extends String> transformer) {
+ return new WithByOnRecordComponent(transformer.apply(this.a), this.b);
+ }
+}
diff --git a/test/transform/resource/after-delombok/WithOnRecordComponent.java b/test/transform/resource/after-delombok/WithOnRecordComponent.java
new file mode 100644
index 00000000..a5f4ec36
--- /dev/null
+++ b/test/transform/resource/after-delombok/WithOnRecordComponent.java
@@ -0,0 +1,6 @@
+record WithOnRecordComponent(String a, String b) {
+ @java.lang.SuppressWarnings("all")
+ public WithOnRecordComponent withA(final String a) {
+ return this.a == a ? this : new WithOnRecordComponent(a, this.b);
+ }
+}
diff --git a/test/transform/resource/after-ecj/WithByOnRecord.java b/test/transform/resource/after-ecj/WithByOnRecord.java
index 9048c9f4..c40841c8 100644
--- a/test/transform/resource/after-ecj/WithByOnRecord.java
+++ b/test/transform/resource/after-ecj/WithByOnRecord.java
@@ -1,8 +1,8 @@
import lombok.experimental.WithBy;
-record WithByOnRecord(String a, String b) {
+@WithBy record WithByOnRecord(String a, String b) {
/* Implicit */ private final String a;
/* Implicit */ private final String b;
- public WithByOnRecord( String a, String b) {
+ public WithByOnRecord(String a, String b) {
super();
.a = a;
.b = b;
@@ -10,4 +10,7 @@ record WithByOnRecord(String a, String b) {
public @java.lang.SuppressWarnings("all") WithByOnRecord withABy(final java.util.function.Function<? super String, ? extends String> transformer) {
return new WithByOnRecord(transformer.apply(this.a), this.b);
}
+ public @java.lang.SuppressWarnings("all") WithByOnRecord withBBy(final java.util.function.Function<? super String, ? extends String> transformer) {
+ return new WithByOnRecord(this.a, transformer.apply(this.b));
+ }
}
diff --git a/test/transform/resource/after-ecj/WithByOnRecordComponent.java b/test/transform/resource/after-ecj/WithByOnRecordComponent.java
new file mode 100644
index 00000000..19fe508c
--- /dev/null
+++ b/test/transform/resource/after-ecj/WithByOnRecordComponent.java
@@ -0,0 +1,13 @@
+import lombok.experimental.WithBy;
+record WithByOnRecordComponent(String a, String b) {
+/* Implicit */ private final String a;
+/* Implicit */ private final String b;
+ public WithByOnRecordComponent( String a, String b) {
+ super();
+ .a = a;
+ .b = b;
+ }
+ public @java.lang.SuppressWarnings("all") WithByOnRecordComponent withABy(final java.util.function.Function<? super String, ? extends String> transformer) {
+ return new WithByOnRecordComponent(transformer.apply(this.a), this.b);
+ }
+}
diff --git a/test/transform/resource/after-ecj/WithOnRecordComponent.java b/test/transform/resource/after-ecj/WithOnRecordComponent.java
new file mode 100644
index 00000000..42028f81
--- /dev/null
+++ b/test/transform/resource/after-ecj/WithOnRecordComponent.java
@@ -0,0 +1,13 @@
+import lombok.With;
+record WithOnRecordComponent(String a, String b) {
+/* Implicit */ private final String a;
+/* Implicit */ private final String b;
+ public WithOnRecordComponent( String a, String b) {
+ super();
+ .a = a;
+ .b = b;
+ }
+ public @java.lang.SuppressWarnings("all") WithOnRecordComponent withA(final String a) {
+ return ((this.a == a) ? this : new WithOnRecordComponent(a, this.b));
+ }
+}
diff --git a/test/transform/resource/before/WithByOnRecord.java b/test/transform/resource/before/WithByOnRecord.java
index 98cbff9b..6c7b8e2d 100644
--- a/test/transform/resource/before/WithByOnRecord.java
+++ b/test/transform/resource/before/WithByOnRecord.java
@@ -2,5 +2,6 @@
import lombok.experimental.WithBy;
-record WithByOnRecord(@WithBy String a, String b) {
+@WithBy
+record WithByOnRecord(String a, String b) {
} \ No newline at end of file
diff --git a/test/transform/resource/before/WithByOnRecordComponent.java b/test/transform/resource/before/WithByOnRecordComponent.java
new file mode 100644
index 00000000..7e0f0f19
--- /dev/null
+++ b/test/transform/resource/before/WithByOnRecordComponent.java
@@ -0,0 +1,6 @@
+// version 14:
+
+import lombok.experimental.WithBy;
+
+record WithByOnRecordComponent(@WithBy String a, String b) {
+} \ No newline at end of file
diff --git a/test/transform/resource/before/WithOnRecordComponent.java b/test/transform/resource/before/WithOnRecordComponent.java
new file mode 100644
index 00000000..6f827851
--- /dev/null
+++ b/test/transform/resource/before/WithOnRecordComponent.java
@@ -0,0 +1,6 @@
+// version 14:
+
+import lombok.With;
+
+record WithOnRecordComponent(@With String a, String b) {
+} \ No newline at end of file