aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/configuration/src/lombok/core/configuration/TestConfiguration.java4
-rw-r--r--test/core/src/lombok/AbstractRunTests.java2
-rw-r--r--test/core/src/lombok/LombokTestSource.java8
-rw-r--r--test/core/src/lombok/RunTestsViaEcj.java77
-rw-r--r--test/pretty/resource/before/ThisParameter.java1
-rw-r--r--test/transform/resource/after-delombok/DelegateWithVarargs2.java12
-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/GetterSetterJavadoc.java2
-rw-r--r--test/transform/resource/after-delombok/LoggerSlf4j.java5
-rw-r--r--test/transform/resource/after-ecj/BuilderJavadoc.java25
-rw-r--r--test/transform/resource/after-ecj/BuilderWithDeprecated.java4
-rw-r--r--test/transform/resource/after-ecj/DelegateWithVarargs2.java17
-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/GetterDeprecated.java3
-rw-r--r--test/transform/resource/after-ecj/GetterSetterJavadoc.java48
-rw-r--r--test/transform/resource/after-ecj/LoggerSlf4j.java8
-rw-r--r--test/transform/resource/after-ecj/SetterAndWithMethodJavadoc.java18
-rw-r--r--test/transform/resource/after-ecj/SetterDeprecated.java3
-rw-r--r--test/transform/resource/after-ecj/WithMethodMarkedDeprecated.java4
-rw-r--r--test/transform/resource/before/DelegateWithVarargs2.java9
-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
30 files changed, 454 insertions, 28 deletions
diff --git a/test/configuration/src/lombok/core/configuration/TestConfiguration.java b/test/configuration/src/lombok/core/configuration/TestConfiguration.java
index 3032daf3..504c36b2 100644
--- a/test/configuration/src/lombok/core/configuration/TestConfiguration.java
+++ b/test/configuration/src/lombok/core/configuration/TestConfiguration.java
@@ -65,8 +65,8 @@ public class TestConfiguration {
outStream.flush();
errStream.flush();
- String out = new String(rawOut.toByteArray()).replace("\r\n", "\n").replace('\\', '/').replaceAll(Pattern.quote(normalizedName) + "|" + Pattern.quote(baseName), "BASE/").trim();
- String err = new String(rawErr.toByteArray()).replace("\r\n", "\n").replace('\\', '/').replaceAll(Pattern.quote(normalizedName) + "|" + Pattern.quote(baseName), "BASE/").trim();
+ String out = new String(rawOut.toByteArray()).replace('\\', '/').replaceAll(Pattern.quote(normalizedName) + "|" + Pattern.quote(baseName), "BASE/").trim();
+ String err = new String(rawErr.toByteArray()).replace('\\', '/').replaceAll(Pattern.quote(normalizedName) + "|" + Pattern.quote(baseName), "BASE/").trim();
checkContent(directory, out, "out");
checkContent(directory, err, "err");
diff --git a/test/core/src/lombok/AbstractRunTests.java b/test/core/src/lombok/AbstractRunTests.java
index 8e73e122..448f77ab 100644
--- a/test/core/src/lombok/AbstractRunTests.java
+++ b/test/core/src/lombok/AbstractRunTests.java
@@ -285,7 +285,7 @@ public abstract class AbstractRunTests {
endIdx--;
}
- return in.substring(0, endIdx);
+ return in.substring(0, endIdx + 1);
}
private static String[] removeBlanks(String[] in) {
diff --git a/test/core/src/lombok/LombokTestSource.java b/test/core/src/lombok/LombokTestSource.java
index 57a32333..a0a6407a 100644
--- a/test/core/src/lombok/LombokTestSource.java
+++ b/test/core/src/lombok/LombokTestSource.java
@@ -113,10 +113,10 @@ public class LombokTestSource {
return formatPreferences;
}
- private static final Pattern VERSION_STYLE_1 = Pattern.compile("^(\\d+)$");
- private static final Pattern VERSION_STYLE_2 = Pattern.compile("^\\:(\\d+)$");
- private static final Pattern VERSION_STYLE_3 = Pattern.compile("^(\\d+):$");
- private static final Pattern VERSION_STYLE_4 = Pattern.compile("^(\\d+):(\\d+)$");
+ private static final Pattern VERSION_STYLE_1 = Pattern.compile("^(\\d+)(?:\\s+.*)?$");
+ private static final Pattern VERSION_STYLE_2 = Pattern.compile("^\\:(\\d+)(?:\\s+.*)?$");
+ private static final Pattern VERSION_STYLE_3 = Pattern.compile("^(\\d+):(?:\\s+.*)?$");
+ private static final Pattern VERSION_STYLE_4 = Pattern.compile("^(\\d+):(\\d+)(?:\\s+.*)?$");
private int[] parseVersionLimit(String spec) {
/* Single version: '5' */ {
diff --git a/test/core/src/lombok/RunTestsViaEcj.java b/test/core/src/lombok/RunTestsViaEcj.java
index ab28cb0c..b98c19b7 100644
--- a/test/core/src/lombok/RunTestsViaEcj.java
+++ b/test/core/src/lombok/RunTestsViaEcj.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2010-2014 The Project Lombok Authors.
+ * Copyright (C) 2010-2020 The Project Lombok Authors.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -35,13 +35,16 @@ import java.util.concurrent.atomic.AtomicReference;
import lombok.eclipse.Eclipse;
import lombok.javac.CapturingDiagnosticListener.CompilerMessage;
+import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jdt.core.compiler.CategorizedProblem;
+import org.eclipse.jdt.core.compiler.CharOperation;
+import org.eclipse.jdt.core.dom.AST;
+import org.eclipse.jdt.core.dom.CompilationUnit;
import org.eclipse.jdt.internal.compiler.CompilationResult;
import org.eclipse.jdt.internal.compiler.Compiler;
import org.eclipse.jdt.internal.compiler.ICompilerRequestor;
import org.eclipse.jdt.internal.compiler.IErrorHandlingPolicy;
import org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration;
-import org.eclipse.jdt.internal.compiler.batch.CompilationUnit;
import org.eclipse.jdt.internal.compiler.batch.FileSystem;
import org.eclipse.jdt.internal.compiler.env.ICompilationUnit;
import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
@@ -103,7 +106,8 @@ public class RunTestsViaEcj extends AbstractRunTests {
};
String source = readFile(file);
- final CompilationUnit sourceUnit = new CompilationUnit(source.toCharArray(), file.getName(), encoding == null ? "UTF-8" : encoding);
+ char[] sourceArray = source.toCharArray();
+ final ICompilationUnit sourceUnit = new TestCompilationUnit(file.getName(), source);
Compiler ecjCompiler = new Compiler(createFileSystem(file, minVersion), ecjErrorHandlingPolicy(), ecjCompilerOptions(), bitbucketRequestor, new DefaultProblemFactory(Locale.ENGLISH)) {
@Override protected synchronized void addCompilationUnit(ICompilationUnit inUnit, CompilationUnitDeclaration parsedUnit) {
@@ -126,11 +130,40 @@ public class RunTestsViaEcj extends AbstractRunTests {
if (cud == null) result.append("---- No CompilationUnit provided by ecj ----");
else result.append(cud.toString());
+ if (eclipseAvailable()) {
+ EclipseDomConversion.toDomAst(cud, sourceArray);
+ }
+
+ return true;
+ }
+
+ private boolean eclipseAvailable() {
+ try {
+ Class.forName("org.eclipse.jdt.core.dom.CompilationUnit");
+ } catch (Throwable t) {
+ return false;
+ }
+
return true;
}
private static final String bootRuntimePath = System.getProperty("delombok.bootclasspath");
+ private static class EclipseDomConversion {
+ static CompilationUnit toDomAst(CompilationUnitDeclaration cud, final char[] source) {
+ Map<String, String> options = new HashMap<String, String>();
+ options.put(JavaCore.COMPILER_SOURCE, "11");
+ options.put("org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures", "enabled");
+
+ org.eclipse.jdt.internal.core.CompilationUnit ccu = new org.eclipse.jdt.internal.core.CompilationUnit(null, null, null) {
+ @Override public char[] getContents() {
+ return source;
+ }
+ };
+ return AST.convertCompilationUnit(4, cud, options, false, ccu, 0, null);
+ }
+ }
+
private FileSystem createFileSystem(File file, int minVersion) {
List<String> classpath = new ArrayList<String>();
for (Iterator<String> i = classpath.iterator(); i.hasNext();) {
@@ -150,4 +183,42 @@ public class RunTestsViaEcj extends AbstractRunTests {
}
return new FileSystem(classpath.toArray(new String[0]), new String[] {file.getAbsolutePath()}, "UTF-8");
}
+
+ private static final class TestCompilationUnit extends org.eclipse.jdt.internal.core.CompilationUnit {
+ private final char[] source;
+ private final char[] mainTypeName;
+
+ private TestCompilationUnit(String name, String source) {
+ super(null, name, null);
+ this.source = source.toCharArray();
+
+ char[] fileNameCharArray = getFileName();
+ int start = CharOperation.lastIndexOf(File.separatorChar, fileNameCharArray) + 1;
+ int end = CharOperation.lastIndexOf('.', fileNameCharArray);
+ if (end == -1) {
+ end = fileNameCharArray.length;
+ }
+ mainTypeName = CharOperation.subarray(fileNameCharArray, start, end);
+ }
+
+ @Override public char[] getContents() {
+ return source;
+ }
+
+ @Override public char[] getMainTypeName() {
+ return mainTypeName;
+ }
+
+ @Override public boolean ignoreOptionalProblems() {
+ return false;
+ }
+
+ @Override public char[][] getPackageName() {
+ return null;
+ }
+
+ @Override public char[] getModuleName() {
+ return null;
+ }
+ }
}
diff --git a/test/pretty/resource/before/ThisParameter.java b/test/pretty/resource/before/ThisParameter.java
index d95c0261..e37651cb 100644
--- a/test/pretty/resource/before/ThisParameter.java
+++ b/test/pretty/resource/before/ThisParameter.java
@@ -1,3 +1,4 @@
+// version 9: the 'this' param option exists in java8, but is bugged, in that annotations are not allowed on them, even without a @Target. The only purpose of the this param is annotations, so, boy, isn't that a punch in the face?
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
diff --git a/test/transform/resource/after-delombok/DelegateWithVarargs2.java b/test/transform/resource/after-delombok/DelegateWithVarargs2.java
new file mode 100644
index 00000000..a8ff6e3b
--- /dev/null
+++ b/test/transform/resource/after-delombok/DelegateWithVarargs2.java
@@ -0,0 +1,12 @@
+class DelegateWithVarargs2 {
+ private DelegateWithVarargs2.B bar;
+ public class B {
+ public void varargs(Object[]... keys) {
+ }
+ }
+ @java.lang.SuppressWarnings("all")
+ public void varargs(final java.lang.Object[]... keys) {
+ this.bar.varargs(keys);
+ }
+}
+
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/GetterSetterJavadoc.java b/test/transform/resource/after-delombok/GetterSetterJavadoc.java
index ae662da7..78d120a4 100644
--- a/test/transform/resource/after-delombok/GetterSetterJavadoc.java
+++ b/test/transform/resource/after-delombok/GetterSetterJavadoc.java
@@ -115,7 +115,7 @@ class GetterSetterJavadoc4 {
/**
* Some text
*
- * @param fieldName Hello, World5
+ * @param fieldName Hello, World4
* @return {@code this}.
*/
@java.lang.SuppressWarnings("all")
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/BuilderJavadoc.java b/test/transform/resource/after-ecj/BuilderJavadoc.java
index 445b5417..3afd3be2 100644
--- a/test/transform/resource/after-ecj/BuilderJavadoc.java
+++ b/test/transform/resource/after-ecj/BuilderJavadoc.java
@@ -16,10 +16,21 @@ import java.util.List;
@java.lang.SuppressWarnings("all") BuilderJavadocBuilder() {
super();
}
+ /**
+ * basic gets only a builder setter.
+ * @see #getsetwith
+ * @param tag is moved to the setter.
+ * @return {@code this}.
+ */
public @java.lang.SuppressWarnings("all") BuilderJavadoc.BuilderJavadocBuilder<T> basic(final int basic) {
this.basic = basic;
return this;
}
+ /**
+ * getsetwith gets a builder setter, an instance getter and setter, and a wither.
+ * @param tag is moved to the setters and wither.
+ * @return {@code this}.
+ */
public @java.lang.SuppressWarnings("all") BuilderJavadoc.BuilderJavadocBuilder<T> getsetwith(final int getsetwith) {
this.getsetwith = getsetwith;
return this;
@@ -45,12 +56,26 @@ import java.util.List;
public static @java.lang.SuppressWarnings("all") <T>BuilderJavadoc.BuilderJavadocBuilder<T> builder() {
return new BuilderJavadoc.BuilderJavadocBuilder<T>();
}
+ /**
+ * getsetwith gets a builder setter, an instance getter and setter, and a wither.
+ *
+ * @return tag is moved to the getter.
+ */
public @java.lang.SuppressWarnings("all") int getGetsetwith() {
return this.getsetwith;
}
+ /**
+ * getsetwith gets a builder setter, an instance getter and setter, and a wither.
+ * @param tag is moved to the setters and wither.
+ */
public @java.lang.SuppressWarnings("all") void setGetsetwith(final int getsetwith) {
this.getsetwith = getsetwith;
}
+ /**
+ * getsetwith gets a builder setter, an instance getter and setter, and a wither.
+ * @param tag is moved to the setters and wither.
+ * @return a clone of this object, except with this updated property (returns {@code this} if an identical value is passed).
+ */
public @java.lang.SuppressWarnings("all") BuilderJavadoc<T> withGetsetwith(final int getsetwith) {
return ((this.getsetwith == getsetwith) ? this : new BuilderJavadoc<T>(this.basic, getsetwith, this.predef, this.predefWithJavadoc));
}
diff --git a/test/transform/resource/after-ecj/BuilderWithDeprecated.java b/test/transform/resource/after-ecj/BuilderWithDeprecated.java
index 724a25e6..65326a66 100644
--- a/test/transform/resource/after-ecj/BuilderWithDeprecated.java
+++ b/test/transform/resource/after-ecj/BuilderWithDeprecated.java
@@ -10,6 +10,10 @@ public @Builder class BuilderWithDeprecated {
@java.lang.SuppressWarnings("all") BuilderWithDeprecatedBuilder() {
super();
}
+ /**
+ * @deprecated since always
+ * @return {@code this}.
+ */
public @java.lang.Deprecated @java.lang.SuppressWarnings("all") BuilderWithDeprecated.BuilderWithDeprecatedBuilder dep1(final String dep1) {
this.dep1 = dep1;
return this;
diff --git a/test/transform/resource/after-ecj/DelegateWithVarargs2.java b/test/transform/resource/after-ecj/DelegateWithVarargs2.java
new file mode 100644
index 00000000..ed0cddf5
--- /dev/null
+++ b/test/transform/resource/after-ecj/DelegateWithVarargs2.java
@@ -0,0 +1,17 @@
+import lombok.experimental.Delegate;
+class DelegateWithVarargs2 {
+ public class B {
+ public B() {
+ super();
+ }
+ public void varargs(Object[]... keys) {
+ }
+ }
+ private @Delegate DelegateWithVarargs2.B bar;
+ DelegateWithVarargs2() {
+ super();
+ }
+ public @java.lang.SuppressWarnings("all") void varargs(final java.lang.Object[]... keys) {
+ this.bar.varargs(keys);
+ }
+}
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/GetterDeprecated.java b/test/transform/resource/after-ecj/GetterDeprecated.java
index 546f7fb7..087a60b8 100644
--- a/test/transform/resource/after-ecj/GetterDeprecated.java
+++ b/test/transform/resource/after-ecj/GetterDeprecated.java
@@ -8,6 +8,9 @@ class GetterDeprecated {
public @java.lang.Deprecated @java.lang.SuppressWarnings("all") int getAnnotation() {
return this.annotation;
}
+ /**
+ * @deprecated
+ */
public @java.lang.Deprecated @java.lang.SuppressWarnings("all") int getJavadoc() {
return this.javadoc;
}
diff --git a/test/transform/resource/after-ecj/GetterSetterJavadoc.java b/test/transform/resource/after-ecj/GetterSetterJavadoc.java
index 4923fd02..c3308c51 100644
--- a/test/transform/resource/after-ecj/GetterSetterJavadoc.java
+++ b/test/transform/resource/after-ecj/GetterSetterJavadoc.java
@@ -1,8 +1,18 @@
@lombok.Data class GetterSetterJavadoc1 {
private int fieldName;
+ /**
+ * Getter section
+ *
+ * @return Sky is blue1
+ */
public @java.lang.SuppressWarnings("all") int getFieldName() {
return this.fieldName;
}
+ /**
+ * Some text
+ *
+ * @param fieldName Hello, World1
+ */
public @java.lang.SuppressWarnings("all") void setFieldName(final int fieldName) {
this.fieldName = fieldName;
}
@@ -39,9 +49,19 @@ class GetterSetterJavadoc2 {
GetterSetterJavadoc2() {
super();
}
+ /**
+ * Some text
+ *
+ * @return Sky is blue2
+ */
public @java.lang.SuppressWarnings("all") int getFieldName() {
return this.fieldName;
}
+ /**
+ * Some text
+ *
+ * @param fieldName Hello, World2
+ */
public @java.lang.SuppressWarnings("all") void setFieldName(final int fieldName) {
this.fieldName = fieldName;
}
@@ -51,9 +71,17 @@ class GetterSetterJavadoc3 {
GetterSetterJavadoc3() {
super();
}
+ /**
+ * Getter section
+ * @return Sky is blue3
+ */
public @java.lang.SuppressWarnings("all") int getFieldName() {
return this.fieldName;
}
+ /**
+ * Setter section
+ * @param fieldName Hello, World3
+ */
public @java.lang.SuppressWarnings("all") void setFieldName(final int fieldName) {
this.fieldName = fieldName;
}
@@ -63,9 +91,20 @@ class GetterSetterJavadoc3 {
GetterSetterJavadoc4() {
super();
}
+ /**
+ * Some text
+ *
+ * @return Sky is blue4
+ */
public @java.lang.SuppressWarnings("all") int fieldName() {
return this.fieldName;
}
+ /**
+ * Some text
+ *
+ * @param fieldName Hello, World4
+ * @return {@code this}.
+ */
public @java.lang.SuppressWarnings("all") GetterSetterJavadoc4 fieldName(final int fieldName) {
this.fieldName = fieldName;
return this;
@@ -76,9 +115,18 @@ class GetterSetterJavadoc3 {
GetterSetterJavadoc5() {
super();
}
+ /**
+ * Getter section
+ * @return Sky is blue5
+ */
public @java.lang.SuppressWarnings("all") int fieldName() {
return this.fieldName;
}
+ /**
+ * Setter section
+ * @param fieldName Hello, World5
+ * @return Sky is blue5
+ */
public @java.lang.SuppressWarnings("all") GetterSetterJavadoc5 fieldName(final int fieldName) {
this.fieldName = fieldName;
return this;
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/after-ecj/SetterAndWithMethodJavadoc.java b/test/transform/resource/after-ecj/SetterAndWithMethodJavadoc.java
index dd64e358..c95b7bab 100644
--- a/test/transform/resource/after-ecj/SetterAndWithMethodJavadoc.java
+++ b/test/transform/resource/after-ecj/SetterAndWithMethodJavadoc.java
@@ -7,15 +7,33 @@ class SetterAndWithMethodJavadoc {
this.i = i;
this.j = j;
}
+ /**
+ * Some value.
+ * @param the new value
+ */
public @java.lang.SuppressWarnings("all") void setI(final int i) {
this.i = i;
}
+ /**
+ * Some value.
+ * @param the new value
+ * @return a clone of this object, except with this updated property (returns {@code this} if an identical value is passed).
+ */
public @java.lang.SuppressWarnings("all") SetterAndWithMethodJavadoc withI(final int i) {
return ((this.i == i) ? this : new SetterAndWithMethodJavadoc(i, this.j));
}
+ /**
+ * Set some other value.
+ * @param the new other value
+ */
public @java.lang.SuppressWarnings("all") void setJ(final int j) {
this.j = j;
}
+ /**
+ * Reinstantiate with some other value.
+ * @param the other new other value
+ * @return a clone of this object, except with this updated property (returns {@code this} if an identical value is passed).
+ */
public @java.lang.SuppressWarnings("all") SetterAndWithMethodJavadoc withJ(final int j) {
return ((this.j == j) ? this : new SetterAndWithMethodJavadoc(this.i, j));
}
diff --git a/test/transform/resource/after-ecj/SetterDeprecated.java b/test/transform/resource/after-ecj/SetterDeprecated.java
index d76612b7..cc089566 100644
--- a/test/transform/resource/after-ecj/SetterDeprecated.java
+++ b/test/transform/resource/after-ecj/SetterDeprecated.java
@@ -8,6 +8,9 @@ class SetterDeprecated {
public @java.lang.Deprecated @java.lang.SuppressWarnings("all") void setAnnotation(final int annotation) {
this.annotation = annotation;
}
+ /**
+ * @deprecated
+ */
public @java.lang.Deprecated @java.lang.SuppressWarnings("all") void setJavadoc(final int javadoc) {
this.javadoc = javadoc;
}
diff --git a/test/transform/resource/after-ecj/WithMethodMarkedDeprecated.java b/test/transform/resource/after-ecj/WithMethodMarkedDeprecated.java
index cd123fe8..4220308c 100644
--- a/test/transform/resource/after-ecj/WithMethodMarkedDeprecated.java
+++ b/test/transform/resource/after-ecj/WithMethodMarkedDeprecated.java
@@ -8,6 +8,10 @@ class WithMethodMarkedDeprecated {
public @java.lang.Deprecated @java.lang.SuppressWarnings("all") WithMethodMarkedDeprecated withAnnotation(final int annotation) {
return ((this.annotation == annotation) ? this : new WithMethodMarkedDeprecated(annotation, this.javadoc));
}
+ /**
+ * @deprecated
+ * @return a clone of this object, except with this updated property (returns {@code this} if an identical value is passed).
+ */
public @java.lang.Deprecated @java.lang.SuppressWarnings("all") WithMethodMarkedDeprecated withJavadoc(final int javadoc) {
return ((this.javadoc == javadoc) ? this : new WithMethodMarkedDeprecated(this.annotation, javadoc));
}
diff --git a/test/transform/resource/before/DelegateWithVarargs2.java b/test/transform/resource/before/DelegateWithVarargs2.java
new file mode 100644
index 00000000..8a3dbf14
--- /dev/null
+++ b/test/transform/resource/before/DelegateWithVarargs2.java
@@ -0,0 +1,9 @@
+import lombok.experimental.Delegate;
+
+class DelegateWithVarargs2 {
+ @Delegate private DelegateWithVarargs2.B bar;
+
+ public class B {
+ public void varargs(Object[]... keys) {}
+ }
+}
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