aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorReinier Zwitserloot <r.zwitserloot@projectlombok.org>2019-08-27 00:15:02 +0200
committerReinier Zwitserloot <r.zwitserloot@projectlombok.org>2020-02-15 07:23:10 +0100
commita991bebe41bd5037323f682301a5fe77ea89b7b9 (patch)
treeda92cd6868cf07b25ac91642d859d865ed43cbb9 /test
parentd08229a58007da1968aa86b4dd4a3a9a21a7b578 (diff)
downloadlombok-a991bebe41bd5037323f682301a5fe77ea89b7b9.tar.gz
lombok-a991bebe41bd5037323f682301a5fe77ea89b7b9.tar.bz2
lombok-a991bebe41bd5037323f682301a5fe77ea89b7b9.zip
[issue #2368] [withBy] support for javac
Diffstat (limited to 'test')
-rw-r--r--test/transform/resource/after-delombok/WithByNullAnnos.java13
-rw-r--r--test/transform/resource/after-delombok/WithByTypes.java62
-rw-r--r--test/transform/resource/before/WithByNullAnnos.java6
-rw-r--r--test/transform/resource/before/WithByTypes.java18
4 files changed, 99 insertions, 0 deletions
diff --git a/test/transform/resource/after-delombok/WithByNullAnnos.java b/test/transform/resource/after-delombok/WithByNullAnnos.java
new file mode 100644
index 00000000..cdaed973
--- /dev/null
+++ b/test/transform/resource/after-delombok/WithByNullAnnos.java
@@ -0,0 +1,13 @@
+import java.util.List;
+public class WithByNullAnnos {
+ final List<String> test;
+ @java.lang.SuppressWarnings("all")
+ public WithByNullAnnos(final List<String> test) {
+ this.test = test;
+ }
+ @org.checkerframework.checker.nullness.qual.NonNull
+ @java.lang.SuppressWarnings("all")
+ public WithByNullAnnos withTestBy(final java.util.function.@org.checkerframework.checker.nullness.qual.NonNull Function<? super List<String>, ? extends List<String>> transformer) {
+ return new WithByNullAnnos(transformer.apply(this.test));
+ }
+}
diff --git a/test/transform/resource/after-delombok/WithByTypes.java b/test/transform/resource/after-delombok/WithByTypes.java
new file mode 100644
index 00000000..e5e2fb07
--- /dev/null
+++ b/test/transform/resource/after-delombok/WithByTypes.java
@@ -0,0 +1,62 @@
+public class WithByTypes<T> {
+ private final int a;
+ private final long b;
+ private final short c;
+ private final char d;
+ private final byte e;
+ private final double f;
+ private final float g;
+ private final boolean h;
+ private final T i;
+ public static void example() {
+ new WithByTypes<String>(0, 0, (short) 0, ' ', (byte) 0, 0.0, 0.0F, true, "").withHBy(x -> !x).withFBy(x -> x + 0.5);
+ }
+ @java.lang.SuppressWarnings("all")
+ public WithByTypes(final int a, final long b, final short c, final char d, final byte e, final double f, final float g, final boolean h, final T i) {
+ this.a = a;
+ this.b = b;
+ this.c = c;
+ this.d = d;
+ this.e = e;
+ this.f = f;
+ this.g = g;
+ this.h = h;
+ this.i = i;
+ }
+ @java.lang.SuppressWarnings("all")
+ public WithByTypes<T> withABy(final java.util.function.IntUnaryOperator transformer) {
+ return new WithByTypes<T>(transformer.applyAsInt(this.a), this.b, this.c, this.d, this.e, this.f, this.g, this.h, this.i);
+ }
+ @java.lang.SuppressWarnings("all")
+ public WithByTypes<T> withBBy(final java.util.function.LongUnaryOperator transformer) {
+ return new WithByTypes<T>(this.a, transformer.applyAsLong(this.b), this.c, this.d, this.e, this.f, this.g, this.h, this.i);
+ }
+ @java.lang.SuppressWarnings("all")
+ public WithByTypes<T> withCBy(final java.util.function.IntUnaryOperator transformer) {
+ return new WithByTypes<T>(this.a, this.b, (short) transformer.applyAsInt(this.c), this.d, this.e, this.f, this.g, this.h, this.i);
+ }
+ @java.lang.SuppressWarnings("all")
+ public WithByTypes<T> withDBy(final java.util.function.IntUnaryOperator transformer) {
+ return new WithByTypes<T>(this.a, this.b, this.c, (char) transformer.applyAsInt(this.d), this.e, this.f, this.g, this.h, this.i);
+ }
+ @java.lang.SuppressWarnings("all")
+ public WithByTypes<T> withEBy(final java.util.function.IntUnaryOperator transformer) {
+ return new WithByTypes<T>(this.a, this.b, this.c, this.d, (byte) transformer.applyAsInt(this.e), this.f, this.g, this.h, this.i);
+ }
+ @java.lang.SuppressWarnings("all")
+ public WithByTypes<T> withFBy(final java.util.function.DoubleUnaryOperator transformer) {
+ return new WithByTypes<T>(this.a, this.b, this.c, this.d, this.e, transformer.applyAsDouble(this.f), this.g, this.h, this.i);
+ }
+ @java.lang.SuppressWarnings("all")
+ public WithByTypes<T> withGBy(final java.util.function.DoubleUnaryOperator transformer) {
+ return new WithByTypes<T>(this.a, this.b, this.c, this.d, this.e, this.f, (float) transformer.applyAsDouble(this.g), this.h, this.i);
+ }
+ @java.lang.SuppressWarnings("all")
+ public WithByTypes<T> withHBy(final java.util.function.UnaryOperator<java.lang.Boolean> transformer) {
+ return new WithByTypes<T>(this.a, this.b, this.c, this.d, this.e, this.f, this.g, transformer.apply(this.h), this.i);
+ }
+ @java.lang.SuppressWarnings("all")
+ public WithByTypes<T> withIBy(final java.util.function.Function<? super T, ? extends T> transformer) {
+ return new WithByTypes<T>(this.a, this.b, this.c, this.d, this.e, this.f, this.g, this.h, transformer.apply(this.i));
+ }
+} \ No newline at end of file
diff --git a/test/transform/resource/before/WithByNullAnnos.java b/test/transform/resource/before/WithByNullAnnos.java
new file mode 100644
index 00000000..3fd8087f
--- /dev/null
+++ b/test/transform/resource/before/WithByNullAnnos.java
@@ -0,0 +1,6 @@
+//CONF: lombok.addNullAnnotations=checkerframework
+import java.util.List;
+@lombok.RequiredArgsConstructor
+public class WithByNullAnnos {
+ @lombok.experimental.WithBy final List<String> test;
+}
diff --git a/test/transform/resource/before/WithByTypes.java b/test/transform/resource/before/WithByTypes.java
new file mode 100644
index 00000000..9d2fe358
--- /dev/null
+++ b/test/transform/resource/before/WithByTypes.java
@@ -0,0 +1,18 @@
+@lombok.RequiredArgsConstructor
+@lombok.experimental.FieldDefaults(level = lombok.AccessLevel.PRIVATE, makeFinal = true)
+@lombok.experimental.WithBy
+public class WithByTypes<T> {
+ int a;
+ long b;
+ short c;
+ char d;
+ byte e;
+ double f;
+ float g;
+ boolean h;
+ T i;
+
+ public static void example() {
+ new WithByTypes<String>(0, 0, (short) 0, ' ', (byte) 0, 0.0, 0.0F, true, "").withHBy(x -> !x).withFBy(x -> x + 0.5);
+ }
+}