aboutsummaryrefslogtreecommitdiff
path: root/test/transform/resource
diff options
context:
space:
mode:
Diffstat (limited to 'test/transform/resource')
-rw-r--r--test/transform/resource/after-delombok/ExtensionMethodAutoboxing.java20
-rw-r--r--test/transform/resource/after-delombok/ExtensionMethodFunctional.java28
-rw-r--r--test/transform/resource/after-delombok/ExtensionMethodVarargs.java19
-rw-r--r--test/transform/resource/after-delombok/LoggerSlf4j.java5
-rw-r--r--test/transform/resource/after-ecj/ExtensionMethodAutoboxing.java25
-rw-r--r--test/transform/resource/after-ecj/ExtensionMethodFunctional.java31
-rw-r--r--test/transform/resource/after-ecj/ExtensionMethodVarargs.java24
-rw-r--r--test/transform/resource/after-ecj/LoggerSlf4j.java8
-rw-r--r--test/transform/resource/before/ExtensionMethodAutoboxing.java23
-rw-r--r--test/transform/resource/before/ExtensionMethodFunctional.java33
-rw-r--r--test/transform/resource/before/ExtensionMethodVarargs.java23
-rw-r--r--test/transform/resource/before/LoggerSlf4j.java4
-rw-r--r--test/transform/resource/messages-delombok/ExtensionMethodVarargs.java.messages1
-rw-r--r--test/transform/resource/messages-idempotent/ExtensionMethodVarargs.java.messages1
14 files changed, 228 insertions, 17 deletions
diff --git a/test/transform/resource/after-delombok/ExtensionMethodAutoboxing.java b/test/transform/resource/after-delombok/ExtensionMethodAutoboxing.java
new file mode 100644
index 00000000..f274cabb
--- /dev/null
+++ b/test/transform/resource/after-delombok/ExtensionMethodAutoboxing.java
@@ -0,0 +1,20 @@
+class ExtensionMethodAutoboxing {
+ public void test() {
+ Long l1 = 1L;
+ long l2 = 1L;
+ Integer i1 = 1;
+ int i2 = 1;
+ String string = "test";
+ ExtensionMethodAutoboxing.Extensions.boxing(string, l1, i1);
+ ExtensionMethodAutoboxing.Extensions.boxing(string, l1, i2);
+ ExtensionMethodAutoboxing.Extensions.boxing(string, l2, i1);
+ ExtensionMethodAutoboxing.Extensions.boxing(string, l2, i2);
+ }
+
+
+ static class Extensions {
+ public static String boxing(String string, Long a, int b) {
+ return string + " " + a + " " + b;
+ }
+ }
+} \ No newline at end of file
diff --git a/test/transform/resource/after-delombok/ExtensionMethodFunctional.java b/test/transform/resource/after-delombok/ExtensionMethodFunctional.java
new file mode 100644
index 00000000..bd301543
--- /dev/null
+++ b/test/transform/resource/after-delombok/ExtensionMethodFunctional.java
@@ -0,0 +1,28 @@
+import java.util.function.Function;
+import java.util.function.Consumer;
+
+class ExtensionMethodFunctional {
+ public void test() {
+ String test = "test";
+ test = ExtensionMethodFunctional.Extensions.map(test, s -> ExtensionMethodFunctional.Extensions.reverse(s));
+ ExtensionMethodFunctional.Extensions.consume(test, s -> System.out.println("1: " + s), s -> System.out.println("2: " + s));
+ ExtensionMethodFunctional.Extensions.consume(test, System.out::println, System.out::println);
+ }
+
+ static class Extensions {
+ public static <T, R> R map(T value, Function<T, R> mapper) {
+ return mapper.apply(value);
+ }
+
+ public static String reverse(String string) {
+ return new StringBuilder(string).reverse().toString();
+ }
+
+ @SafeVarargs
+ public static <T> void consume(T o, Consumer<T>... consumer) {
+ for (int i = 0; i < consumer.length; i++) {
+ consumer[i].accept(o);
+ }
+ }
+ }
+}
diff --git a/test/transform/resource/after-delombok/ExtensionMethodVarargs.java b/test/transform/resource/after-delombok/ExtensionMethodVarargs.java
new file mode 100644
index 00000000..237b73ef
--- /dev/null
+++ b/test/transform/resource/after-delombok/ExtensionMethodVarargs.java
@@ -0,0 +1,19 @@
+class ExtensionMethodVarargs {
+ public void test() {
+ Long l1 = 1L;
+ long l2 = 1L;
+ Integer i1 = 1;
+ int i2 = 1;
+ ExtensionMethodVarargs.Extensions.format("%d %d %d %d", l1, l2, i1, i2);
+ ExtensionMethodVarargs.Extensions.format("%d", l1);
+ ExtensionMethodVarargs.Extensions.format("", new Integer[] {1, 2});
+ ExtensionMethodVarargs.Extensions.format("", new Integer[] {1, 2}, new Integer[] {1, 2});
+ }
+
+
+ static class Extensions {
+ public static String format(String string, Object... params) {
+ return String.format(string, params);
+ }
+ }
+} \ No newline at end of file
diff --git a/test/transform/resource/after-delombok/LoggerSlf4j.java b/test/transform/resource/after-delombok/LoggerSlf4j.java
index 70f11ae4..152c8708 100644
--- a/test/transform/resource/after-delombok/LoggerSlf4j.java
+++ b/test/transform/resource/after-delombok/LoggerSlf4j.java
@@ -29,8 +29,3 @@ class LoggerSlf4jWithTwoStaticFields {
private static final org.slf4j.Logger log = org.slf4j.LoggerFactory.getLogger(LoggerSlf4jWithTwoStaticFields.TOPIC + LoggerSlf4jWithTwoStaticFields.TOPIC);
static final String TOPIC = "StaticField";
}
-
-class LoggerSlf4jWithTwoLiterals {
- @java.lang.SuppressWarnings("all")
- private static final org.slf4j.Logger log = org.slf4j.LoggerFactory.getLogger("A" + "B");
-} \ No newline at end of file
diff --git a/test/transform/resource/after-ecj/ExtensionMethodAutoboxing.java b/test/transform/resource/after-ecj/ExtensionMethodAutoboxing.java
new file mode 100644
index 00000000..8bc2b30f
--- /dev/null
+++ b/test/transform/resource/after-ecj/ExtensionMethodAutoboxing.java
@@ -0,0 +1,25 @@
+import lombok.experimental.ExtensionMethod;
+@ExtensionMethod({ExtensionMethodAutoboxing.Extensions.class}) class ExtensionMethodAutoboxing {
+ static class Extensions {
+ Extensions() {
+ super();
+ }
+ public static String boxing(String string, Long a, int b) {
+ return ((((string + " ") + a) + " ") + b);
+ }
+ }
+ ExtensionMethodAutoboxing() {
+ super();
+ }
+ public void test() {
+ Long l1 = 1l;
+ long l2 = 1l;
+ Integer i1 = 1;
+ int i2 = 1;
+ String string = "test";
+ ExtensionMethodAutoboxing.Extensions.boxing(string, l1, i1);
+ ExtensionMethodAutoboxing.Extensions.boxing(string, l1, i2);
+ ExtensionMethodAutoboxing.Extensions.boxing(string, l2, i1);
+ ExtensionMethodAutoboxing.Extensions.boxing(string, l2, i2);
+ }
+} \ No newline at end of file
diff --git a/test/transform/resource/after-ecj/ExtensionMethodFunctional.java b/test/transform/resource/after-ecj/ExtensionMethodFunctional.java
new file mode 100644
index 00000000..0190eabb
--- /dev/null
+++ b/test/transform/resource/after-ecj/ExtensionMethodFunctional.java
@@ -0,0 +1,31 @@
+import java.util.function.Function;
+import java.util.function.Consumer;
+import lombok.experimental.ExtensionMethod;
+@ExtensionMethod(ExtensionMethodFunctional.Extensions.class) class ExtensionMethodFunctional {
+ static class Extensions {
+ Extensions() {
+ super();
+ }
+ public static <T, R>R map(T value, Function<T, R> mapper) {
+ return mapper.apply(value);
+ }
+ public static String reverse(String string) {
+ return new StringBuilder(string).reverse().toString();
+ }
+ public static @SafeVarargs <T>void consume(T o, Consumer<T>... consumer) {
+ for (int i = 0;; (i < consumer.length); i ++)
+ {
+ consumer[i].accept(o);
+ }
+ }
+ }
+ ExtensionMethodFunctional() {
+ super();
+ }
+ public void test() {
+ String test = "test";
+ test = ExtensionMethodFunctional.Extensions.map(test, (<no type> s) -> ExtensionMethodFunctional.Extensions.reverse(s));
+ ExtensionMethodFunctional.Extensions.consume(test, (<no type> s) -> System.out.println(("1: " + s)), (<no type> s) -> System.out.println(("2: " + s)));
+ ExtensionMethodFunctional.Extensions.consume(test, System.out::println, System.out::println);
+ }
+}
diff --git a/test/transform/resource/after-ecj/ExtensionMethodVarargs.java b/test/transform/resource/after-ecj/ExtensionMethodVarargs.java
new file mode 100644
index 00000000..727b6494
--- /dev/null
+++ b/test/transform/resource/after-ecj/ExtensionMethodVarargs.java
@@ -0,0 +1,24 @@
+import lombok.experimental.ExtensionMethod;
+@ExtensionMethod(ExtensionMethodVarargs.Extensions.class) class ExtensionMethodVarargs {
+ static class Extensions {
+ Extensions() {
+ super();
+ }
+ public static String format(String string, Object... params) {
+ return String.format(string, params);
+ }
+ }
+ ExtensionMethodVarargs() {
+ super();
+ }
+ public void test() {
+ Long l1 = 1l;
+ long l2 = 1l;
+ Integer i1 = 1;
+ int i2 = 1;
+ ExtensionMethodVarargs.Extensions.format("%d %d %d %d", l1, l2, i1, i2);
+ ExtensionMethodVarargs.Extensions.format("%d", l1);
+ ExtensionMethodVarargs.Extensions.format("", new Integer[]{1, 2});
+ ExtensionMethodVarargs.Extensions.format("", new Integer[]{1, 2}, new Integer[]{1, 2});
+ }
+} \ No newline at end of file
diff --git a/test/transform/resource/after-ecj/LoggerSlf4j.java b/test/transform/resource/after-ecj/LoggerSlf4j.java
index c303a895..286d023b 100644
--- a/test/transform/resource/after-ecj/LoggerSlf4j.java
+++ b/test/transform/resource/after-ecj/LoggerSlf4j.java
@@ -56,11 +56,3 @@ class LoggerSlf4jOuter {
super();
}
}
-@Slf4j(topic = ExtendedStringLiteral{AB}) class LoggerSlf4jWithTwoLiterals {
- private static final org.slf4j.Logger log = org.slf4j.LoggerFactory.getLogger("AB");
- <clinit>() {
- }
- LoggerSlf4jWithTwoLiterals() {
- super();
- }
-} \ No newline at end of file
diff --git a/test/transform/resource/before/ExtensionMethodAutoboxing.java b/test/transform/resource/before/ExtensionMethodAutoboxing.java
new file mode 100644
index 00000000..5e07a6b3
--- /dev/null
+++ b/test/transform/resource/before/ExtensionMethodAutoboxing.java
@@ -0,0 +1,23 @@
+import lombok.experimental.ExtensionMethod;
+
+@ExtensionMethod({ExtensionMethodAutoboxing.Extensions.class})
+class ExtensionMethodAutoboxing {
+ public void test() {
+ Long l1 = 1l;
+ long l2 = 1l;
+ Integer i1 = 1;
+ int i2 = 1;
+
+ String string = "test";
+ string.boxing(l1, i1);
+ string.boxing(l1, i2);
+ string.boxing(l2, i1);
+ string.boxing(l2, i2);
+ }
+
+ static class Extensions {
+ public static String boxing(String string, Long a, int b) {
+ return string + " " + a + " " + b;
+ }
+ }
+}
diff --git a/test/transform/resource/before/ExtensionMethodFunctional.java b/test/transform/resource/before/ExtensionMethodFunctional.java
new file mode 100644
index 00000000..19983258
--- /dev/null
+++ b/test/transform/resource/before/ExtensionMethodFunctional.java
@@ -0,0 +1,33 @@
+// version 8:
+import java.util.function.Function;
+import java.util.function.Consumer;
+
+import lombok.experimental.ExtensionMethod;
+
+@ExtensionMethod(ExtensionMethodFunctional.Extensions.class)
+class ExtensionMethodFunctional {
+ public void test() {
+ String test = "test";
+ test = test.map(s -> s.reverse());
+
+ test.consume(s -> System.out.println("1: " + s), s -> System.out.println("2: " + s));
+ test.consume(System.out::println, System.out::println);
+ }
+
+ static class Extensions {
+ public static <T, R> R map(T value, Function<T, R> mapper) {
+ return mapper.apply(value);
+ }
+
+ public static String reverse(String string) {
+ return new StringBuilder(string).reverse().toString();
+ }
+
+ @SafeVarargs
+ public static <T> void consume(T o, Consumer<T>... consumer) {
+ for (int i = 0; i < consumer.length; i++) {
+ consumer[i].accept(o);
+ }
+ }
+ }
+}
diff --git a/test/transform/resource/before/ExtensionMethodVarargs.java b/test/transform/resource/before/ExtensionMethodVarargs.java
new file mode 100644
index 00000000..a976f9e6
--- /dev/null
+++ b/test/transform/resource/before/ExtensionMethodVarargs.java
@@ -0,0 +1,23 @@
+// version 8:
+import lombok.experimental.ExtensionMethod;
+
+@ExtensionMethod(ExtensionMethodVarargs.Extensions.class)
+class ExtensionMethodVarargs {
+ public void test() {
+ Long l1 = 1l;
+ long l2 = 1l;
+ Integer i1 = 1;
+ int i2 = 1;
+
+ "%d %d %d %d".format(l1, l2, i1, i2);
+ "%d".format(l1);
+ "".format(new Integer[]{1,2});
+ "".format(new Integer[]{1,2}, new Integer[]{1,2});
+ }
+
+ static class Extensions {
+ public static String format(String string, Object... params) {
+ return String.format(string, params);
+ }
+ }
+}
diff --git a/test/transform/resource/before/LoggerSlf4j.java b/test/transform/resource/before/LoggerSlf4j.java
index 3f8284e8..c59db4ee 100644
--- a/test/transform/resource/before/LoggerSlf4j.java
+++ b/test/transform/resource/before/LoggerSlf4j.java
@@ -28,7 +28,3 @@ class LoggerSlf4jWithStaticField {
class LoggerSlf4jWithTwoStaticFields {
static final String TOPIC = "StaticField";
}
-
-@Slf4j(topic="A"+"B")
-class LoggerSlf4jWithTwoLiterals {
-} \ No newline at end of file
diff --git a/test/transform/resource/messages-delombok/ExtensionMethodVarargs.java.messages b/test/transform/resource/messages-delombok/ExtensionMethodVarargs.java.messages
new file mode 100644
index 00000000..587d0767
--- /dev/null
+++ b/test/transform/resource/messages-delombok/ExtensionMethodVarargs.java.messages
@@ -0,0 +1 @@
+14 non-varargs call of varargs method with inexact argument type for last parameter \ No newline at end of file
diff --git a/test/transform/resource/messages-idempotent/ExtensionMethodVarargs.java.messages b/test/transform/resource/messages-idempotent/ExtensionMethodVarargs.java.messages
new file mode 100644
index 00000000..5a1016ca
--- /dev/null
+++ b/test/transform/resource/messages-idempotent/ExtensionMethodVarargs.java.messages
@@ -0,0 +1 @@
+9 non-varargs call of varargs method with inexact argument type for last parameter \ No newline at end of file