aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/core/src/lombok/RunTestsViaEcj.java14
-rw-r--r--test/eclipse/resource/cleanup/useThis/after/A.java18
-rw-r--r--test/eclipse/resource/cleanup/useThis/before/A.java18
-rw-r--r--test/eclipse/resource/extractinterface/simple/after/A.java15
-rw-r--r--test/eclipse/resource/extractinterface/simple/after/Interface.java21
-rw-r--r--test/eclipse/resource/extractinterface/simple/before/A.java15
-rw-r--r--test/eclipse/resource/extractinterface/usage/after/A.java15
-rw-r--r--test/eclipse/resource/extractinterface/usage/after/B.java12
-rw-r--r--test/eclipse/resource/extractinterface/usage/after/Interface.java21
-rw-r--r--test/eclipse/resource/extractinterface/usage/before/A.java15
-rw-r--r--test/eclipse/resource/extractinterface/usage/before/B.java12
-rw-r--r--test/eclipse/resource/rename/builderField/after/A.java8
-rw-r--r--test/eclipse/resource/rename/builderField/before/A.java8
-rw-r--r--test/eclipse/resource/rename/simple/after/A.java14
-rw-r--r--test/eclipse/resource/rename/simple/before/A.java14
-rw-r--r--test/eclipse/resource/rename/withGetter/after/A.java18
-rw-r--r--test/eclipse/resource/rename/withGetter/before/A.java18
-rw-r--r--test/eclipse/resource/rename/withGetterDifferentFile/after/A.java14
-rw-r--r--test/eclipse/resource/rename/withGetterDifferentFile/after/B.java7
-rw-r--r--test/eclipse/resource/rename/withGetterDifferentFile/before/A.java14
-rw-r--r--test/eclipse/resource/rename/withGetterDifferentFile/before/B.java7
-rw-r--r--test/eclipse/resource/select/builderField/A.java8
-rw-r--r--test/eclipse/resource/select/superbuilderField/A.java8
-rw-r--r--test/eclipse/src/lombok/eclipse/EclipseRunner.java154
-rw-r--r--test/eclipse/src/lombok/eclipse/EclipseTests.java16
-rw-r--r--test/eclipse/src/lombok/eclipse/RefactoringUtils.java30
-rw-r--r--test/eclipse/src/lombok/eclipse/SetupBeforeAfterTest.java52
-rw-r--r--test/eclipse/src/lombok/eclipse/SetupSingleFileTest.java28
-rw-r--r--test/eclipse/src/lombok/eclipse/SetupTest.java107
-rw-r--r--test/eclipse/src/lombok/eclipse/cleanup/CleanupTest.java45
-rw-r--r--test/eclipse/src/lombok/eclipse/edit/SelectTest.java48
-rw-r--r--test/eclipse/src/lombok/eclipse/refactoring/ExtractInterfaceTest.java47
-rw-r--r--test/eclipse/src/lombok/eclipse/refactoring/RenameTest.java71
-rw-r--r--test/pretty/resource/after/RecordPattern.java15
-rw-r--r--test/pretty/resource/after/Switch19.java32
-rw-r--r--test/pretty/resource/before/RecordPattern.java16
-rw-r--r--test/pretty/resource/before/Switch17.java2
-rw-r--r--test/pretty/resource/before/Switch19.java33
-rw-r--r--test/transform/resource/after-delombok/CheckerFrameworkBuilder.java2
-rw-r--r--test/transform/resource/after-delombok/LoggerFloggerRecord.java3
-rw-r--r--test/transform/resource/after-delombok/SuperBuilderNameClashes.java46
-rw-r--r--test/transform/resource/after-delombok/ValInvalidParameter.java1
-rw-r--r--test/transform/resource/after-ecj/LoggerFloggerRecord.java3
-rw-r--r--test/transform/resource/after-ecj/NonNullOnRecord3.java6
-rw-r--r--test/transform/resource/after-ecj/SuperBuilderNameClashes.java35
-rw-r--r--test/transform/resource/before/LoggerFloggerRecord.java2
-rw-r--r--test/transform/resource/before/SuperBuilderNameClashes.java12
-rw-r--r--test/transform/resource/before/ValInvalidParameter.java2
48 files changed, 1111 insertions, 11 deletions
diff --git a/test/core/src/lombok/RunTestsViaEcj.java b/test/core/src/lombok/RunTestsViaEcj.java
index 60a6e92a..699b33ed 100644
--- a/test/core/src/lombok/RunTestsViaEcj.java
+++ b/test/core/src/lombok/RunTestsViaEcj.java
@@ -289,6 +289,10 @@ public class RunTestsViaEcj extends AbstractRunTests {
@Override public char[][] getPackageName() {
return null;
}
+
+ @Override public boolean ignoreOptionalProblems() {
+ return false;
+ }
}
private static final class TestCompilationUnitEclipse extends org.eclipse.jdt.internal.core.CompilationUnit {
@@ -308,6 +312,14 @@ public class RunTestsViaEcj extends AbstractRunTests {
mainTypeName = CharOperation.subarray(fileNameCharArray, start, end);
}
+ @Override public int hashCode() {
+ return System.identityHashCode(this);
+ }
+
+ @Override public boolean equals(Object obj) {
+ return this == obj;
+ }
+
@Override public char[] getContents() {
return source;
}
@@ -324,7 +336,7 @@ public class RunTestsViaEcj extends AbstractRunTests {
return null;
}
- @Override public char[] getModuleName() {
+ public char[] getModuleName() {
return null;
}
}
diff --git a/test/eclipse/resource/cleanup/useThis/after/A.java b/test/eclipse/resource/cleanup/useThis/after/A.java
new file mode 100644
index 00000000..58913c6c
--- /dev/null
+++ b/test/eclipse/resource/cleanup/useThis/after/A.java
@@ -0,0 +1,18 @@
+package pkg;
+
+import lombok.Builder;
+import lombok.Data;
+import lombok.With;
+import lombok.experimental.WithBy;
+
+@Data
+@Builder
+@With
+@WithBy
+public class A {
+ private String string;
+
+ public void a() {
+ this.string = "a";
+ }
+} \ No newline at end of file
diff --git a/test/eclipse/resource/cleanup/useThis/before/A.java b/test/eclipse/resource/cleanup/useThis/before/A.java
new file mode 100644
index 00000000..2eb74ebe
--- /dev/null
+++ b/test/eclipse/resource/cleanup/useThis/before/A.java
@@ -0,0 +1,18 @@
+package pkg;
+
+import lombok.Builder;
+import lombok.Data;
+import lombok.With;
+import lombok.experimental.WithBy;
+
+@Data
+@Builder
+@With
+@WithBy
+public class A {
+ private String string;
+
+ public void a() {
+ string = "a";
+ }
+} \ No newline at end of file
diff --git a/test/eclipse/resource/extractinterface/simple/after/A.java b/test/eclipse/resource/extractinterface/simple/after/A.java
new file mode 100644
index 00000000..66744a22
--- /dev/null
+++ b/test/eclipse/resource/extractinterface/simple/after/A.java
@@ -0,0 +1,15 @@
+package pkg;
+
+import lombok.EqualsAndHashCode;
+import lombok.Getter;
+import lombok.Setter;
+import lombok.ToString;
+
+@EqualsAndHashCode
+@Getter
+@Setter
+@ToString
+public class A implements Interface {
+ private String string;
+ private int integer;
+} \ No newline at end of file
diff --git a/test/eclipse/resource/extractinterface/simple/after/Interface.java b/test/eclipse/resource/extractinterface/simple/after/Interface.java
new file mode 100644
index 00000000..f7fa896d
--- /dev/null
+++ b/test/eclipse/resource/extractinterface/simple/after/Interface.java
@@ -0,0 +1,21 @@
+package pkg;
+
+public interface Interface {
+
+ boolean equals(java.lang.Object o);
+
+ boolean canEqual(java.lang.Object other);
+
+ int hashCode();
+
+ String getString();
+
+ int getInteger();
+
+ void setString(String string);
+
+ void setInteger(int integer);
+
+ java.lang.String toString();
+
+} \ No newline at end of file
diff --git a/test/eclipse/resource/extractinterface/simple/before/A.java b/test/eclipse/resource/extractinterface/simple/before/A.java
new file mode 100644
index 00000000..87a6a8e4
--- /dev/null
+++ b/test/eclipse/resource/extractinterface/simple/before/A.java
@@ -0,0 +1,15 @@
+package pkg;
+
+import lombok.EqualsAndHashCode;
+import lombok.Getter;
+import lombok.Setter;
+import lombok.ToString;
+
+@EqualsAndHashCode
+@Getter
+@Setter
+@ToString
+public class A {
+ private String string;
+ private int integer;
+} \ No newline at end of file
diff --git a/test/eclipse/resource/extractinterface/usage/after/A.java b/test/eclipse/resource/extractinterface/usage/after/A.java
new file mode 100644
index 00000000..66744a22
--- /dev/null
+++ b/test/eclipse/resource/extractinterface/usage/after/A.java
@@ -0,0 +1,15 @@
+package pkg;
+
+import lombok.EqualsAndHashCode;
+import lombok.Getter;
+import lombok.Setter;
+import lombok.ToString;
+
+@EqualsAndHashCode
+@Getter
+@Setter
+@ToString
+public class A implements Interface {
+ private String string;
+ private int integer;
+} \ No newline at end of file
diff --git a/test/eclipse/resource/extractinterface/usage/after/B.java b/test/eclipse/resource/extractinterface/usage/after/B.java
new file mode 100644
index 00000000..fccd6237
--- /dev/null
+++ b/test/eclipse/resource/extractinterface/usage/after/B.java
@@ -0,0 +1,12 @@
+package pkg;
+
+import lombok.Getter;
+import lombok.Setter;
+
+@Getter
+@Setter
+public class B {
+ private Interface a = new A();
+ private String string = a.getString();
+ private int integer = a.getInteger();
+} \ No newline at end of file
diff --git a/test/eclipse/resource/extractinterface/usage/after/Interface.java b/test/eclipse/resource/extractinterface/usage/after/Interface.java
new file mode 100644
index 00000000..f7fa896d
--- /dev/null
+++ b/test/eclipse/resource/extractinterface/usage/after/Interface.java
@@ -0,0 +1,21 @@
+package pkg;
+
+public interface Interface {
+
+ boolean equals(java.lang.Object o);
+
+ boolean canEqual(java.lang.Object other);
+
+ int hashCode();
+
+ String getString();
+
+ int getInteger();
+
+ void setString(String string);
+
+ void setInteger(int integer);
+
+ java.lang.String toString();
+
+} \ No newline at end of file
diff --git a/test/eclipse/resource/extractinterface/usage/before/A.java b/test/eclipse/resource/extractinterface/usage/before/A.java
new file mode 100644
index 00000000..87a6a8e4
--- /dev/null
+++ b/test/eclipse/resource/extractinterface/usage/before/A.java
@@ -0,0 +1,15 @@
+package pkg;
+
+import lombok.EqualsAndHashCode;
+import lombok.Getter;
+import lombok.Setter;
+import lombok.ToString;
+
+@EqualsAndHashCode
+@Getter
+@Setter
+@ToString
+public class A {
+ private String string;
+ private int integer;
+} \ No newline at end of file
diff --git a/test/eclipse/resource/extractinterface/usage/before/B.java b/test/eclipse/resource/extractinterface/usage/before/B.java
new file mode 100644
index 00000000..0034a8a6
--- /dev/null
+++ b/test/eclipse/resource/extractinterface/usage/before/B.java
@@ -0,0 +1,12 @@
+package pkg;
+
+import lombok.Getter;
+import lombok.Setter;
+
+@Getter
+@Setter
+public class B {
+ private A a = new A();
+ private String string = a.getString();
+ private int integer = a.getInteger();
+} \ No newline at end of file
diff --git a/test/eclipse/resource/rename/builderField/after/A.java b/test/eclipse/resource/rename/builderField/after/A.java
new file mode 100644
index 00000000..4d2ac69a
--- /dev/null
+++ b/test/eclipse/resource/rename/builderField/after/A.java
@@ -0,0 +1,8 @@
+package pkg;
+
+import lombok.Builder;
+
+@Builder
+public class A {
+ private String newString;
+} \ No newline at end of file
diff --git a/test/eclipse/resource/rename/builderField/before/A.java b/test/eclipse/resource/rename/builderField/before/A.java
new file mode 100644
index 00000000..3f4ec235
--- /dev/null
+++ b/test/eclipse/resource/rename/builderField/before/A.java
@@ -0,0 +1,8 @@
+package pkg;
+
+import lombok.Builder;
+
+@Builder
+public class A {
+ private String string;
+} \ No newline at end of file
diff --git a/test/eclipse/resource/rename/simple/after/A.java b/test/eclipse/resource/rename/simple/after/A.java
new file mode 100644
index 00000000..5a564be2
--- /dev/null
+++ b/test/eclipse/resource/rename/simple/after/A.java
@@ -0,0 +1,14 @@
+package pkg;
+
+import lombok.EqualsAndHashCode;
+import lombok.Getter;
+import lombok.Setter;
+import lombok.ToString;
+
+@EqualsAndHashCode
+@Getter
+@Setter
+@ToString
+public class A {
+ private String newString;
+} \ No newline at end of file
diff --git a/test/eclipse/resource/rename/simple/before/A.java b/test/eclipse/resource/rename/simple/before/A.java
new file mode 100644
index 00000000..b0d4c41e
--- /dev/null
+++ b/test/eclipse/resource/rename/simple/before/A.java
@@ -0,0 +1,14 @@
+package pkg;
+
+import lombok.EqualsAndHashCode;
+import lombok.Getter;
+import lombok.Setter;
+import lombok.ToString;
+
+@EqualsAndHashCode
+@Getter
+@Setter
+@ToString
+public class A {
+ private String string;
+} \ No newline at end of file
diff --git a/test/eclipse/resource/rename/withGetter/after/A.java b/test/eclipse/resource/rename/withGetter/after/A.java
new file mode 100644
index 00000000..81237a7e
--- /dev/null
+++ b/test/eclipse/resource/rename/withGetter/after/A.java
@@ -0,0 +1,18 @@
+package pkg;
+
+import lombok.EqualsAndHashCode;
+import lombok.Getter;
+import lombok.Setter;
+import lombok.ToString;
+
+@EqualsAndHashCode
+@Getter
+@Setter
+@ToString
+public class A {
+ private String newString;
+
+ public String test() {
+ return getNewString();
+ }
+} \ No newline at end of file
diff --git a/test/eclipse/resource/rename/withGetter/before/A.java b/test/eclipse/resource/rename/withGetter/before/A.java
new file mode 100644
index 00000000..c9d9e4e5
--- /dev/null
+++ b/test/eclipse/resource/rename/withGetter/before/A.java
@@ -0,0 +1,18 @@
+package pkg;
+
+import lombok.EqualsAndHashCode;
+import lombok.Getter;
+import lombok.Setter;
+import lombok.ToString;
+
+@EqualsAndHashCode
+@Getter
+@Setter
+@ToString
+public class A {
+ private String string;
+
+ public String test() {
+ return getString();
+ }
+} \ No newline at end of file
diff --git a/test/eclipse/resource/rename/withGetterDifferentFile/after/A.java b/test/eclipse/resource/rename/withGetterDifferentFile/after/A.java
new file mode 100644
index 00000000..5a564be2
--- /dev/null
+++ b/test/eclipse/resource/rename/withGetterDifferentFile/after/A.java
@@ -0,0 +1,14 @@
+package pkg;
+
+import lombok.EqualsAndHashCode;
+import lombok.Getter;
+import lombok.Setter;
+import lombok.ToString;
+
+@EqualsAndHashCode
+@Getter
+@Setter
+@ToString
+public class A {
+ private String newString;
+} \ No newline at end of file
diff --git a/test/eclipse/resource/rename/withGetterDifferentFile/after/B.java b/test/eclipse/resource/rename/withGetterDifferentFile/after/B.java
new file mode 100644
index 00000000..f7cd35c4
--- /dev/null
+++ b/test/eclipse/resource/rename/withGetterDifferentFile/after/B.java
@@ -0,0 +1,7 @@
+package pkg;
+
+public class B {
+ public String test() {
+ return new A().getNewString();
+ }
+} \ No newline at end of file
diff --git a/test/eclipse/resource/rename/withGetterDifferentFile/before/A.java b/test/eclipse/resource/rename/withGetterDifferentFile/before/A.java
new file mode 100644
index 00000000..b0d4c41e
--- /dev/null
+++ b/test/eclipse/resource/rename/withGetterDifferentFile/before/A.java
@@ -0,0 +1,14 @@
+package pkg;
+
+import lombok.EqualsAndHashCode;
+import lombok.Getter;
+import lombok.Setter;
+import lombok.ToString;
+
+@EqualsAndHashCode
+@Getter
+@Setter
+@ToString
+public class A {
+ private String string;
+} \ No newline at end of file
diff --git a/test/eclipse/resource/rename/withGetterDifferentFile/before/B.java b/test/eclipse/resource/rename/withGetterDifferentFile/before/B.java
new file mode 100644
index 00000000..24a74d6f
--- /dev/null
+++ b/test/eclipse/resource/rename/withGetterDifferentFile/before/B.java
@@ -0,0 +1,7 @@
+package pkg;
+
+public class B {
+ public String test() {
+ return new A().getString();
+ }
+} \ No newline at end of file
diff --git a/test/eclipse/resource/select/builderField/A.java b/test/eclipse/resource/select/builderField/A.java
new file mode 100644
index 00000000..18b4b150
--- /dev/null
+++ b/test/eclipse/resource/select/builderField/A.java
@@ -0,0 +1,8 @@
+package pkg;
+
+import lombok.Builder;
+
+@Builder
+public class A {
+ private String id;
+} \ No newline at end of file
diff --git a/test/eclipse/resource/select/superbuilderField/A.java b/test/eclipse/resource/select/superbuilderField/A.java
new file mode 100644
index 00000000..d9df476c
--- /dev/null
+++ b/test/eclipse/resource/select/superbuilderField/A.java
@@ -0,0 +1,8 @@
+package pkg;
+
+import lombok.experimental.SuperBuilder;
+
+@SuperBuilder
+public class A {
+ private String id;
+} \ No newline at end of file
diff --git a/test/eclipse/src/lombok/eclipse/EclipseRunner.java b/test/eclipse/src/lombok/eclipse/EclipseRunner.java
new file mode 100644
index 00000000..1e1c17fe
--- /dev/null
+++ b/test/eclipse/src/lombok/eclipse/EclipseRunner.java
@@ -0,0 +1,154 @@
+package lombok.eclipse;
+
+import java.io.File;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.eclipse.core.runtime.adaptor.EclipseStarter;
+import org.eclipse.osgi.container.Module;
+import org.eclipse.osgi.container.Module.StartOptions;
+import org.eclipse.osgi.container.Module.State;
+import org.eclipse.osgi.internal.location.EquinoxLocations;
+import org.junit.runner.Description;
+import org.junit.runner.Runner;
+import org.junit.runner.notification.RunNotifier;
+import org.junit.runners.BlockJUnit4ClassRunner;
+import org.junit.runners.model.InitializationError;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.BundleException;
+import org.osgi.framework.wiring.BundleRevision;
+import org.osgi.framework.wiring.BundleWire;
+import org.osgi.framework.wiring.BundleWiring;
+
+/**
+ * We have to load the osgi/eclipse classes before we run the test case. This is only possible using a custom runner.
+ *
+ */
+public class EclipseRunner extends Runner {
+ private Runner runner;
+ private boolean debug = false;
+ private static boolean setupDone;
+
+ public EclipseRunner(Class<?> klass) throws InitializationError {
+ try {
+ if (!setupDone) {
+ debug = System.getProperty("lombok.debug") != null;
+ startEclipse(System.getProperty("lombok.testenv"));
+ setupDone = true;
+ }
+ } catch (Throwable e) {
+ throw new InitializationError(e);
+ }
+
+ runner = new BlockJUnit4ClassRunner(klass);
+
+ }
+
+ @Override
+ public Description getDescription() {
+ return runner.getDescription();
+ }
+
+ @Override
+ public void run(RunNotifier notifier) {
+ runner.run(notifier);
+ }
+
+ private void startEclipse(String path) throws Exception {
+ Map<String, String> initialProperties = new HashMap<String, String>();
+
+ File rootDir = new File(path);
+ File pluginDir = new File(rootDir, "plugins/");
+
+ StringBuilder bundleString = new StringBuilder();
+ String osgiPlugin = null;
+ File[] bundles = pluginDir.listFiles();
+ Arrays.sort(bundles);
+ for (File plugin : bundles) {
+ String fileName = plugin.getName();
+ String bundleName = fileName.substring(0, fileName.indexOf("_"));
+
+ if (bundleName.equals("org.eclipse.osgi")) {
+ osgiPlugin = plugin.toURI().toString();
+ }
+
+ if (bundleString.length() > 0) {
+ bundleString.append(",");
+ }
+ bundleString.append(bundleName);
+ }
+
+ initialProperties.put(EclipseStarter.PROP_BUNDLES, bundleString.toString());
+ initialProperties.put(EclipseStarter.PROP_INSTALL_AREA, "file:" + path);
+ initialProperties.put(EquinoxLocations.PROP_INSTANCE_AREA, "file:" + path);
+ initialProperties.put(EclipseStarter.PROP_FRAMEWORK, osgiPlugin);
+ initialProperties.put("osgi.framework.useSystemProperties", "false");
+ initialProperties.put(EclipseStarter.PROP_NOSHUTDOWN, "false");
+
+ initialProperties.put("osgi.parentClassloader", "fwk");
+ initialProperties.put("osgi.frameworkParentClassloader", "fwk");
+ initialProperties.put("osgi.contextClassLoaderParent", "ext");
+ initialProperties.put("osgi.context.bootdelegation", "*");
+ initialProperties.put("org.osgi.framework.bootdelegation", "*");
+
+ EclipseStarter.setInitialProperties(initialProperties);
+ String[] args = new String[] {"-clean"};
+ if (debug) args = new String[] {"-clean", "-console", "-consoleLog", "-debug"};
+ BundleContext context = EclipseStarter.startup(args, null);
+
+ Map<String, Module> moduleMap = new HashMap<String, Module>();
+ for (Bundle b : context.getBundles()) {
+ Module module = b.adapt(Module.class);
+ moduleMap.put(b.getSymbolicName(), module);
+ }
+
+ Set<String> startedBundles = new HashSet<String>();
+ // Mark the debug bundle as started, it will fail anyway...
+ startedBundles.add("org.eclipse.debug.ui");
+
+ startBundle(moduleMap, startedBundles, "org.apache.felix.scr");
+ startBundle(moduleMap, startedBundles, "org.eclipse.jdt.core.manipulation");
+ startBundle(moduleMap, startedBundles, "org.eclipse.jdt.ui");
+
+ if (debug) {
+ for (Bundle b : context.getBundles()) {
+ System.out.println("BUNDLE: " + b.getSymbolicName() + " " + b.getVersion() + " " + b.getLocation() + " " + b.getState());
+ }
+ }
+ }
+
+ private void startBundle(Map<String, Module> moduleMap, Set<String> started, String bundle) throws BundleException {
+ if (started.contains(bundle)) return;
+
+ Module module = moduleMap.get(bundle);
+ started.add(bundle);
+
+ BundleWiring wiring = module.getBundle().adapt(BundleWiring.class);
+ List<BundleWire> requiredWires = wiring.getRequiredWires(BundleRevision.PACKAGE_NAMESPACE);
+ requiredWires.addAll(wiring.getRequiredWires(BundleRevision.BUNDLE_NAMESPACE));
+
+ for (BundleWire bundleWire : requiredWires) {
+ startBundle(moduleMap, started, bundleWire.getProvider().getSymbolicName());
+ }
+
+ startModule(module);
+ }
+
+ private void startModule(Module module) throws BundleException {
+ if (module.getState() == State.LAZY_STARTING || module.getState() == State.RESOLVED) {
+ if (debug) System.out.print("Starting bundle " + module.getBundle().getSymbolicName() + "...");
+ try {
+ module.start(StartOptions.LAZY_TRIGGER);
+ if (debug) System.out.println(" [done]");
+ } catch (Exception e) {
+ if (debug) System.out.println(" [error]");
+ e.printStackTrace();
+ }
+ }
+ }
+}
diff --git a/test/eclipse/src/lombok/eclipse/EclipseTests.java b/test/eclipse/src/lombok/eclipse/EclipseTests.java
new file mode 100644
index 00000000..ba017fd2
--- /dev/null
+++ b/test/eclipse/src/lombok/eclipse/EclipseTests.java
@@ -0,0 +1,16 @@
+package lombok.eclipse;
+
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+import org.junit.runners.Suite.SuiteClasses;
+
+import lombok.eclipse.cleanup.CleanupTest;
+import lombok.eclipse.edit.SelectTest;
+import lombok.eclipse.refactoring.ExtractInterfaceTest;
+import lombok.eclipse.refactoring.RenameTest;
+
+@RunWith(Suite.class)
+@SuiteClasses({ExtractInterfaceTest.class, RenameTest.class, SelectTest.class, CleanupTest.class})
+public class EclipseTests {
+
+}
diff --git a/test/eclipse/src/lombok/eclipse/RefactoringUtils.java b/test/eclipse/src/lombok/eclipse/RefactoringUtils.java
new file mode 100644
index 00000000..38349d2d
--- /dev/null
+++ b/test/eclipse/src/lombok/eclipse/RefactoringUtils.java
@@ -0,0 +1,30 @@
+package lombok.eclipse;
+
+import static org.junit.Assert.assertTrue;
+
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.ltk.core.refactoring.CheckConditionsOperation;
+import org.eclipse.ltk.core.refactoring.CreateChangeOperation;
+import org.eclipse.ltk.core.refactoring.PerformChangeOperation;
+import org.eclipse.ltk.core.refactoring.Refactoring;
+import org.eclipse.ltk.core.refactoring.RefactoringStatus;
+import org.eclipse.ltk.core.refactoring.participants.ProcessorBasedRefactoring;
+import org.eclipse.ltk.core.refactoring.participants.RefactoringProcessor;
+
+public class RefactoringUtils {
+ public static void performRefactoring(RefactoringProcessor proccessor) throws CoreException {
+ performRefactoring(new ProcessorBasedRefactoring(proccessor));
+ }
+
+ public static void performRefactoring(Refactoring refactoring) throws CoreException {
+ CheckConditionsOperation checkConditionsOperation = new CheckConditionsOperation(refactoring, CheckConditionsOperation.ALL_CONDITIONS);
+ CreateChangeOperation change = new CreateChangeOperation(checkConditionsOperation, RefactoringStatus.FATAL);
+ final PerformChangeOperation perform = new PerformChangeOperation(change);
+
+ ResourcesPlugin.getWorkspace().run(perform, null);
+
+ assertTrue("Condition failed", change.getConditionCheckingStatus().isOK());
+ assertTrue("Perform failed", perform.changeExecuted());
+ }
+}
diff --git a/test/eclipse/src/lombok/eclipse/SetupBeforeAfterTest.java b/test/eclipse/src/lombok/eclipse/SetupBeforeAfterTest.java
new file mode 100644
index 00000000..96e21d4b
--- /dev/null
+++ b/test/eclipse/src/lombok/eclipse/SetupBeforeAfterTest.java
@@ -0,0 +1,52 @@
+package lombok.eclipse;
+
+import static org.junit.Assert.assertEquals;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+
+import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jdt.core.JavaModelException;
+import org.junit.runner.Description;
+
+public class SetupBeforeAfterTest extends SetupTest {
+
+ private File before;
+ private File after;
+
+ @Override
+ protected void starting(Description description) {
+ super.starting(description);
+
+ before = new File(root, "/before/");
+ after = new File(root, "/after/");
+
+ try {
+ copyBeforeFiles();
+ } catch (Throwable e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ @Override
+ protected void succeeded(Description description) {
+ try {
+ compareWithAfter();
+ } catch (Throwable e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ private void compareWithAfter() throws FileNotFoundException, JavaModelException {
+ for (ICompilationUnit result : packageFragment.getCompilationUnits()) {
+ assertEquals(getContent(new File(after, result.getElementName())), result.getSource());
+ }
+ }
+
+ void copyBeforeFiles() throws JavaModelException, FileNotFoundException {
+ for (File file : before.listFiles()) {
+ createCompilationUnit(file, packageFragment);
+ }
+
+ }
+}
diff --git a/test/eclipse/src/lombok/eclipse/SetupSingleFileTest.java b/test/eclipse/src/lombok/eclipse/SetupSingleFileTest.java
new file mode 100644
index 00000000..47010f0c
--- /dev/null
+++ b/test/eclipse/src/lombok/eclipse/SetupSingleFileTest.java
@@ -0,0 +1,28 @@
+package lombok.eclipse;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+
+import org.eclipse.jdt.core.JavaModelException;
+import org.junit.runner.Description;
+
+public class SetupSingleFileTest extends SetupTest {
+
+ @Override
+ protected void starting(Description description) {
+ super.starting(description);
+
+ try {
+ copyRootFiles();
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ private void copyRootFiles() throws JavaModelException, FileNotFoundException {
+ for (File file : root.listFiles()) {
+ createCompilationUnit(file, packageFragment);
+ }
+
+ }
+}
diff --git a/test/eclipse/src/lombok/eclipse/SetupTest.java b/test/eclipse/src/lombok/eclipse/SetupTest.java
new file mode 100644
index 00000000..fe8d469c
--- /dev/null
+++ b/test/eclipse/src/lombok/eclipse/SetupTest.java
@@ -0,0 +1,107 @@
+package lombok.eclipse;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.util.Scanner;
+
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IProjectDescription;
+import org.eclipse.core.resources.IWorkspace;
+import org.eclipse.core.resources.IWorkspaceRoot;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jdt.core.IClasspathEntry;
+import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.IPackageFragment;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.core.JavaModelException;
+import org.junit.rules.TestWatcher;
+import org.junit.runner.Description;
+
+public abstract class SetupTest extends TestWatcher {
+
+ private IJavaProject javaProject;
+ protected IPackageFragment packageFragment;
+ private IWorkspace workspace;
+ protected File root;
+
+ public IJavaProject getJavaProject() {
+ return javaProject;
+ }
+
+ public IPackageFragment getPackageFragment() {
+ return packageFragment;
+ }
+
+ public IWorkspace getWorkspace() {
+ return workspace;
+ }
+
+ @Override
+ protected void starting(Description description) {
+ String category = description.getTestClass().getSimpleName().toLowerCase().replaceAll("test$", "");
+ String testname = description.getMethodName();
+
+ root = new File("test/eclipse/resource/" + category + "/" + testname);
+
+ try {
+ createProject(category, description.getMethodName());
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ private void createProject(String category, String test) throws CoreException {
+ workspace = ResourcesPlugin.getWorkspace();
+
+ IWorkspaceRoot root = getWorkspace().getRoot();
+ IProject project = root.getProject(category + "_" + test);
+
+ if (project.exists()) {
+ project.delete(true, true, null);
+ }
+ project.create(null);
+ project.open(null);
+
+ IFolder targetFolder = createFolder(project, "target");
+ IFolder srcFolder = createFolder(project, "src");
+
+ IProjectDescription description = project.getDescription();
+ description.setNatureIds(new String[] {JavaCore.NATURE_ID});
+ project.setDescription(description, null);
+
+ javaProject = JavaCore.create(project);
+ javaProject.setOutputLocation(targetFolder.getFullPath(), null);
+ JavaCore.setComplianceOptions(JavaCore.VERSION_1_8, javaProject.getOptions(false));
+
+ IClasspathEntry classpathEntry = JavaCore.newSourceEntry(srcFolder.getFullPath());
+ IClasspathEntry newLibraryEntry = JavaCore.newLibraryEntry(new Path(new File("dist/lombok.jar").getAbsolutePath()), null, null);
+ IClasspathEntry javaRtEntry = JavaCore.newLibraryEntry(new Path(new File("lib/rtstubs18.jar").getAbsolutePath()), null, null);
+ javaProject.setRawClasspath(new IClasspathEntry[] {classpathEntry, newLibraryEntry, javaRtEntry}, null);
+
+ packageFragment = javaProject.getPackageFragmentRoot(srcFolder).createPackageFragment("pkg", false, null);
+ }
+
+ protected IFolder createFolder(IProject project, String name) throws CoreException {
+ IFolder folder = project.getFolder(name);
+ if (folder.exists()) {
+ folder.delete(true, null);
+ }
+ folder.create(false, true, null);
+ return folder;
+ }
+
+ protected ICompilationUnit createCompilationUnit(File file, IPackageFragment pkg) throws JavaModelException, FileNotFoundException {
+ return pkg.createCompilationUnit(file.getName(), getContent(file), true, null);
+ }
+
+ protected String getContent(File f) throws FileNotFoundException {
+ Scanner scanner = new Scanner(f);
+ String text = scanner.useDelimiter("\\A").next();
+ scanner.close();
+ return text;
+ }
+} \ No newline at end of file
diff --git a/test/eclipse/src/lombok/eclipse/cleanup/CleanupTest.java b/test/eclipse/src/lombok/eclipse/cleanup/CleanupTest.java
new file mode 100644
index 00000000..2d018228
--- /dev/null
+++ b/test/eclipse/src/lombok/eclipse/cleanup/CleanupTest.java
@@ -0,0 +1,45 @@
+package lombok.eclipse.cleanup;
+
+import static lombok.eclipse.RefactoringUtils.performRefactoring;
+
+import java.util.Map.Entry;
+
+import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jdt.internal.corext.fix.CleanUpConstants;
+import org.eclipse.jdt.internal.corext.fix.CleanUpRefactoring;
+import org.eclipse.jdt.internal.corext.fix.CleanUpRegistry;
+import org.eclipse.jdt.internal.ui.JavaPlugin;
+import org.eclipse.jdt.internal.ui.fix.CodeStyleCleanUp;
+import org.eclipse.jdt.internal.ui.fix.MapCleanUpOptions;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import lombok.eclipse.EclipseRunner;
+import lombok.eclipse.SetupBeforeAfterTest;
+
+@RunWith(EclipseRunner.class)
+public class CleanupTest {
+
+ @Rule
+ public SetupBeforeAfterTest setup = new SetupBeforeAfterTest();
+
+ @Test
+ public void useThis() throws Exception {
+ ICompilationUnit cu = setup.getPackageFragment().getCompilationUnit("A.java");
+
+ CleanUpRegistry cleanUpRegistry = JavaPlugin.getDefault().getCleanUpRegistry();
+ MapCleanUpOptions options = cleanUpRegistry.getDefaultOptions(CleanUpConstants.DEFAULT_CLEAN_UP_OPTIONS);
+ for (Entry<String, String> entry : options.getMap().entrySet()) {
+ entry.setValue(MapCleanUpOptions.FALSE);
+ }
+ options.setOption(CleanUpConstants.MEMBER_ACCESSES_NON_STATIC_FIELD_USE_THIS, MapCleanUpOptions.TRUE);
+ options.setOption(CleanUpConstants.MEMBER_ACCESSES_NON_STATIC_FIELD_USE_THIS_ALWAYS, MapCleanUpOptions.TRUE);
+
+ CleanUpRefactoring ref = new CleanUpRefactoring();
+ ref.addCompilationUnit(cu);
+ ref.addCleanUp(new CodeStyleCleanUp(options.getMap()));
+
+ performRefactoring(ref);
+ }
+}
diff --git a/test/eclipse/src/lombok/eclipse/edit/SelectTest.java b/test/eclipse/src/lombok/eclipse/edit/SelectTest.java
new file mode 100644
index 00000000..9f348a0c
--- /dev/null
+++ b/test/eclipse/src/lombok/eclipse/edit/SelectTest.java
@@ -0,0 +1,48 @@
+package lombok.eclipse.edit;
+
+import static org.junit.Assert.assertEquals;
+
+import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jdt.core.IField;
+import org.eclipse.jdt.core.IJavaElement;
+import org.eclipse.jdt.core.ISourceRange;
+import org.eclipse.jdt.core.IType;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import lombok.eclipse.EclipseRunner;
+import lombok.eclipse.SetupSingleFileTest;
+
+@RunWith(EclipseRunner.class)
+public class SelectTest {
+
+ @Rule
+ public SetupSingleFileTest setup = new SetupSingleFileTest();
+
+ @Test
+ public void builderField() throws Exception {
+ ICompilationUnit cu = setup.getPackageFragment().getCompilationUnit("A.java");
+ IType type = cu.findPrimaryType();
+ IField field = type.getField("id");
+
+ ISourceRange sourceRange = field.getNameRange();
+ IJavaElement[] codeSelect = cu.codeSelect(sourceRange.getOffset(), sourceRange.getLength());
+
+ assertEquals(1, codeSelect.length);
+ assertEquals(field, codeSelect[0]);
+ }
+
+ @Test
+ public void superbuilderField() throws Exception {
+ ICompilationUnit cu = setup.getPackageFragment().getCompilationUnit("A.java");
+ IType type = cu.findPrimaryType();
+ IField field = type.getField("id");
+
+ ISourceRange sourceRange = field.getNameRange();
+ IJavaElement[] codeSelect = cu.codeSelect(sourceRange.getOffset(), sourceRange.getLength());
+
+ assertEquals(1, codeSelect.length);
+ assertEquals(field, codeSelect[0]);
+ }
+}
diff --git a/test/eclipse/src/lombok/eclipse/refactoring/ExtractInterfaceTest.java b/test/eclipse/src/lombok/eclipse/refactoring/ExtractInterfaceTest.java
new file mode 100644
index 00000000..d4c892f3
--- /dev/null
+++ b/test/eclipse/src/lombok/eclipse/refactoring/ExtractInterfaceTest.java
@@ -0,0 +1,47 @@
+package lombok.eclipse.refactoring;
+
+import static lombok.eclipse.RefactoringUtils.performRefactoring;
+
+import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.internal.corext.refactoring.structure.ExtractInterfaceProcessor;
+import org.eclipse.jdt.internal.ui.preferences.JavaPreferencesSettings;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import lombok.eclipse.EclipseRunner;
+import lombok.eclipse.SetupBeforeAfterTest;
+
+@RunWith(EclipseRunner.class)
+public class ExtractInterfaceTest {
+
+ @Rule
+ public SetupBeforeAfterTest setup = new SetupBeforeAfterTest();
+
+ @Test
+ public void simple() throws Exception {
+ ICompilationUnit cu = setup.getPackageFragment().getCompilationUnit("A.java");
+ IType type = cu.findPrimaryType();
+
+ ExtractInterfaceProcessor extractInterfaceProcessor = new ExtractInterfaceProcessor(type, JavaPreferencesSettings.getCodeGenerationSettings(setup.getJavaProject()));
+ extractInterfaceProcessor.setExtractedMembers(type.getMethods());
+ extractInterfaceProcessor.setTypeName("Interface");
+
+ performRefactoring(extractInterfaceProcessor);
+ }
+
+ @Test
+ public void usage() throws Exception {
+ ICompilationUnit cu = setup.getPackageFragment().getCompilationUnit("A.java");
+ IType type = cu.findPrimaryType();
+
+ ExtractInterfaceProcessor extractInterfaceProcessor = new ExtractInterfaceProcessor(type, JavaPreferencesSettings.getCodeGenerationSettings(setup.getJavaProject()));
+ extractInterfaceProcessor.setExtractedMembers(type.getMethods());
+ extractInterfaceProcessor.setTypeName("Interface");
+ extractInterfaceProcessor.setReplace(true);
+
+ performRefactoring(extractInterfaceProcessor);
+ }
+
+}
diff --git a/test/eclipse/src/lombok/eclipse/refactoring/RenameTest.java b/test/eclipse/src/lombok/eclipse/refactoring/RenameTest.java
new file mode 100644
index 00000000..c1a86736
--- /dev/null
+++ b/test/eclipse/src/lombok/eclipse/refactoring/RenameTest.java
@@ -0,0 +1,71 @@
+package lombok.eclipse.refactoring;
+
+import static lombok.eclipse.RefactoringUtils.performRefactoring;
+
+import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jdt.core.IField;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.internal.corext.refactoring.rename.RenameFieldProcessor;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import lombok.eclipse.EclipseRunner;
+import lombok.eclipse.SetupBeforeAfterTest;
+
+@RunWith(EclipseRunner.class)
+public class RenameTest {
+
+ @Rule
+ public SetupBeforeAfterTest setup = new SetupBeforeAfterTest();
+
+ @Test
+ public void simple() throws Exception {
+ ICompilationUnit cu = setup.getPackageFragment().getCompilationUnit("A.java");
+ IType type = cu.findPrimaryType();
+ IField field = type.getField("string");
+
+ RenameFieldProcessor renameFieldProcessor = new RenameFieldProcessor(field);
+ renameFieldProcessor.setNewElementName("newString");
+
+ performRefactoring(renameFieldProcessor);
+ }
+
+ @Test
+ public void withGetter() throws Exception {
+ ICompilationUnit cu = setup.getPackageFragment().getCompilationUnit("A.java");
+ IType type = cu.findPrimaryType();
+ IField field = type.getField("string");
+
+ RenameFieldProcessor renameFieldProcessor = new RenameFieldProcessor(field);
+ renameFieldProcessor.setNewElementName("newString");
+ renameFieldProcessor.setRenameGetter(true);
+
+ performRefactoring(renameFieldProcessor);
+ }
+
+ @Test
+ public void withGetterDifferentFile() throws Exception {
+ ICompilationUnit cu = setup.getPackageFragment().getCompilationUnit("A.java");
+ IType type = cu.findPrimaryType();
+ IField field = type.getField("string");
+
+ RenameFieldProcessor renameFieldProcessor = new RenameFieldProcessor(field);
+ renameFieldProcessor.setNewElementName("newString");
+ renameFieldProcessor.setRenameGetter(true);
+
+ performRefactoring(renameFieldProcessor);
+ }
+
+ @Test
+ public void builderField() throws Exception {
+ ICompilationUnit cu = setup.getPackageFragment().getCompilationUnit("A.java");
+ IType type = cu.findPrimaryType();
+ IField field = type.getField("string");
+
+ RenameFieldProcessor renameFieldProcessor = new RenameFieldProcessor(field);
+ renameFieldProcessor.setNewElementName("newString");
+
+ performRefactoring(renameFieldProcessor);
+ }
+}
diff --git a/test/pretty/resource/after/RecordPattern.java b/test/pretty/resource/after/RecordPattern.java
new file mode 100644
index 00000000..ad9fae0b
--- /dev/null
+++ b/test/pretty/resource/after/RecordPattern.java
@@ -0,0 +1,15 @@
+record Point(int x, int y) {
+}
+record Rectangle(Point upperLeft, Point lowerRight) {
+}
+
+public class RecordPattern {
+ void recordPattern(Object o) {
+ if (o instanceof Point(int x, int y)) {
+ }
+ if (o instanceof Point(int x, int y) p) {
+ }
+ if (o instanceof Rectangle(Point(int x1, int y1), Point(int x2, int y2))) {
+ }
+ }
+} \ No newline at end of file
diff --git a/test/pretty/resource/after/Switch19.java b/test/pretty/resource/after/Switch19.java
new file mode 100644
index 00000000..5947830b
--- /dev/null
+++ b/test/pretty/resource/after/Switch19.java
@@ -0,0 +1,32 @@
+public class Switch19 {
+ String switchPatternMatching(Object o) {
+ return switch (o) {
+ case Integer i -> String.format("int %d", i);
+ case Long l -> String.format("long %d", l);
+ case Double d -> String.format("double %f", d);
+ case String s -> String.format("String %s", s);
+ default -> o.toString();
+ };
+ }
+
+ String switchNull(Object o) {
+ return switch (o) {
+ case null, default -> "?";
+ };
+ }
+
+ String switchGuardPattern(Object o) {
+ return switch (o) {
+ case String s when s.length() > 1 -> s;
+ case String s -> s;
+ default -> o.toString();
+ };
+ }
+
+ String switchParenthesizedPattern(Object o) {
+ return switch (o) {
+ case (String s) -> s;
+ default -> o.toString();
+ };
+ }
+}
diff --git a/test/pretty/resource/before/RecordPattern.java b/test/pretty/resource/before/RecordPattern.java
new file mode 100644
index 00000000..93c07965
--- /dev/null
+++ b/test/pretty/resource/before/RecordPattern.java
@@ -0,0 +1,16 @@
+// version 19:
+record Point(int x, int y) {
+}
+record Rectangle(Point upperLeft, Point lowerRight) {
+}
+
+public class RecordPattern {
+ void recordPattern(Object o) {
+ if (o instanceof Point(int x, int y)) {
+ }
+ if (o instanceof Point(int x, int y) p) {
+ }
+ if (o instanceof Rectangle(Point(int x1, int y1), Point(int x2, int y2))) {
+ }
+ }
+} \ No newline at end of file
diff --git a/test/pretty/resource/before/Switch17.java b/test/pretty/resource/before/Switch17.java
index 17754e82..42a8f181 100644
--- a/test/pretty/resource/before/Switch17.java
+++ b/test/pretty/resource/before/Switch17.java
@@ -1,4 +1,4 @@
-// version 17:
+// version 17:18
public class Switch17 {
String switchPatternMatching(Object o) {
return switch (o) {
diff --git a/test/pretty/resource/before/Switch19.java b/test/pretty/resource/before/Switch19.java
new file mode 100644
index 00000000..05b27928
--- /dev/null
+++ b/test/pretty/resource/before/Switch19.java
@@ -0,0 +1,33 @@
+// version 19:
+public class Switch19 {
+ String switchPatternMatching(Object o) {
+ return switch (o) {
+ case Integer i -> String.format("int %d", i);
+ case Long l -> String.format("long %d", l);
+ case Double d -> String.format("double %f", d);
+ case String s -> String.format("String %s", s);
+ default -> o.toString();
+ };
+ }
+
+ String switchNull(Object o) {
+ return switch (o) {
+ case null, default -> "?";
+ };
+ }
+
+ String switchGuardPattern(Object o) {
+ return switch (o) {
+ case String s when s.length() > 1 -> s;
+ case String s -> s;
+ default -> o.toString();
+ };
+ }
+
+ String switchParenthesizedPattern(Object o) {
+ return switch (o) {
+ case (String s) -> s;
+ default -> o.toString();
+ };
+ }
+}
diff --git a/test/transform/resource/after-delombok/CheckerFrameworkBuilder.java b/test/transform/resource/after-delombok/CheckerFrameworkBuilder.java
index 99245e11..64f07c37 100644
--- a/test/transform/resource/after-delombok/CheckerFrameworkBuilder.java
+++ b/test/transform/resource/after-delombok/CheckerFrameworkBuilder.java
@@ -1,3 +1,5 @@
+//version 8:
+//skip-idempotent
import java.util.List;
class CheckerFrameworkBuilder {
int x;
diff --git a/test/transform/resource/after-delombok/LoggerFloggerRecord.java b/test/transform/resource/after-delombok/LoggerFloggerRecord.java
index 9cc0c9c0..bd51d056 100644
--- a/test/transform/resource/after-delombok/LoggerFloggerRecord.java
+++ b/test/transform/resource/after-delombok/LoggerFloggerRecord.java
@@ -1,5 +1,6 @@
+// version 14:
class LoggerFloggerRecord {
- record Inner(String x) {
+ public record Inner(String x) {
@java.lang.SuppressWarnings("all")
private static final com.google.common.flogger.FluentLogger log = com.google.common.flogger.FluentLogger.forEnclosingClass();
}
diff --git a/test/transform/resource/after-delombok/SuperBuilderNameClashes.java b/test/transform/resource/after-delombok/SuperBuilderNameClashes.java
index 93aed7d3..5b0db135 100644
--- a/test/transform/resource/after-delombok/SuperBuilderNameClashes.java
+++ b/test/transform/resource/after-delombok/SuperBuilderNameClashes.java
@@ -124,4 +124,50 @@ public class SuperBuilderNameClashes {
return new SuperBuilderNameClashes.C.CBuilderImpl();
}
}
+ interface B2 {
+ interface B4<X> {
+ }
+ }
+ interface B3<Y> {
+ }
+ public static class ExtendsClauseCollision extends B implements B2.B4<Object>, B3<Object> {
+ @java.lang.SuppressWarnings("all")
+ public static abstract class ExtendsClauseCollisionBuilder<C extends SuperBuilderNameClashes.ExtendsClauseCollision, B4 extends SuperBuilderNameClashes.ExtendsClauseCollision.ExtendsClauseCollisionBuilder<C, B4>> extends B.BBuilder<C, B4> {
+ @java.lang.Override
+ @java.lang.SuppressWarnings("all")
+ protected abstract B4 self();
+ @java.lang.Override
+ @java.lang.SuppressWarnings("all")
+ public abstract C build();
+ @java.lang.Override
+ @java.lang.SuppressWarnings("all")
+ public java.lang.String toString() {
+ return "SuperBuilderNameClashes.ExtendsClauseCollision.ExtendsClauseCollisionBuilder(super=" + super.toString() + ")";
+ }
+ }
+ @java.lang.SuppressWarnings("all")
+ private static final class ExtendsClauseCollisionBuilderImpl extends SuperBuilderNameClashes.ExtendsClauseCollision.ExtendsClauseCollisionBuilder<SuperBuilderNameClashes.ExtendsClauseCollision, SuperBuilderNameClashes.ExtendsClauseCollision.ExtendsClauseCollisionBuilderImpl> {
+ @java.lang.SuppressWarnings("all")
+ private ExtendsClauseCollisionBuilderImpl() {
+ }
+ @java.lang.Override
+ @java.lang.SuppressWarnings("all")
+ protected SuperBuilderNameClashes.ExtendsClauseCollision.ExtendsClauseCollisionBuilderImpl self() {
+ return this;
+ }
+ @java.lang.Override
+ @java.lang.SuppressWarnings("all")
+ public SuperBuilderNameClashes.ExtendsClauseCollision build() {
+ return new SuperBuilderNameClashes.ExtendsClauseCollision(this);
+ }
+ }
+ @java.lang.SuppressWarnings("all")
+ protected ExtendsClauseCollision(final SuperBuilderNameClashes.ExtendsClauseCollision.ExtendsClauseCollisionBuilder<?, ?> b) {
+ super(b);
+ }
+ @java.lang.SuppressWarnings("all")
+ public static SuperBuilderNameClashes.ExtendsClauseCollision.ExtendsClauseCollisionBuilder<?, ?> builder() {
+ return new SuperBuilderNameClashes.ExtendsClauseCollision.ExtendsClauseCollisionBuilderImpl();
+ }
+ }
}
diff --git a/test/transform/resource/after-delombok/ValInvalidParameter.java b/test/transform/resource/after-delombok/ValInvalidParameter.java
index f3d4229c..787a20bf 100644
--- a/test/transform/resource/after-delombok/ValInvalidParameter.java
+++ b/test/transform/resource/after-delombok/ValInvalidParameter.java
@@ -1,3 +1,4 @@
+//version 7:8
public class ValInvalidParameter {
public void val() {
final java.lang.Object a = a(new NonExistingClass());
diff --git a/test/transform/resource/after-ecj/LoggerFloggerRecord.java b/test/transform/resource/after-ecj/LoggerFloggerRecord.java
index 86004b67..fde69e74 100644
--- a/test/transform/resource/after-ecj/LoggerFloggerRecord.java
+++ b/test/transform/resource/after-ecj/LoggerFloggerRecord.java
@@ -1,6 +1,7 @@
+// version 19:
import lombok.extern.flogger.Flogger;
class LoggerFloggerRecord {
- static @Flogger record Inner(String x) {
+ public @Flogger record Inner(com log) {
private static final com.google.common.flogger.FluentLogger log = com.google.common.flogger.FluentLogger.forEnclosingClass();
/* Implicit */ private final String x;
<clinit>() {
diff --git a/test/transform/resource/after-ecj/NonNullOnRecord3.java b/test/transform/resource/after-ecj/NonNullOnRecord3.java
index 44c00098..37f0afcf 100644
--- a/test/transform/resource/after-ecj/NonNullOnRecord3.java
+++ b/test/transform/resource/after-ecj/NonNullOnRecord3.java
@@ -1,13 +1,9 @@
-// version 14:
+// version 19:
import lombok.NonNull;
public record NonNullOnRecord3(String a) {
/* Implicit */ private final String a;
public NonNullOnRecord3(String a) {
super();
- .a = a;
- }
- public NonNullOnRecord3(String a) {
- super();
this.a = a;
}
public void method(@NonNull String param) {
diff --git a/test/transform/resource/after-ecj/SuperBuilderNameClashes.java b/test/transform/resource/after-ecj/SuperBuilderNameClashes.java
index 438831df..7f8507ce 100644
--- a/test/transform/resource/after-ecj/SuperBuilderNameClashes.java
+++ b/test/transform/resource/after-ecj/SuperBuilderNameClashes.java
@@ -101,6 +101,41 @@ public class SuperBuilderNameClashes {
return new SuperBuilderNameClashes.C.CBuilderImpl();
}
}
+ interface B2 {
+ interface B4<X> {
+ }
+ }
+ interface B3<Y> {
+ }
+ public static @lombok.experimental.SuperBuilder class ExtendsClauseCollision extends B implements B2.B4<Object>, B3<Object> {
+ public static abstract @java.lang.SuppressWarnings("all") class ExtendsClauseCollisionBuilder<C extends SuperBuilderNameClashes.ExtendsClauseCollision, B4 extends SuperBuilderNameClashes.ExtendsClauseCollision.ExtendsClauseCollisionBuilder<C, B4>> extends B.BBuilder<C, B4> {
+ public ExtendsClauseCollisionBuilder() {
+ super();
+ }
+ protected abstract @java.lang.Override @java.lang.SuppressWarnings("all") B4 self();
+ public abstract @java.lang.Override @java.lang.SuppressWarnings("all") C build();
+ public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() {
+ return (("SuperBuilderNameClashes.ExtendsClauseCollision.ExtendsClauseCollisionBuilder(super=" + super.toString()) + ")");
+ }
+ }
+ private static final @java.lang.SuppressWarnings("all") class ExtendsClauseCollisionBuilderImpl extends SuperBuilderNameClashes.ExtendsClauseCollision.ExtendsClauseCollisionBuilder<SuperBuilderNameClashes.ExtendsClauseCollision, SuperBuilderNameClashes.ExtendsClauseCollision.ExtendsClauseCollisionBuilderImpl> {
+ private ExtendsClauseCollisionBuilderImpl() {
+ super();
+ }
+ protected @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderNameClashes.ExtendsClauseCollision.ExtendsClauseCollisionBuilderImpl self() {
+ return this;
+ }
+ public @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderNameClashes.ExtendsClauseCollision build() {
+ return new SuperBuilderNameClashes.ExtendsClauseCollision(this);
+ }
+ }
+ protected @java.lang.SuppressWarnings("all") ExtendsClauseCollision(final SuperBuilderNameClashes.ExtendsClauseCollision.ExtendsClauseCollisionBuilder<?, ?> b) {
+ super(b);
+ }
+ public static @java.lang.SuppressWarnings("all") SuperBuilderNameClashes.ExtendsClauseCollision.ExtendsClauseCollisionBuilder<?, ?> builder() {
+ return new SuperBuilderNameClashes.ExtendsClauseCollision.ExtendsClauseCollisionBuilderImpl();
+ }
+ }
public SuperBuilderNameClashes() {
super();
}
diff --git a/test/transform/resource/before/LoggerFloggerRecord.java b/test/transform/resource/before/LoggerFloggerRecord.java
index 908704d6..f8f48f2c 100644
--- a/test/transform/resource/before/LoggerFloggerRecord.java
+++ b/test/transform/resource/before/LoggerFloggerRecord.java
@@ -4,5 +4,5 @@ import lombok.extern.flogger.Flogger;
class LoggerFloggerRecord {
@Flogger
- record Inner(String x) {}
+ public record Inner(String x) {}
}
diff --git a/test/transform/resource/before/SuperBuilderNameClashes.java b/test/transform/resource/before/SuperBuilderNameClashes.java
index a0b58452..ec3afbb8 100644
--- a/test/transform/resource/before/SuperBuilderNameClashes.java
+++ b/test/transform/resource/before/SuperBuilderNameClashes.java
@@ -14,4 +14,16 @@ public class SuperBuilderNameClashes {
public static class C {
C2 c2;
}
+
+ interface B2 {
+ interface B4<X> {
+ }
+ }
+
+ interface B3<Y> {
+ }
+
+ @lombok.experimental.SuperBuilder
+ public static class ExtendsClauseCollision extends B implements B2.B4<Object>, B3<Object> {
+ }
}
diff --git a/test/transform/resource/before/ValInvalidParameter.java b/test/transform/resource/before/ValInvalidParameter.java
index f4961c4e..10487e47 100644
--- a/test/transform/resource/before/ValInvalidParameter.java
+++ b/test/transform/resource/before/ValInvalidParameter.java
@@ -1,4 +1,4 @@
-//version :9
+//version 8:9
import lombok.val;
public class ValInvalidParameter {