diff options
Diffstat (limited to 'test')
110 files changed, 1870 insertions, 329 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/BuilderCustomName.java b/test/transform/resource/after-delombok/BuilderCustomName.java index 2e5924d3..900fbb03 100644 --- a/test/transform/resource/after-delombok/BuilderCustomName.java +++ b/test/transform/resource/after-delombok/BuilderCustomName.java @@ -5,10 +5,6 @@ class BuilderCustomName<T> { public static abstract class SimpleTestBuilder<T, C extends BuilderCustomName<T>, B extends BuilderCustomName.SimpleTestBuilder<T, C, B>> { @java.lang.SuppressWarnings("all") private int field; - @java.lang.SuppressWarnings("all") - protected abstract B self(); - @java.lang.SuppressWarnings("all") - public abstract C build(); /** * @return {@code this}. */ @@ -17,6 +13,10 @@ class BuilderCustomName<T> { this.field = field; return self(); } + @java.lang.SuppressWarnings("all") + protected abstract B self(); + @java.lang.SuppressWarnings("all") + public abstract C build(); @java.lang.Override @java.lang.SuppressWarnings("all") public java.lang.String toString() { diff --git a/test/transform/resource/after-delombok/BuilderDefaultsArray.java b/test/transform/resource/after-delombok/BuilderDefaultsArray.java new file mode 100644 index 00000000..2dd6b304 --- /dev/null +++ b/test/transform/resource/after-delombok/BuilderDefaultsArray.java @@ -0,0 +1,79 @@ +import lombok.Value; + +public class BuilderDefaultsArray { + int[] x; + java.lang.String[][] y; + + @java.lang.SuppressWarnings("all") + private static int[] $default$x() { + return new int[] {1, 2}; + } + + @java.lang.SuppressWarnings("all") + private static java.lang.String[][] $default$y() { + return new java.lang.String[][] {}; + } + + @java.lang.SuppressWarnings("all") + BuilderDefaultsArray(final int[] x, final java.lang.String[][] y) { + this.x = x; + this.y = y; + } + + + @java.lang.SuppressWarnings("all") + public static class BuilderDefaultsArrayBuilder { + @java.lang.SuppressWarnings("all") + private boolean x$set; + @java.lang.SuppressWarnings("all") + private int[] x$value; + @java.lang.SuppressWarnings("all") + private boolean y$set; + @java.lang.SuppressWarnings("all") + private java.lang.String[][] y$value; + + @java.lang.SuppressWarnings("all") + BuilderDefaultsArrayBuilder() { + } + + /** + * @return {@code this}. + */ + @java.lang.SuppressWarnings("all") + public BuilderDefaultsArray.BuilderDefaultsArrayBuilder x(final int[] x) { + this.x$value = x; + x$set = true; + return this; + } + + /** + * @return {@code this}. + */ + @java.lang.SuppressWarnings("all") + public BuilderDefaultsArray.BuilderDefaultsArrayBuilder y(final java.lang.String[][] y) { + this.y$value = y; + y$set = true; + return this; + } + + @java.lang.SuppressWarnings("all") + public BuilderDefaultsArray build() { + int[] x$value = this.x$value; + if (!this.x$set) x$value = BuilderDefaultsArray.$default$x(); + java.lang.String[][] y$value = this.y$value; + if (!this.y$set) y$value = BuilderDefaultsArray.$default$y(); + return new BuilderDefaultsArray(x$value, y$value); + } + + @java.lang.Override + @java.lang.SuppressWarnings("all") + public java.lang.String toString() { + return "BuilderDefaultsArray.BuilderDefaultsArrayBuilder(x$value=" + java.util.Arrays.toString(this.x$value) + ", y$value=" + java.util.Arrays.deepToString(this.y$value) + ")"; + } + } + + @java.lang.SuppressWarnings("all") + public static BuilderDefaultsArray.BuilderDefaultsArrayBuilder builder() { + return new BuilderDefaultsArray.BuilderDefaultsArrayBuilder(); + } +} 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/CheckerFrameworkSuperBuilder.java b/test/transform/resource/after-delombok/CheckerFrameworkSuperBuilder.java index cab11f3c..cf00f5fc 100644 --- a/test/transform/resource/after-delombok/CheckerFrameworkSuperBuilder.java +++ b/test/transform/resource/after-delombok/CheckerFrameworkSuperBuilder.java @@ -23,12 +23,6 @@ class CheckerFrameworkSuperBuilder { private int z; @java.lang.SuppressWarnings("all") private java.util.ArrayList<String> names; - @org.checkerframework.dataflow.qual.Pure - @java.lang.SuppressWarnings("all") - protected abstract @org.checkerframework.common.returnsreceiver.qual.This B self(); - @org.checkerframework.dataflow.qual.SideEffectFree - @java.lang.SuppressWarnings("all") - public abstract C build(CheckerFrameworkSuperBuilder.Parent.@org.checkerframework.checker.calledmethods.qual.CalledMethods({"y", "z"}) ParentBuilder<C, B> this); /** * @return {@code this}. */ @@ -74,6 +68,12 @@ class CheckerFrameworkSuperBuilder { if (this.names != null) this.names.clear(); return self(); } + @org.checkerframework.dataflow.qual.Pure + @java.lang.SuppressWarnings("all") + protected abstract @org.checkerframework.common.returnsreceiver.qual.This B self(); + @org.checkerframework.dataflow.qual.SideEffectFree + @java.lang.SuppressWarnings("all") + public abstract C build(CheckerFrameworkSuperBuilder.Parent.@org.checkerframework.checker.calledmethods.qual.CalledMethods({"y", "z"}) ParentBuilder<C, B> this); @org.checkerframework.dataflow.qual.SideEffectFree @java.lang.Override @java.lang.SuppressWarnings("all") @@ -140,14 +140,6 @@ class CheckerFrameworkSuperBuilder { private int a$value; @java.lang.SuppressWarnings("all") private int b; - @java.lang.Override - @org.checkerframework.dataflow.qual.Pure - @java.lang.SuppressWarnings("all") - protected abstract @org.checkerframework.common.returnsreceiver.qual.This B self(); - @org.checkerframework.dataflow.qual.SideEffectFree - @java.lang.Override - @java.lang.SuppressWarnings("all") - public abstract C build(CheckerFrameworkSuperBuilder.ZChild.@org.checkerframework.checker.calledmethods.qual.CalledMethods("b") ZChildBuilder<C, B> this); /** * @return {@code this}. */ @@ -165,6 +157,14 @@ class CheckerFrameworkSuperBuilder { this.b = b; return self(); } + @java.lang.Override + @org.checkerframework.dataflow.qual.Pure + @java.lang.SuppressWarnings("all") + protected abstract @org.checkerframework.common.returnsreceiver.qual.This B self(); + @org.checkerframework.dataflow.qual.SideEffectFree + @java.lang.Override + @java.lang.SuppressWarnings("all") + public abstract C build(CheckerFrameworkSuperBuilder.ZChild.@org.checkerframework.checker.calledmethods.qual.CalledMethods("b") ZChildBuilder<C, B> this); @org.checkerframework.dataflow.qual.SideEffectFree @java.lang.Override @java.lang.SuppressWarnings("all") diff --git a/test/transform/resource/after-delombok/ConstructorsWithSuperBuilderDefaults.java b/test/transform/resource/after-delombok/ConstructorsWithSuperBuilderDefaults.java index e7811dd5..c5188bb3 100644 --- a/test/transform/resource/after-delombok/ConstructorsWithSuperBuilderDefaults.java +++ b/test/transform/resource/after-delombok/ConstructorsWithSuperBuilderDefaults.java @@ -17,12 +17,6 @@ class ConstructorsWithSuperBuilderDefaults { @java.lang.SuppressWarnings("all") private int y; - @java.lang.SuppressWarnings("all") - protected abstract B self(); - - @java.lang.SuppressWarnings("all") - public abstract C build(); - /** * @return {@code this}. */ @@ -42,6 +36,12 @@ class ConstructorsWithSuperBuilderDefaults { return self(); } + @java.lang.SuppressWarnings("all") + protected abstract B self(); + + @java.lang.SuppressWarnings("all") + public abstract C build(); + @java.lang.Override @java.lang.SuppressWarnings("all") public java.lang.String toString() { diff --git a/test/transform/resource/after-delombok/ExtensionMethodNonStatic.java b/test/transform/resource/after-delombok/ExtensionMethodNonStatic.java new file mode 100644 index 00000000..c0f71308 --- /dev/null +++ b/test/transform/resource/after-delombok/ExtensionMethodNonStatic.java @@ -0,0 +1,12 @@ +class ExtensionMethodNonStatic { + public void test() { + String s = "test"; + s.startsWith(""); + } + + static class Extensions { + public boolean startsWith(String s, String prefix) { + return s.startsWith(prefix); + } + } +}
\ No newline at end of file diff --git a/test/transform/resource/after-delombok/JacksonizedSuperBuilderSimple.java b/test/transform/resource/after-delombok/JacksonizedSuperBuilderSimple.java index 88a51f41..a07d9dfc 100644 --- a/test/transform/resource/after-delombok/JacksonizedSuperBuilderSimple.java +++ b/test/transform/resource/after-delombok/JacksonizedSuperBuilderSimple.java @@ -8,10 +8,6 @@ public class JacksonizedSuperBuilderSimple { public static abstract class ParentBuilder<C extends JacksonizedSuperBuilderSimple.Parent, B extends JacksonizedSuperBuilderSimple.Parent.ParentBuilder<C, B>> { @java.lang.SuppressWarnings("all") private int field1; - @java.lang.SuppressWarnings("all") - protected abstract B self(); - @java.lang.SuppressWarnings("all") - public abstract C build(); /** * @return {@code this}. */ @@ -20,6 +16,10 @@ public class JacksonizedSuperBuilderSimple { this.field1 = field1; return self(); } + @java.lang.SuppressWarnings("all") + protected abstract B self(); + @java.lang.SuppressWarnings("all") + public abstract C build(); @java.lang.Override @java.lang.SuppressWarnings("all") public java.lang.String toString() { diff --git a/test/transform/resource/after-delombok/JacksonizedSuperBuilderWithJsonDeserialize.java b/test/transform/resource/after-delombok/JacksonizedSuperBuilderWithJsonDeserialize.java index 1ed38f05..307537ae 100644 --- a/test/transform/resource/after-delombok/JacksonizedSuperBuilderWithJsonDeserialize.java +++ b/test/transform/resource/after-delombok/JacksonizedSuperBuilderWithJsonDeserialize.java @@ -6,10 +6,6 @@ public class JacksonizedSuperBuilderWithJsonDeserialize { public static abstract class JacksonizedSuperBuilderWithJsonDeserializeBuilder<C extends JacksonizedSuperBuilderWithJsonDeserialize, B extends JacksonizedSuperBuilderWithJsonDeserialize.JacksonizedSuperBuilderWithJsonDeserializeBuilder<C, B>> { @java.lang.SuppressWarnings("all") private int field1; - @java.lang.SuppressWarnings("all") - protected abstract B self(); - @java.lang.SuppressWarnings("all") - public abstract C build(); /** * @return {@code this}. */ @@ -18,6 +14,10 @@ public class JacksonizedSuperBuilderWithJsonDeserialize { this.field1 = field1; return self(); } + @java.lang.SuppressWarnings("all") + protected abstract B self(); + @java.lang.SuppressWarnings("all") + public abstract C build(); @java.lang.Override @java.lang.SuppressWarnings("all") public java.lang.String toString() { 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/NullAnnotatedCheckerFrameworkSuperBuilder.java b/test/transform/resource/after-delombok/NullAnnotatedCheckerFrameworkSuperBuilder.java index 25a76c6d..ae2bcdfd 100644 --- a/test/transform/resource/after-delombok/NullAnnotatedCheckerFrameworkSuperBuilder.java +++ b/test/transform/resource/after-delombok/NullAnnotatedCheckerFrameworkSuperBuilder.java @@ -29,12 +29,6 @@ class NullAnnotatedCheckerFrameworkSuperBuilder { @java.lang.SuppressWarnings("all") private java.util.ArrayList<String> names; - @java.lang.SuppressWarnings("all") - protected abstract B self(); - - @java.lang.SuppressWarnings("all") - public abstract C build(); - /** * @return {@code this}. */ @@ -92,6 +86,12 @@ class NullAnnotatedCheckerFrameworkSuperBuilder { return self(); } + @java.lang.SuppressWarnings("all") + protected abstract B self(); + + @java.lang.SuppressWarnings("all") + public abstract C build(); + @java.lang.Override @java.lang.SuppressWarnings("all") public java.lang.@org.checkerframework.checker.nullness.qual.NonNull String toString() { @@ -165,14 +165,6 @@ class NullAnnotatedCheckerFrameworkSuperBuilder { @java.lang.SuppressWarnings("all") private int b; - @java.lang.Override - @java.lang.SuppressWarnings("all") - protected abstract B self(); - - @java.lang.Override - @java.lang.SuppressWarnings("all") - public abstract C build(); - /** * @return {@code this}. */ @@ -196,6 +188,14 @@ class NullAnnotatedCheckerFrameworkSuperBuilder { @java.lang.Override @java.lang.SuppressWarnings("all") + protected abstract B self(); + + @java.lang.Override + @java.lang.SuppressWarnings("all") + public abstract C build(); + + @java.lang.Override + @java.lang.SuppressWarnings("all") public java.lang.@org.checkerframework.checker.nullness.qual.NonNull String toString() { return "NullAnnotatedCheckerFrameworkSuperBuilder.ZChild.ZChildBuilder(super=" + super.toString() + ", a$value=" + this.a$value + ", b=" + this.b + ")"; } diff --git a/test/transform/resource/after-delombok/SuperBuilderAbstract.java b/test/transform/resource/after-delombok/SuperBuilderAbstract.java index 727c5beb..f92eede2 100644 --- a/test/transform/resource/after-delombok/SuperBuilderAbstract.java +++ b/test/transform/resource/after-delombok/SuperBuilderAbstract.java @@ -5,10 +5,6 @@ public class SuperBuilderAbstract { public static abstract class ParentBuilder<C extends SuperBuilderAbstract.Parent, B extends SuperBuilderAbstract.Parent.ParentBuilder<C, B>> { @java.lang.SuppressWarnings("all") private int parentField; - @java.lang.SuppressWarnings("all") - protected abstract B self(); - @java.lang.SuppressWarnings("all") - public abstract C build(); /** * @return {@code this}. */ @@ -17,6 +13,10 @@ public class SuperBuilderAbstract { this.parentField = parentField; return self(); } + @java.lang.SuppressWarnings("all") + protected abstract B self(); + @java.lang.SuppressWarnings("all") + public abstract C build(); @java.lang.Override @java.lang.SuppressWarnings("all") public java.lang.String toString() { @@ -54,12 +54,6 @@ public class SuperBuilderAbstract { public static abstract class ChildBuilder<C extends SuperBuilderAbstract.Child, B extends SuperBuilderAbstract.Child.ChildBuilder<C, B>> extends Parent.ParentBuilder<C, B> { @java.lang.SuppressWarnings("all") private double childField; - @java.lang.Override - @java.lang.SuppressWarnings("all") - protected abstract B self(); - @java.lang.Override - @java.lang.SuppressWarnings("all") - public abstract C build(); /** * @return {@code this}. */ @@ -70,6 +64,12 @@ public class SuperBuilderAbstract { } @java.lang.Override @java.lang.SuppressWarnings("all") + protected abstract B 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 "SuperBuilderAbstract.Child.ChildBuilder(super=" + super.toString() + ", childField=" + this.childField + ")"; } @@ -86,12 +86,6 @@ public class SuperBuilderAbstract { public static abstract class GrandChildBuilder<C extends SuperBuilderAbstract.GrandChild, B extends SuperBuilderAbstract.GrandChild.GrandChildBuilder<C, B>> extends Child.ChildBuilder<C, B> { @java.lang.SuppressWarnings("all") private String grandChildField; - @java.lang.Override - @java.lang.SuppressWarnings("all") - protected abstract B self(); - @java.lang.Override - @java.lang.SuppressWarnings("all") - public abstract C build(); /** * @return {@code this}. */ @@ -102,6 +96,12 @@ public class SuperBuilderAbstract { } @java.lang.Override @java.lang.SuppressWarnings("all") + protected abstract B 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 "SuperBuilderAbstract.GrandChild.GrandChildBuilder(super=" + super.toString() + ", grandChildField=" + this.grandChildField + ")"; } diff --git a/test/transform/resource/after-delombok/SuperBuilderAbstractToBuilder.java b/test/transform/resource/after-delombok/SuperBuilderAbstractToBuilder.java index 53962c60..c9ed6ad7 100644 --- a/test/transform/resource/after-delombok/SuperBuilderAbstractToBuilder.java +++ b/test/transform/resource/after-delombok/SuperBuilderAbstractToBuilder.java @@ -14,10 +14,6 @@ public class SuperBuilderAbstractToBuilder { private static void $fillValuesFromInstanceIntoBuilder(final SuperBuilderAbstractToBuilder.Parent instance, final SuperBuilderAbstractToBuilder.Parent.ParentBuilder<?, ?> b) { b.parentField(instance.parentField); } - @java.lang.SuppressWarnings("all") - protected abstract B self(); - @java.lang.SuppressWarnings("all") - public abstract C build(); /** * @return {@code this}. */ @@ -26,6 +22,10 @@ public class SuperBuilderAbstractToBuilder { this.parentField = parentField; return self(); } + @java.lang.SuppressWarnings("all") + protected abstract B self(); + @java.lang.SuppressWarnings("all") + public abstract C build(); @java.lang.Override @java.lang.SuppressWarnings("all") public java.lang.String toString() { @@ -78,12 +78,6 @@ public class SuperBuilderAbstractToBuilder { private static void $fillValuesFromInstanceIntoBuilder(final SuperBuilderAbstractToBuilder.Child instance, final SuperBuilderAbstractToBuilder.Child.ChildBuilder<?, ?> b) { b.childField(instance.childField); } - @java.lang.Override - @java.lang.SuppressWarnings("all") - protected abstract B self(); - @java.lang.Override - @java.lang.SuppressWarnings("all") - public abstract C build(); /** * @return {@code this}. */ @@ -94,6 +88,12 @@ public class SuperBuilderAbstractToBuilder { } @java.lang.Override @java.lang.SuppressWarnings("all") + protected abstract B 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 "SuperBuilderAbstractToBuilder.Child.ChildBuilder(super=" + super.toString() + ", childField=" + this.childField + ")"; } @@ -121,12 +121,6 @@ public class SuperBuilderAbstractToBuilder { private static void $fillValuesFromInstanceIntoBuilder(final SuperBuilderAbstractToBuilder.GrandChild instance, final SuperBuilderAbstractToBuilder.GrandChild.GrandChildBuilder<?, ?> b) { b.grandChildField(instance.grandChildField); } - @java.lang.Override - @java.lang.SuppressWarnings("all") - protected abstract B self(); - @java.lang.Override - @java.lang.SuppressWarnings("all") - public abstract C build(); /** * @return {@code this}. */ @@ -137,6 +131,12 @@ public class SuperBuilderAbstractToBuilder { } @java.lang.Override @java.lang.SuppressWarnings("all") + protected abstract B 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 "SuperBuilderAbstractToBuilder.GrandChild.GrandChildBuilder(super=" + super.toString() + ", grandChildField=" + this.grandChildField + ")"; } diff --git a/test/transform/resource/after-delombok/SuperBuilderBasic.java b/test/transform/resource/after-delombok/SuperBuilderBasic.java index 7fff2ef8..31b6692d 100644 --- a/test/transform/resource/after-delombok/SuperBuilderBasic.java +++ b/test/transform/resource/after-delombok/SuperBuilderBasic.java @@ -9,10 +9,6 @@ public class SuperBuilderBasic { private int field1; @java.lang.SuppressWarnings("all") private java.util.ArrayList<String> items; - @java.lang.SuppressWarnings("all") - protected abstract B self(); - @java.lang.SuppressWarnings("all") - public abstract C build(); /** * @return {@code this}. */ @@ -41,6 +37,10 @@ public class SuperBuilderBasic { if (this.items != null) this.items.clear(); return self(); } + @java.lang.SuppressWarnings("all") + protected abstract B self(); + @java.lang.SuppressWarnings("all") + public abstract C build(); @java.lang.Override @java.lang.SuppressWarnings("all") public java.lang.String toString() { @@ -90,12 +90,6 @@ public class SuperBuilderBasic { public static abstract class ChildBuilder<C extends SuperBuilderBasic.Child, B extends SuperBuilderBasic.Child.ChildBuilder<C, B>> extends SuperBuilderBasic.Parent.ParentBuilder<C, B> { @java.lang.SuppressWarnings("all") private double field3; - @java.lang.Override - @java.lang.SuppressWarnings("all") - protected abstract B self(); - @java.lang.Override - @java.lang.SuppressWarnings("all") - public abstract C build(); /** * @return {@code this}. */ @@ -106,6 +100,12 @@ public class SuperBuilderBasic { } @java.lang.Override @java.lang.SuppressWarnings("all") + protected abstract B 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 "SuperBuilderBasic.Child.ChildBuilder(super=" + super.toString() + ", field3=" + this.field3 + ")"; } diff --git a/test/transform/resource/after-delombok/SuperBuilderBasicToBuilder.java b/test/transform/resource/after-delombok/SuperBuilderBasicToBuilder.java index add6f841..f57937ec 100644 --- a/test/transform/resource/after-delombok/SuperBuilderBasicToBuilder.java +++ b/test/transform/resource/after-delombok/SuperBuilderBasicToBuilder.java @@ -37,10 +37,6 @@ public class SuperBuilderBasicToBuilder { b.obtainViaStaticMethod(SuperBuilderBasicToBuilder.Parent.staticMethod(instance)); b.items(instance.items == null ? java.util.Collections.<String>emptyList() : instance.items); } - @java.lang.SuppressWarnings("all") - protected abstract B self(); - @java.lang.SuppressWarnings("all") - public abstract C build(); /** * @return {@code this}. */ @@ -93,6 +89,10 @@ public class SuperBuilderBasicToBuilder { if (this.items != null) this.items.clear(); return self(); } + @java.lang.SuppressWarnings("all") + protected abstract B self(); + @java.lang.SuppressWarnings("all") + public abstract C build(); @java.lang.Override @java.lang.SuppressWarnings("all") public java.lang.String toString() { @@ -160,12 +160,6 @@ public class SuperBuilderBasicToBuilder { private static void $fillValuesFromInstanceIntoBuilder(final SuperBuilderBasicToBuilder.Child instance, final SuperBuilderBasicToBuilder.Child.ChildBuilder<?, ?> b) { b.field3(instance.field3); } - @java.lang.Override - @java.lang.SuppressWarnings("all") - protected abstract B self(); - @java.lang.Override - @java.lang.SuppressWarnings("all") - public abstract C build(); /** * @return {@code this}. */ @@ -176,6 +170,12 @@ public class SuperBuilderBasicToBuilder { } @java.lang.Override @java.lang.SuppressWarnings("all") + protected abstract B 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 "SuperBuilderBasicToBuilder.Child.ChildBuilder(super=" + super.toString() + ", field3=" + this.field3 + ")"; } diff --git a/test/transform/resource/after-delombok/SuperBuilderCustomized.java b/test/transform/resource/after-delombok/SuperBuilderCustomized.java index 3a0bbd9b..5f41cdde 100644 --- a/test/transform/resource/after-delombok/SuperBuilderCustomized.java +++ b/test/transform/resource/after-delombok/SuperBuilderCustomized.java @@ -71,12 +71,6 @@ public class SuperBuilderCustomized { public static abstract class ChildBuilder<C extends SuperBuilderCustomized.Child, B extends SuperBuilderCustomized.Child.ChildBuilder<C, B>> extends Parent.ParentBuilder<C, B> { @java.lang.SuppressWarnings("all") private double field2; - @java.lang.Override - @java.lang.SuppressWarnings("all") - protected abstract B self(); - @java.lang.Override - @java.lang.SuppressWarnings("all") - public abstract C build(); /** * @return {@code this}. */ @@ -87,6 +81,12 @@ public class SuperBuilderCustomized { } @java.lang.Override @java.lang.SuppressWarnings("all") + protected abstract B 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 "SuperBuilderCustomized.Child.ChildBuilder(super=" + super.toString() + ", field2=" + this.field2 + ")"; } diff --git a/test/transform/resource/after-delombok/SuperBuilderInitializer.java b/test/transform/resource/after-delombok/SuperBuilderInitializer.java index 95943aa9..19ed0c68 100644 --- a/test/transform/resource/after-delombok/SuperBuilderInitializer.java +++ b/test/transform/resource/after-delombok/SuperBuilderInitializer.java @@ -19,12 +19,6 @@ class SuperBuilderInitializer { @java.lang.SuppressWarnings("all") private String world; - @java.lang.SuppressWarnings("all") - protected abstract B self(); - - @java.lang.SuppressWarnings("all") - public abstract C build(); - /** * @return {@code this}. */ @@ -34,6 +28,12 @@ class SuperBuilderInitializer { return self(); } + @java.lang.SuppressWarnings("all") + protected abstract B self(); + + @java.lang.SuppressWarnings("all") + public abstract C build(); + @java.lang.Override @java.lang.SuppressWarnings("all") public java.lang.String toString() { diff --git a/test/transform/resource/after-delombok/SuperBuilderNameClashes.java b/test/transform/resource/after-delombok/SuperBuilderNameClashes.java index 8cef4e11..5b0db135 100644 --- a/test/transform/resource/after-delombok/SuperBuilderNameClashes.java +++ b/test/transform/resource/after-delombok/SuperBuilderNameClashes.java @@ -81,10 +81,6 @@ public class SuperBuilderNameClashes { public static abstract class CBuilder<C3 extends SuperBuilderNameClashes.C, B extends SuperBuilderNameClashes.C.CBuilder<C3, B>> { @java.lang.SuppressWarnings("all") private C2 c2; - @java.lang.SuppressWarnings("all") - protected abstract B self(); - @java.lang.SuppressWarnings("all") - public abstract C3 build(); /** * @return {@code this}. */ @@ -93,6 +89,10 @@ public class SuperBuilderNameClashes { this.c2 = c2; return self(); } + @java.lang.SuppressWarnings("all") + protected abstract B self(); + @java.lang.SuppressWarnings("all") + public abstract C3 build(); @java.lang.Override @java.lang.SuppressWarnings("all") public java.lang.String toString() { @@ -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/SuperBuilderSingularAnnotatedTypes.java b/test/transform/resource/after-delombok/SuperBuilderSingularAnnotatedTypes.java index ad51816a..6e2fdca2 100644 --- a/test/transform/resource/after-delombok/SuperBuilderSingularAnnotatedTypes.java +++ b/test/transform/resource/after-delombok/SuperBuilderSingularAnnotatedTypes.java @@ -19,10 +19,6 @@ class SuperBuilderSingularAnnotatedTypes { @java.lang.SuppressWarnings("all") private java.util.ArrayList<@MyAnnotation @NonNull Integer> bars$value; @java.lang.SuppressWarnings("all") - protected abstract B self(); - @java.lang.SuppressWarnings("all") - public abstract C build(); - @java.lang.SuppressWarnings("all") public B foo(@MyAnnotation @NonNull final String foo) { if (foo == null) { throw new java.lang.NullPointerException("foo is marked non-null but is null"); @@ -84,6 +80,10 @@ class SuperBuilderSingularAnnotatedTypes { } return self(); } + @java.lang.SuppressWarnings("all") + protected abstract B self(); + @java.lang.SuppressWarnings("all") + public abstract C build(); @java.lang.Override @java.lang.SuppressWarnings("all") public java.lang.String toString() { diff --git a/test/transform/resource/after-delombok/SuperBuilderSingularCustomized.java b/test/transform/resource/after-delombok/SuperBuilderSingularCustomized.java index 04cfd9f2..1f07c448 100644 --- a/test/transform/resource/after-delombok/SuperBuilderSingularCustomized.java +++ b/test/transform/resource/after-delombok/SuperBuilderSingularCustomized.java @@ -8,10 +8,6 @@ class SuperBuilderSingularCustomized { return self(); } @java.lang.SuppressWarnings("all") - protected abstract B self(); - @java.lang.SuppressWarnings("all") - public abstract C build(); - @java.lang.SuppressWarnings("all") public B foo(final String foo) { if (this.foos == null) this.foos = new java.util.ArrayList<String>(); this.foos.add(foo); @@ -31,6 +27,10 @@ class SuperBuilderSingularCustomized { if (this.foos != null) this.foos.clear(); return self(); } + @java.lang.SuppressWarnings("all") + protected abstract B self(); + @java.lang.SuppressWarnings("all") + public abstract C build(); @java.lang.Override @java.lang.SuppressWarnings("all") public java.lang.String toString() { diff --git a/test/transform/resource/after-delombok/SuperBuilderSingularToBuilderGuava.java b/test/transform/resource/after-delombok/SuperBuilderSingularToBuilderGuava.java index ec716fdd..685f3f85 100644 --- a/test/transform/resource/after-delombok/SuperBuilderSingularToBuilderGuava.java +++ b/test/transform/resource/after-delombok/SuperBuilderSingularToBuilderGuava.java @@ -32,10 +32,6 @@ public class SuperBuilderSingularToBuilderGuava { b.users(instance.users == null ? com.google.common.collect.ImmutableTable.<Number, Number, String>of() : instance.users); } @java.lang.SuppressWarnings("all") - protected abstract B self(); - @java.lang.SuppressWarnings("all") - public abstract C build(); - @java.lang.SuppressWarnings("all") public B card(final T card) { if (this.cards == null) this.cards = com.google.common.collect.ImmutableList.builder(); this.cards.add(card); @@ -135,6 +131,10 @@ public class SuperBuilderSingularToBuilderGuava { this.users = null; return self(); } + @java.lang.SuppressWarnings("all") + protected abstract B self(); + @java.lang.SuppressWarnings("all") + public abstract C build(); @java.lang.Override @java.lang.SuppressWarnings("all") public java.lang.String toString() { @@ -196,12 +196,6 @@ public class SuperBuilderSingularToBuilderGuava { private static <T> void $fillValuesFromInstanceIntoBuilder(final SuperBuilderSingularToBuilderGuava.Child<T> instance, final SuperBuilderSingularToBuilderGuava.Child.ChildBuilder<T, ?, ?> b) { b.field3(instance.field3); } - @java.lang.Override - @java.lang.SuppressWarnings("all") - protected abstract B self(); - @java.lang.Override - @java.lang.SuppressWarnings("all") - public abstract C build(); /** * @return {@code this}. */ @@ -212,6 +206,12 @@ public class SuperBuilderSingularToBuilderGuava { } @java.lang.Override @java.lang.SuppressWarnings("all") + protected abstract B 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 "SuperBuilderSingularToBuilderGuava.Child.ChildBuilder(super=" + super.toString() + ", field3=" + this.field3 + ")"; } diff --git a/test/transform/resource/after-delombok/SuperBuilderWithCustomBuilderMethod.java b/test/transform/resource/after-delombok/SuperBuilderWithCustomBuilderMethod.java index 9237a148..a2f3231d 100644 --- a/test/transform/resource/after-delombok/SuperBuilderWithCustomBuilderMethod.java +++ b/test/transform/resource/after-delombok/SuperBuilderWithCustomBuilderMethod.java @@ -10,10 +10,6 @@ public class SuperBuilderWithCustomBuilderMethod { private A field1; @java.lang.SuppressWarnings("all") private java.util.ArrayList<String> items; - @java.lang.SuppressWarnings("all") - protected abstract B self(); - @java.lang.SuppressWarnings("all") - public abstract C build(); /** * @return {@code this}. */ @@ -42,6 +38,10 @@ public class SuperBuilderWithCustomBuilderMethod { if (this.items != null) this.items.clear(); return self(); } + @java.lang.SuppressWarnings("all") + protected abstract B self(); + @java.lang.SuppressWarnings("all") + public abstract C build(); @java.lang.Override @java.lang.SuppressWarnings("all") public java.lang.String toString() { @@ -94,12 +94,6 @@ public class SuperBuilderWithCustomBuilderMethod { public static abstract class ChildBuilder<A, C extends SuperBuilderWithCustomBuilderMethod.Child<A>, B extends SuperBuilderWithCustomBuilderMethod.Child.ChildBuilder<A, C, B>> extends Parent.ParentBuilder<A, C, B> { @java.lang.SuppressWarnings("all") private double field3; - @java.lang.Override - @java.lang.SuppressWarnings("all") - protected abstract B self(); - @java.lang.Override - @java.lang.SuppressWarnings("all") - public abstract C build(); /** * @return {@code this}. */ @@ -110,6 +104,12 @@ public class SuperBuilderWithCustomBuilderMethod { } @java.lang.Override @java.lang.SuppressWarnings("all") + protected abstract B 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 "SuperBuilderWithCustomBuilderMethod.Child.ChildBuilder(super=" + super.toString() + ", field3=" + this.field3 + ")"; } diff --git a/test/transform/resource/after-delombok/SuperBuilderWithDefaults.java b/test/transform/resource/after-delombok/SuperBuilderWithDefaults.java index a9d92ff9..3fc47f02 100644 --- a/test/transform/resource/after-delombok/SuperBuilderWithDefaults.java +++ b/test/transform/resource/after-delombok/SuperBuilderWithDefaults.java @@ -21,10 +21,6 @@ public class SuperBuilderWithDefaults { private boolean numberField$set; @java.lang.SuppressWarnings("all") private N numberField$value; - @java.lang.SuppressWarnings("all") - protected abstract B self(); - @java.lang.SuppressWarnings("all") - public abstract C build(); /** * @return {@code this}. */ @@ -43,6 +39,10 @@ public class SuperBuilderWithDefaults { numberField$set = true; return self(); } + @java.lang.SuppressWarnings("all") + protected abstract B self(); + @java.lang.SuppressWarnings("all") + public abstract C build(); @java.lang.Override @java.lang.SuppressWarnings("all") public java.lang.String toString() { @@ -89,12 +89,6 @@ public class SuperBuilderWithDefaults { private boolean doubleField$set; @java.lang.SuppressWarnings("all") private double doubleField$value; - @java.lang.Override - @java.lang.SuppressWarnings("all") - protected abstract B self(); - @java.lang.Override - @java.lang.SuppressWarnings("all") - public abstract C build(); /** * @return {@code this}. */ @@ -106,6 +100,12 @@ public class SuperBuilderWithDefaults { } @java.lang.Override @java.lang.SuppressWarnings("all") + protected abstract B 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 "SuperBuilderWithDefaults.Child.ChildBuilder(super=" + super.toString() + ", doubleField$value=" + this.doubleField$value + ")"; } diff --git a/test/transform/resource/after-delombok/SuperBuilderWithDefaultsAndTargetTyping.java b/test/transform/resource/after-delombok/SuperBuilderWithDefaultsAndTargetTyping.java index bc7b3099..9a67573d 100644 --- a/test/transform/resource/after-delombok/SuperBuilderWithDefaultsAndTargetTyping.java +++ b/test/transform/resource/after-delombok/SuperBuilderWithDefaultsAndTargetTyping.java @@ -18,12 +18,6 @@ public class SuperBuilderWithDefaultsAndTargetTyping { @java.lang.SuppressWarnings("all") private String foo$value; - @java.lang.SuppressWarnings("all") - protected abstract B self(); - - @java.lang.SuppressWarnings("all") - public abstract C build(); - /** * @return {@code this}. */ @@ -34,6 +28,12 @@ public class SuperBuilderWithDefaultsAndTargetTyping { return self(); } + @java.lang.SuppressWarnings("all") + protected abstract B self(); + + @java.lang.SuppressWarnings("all") + public abstract C build(); + @java.lang.Override @java.lang.SuppressWarnings("all") public java.lang.String toString() { @@ -90,14 +90,6 @@ public class SuperBuilderWithDefaultsAndTargetTyping { @java.lang.SuppressWarnings("all") private String foo$value; - @java.lang.Override - @java.lang.SuppressWarnings("all") - protected abstract B self(); - - @java.lang.Override - @java.lang.SuppressWarnings("all") - public abstract C build(); - /** * @return {@code this}. */ @@ -110,6 +102,14 @@ public class SuperBuilderWithDefaultsAndTargetTyping { @java.lang.Override @java.lang.SuppressWarnings("all") + protected abstract B 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 "SuperBuilderWithDefaultsAndTargetTyping.Child.ChildBuilder(super=" + super.toString() + ", foo$value=" + this.foo$value + ")"; } diff --git a/test/transform/resource/after-delombok/SuperBuilderWithGenerics.java b/test/transform/resource/after-delombok/SuperBuilderWithGenerics.java index 017ebf31..0c00cdfc 100644 --- a/test/transform/resource/after-delombok/SuperBuilderWithGenerics.java +++ b/test/transform/resource/after-delombok/SuperBuilderWithGenerics.java @@ -9,10 +9,6 @@ public class SuperBuilderWithGenerics { private A field1; @java.lang.SuppressWarnings("all") private java.util.ArrayList<String> items; - @java.lang.SuppressWarnings("all") - protected abstract B self(); - @java.lang.SuppressWarnings("all") - public abstract C build(); /** * @return {@code this}. */ @@ -41,6 +37,10 @@ public class SuperBuilderWithGenerics { if (this.items != null) this.items.clear(); return self(); } + @java.lang.SuppressWarnings("all") + protected abstract B self(); + @java.lang.SuppressWarnings("all") + public abstract C build(); @java.lang.Override @java.lang.SuppressWarnings("all") public java.lang.String toString() { @@ -90,12 +90,6 @@ public class SuperBuilderWithGenerics { public static abstract class ChildBuilder<A, C extends SuperBuilderWithGenerics.Child<A>, B extends SuperBuilderWithGenerics.Child.ChildBuilder<A, C, B>> extends Parent.ParentBuilder<A, C, B> { @java.lang.SuppressWarnings("all") private double field3; - @java.lang.Override - @java.lang.SuppressWarnings("all") - protected abstract B self(); - @java.lang.Override - @java.lang.SuppressWarnings("all") - public abstract C build(); /** * @return {@code this}. */ @@ -106,6 +100,12 @@ public class SuperBuilderWithGenerics { } @java.lang.Override @java.lang.SuppressWarnings("all") + protected abstract B 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 "SuperBuilderWithGenerics.Child.ChildBuilder(super=" + super.toString() + ", field3=" + this.field3 + ")"; } diff --git a/test/transform/resource/after-delombok/SuperBuilderWithGenerics2.java b/test/transform/resource/after-delombok/SuperBuilderWithGenerics2.java index 8c465b0e..011604e9 100644 --- a/test/transform/resource/after-delombok/SuperBuilderWithGenerics2.java +++ b/test/transform/resource/after-delombok/SuperBuilderWithGenerics2.java @@ -9,10 +9,6 @@ public class SuperBuilderWithGenerics2 { private A field1; @java.lang.SuppressWarnings("all") private java.util.ArrayList<String> items; - @java.lang.SuppressWarnings("all") - protected abstract B self(); - @java.lang.SuppressWarnings("all") - public abstract C build(); /** * @return {@code this}. */ @@ -41,6 +37,10 @@ public class SuperBuilderWithGenerics2 { if (this.items != null) this.items.clear(); return self(); } + @java.lang.SuppressWarnings("all") + protected abstract B self(); + @java.lang.SuppressWarnings("all") + public abstract C build(); @java.lang.Override @java.lang.SuppressWarnings("all") public java.lang.String toString() { @@ -90,12 +90,6 @@ public class SuperBuilderWithGenerics2 { public static abstract class ChildBuilder<A, C extends SuperBuilderWithGenerics2.Child<A>, B extends SuperBuilderWithGenerics2.Child.ChildBuilder<A, C, B>> extends Parent.ParentBuilder<String, C, B> { @java.lang.SuppressWarnings("all") private A field3; - @java.lang.Override - @java.lang.SuppressWarnings("all") - protected abstract B self(); - @java.lang.Override - @java.lang.SuppressWarnings("all") - public abstract C build(); /** * @return {@code this}. */ @@ -106,6 +100,12 @@ public class SuperBuilderWithGenerics2 { } @java.lang.Override @java.lang.SuppressWarnings("all") + protected abstract B 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 "SuperBuilderWithGenerics2.Child.ChildBuilder(super=" + super.toString() + ", field3=" + this.field3 + ")"; } diff --git a/test/transform/resource/after-delombok/SuperBuilderWithGenerics3.java b/test/transform/resource/after-delombok/SuperBuilderWithGenerics3.java index 991d7cbe..ac33d10f 100644 --- a/test/transform/resource/after-delombok/SuperBuilderWithGenerics3.java +++ b/test/transform/resource/after-delombok/SuperBuilderWithGenerics3.java @@ -6,10 +6,6 @@ public class SuperBuilderWithGenerics3 { public static abstract class ParentBuilder<A, C extends SuperBuilderWithGenerics3.Parent<A>, B extends SuperBuilderWithGenerics3.Parent.ParentBuilder<A, C, B>> { @java.lang.SuppressWarnings("all") private String str; - @java.lang.SuppressWarnings("all") - protected abstract B self(); - @java.lang.SuppressWarnings("all") - public abstract C build(); /** * @return {@code this}. */ @@ -18,6 +14,10 @@ public class SuperBuilderWithGenerics3 { this.str = str; return self(); } + @java.lang.SuppressWarnings("all") + protected abstract B self(); + @java.lang.SuppressWarnings("all") + public abstract C build(); @java.lang.Override @java.lang.SuppressWarnings("all") public java.lang.String toString() { @@ -57,12 +57,6 @@ public class SuperBuilderWithGenerics3 { public static abstract class ChildBuilder<C extends SuperBuilderWithGenerics3.Child, B extends SuperBuilderWithGenerics3.Child.ChildBuilder<C, B>> extends Parent.ParentBuilder<Child.SomeInnerStaticClass, C, B> { @java.lang.SuppressWarnings("all") private double field3; - @java.lang.Override - @java.lang.SuppressWarnings("all") - protected abstract B self(); - @java.lang.Override - @java.lang.SuppressWarnings("all") - public abstract C build(); /** * @return {@code this}. */ @@ -73,6 +67,12 @@ public class SuperBuilderWithGenerics3 { } @java.lang.Override @java.lang.SuppressWarnings("all") + protected abstract B 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 "SuperBuilderWithGenerics3.Child.ChildBuilder(super=" + super.toString() + ", field3=" + this.field3 + ")"; } diff --git a/test/transform/resource/after-delombok/SuperBuilderWithGenericsAndToBuilder.java b/test/transform/resource/after-delombok/SuperBuilderWithGenericsAndToBuilder.java index 28c48db3..b85e233c 100644 --- a/test/transform/resource/after-delombok/SuperBuilderWithGenericsAndToBuilder.java +++ b/test/transform/resource/after-delombok/SuperBuilderWithGenericsAndToBuilder.java @@ -21,10 +21,6 @@ public class SuperBuilderWithGenericsAndToBuilder { b.field1(instance.field1); b.items(instance.items == null ? java.util.Collections.<Integer, String>emptyMap() : instance.items); } - @java.lang.SuppressWarnings("all") - protected abstract B self(); - @java.lang.SuppressWarnings("all") - public abstract C build(); /** * @return {@code this}. */ @@ -66,6 +62,10 @@ public class SuperBuilderWithGenericsAndToBuilder { } return self(); } + @java.lang.SuppressWarnings("all") + protected abstract B self(); + @java.lang.SuppressWarnings("all") + public abstract C build(); @java.lang.Override @java.lang.SuppressWarnings("all") public java.lang.String toString() { @@ -132,12 +132,6 @@ public class SuperBuilderWithGenericsAndToBuilder { private static <A> void $fillValuesFromInstanceIntoBuilder(final SuperBuilderWithGenericsAndToBuilder.Child<A> instance, final SuperBuilderWithGenericsAndToBuilder.Child.ChildBuilder<A, ?, ?> b) { b.field3(instance.field3); } - @java.lang.Override - @java.lang.SuppressWarnings("all") - protected abstract B self(); - @java.lang.Override - @java.lang.SuppressWarnings("all") - public abstract C build(); /** * @return {@code this}. */ @@ -148,6 +142,12 @@ public class SuperBuilderWithGenericsAndToBuilder { } @java.lang.Override @java.lang.SuppressWarnings("all") + protected abstract B 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 "SuperBuilderWithGenericsAndToBuilder.Child.ChildBuilder(super=" + super.toString() + ", field3=" + this.field3 + ")"; } diff --git a/test/transform/resource/after-delombok/SuperBuilderWithNonNull.java b/test/transform/resource/after-delombok/SuperBuilderWithNonNull.java index a3e15e8d..f51b204d 100644 --- a/test/transform/resource/after-delombok/SuperBuilderWithNonNull.java +++ b/test/transform/resource/after-delombok/SuperBuilderWithNonNull.java @@ -14,10 +14,6 @@ public class SuperBuilderWithNonNull { private boolean nonNullParentField$set; @java.lang.SuppressWarnings("all") private String nonNullParentField$value; - @java.lang.SuppressWarnings("all") - protected abstract B self(); - @java.lang.SuppressWarnings("all") - public abstract C build(); /** * @return {@code this}. */ @@ -30,6 +26,10 @@ public class SuperBuilderWithNonNull { nonNullParentField$set = true; return self(); } + @java.lang.SuppressWarnings("all") + protected abstract B self(); + @java.lang.SuppressWarnings("all") + public abstract C build(); @java.lang.Override @java.lang.SuppressWarnings("all") public java.lang.String toString() { @@ -72,12 +72,6 @@ public class SuperBuilderWithNonNull { public static abstract class ChildBuilder<C extends SuperBuilderWithNonNull.Child, B extends SuperBuilderWithNonNull.Child.ChildBuilder<C, B>> extends Parent.ParentBuilder<C, B> { @java.lang.SuppressWarnings("all") private String nonNullChildField; - @java.lang.Override - @java.lang.SuppressWarnings("all") - protected abstract B self(); - @java.lang.Override - @java.lang.SuppressWarnings("all") - public abstract C build(); /** * @return {@code this}. */ @@ -91,6 +85,12 @@ public class SuperBuilderWithNonNull { } @java.lang.Override @java.lang.SuppressWarnings("all") + protected abstract B 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 "SuperBuilderWithNonNull.Child.ChildBuilder(super=" + super.toString() + ", nonNullChildField=" + this.nonNullChildField + ")"; } diff --git a/test/transform/resource/after-delombok/SuperBuilderWithOverloadedGeneratedMethods.java b/test/transform/resource/after-delombok/SuperBuilderWithOverloadedGeneratedMethods.java new file mode 100644 index 00000000..4c8b77a8 --- /dev/null +++ b/test/transform/resource/after-delombok/SuperBuilderWithOverloadedGeneratedMethods.java @@ -0,0 +1,106 @@ +public class SuperBuilderWithOverloadedGeneratedMethods { + public static class Parent { + int self; + @java.lang.SuppressWarnings("all") + public static abstract class ParentBuilder<C extends SuperBuilderWithOverloadedGeneratedMethods.Parent, B extends SuperBuilderWithOverloadedGeneratedMethods.Parent.ParentBuilder<C, B>> { + @java.lang.SuppressWarnings("all") + private int self; + /** + * @return {@code this}. + */ + @java.lang.SuppressWarnings("all") + public B self(final int self) { + this.self = self; + return self(); + } + @java.lang.SuppressWarnings("all") + protected abstract B self(); + @java.lang.SuppressWarnings("all") + public abstract C build(); + @java.lang.Override + @java.lang.SuppressWarnings("all") + public java.lang.String toString() { + return "SuperBuilderWithOverloadedGeneratedMethods.Parent.ParentBuilder(self=" + this.self + ")"; + } + } + @java.lang.SuppressWarnings("all") + private static final class ParentBuilderImpl extends SuperBuilderWithOverloadedGeneratedMethods.Parent.ParentBuilder<SuperBuilderWithOverloadedGeneratedMethods.Parent, SuperBuilderWithOverloadedGeneratedMethods.Parent.ParentBuilderImpl> { + @java.lang.SuppressWarnings("all") + private ParentBuilderImpl() { + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + protected SuperBuilderWithOverloadedGeneratedMethods.Parent.ParentBuilderImpl self() { + return this; + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public SuperBuilderWithOverloadedGeneratedMethods.Parent build() { + return new SuperBuilderWithOverloadedGeneratedMethods.Parent(this); + } + } + @java.lang.SuppressWarnings("all") + protected Parent(final SuperBuilderWithOverloadedGeneratedMethods.Parent.ParentBuilder<?, ?> b) { + this.self = b.self; + } + @java.lang.SuppressWarnings("all") + public static SuperBuilderWithOverloadedGeneratedMethods.Parent.ParentBuilder<?, ?> builder() { + return new SuperBuilderWithOverloadedGeneratedMethods.Parent.ParentBuilderImpl(); + } + } + public static class Child extends Parent { + double build; + @java.lang.SuppressWarnings("all") + public static abstract class ChildBuilder<C extends SuperBuilderWithOverloadedGeneratedMethods.Child, B extends SuperBuilderWithOverloadedGeneratedMethods.Child.ChildBuilder<C, B>> extends Parent.ParentBuilder<C, B> { + @java.lang.SuppressWarnings("all") + private double build; + /** + * @return {@code this}. + */ + @java.lang.SuppressWarnings("all") + public B build(final double build) { + this.build = build; + return self(); + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + protected abstract B 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 "SuperBuilderWithOverloadedGeneratedMethods.Child.ChildBuilder(super=" + super.toString() + ", build=" + this.build + ")"; + } + } + @java.lang.SuppressWarnings("all") + private static final class ChildBuilderImpl extends SuperBuilderWithOverloadedGeneratedMethods.Child.ChildBuilder<SuperBuilderWithOverloadedGeneratedMethods.Child, SuperBuilderWithOverloadedGeneratedMethods.Child.ChildBuilderImpl> { + @java.lang.SuppressWarnings("all") + private ChildBuilderImpl() { + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + protected SuperBuilderWithOverloadedGeneratedMethods.Child.ChildBuilderImpl self() { + return this; + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public SuperBuilderWithOverloadedGeneratedMethods.Child build() { + return new SuperBuilderWithOverloadedGeneratedMethods.Child(this); + } + } + @java.lang.SuppressWarnings("all") + protected Child(final SuperBuilderWithOverloadedGeneratedMethods.Child.ChildBuilder<?, ?> b) { + super(b); + this.build = b.build; + } + @java.lang.SuppressWarnings("all") + public static SuperBuilderWithOverloadedGeneratedMethods.Child.ChildBuilder<?, ?> builder() { + return new SuperBuilderWithOverloadedGeneratedMethods.Child.ChildBuilderImpl(); + } + } + public static void test() { + Child x = Child.builder().build(0.0).self(5).build(); + } +} diff --git a/test/transform/resource/after-delombok/SuperBuilderWithPrefixes.java b/test/transform/resource/after-delombok/SuperBuilderWithPrefixes.java index 16325113..04c23051 100644 --- a/test/transform/resource/after-delombok/SuperBuilderWithPrefixes.java +++ b/test/transform/resource/after-delombok/SuperBuilderWithPrefixes.java @@ -10,10 +10,6 @@ class SuperBuilderWithPrefixes { private int otherField; @java.lang.SuppressWarnings("all") private java.util.ArrayList<String> items; - @java.lang.SuppressWarnings("all") - protected abstract B self(); - @java.lang.SuppressWarnings("all") - public abstract C build(); /** * @return {@code this}. */ @@ -50,6 +46,10 @@ class SuperBuilderWithPrefixes { if (this.items != null) this.items.clear(); return self(); } + @java.lang.SuppressWarnings("all") + protected abstract B self(); + @java.lang.SuppressWarnings("all") + public abstract C build(); @java.lang.Override @java.lang.SuppressWarnings("all") public java.lang.String toString() { diff --git a/test/transform/resource/after-delombok/SuperBuilderWithSetterPrefix.java b/test/transform/resource/after-delombok/SuperBuilderWithSetterPrefix.java index 88db8511..a82e2eac 100644 --- a/test/transform/resource/after-delombok/SuperBuilderWithSetterPrefix.java +++ b/test/transform/resource/after-delombok/SuperBuilderWithSetterPrefix.java @@ -37,10 +37,6 @@ public class SuperBuilderWithSetterPrefix { b.withObtainViaStaticMethod(SuperBuilderWithSetterPrefix.Parent.staticMethod(instance)); b.withItems(instance.items == null ? java.util.Collections.<String>emptyList() : instance.items); } - @java.lang.SuppressWarnings("all") - protected abstract B self(); - @java.lang.SuppressWarnings("all") - public abstract C build(); /** * @return {@code this}. */ @@ -93,6 +89,10 @@ public class SuperBuilderWithSetterPrefix { if (this.items != null) this.items.clear(); return self(); } + @java.lang.SuppressWarnings("all") + protected abstract B self(); + @java.lang.SuppressWarnings("all") + public abstract C build(); @java.lang.Override @java.lang.SuppressWarnings("all") public java.lang.String toString() { @@ -160,12 +160,6 @@ public class SuperBuilderWithSetterPrefix { private static void $fillValuesFromInstanceIntoBuilder(final SuperBuilderWithSetterPrefix.Child instance, final SuperBuilderWithSetterPrefix.Child.ChildBuilder<?, ?> b) { b.setField3(instance.field3); } - @java.lang.Override - @java.lang.SuppressWarnings("all") - protected abstract B self(); - @java.lang.Override - @java.lang.SuppressWarnings("all") - public abstract C build(); /** * @return {@code this}. */ @@ -176,6 +170,12 @@ public class SuperBuilderWithSetterPrefix { } @java.lang.Override @java.lang.SuppressWarnings("all") + protected abstract B 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 "SuperBuilderWithSetterPrefix.Child.ChildBuilder(super=" + super.toString() + ", field3=" + this.field3 + ")"; } 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-delombok/ValSuperDefaultMethod.java b/test/transform/resource/after-delombok/ValSuperDefaultMethod.java new file mode 100644 index 00000000..5275a5e8 --- /dev/null +++ b/test/transform/resource/after-delombok/ValSuperDefaultMethod.java @@ -0,0 +1,12 @@ +// version :9 +class ValSuperDefaultMethod implements Default { + public void test() { + final java.lang.String a = ""; + Default.super.method(); + } +} + +interface Default { + default void method() { + } +}
\ No newline at end of file diff --git a/test/transform/resource/after-ecj/BuilderCustomName.java b/test/transform/resource/after-ecj/BuilderCustomName.java index 652bdf16..cb578ccd 100644 --- a/test/transform/resource/after-ecj/BuilderCustomName.java +++ b/test/transform/resource/after-ecj/BuilderCustomName.java @@ -5,8 +5,6 @@ import java.util.List; public SimpleTestBuilder() { super(); } - protected abstract @java.lang.SuppressWarnings("all") B self(); - public abstract @java.lang.SuppressWarnings("all") C build(); /** * @return {@code this}. */ @@ -14,6 +12,8 @@ import java.util.List; this.field = field; return self(); } + protected abstract @java.lang.SuppressWarnings("all") B self(); + public abstract @java.lang.SuppressWarnings("all") C build(); public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { return (("BuilderCustomName.SimpleTestBuilder(field=" + this.field) + ")"); } diff --git a/test/transform/resource/after-ecj/BuilderDefaultsArray.java b/test/transform/resource/after-ecj/BuilderDefaultsArray.java new file mode 100644 index 00000000..d25e0371 --- /dev/null +++ b/test/transform/resource/after-ecj/BuilderDefaultsArray.java @@ -0,0 +1,57 @@ +import lombok.Builder; +import lombok.Value; +public @Builder class BuilderDefaultsArray { + public static @java.lang.SuppressWarnings("all") class BuilderDefaultsArrayBuilder { + private @java.lang.SuppressWarnings("all") int[] x$value; + private @java.lang.SuppressWarnings("all") boolean x$set; + private @java.lang.SuppressWarnings("all") java.lang.String[][] y$value; + private @java.lang.SuppressWarnings("all") boolean y$set; + @java.lang.SuppressWarnings("all") BuilderDefaultsArrayBuilder() { + super(); + } + /** + * @return {@code this}. + */ + public @java.lang.SuppressWarnings("all") BuilderDefaultsArray.BuilderDefaultsArrayBuilder x(final int[] x) { + this.x$value = x; + x$set = true; + return this; + } + /** + * @return {@code this}. + */ + public @java.lang.SuppressWarnings("all") BuilderDefaultsArray.BuilderDefaultsArrayBuilder y(final java.lang.String[][] y) { + this.y$value = y; + y$set = true; + return this; + } + public @java.lang.SuppressWarnings("all") BuilderDefaultsArray build() { + int[] x$value = this.x$value; + if ((! this.x$set)) + x$value = BuilderDefaultsArray.$default$x(); + java.lang.String[][] y$value = this.y$value; + if ((! this.y$set)) + y$value = BuilderDefaultsArray.$default$y(); + return new BuilderDefaultsArray(x$value, y$value); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (((("BuilderDefaultsArray.BuilderDefaultsArrayBuilder(x$value=" + java.util.Arrays.toString(this.x$value)) + ", y$value=") + java.util.Arrays.deepToString(this.y$value)) + ")"); + } + } + @Builder.Default int[] x; + @Builder.Default java.lang.String[][] y; + private static @java.lang.SuppressWarnings("all") int[] $default$x() { + return new int[]{1, 2}; + } + private static @java.lang.SuppressWarnings("all") java.lang.String[][] $default$y() { + return new java.lang.String[][]{}; + } + @java.lang.SuppressWarnings("all") BuilderDefaultsArray(final int[] x, final java.lang.String[][] y) { + super(); + this.x = x; + this.y = y; + } + public static @java.lang.SuppressWarnings("all") BuilderDefaultsArray.BuilderDefaultsArrayBuilder builder() { + return new BuilderDefaultsArray.BuilderDefaultsArrayBuilder(); + } +}
\ No newline at end of file diff --git a/test/transform/resource/after-ecj/CheckerFrameworkSuperBuilder.java b/test/transform/resource/after-ecj/CheckerFrameworkSuperBuilder.java index 74a1c80f..228993e0 100644 --- a/test/transform/resource/after-ecj/CheckerFrameworkSuperBuilder.java +++ b/test/transform/resource/after-ecj/CheckerFrameworkSuperBuilder.java @@ -11,8 +11,6 @@ class CheckerFrameworkSuperBuilder { public ParentBuilder() { super(); } - protected abstract @org.checkerframework.dataflow.qual.Pure @java.lang.SuppressWarnings("all") @org.checkerframework.common.returnsreceiver.qual.This B self(); - public abstract @org.checkerframework.dataflow.qual.SideEffectFree @java.lang.SuppressWarnings("all") C build(CheckerFrameworkSuperBuilder.Parent. @org.checkerframework.checker.calledmethods.qual.CalledMethods({"y", "z"}) ParentBuilder<C, B> this); /** * @return {@code this}. */ @@ -56,6 +54,8 @@ class CheckerFrameworkSuperBuilder { this.names.clear(); return self(); } + protected abstract @org.checkerframework.dataflow.qual.Pure @java.lang.SuppressWarnings("all") @org.checkerframework.common.returnsreceiver.qual.This B self(); + public abstract @org.checkerframework.dataflow.qual.SideEffectFree @java.lang.SuppressWarnings("all") C build(CheckerFrameworkSuperBuilder.Parent. @org.checkerframework.checker.calledmethods.qual.CalledMethods({"y", "z"}) ParentBuilder<C, B> this); public @java.lang.Override @org.checkerframework.dataflow.qual.SideEffectFree @java.lang.SuppressWarnings("all") java.lang.String toString() { return (((((((("CheckerFrameworkSuperBuilder.Parent.ParentBuilder(x$value=" + this.x$value) + ", y=") + this.y) + ", z=") + this.z) + ", names=") + this.names) + ")"); } @@ -111,8 +111,6 @@ class CheckerFrameworkSuperBuilder { public ZChildBuilder() { super(); } - protected abstract @java.lang.Override @org.checkerframework.dataflow.qual.Pure @java.lang.SuppressWarnings("all") @org.checkerframework.common.returnsreceiver.qual.This B self(); - public abstract @java.lang.Override @org.checkerframework.dataflow.qual.SideEffectFree @java.lang.SuppressWarnings("all") C build(CheckerFrameworkSuperBuilder.ZChild. @org.checkerframework.checker.calledmethods.qual.CalledMethods("b") ZChildBuilder<C, B> this); /** * @return {@code this}. */ @@ -128,6 +126,8 @@ class CheckerFrameworkSuperBuilder { this.b = b; return self(); } + protected abstract @java.lang.Override @org.checkerframework.dataflow.qual.Pure @java.lang.SuppressWarnings("all") @org.checkerframework.common.returnsreceiver.qual.This B self(); + public abstract @java.lang.Override @org.checkerframework.dataflow.qual.SideEffectFree @java.lang.SuppressWarnings("all") C build(CheckerFrameworkSuperBuilder.ZChild. @org.checkerframework.checker.calledmethods.qual.CalledMethods("b") ZChildBuilder<C, B> this); public @java.lang.Override @org.checkerframework.dataflow.qual.SideEffectFree @java.lang.SuppressWarnings("all") java.lang.String toString() { return (((((("CheckerFrameworkSuperBuilder.ZChild.ZChildBuilder(super=" + super.toString()) + ", a$value=") + this.a$value) + ", b=") + this.b) + ")"); } diff --git a/test/transform/resource/after-ecj/ConstructorsWithSuperBuilderDefaults.java b/test/transform/resource/after-ecj/ConstructorsWithSuperBuilderDefaults.java index a6c97d3b..16a4ee92 100644 --- a/test/transform/resource/after-ecj/ConstructorsWithSuperBuilderDefaults.java +++ b/test/transform/resource/after-ecj/ConstructorsWithSuperBuilderDefaults.java @@ -10,8 +10,6 @@ import lombok.Builder; public ConstructorsWithSuperBuilderDefaultsBuilder() { super(); } - protected abstract @java.lang.SuppressWarnings("all") B self(); - public abstract @java.lang.SuppressWarnings("all") C build(); /** * @return {@code this}. */ @@ -27,6 +25,8 @@ import lombok.Builder; this.y = y; return self(); } + protected abstract @java.lang.SuppressWarnings("all") B self(); + public abstract @java.lang.SuppressWarnings("all") C build(); public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { return (((("ConstructorsWithSuperBuilderDefaults.ConstructorsWithSuperBuilderDefaultsBuilder(x$value=" + this.x$value) + ", y=") + this.y) + ")"); } diff --git a/test/transform/resource/after-ecj/ExtensionMethodNonStatic.java b/test/transform/resource/after-ecj/ExtensionMethodNonStatic.java new file mode 100644 index 00000000..e2362790 --- /dev/null +++ b/test/transform/resource/after-ecj/ExtensionMethodNonStatic.java @@ -0,0 +1,18 @@ +import lombok.experimental.ExtensionMethod; +@ExtensionMethod({ExtensionMethodNonStatic.Extensions.class}) class ExtensionMethodNonStatic { + static class Extensions { + Extensions() { + super(); + } + public boolean startsWith(String s, String prefix) { + return s.startsWith(prefix); + } + } + ExtensionMethodNonStatic() { + super(); + } + public void test() { + String s = "test"; + s.startsWith(""); + } +}
\ No newline at end of file diff --git a/test/transform/resource/after-ecj/JacksonizedSuperBuilderSimple.java b/test/transform/resource/after-ecj/JacksonizedSuperBuilderSimple.java index 46709a66..348d91a2 100644 --- a/test/transform/resource/after-ecj/JacksonizedSuperBuilderSimple.java +++ b/test/transform/resource/after-ecj/JacksonizedSuperBuilderSimple.java @@ -5,8 +5,6 @@ public class JacksonizedSuperBuilderSimple { public ParentBuilder() { super(); } - protected abstract @java.lang.SuppressWarnings("all") B self(); - public abstract @java.lang.SuppressWarnings("all") C build(); /** * @return {@code this}. */ @@ -14,6 +12,8 @@ public class JacksonizedSuperBuilderSimple { this.field1 = field1; return self(); } + protected abstract @java.lang.SuppressWarnings("all") B self(); + public abstract @java.lang.SuppressWarnings("all") C build(); public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { return (("JacksonizedSuperBuilderSimple.Parent.ParentBuilder(field1=" + this.field1) + ")"); } diff --git a/test/transform/resource/after-ecj/JacksonizedSuperBuilderWithJsonDeserialize.java b/test/transform/resource/after-ecj/JacksonizedSuperBuilderWithJsonDeserialize.java index 62938eea..a72da70b 100644 --- a/test/transform/resource/after-ecj/JacksonizedSuperBuilderWithJsonDeserialize.java +++ b/test/transform/resource/after-ecj/JacksonizedSuperBuilderWithJsonDeserialize.java @@ -4,8 +4,6 @@ public @lombok.extern.jackson.Jacksonized @lombok.experimental.SuperBuilder @com public JacksonizedSuperBuilderWithJsonDeserializeBuilder() { super(); } - protected abstract @java.lang.SuppressWarnings("all") B self(); - public abstract @java.lang.SuppressWarnings("all") C build(); /** * @return {@code this}. */ @@ -13,6 +11,8 @@ public @lombok.extern.jackson.Jacksonized @lombok.experimental.SuperBuilder @com this.field1 = field1; return self(); } + protected abstract @java.lang.SuppressWarnings("all") B self(); + public abstract @java.lang.SuppressWarnings("all") C build(); public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { return (("JacksonizedSuperBuilderWithJsonDeserialize.JacksonizedSuperBuilderWithJsonDeserializeBuilder(field1=" + this.field1) + ")"); } 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/NullAnnotatedCheckerFrameworkSuperBuilder.java b/test/transform/resource/after-ecj/NullAnnotatedCheckerFrameworkSuperBuilder.java index 94b708d2..f4a1c992 100644 --- a/test/transform/resource/after-ecj/NullAnnotatedCheckerFrameworkSuperBuilder.java +++ b/test/transform/resource/after-ecj/NullAnnotatedCheckerFrameworkSuperBuilder.java @@ -11,8 +11,6 @@ class NullAnnotatedCheckerFrameworkSuperBuilder { public ParentBuilder() { super(); } - protected abstract @java.lang.SuppressWarnings("all") B self(); - public abstract @java.lang.SuppressWarnings("all") C build(); /** * @return {@code this}. */ @@ -56,6 +54,8 @@ class NullAnnotatedCheckerFrameworkSuperBuilder { this.names.clear(); return self(); } + protected abstract @java.lang.SuppressWarnings("all") B self(); + public abstract @java.lang.SuppressWarnings("all") C build(); public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.@org.checkerframework.checker.nullness.qual.NonNull String toString() { return (((((((("NullAnnotatedCheckerFrameworkSuperBuilder.Parent.ParentBuilder(x$value=" + this.x$value) + ", y=") + this.y) + ", z=") + this.z) + ", names=") + this.names) + ")"); } @@ -111,8 +111,6 @@ class NullAnnotatedCheckerFrameworkSuperBuilder { public ZChildBuilder() { super(); } - protected abstract @java.lang.Override @java.lang.SuppressWarnings("all") B self(); - public abstract @java.lang.Override @java.lang.SuppressWarnings("all") C build(); /** * @return {@code this}. */ @@ -128,6 +126,8 @@ class NullAnnotatedCheckerFrameworkSuperBuilder { this.b = b; return self(); } + protected abstract @java.lang.Override @java.lang.SuppressWarnings("all") B self(); + public abstract @java.lang.Override @java.lang.SuppressWarnings("all") C build(); public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.@org.checkerframework.checker.nullness.qual.NonNull String toString() { return (((((("NullAnnotatedCheckerFrameworkSuperBuilder.ZChild.ZChildBuilder(super=" + super.toString()) + ", a$value=") + this.a$value) + ", b=") + this.b) + ")"); } diff --git a/test/transform/resource/after-ecj/SuperBuilderAbstract.java b/test/transform/resource/after-ecj/SuperBuilderAbstract.java index 2fef9451..c5d97c45 100644 --- a/test/transform/resource/after-ecj/SuperBuilderAbstract.java +++ b/test/transform/resource/after-ecj/SuperBuilderAbstract.java @@ -5,8 +5,6 @@ public class SuperBuilderAbstract { public ParentBuilder() { super(); } - protected abstract @java.lang.SuppressWarnings("all") B self(); - public abstract @java.lang.SuppressWarnings("all") C build(); /** * @return {@code this}. */ @@ -14,6 +12,8 @@ public class SuperBuilderAbstract { this.parentField = parentField; return self(); } + protected abstract @java.lang.SuppressWarnings("all") B self(); + public abstract @java.lang.SuppressWarnings("all") C build(); public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { return (("SuperBuilderAbstract.Parent.ParentBuilder(parentField=" + this.parentField) + ")"); } @@ -44,8 +44,6 @@ public class SuperBuilderAbstract { public ChildBuilder() { super(); } - protected abstract @java.lang.Override @java.lang.SuppressWarnings("all") B self(); - public abstract @java.lang.Override @java.lang.SuppressWarnings("all") C build(); /** * @return {@code this}. */ @@ -53,6 +51,8 @@ public class SuperBuilderAbstract { this.childField = childField; return self(); } + protected abstract @java.lang.Override @java.lang.SuppressWarnings("all") B 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 (((("SuperBuilderAbstract.Child.ChildBuilder(super=" + super.toString()) + ", childField=") + this.childField) + ")"); } @@ -69,8 +69,6 @@ public class SuperBuilderAbstract { public GrandChildBuilder() { super(); } - protected abstract @java.lang.Override @java.lang.SuppressWarnings("all") B self(); - public abstract @java.lang.Override @java.lang.SuppressWarnings("all") C build(); /** * @return {@code this}. */ @@ -78,6 +76,8 @@ public class SuperBuilderAbstract { this.grandChildField = grandChildField; return self(); } + protected abstract @java.lang.Override @java.lang.SuppressWarnings("all") B 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 (((("SuperBuilderAbstract.GrandChild.GrandChildBuilder(super=" + super.toString()) + ", grandChildField=") + this.grandChildField) + ")"); } diff --git a/test/transform/resource/after-ecj/SuperBuilderAbstractToBuilder.java b/test/transform/resource/after-ecj/SuperBuilderAbstractToBuilder.java index 2d2cd422..0ed393e9 100644 --- a/test/transform/resource/after-ecj/SuperBuilderAbstractToBuilder.java +++ b/test/transform/resource/after-ecj/SuperBuilderAbstractToBuilder.java @@ -12,8 +12,6 @@ public class SuperBuilderAbstractToBuilder { private static @java.lang.SuppressWarnings("all") void $fillValuesFromInstanceIntoBuilder(final SuperBuilderAbstractToBuilder.Parent instance, final SuperBuilderAbstractToBuilder.Parent.ParentBuilder<?, ?> b) { b.parentField(instance.parentField); } - protected abstract @java.lang.SuppressWarnings("all") B self(); - public abstract @java.lang.SuppressWarnings("all") C build(); /** * @return {@code this}. */ @@ -21,6 +19,8 @@ public class SuperBuilderAbstractToBuilder { this.parentField = parentField; return self(); } + protected abstract @java.lang.SuppressWarnings("all") B self(); + public abstract @java.lang.SuppressWarnings("all") C build(); public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { return (("SuperBuilderAbstractToBuilder.Parent.ParentBuilder(parentField=" + this.parentField) + ")"); } @@ -62,8 +62,6 @@ public class SuperBuilderAbstractToBuilder { private static @java.lang.SuppressWarnings("all") void $fillValuesFromInstanceIntoBuilder(final SuperBuilderAbstractToBuilder.Child instance, final SuperBuilderAbstractToBuilder.Child.ChildBuilder<?, ?> b) { b.childField(instance.childField); } - protected abstract @java.lang.Override @java.lang.SuppressWarnings("all") B self(); - public abstract @java.lang.Override @java.lang.SuppressWarnings("all") C build(); /** * @return {@code this}. */ @@ -71,6 +69,8 @@ public class SuperBuilderAbstractToBuilder { this.childField = childField; return self(); } + protected abstract @java.lang.Override @java.lang.SuppressWarnings("all") B 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 (((("SuperBuilderAbstractToBuilder.Child.ChildBuilder(super=" + super.toString()) + ", childField=") + this.childField) + ")"); } @@ -95,8 +95,6 @@ public class SuperBuilderAbstractToBuilder { private static @java.lang.SuppressWarnings("all") void $fillValuesFromInstanceIntoBuilder(final SuperBuilderAbstractToBuilder.GrandChild instance, final SuperBuilderAbstractToBuilder.GrandChild.GrandChildBuilder<?, ?> b) { b.grandChildField(instance.grandChildField); } - protected abstract @java.lang.Override @java.lang.SuppressWarnings("all") B self(); - public abstract @java.lang.Override @java.lang.SuppressWarnings("all") C build(); /** * @return {@code this}. */ @@ -104,6 +102,8 @@ public class SuperBuilderAbstractToBuilder { this.grandChildField = grandChildField; return self(); } + protected abstract @java.lang.Override @java.lang.SuppressWarnings("all") B 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 (((("SuperBuilderAbstractToBuilder.GrandChild.GrandChildBuilder(super=" + super.toString()) + ", grandChildField=") + this.grandChildField) + ")"); } diff --git a/test/transform/resource/after-ecj/SuperBuilderBasic.java b/test/transform/resource/after-ecj/SuperBuilderBasic.java index 844206d0..ad31a14b 100644 --- a/test/transform/resource/after-ecj/SuperBuilderBasic.java +++ b/test/transform/resource/after-ecj/SuperBuilderBasic.java @@ -7,8 +7,6 @@ public class SuperBuilderBasic { public ParentBuilder() { super(); } - protected abstract @java.lang.SuppressWarnings("all") B self(); - public abstract @java.lang.SuppressWarnings("all") C build(); /** * @return {@code this}. */ @@ -37,6 +35,8 @@ public class SuperBuilderBasic { this.items.clear(); return self(); } + protected abstract @java.lang.SuppressWarnings("all") B self(); + public abstract @java.lang.SuppressWarnings("all") C build(); public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { return (((("SuperBuilderBasic.Parent.ParentBuilder(field1=" + this.field1) + ", items=") + this.items) + ")"); } @@ -80,8 +80,6 @@ public class SuperBuilderBasic { public ChildBuilder() { super(); } - protected abstract @java.lang.Override @java.lang.SuppressWarnings("all") B self(); - public abstract @java.lang.Override @java.lang.SuppressWarnings("all") C build(); /** * @return {@code this}. */ @@ -89,6 +87,8 @@ public class SuperBuilderBasic { this.field3 = field3; return self(); } + protected abstract @java.lang.Override @java.lang.SuppressWarnings("all") B 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 (((("SuperBuilderBasic.Child.ChildBuilder(super=" + super.toString()) + ", field3=") + this.field3) + ")"); } diff --git a/test/transform/resource/after-ecj/SuperBuilderBasicToBuilder.java b/test/transform/resource/after-ecj/SuperBuilderBasicToBuilder.java index 67ee62f6..f29dfd37 100644 --- a/test/transform/resource/after-ecj/SuperBuilderBasicToBuilder.java +++ b/test/transform/resource/after-ecj/SuperBuilderBasicToBuilder.java @@ -21,8 +21,6 @@ public class SuperBuilderBasicToBuilder { b.obtainViaStaticMethod(SuperBuilderBasicToBuilder.Parent.staticMethod(instance)); b.items(((instance.items == null) ? java.util.Collections.<String>emptyList() : instance.items)); } - protected abstract @java.lang.SuppressWarnings("all") B self(); - public abstract @java.lang.SuppressWarnings("all") C build(); /** * @return {@code this}. */ @@ -72,6 +70,8 @@ public class SuperBuilderBasicToBuilder { this.items.clear(); return self(); } + protected abstract @java.lang.SuppressWarnings("all") B self(); + public abstract @java.lang.SuppressWarnings("all") C build(); public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { return (((((((((("SuperBuilderBasicToBuilder.Parent.ParentBuilder(field1=" + this.field1) + ", obtainViaField=") + this.obtainViaField) + ", obtainViaMethod=") + this.obtainViaMethod) + ", obtainViaStaticMethod=") + this.obtainViaStaticMethod) + ", items=") + this.items) + ")"); } @@ -138,8 +138,6 @@ public class SuperBuilderBasicToBuilder { private static @java.lang.SuppressWarnings("all") void $fillValuesFromInstanceIntoBuilder(final SuperBuilderBasicToBuilder.Child instance, final SuperBuilderBasicToBuilder.Child.ChildBuilder<?, ?> b) { b.field3(instance.field3); } - protected abstract @java.lang.Override @java.lang.SuppressWarnings("all") B self(); - public abstract @java.lang.Override @java.lang.SuppressWarnings("all") C build(); /** * @return {@code this}. */ @@ -147,6 +145,8 @@ public class SuperBuilderBasicToBuilder { this.field3 = field3; return self(); } + protected abstract @java.lang.Override @java.lang.SuppressWarnings("all") B 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 (((("SuperBuilderBasicToBuilder.Child.ChildBuilder(super=" + super.toString()) + ", field3=") + this.field3) + ")"); } diff --git a/test/transform/resource/after-ecj/SuperBuilderCustomized.java b/test/transform/resource/after-ecj/SuperBuilderCustomized.java index 1fb41367..e84ffe14 100644 --- a/test/transform/resource/after-ecj/SuperBuilderCustomized.java +++ b/test/transform/resource/after-ecj/SuperBuilderCustomized.java @@ -60,8 +60,6 @@ public class SuperBuilderCustomized { public ChildBuilder() { super(); } - protected abstract @java.lang.Override @java.lang.SuppressWarnings("all") B self(); - public abstract @java.lang.Override @java.lang.SuppressWarnings("all") C build(); /** * @return {@code this}. */ @@ -69,6 +67,8 @@ public class SuperBuilderCustomized { this.field2 = field2; return self(); } + protected abstract @java.lang.Override @java.lang.SuppressWarnings("all") B 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 (((("SuperBuilderCustomized.Child.ChildBuilder(super=" + super.toString()) + ", field2=") + this.field2) + ")"); } diff --git a/test/transform/resource/after-ecj/SuperBuilderInitializer.java b/test/transform/resource/after-ecj/SuperBuilderInitializer.java index 0425fb89..9143be94 100644 --- a/test/transform/resource/after-ecj/SuperBuilderInitializer.java +++ b/test/transform/resource/after-ecj/SuperBuilderInitializer.java @@ -6,8 +6,6 @@ class SuperBuilderInitializer { public OneBuilder() { super(); } - protected abstract @java.lang.SuppressWarnings("all") B self(); - public abstract @java.lang.SuppressWarnings("all") C build(); /** * @return {@code this}. */ @@ -15,6 +13,8 @@ class SuperBuilderInitializer { this.world = world; return self(); } + protected abstract @java.lang.SuppressWarnings("all") B self(); + public abstract @java.lang.SuppressWarnings("all") C build(); public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { return (("SuperBuilderInitializer.One.OneBuilder(world=" + this.world) + ")"); } diff --git a/test/transform/resource/after-ecj/SuperBuilderNameClashes.java b/test/transform/resource/after-ecj/SuperBuilderNameClashes.java index 44d3db92..7f8507ce 100644 --- a/test/transform/resource/after-ecj/SuperBuilderNameClashes.java +++ b/test/transform/resource/after-ecj/SuperBuilderNameClashes.java @@ -68,8 +68,6 @@ public class SuperBuilderNameClashes { public CBuilder() { super(); } - protected abstract @java.lang.SuppressWarnings("all") B self(); - public abstract @java.lang.SuppressWarnings("all") C3 build(); /** * @return {@code this}. */ @@ -77,6 +75,8 @@ public class SuperBuilderNameClashes { this.c2 = c2; return self(); } + protected abstract @java.lang.SuppressWarnings("all") B self(); + public abstract @java.lang.SuppressWarnings("all") C3 build(); public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { return (("SuperBuilderNameClashes.C.CBuilder(c2=" + this.c2) + ")"); } @@ -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/after-ecj/SuperBuilderSingularAnnotatedTypes.java b/test/transform/resource/after-ecj/SuperBuilderSingularAnnotatedTypes.java index eac26153..1915e765 100644 --- a/test/transform/resource/after-ecj/SuperBuilderSingularAnnotatedTypes.java +++ b/test/transform/resource/after-ecj/SuperBuilderSingularAnnotatedTypes.java @@ -14,8 +14,6 @@ import lombok.Singular; public SuperBuilderSingularAnnotatedTypesBuilder() { super(); } - protected abstract @java.lang.SuppressWarnings("all") B self(); - public abstract @java.lang.SuppressWarnings("all") C build(); public @java.lang.SuppressWarnings("all") B foo(final @MyAnnotation @NonNull String foo) { if ((foo == null)) { @@ -84,6 +82,8 @@ import lombok.Singular; } return self(); } + protected abstract @java.lang.SuppressWarnings("all") B self(); + public abstract @java.lang.SuppressWarnings("all") C build(); public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { return (((((("SuperBuilderSingularAnnotatedTypes.SuperBuilderSingularAnnotatedTypesBuilder(foos=" + this.foos) + ", bars$key=") + this.bars$key) + ", bars$value=") + this.bars$value) + ")"); } diff --git a/test/transform/resource/after-ecj/SuperBuilderSingularCustomized.java b/test/transform/resource/after-ecj/SuperBuilderSingularCustomized.java index 613edb03..da9d0c3b 100644 --- a/test/transform/resource/after-ecj/SuperBuilderSingularCustomized.java +++ b/test/transform/resource/after-ecj/SuperBuilderSingularCustomized.java @@ -8,8 +8,6 @@ import java.util.Set; public B custom(final String value) { return self(); } - protected abstract @java.lang.SuppressWarnings("all") B self(); - public abstract @java.lang.SuppressWarnings("all") C build(); public @java.lang.SuppressWarnings("all") B foo(final String foo) { if ((this.foos == null)) this.foos = new java.util.ArrayList<String>(); @@ -31,6 +29,8 @@ import java.util.Set; this.foos.clear(); return self(); } + protected abstract @java.lang.SuppressWarnings("all") B self(); + public abstract @java.lang.SuppressWarnings("all") C build(); public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { return (("SuperBuilderSingularCustomized.SuperBuilderSingularCustomizedBuilder(foos=" + this.foos) + ")"); } diff --git a/test/transform/resource/after-ecj/SuperBuilderSingularToBuilderGuava.java b/test/transform/resource/after-ecj/SuperBuilderSingularToBuilderGuava.java index 76a80781..62146b99 100644 --- a/test/transform/resource/after-ecj/SuperBuilderSingularToBuilderGuava.java +++ b/test/transform/resource/after-ecj/SuperBuilderSingularToBuilderGuava.java @@ -20,8 +20,6 @@ public class SuperBuilderSingularToBuilderGuava { b.passes(((instance.passes == null) ? com.google.common.collect.ImmutableSortedSet.<String>of() : instance.passes)); b.users(((instance.users == null) ? com.google.common.collect.ImmutableTable.<Number, Number, String>of() : instance.users)); } - protected abstract @java.lang.SuppressWarnings("all") B self(); - public abstract @java.lang.SuppressWarnings("all") C build(); public @java.lang.SuppressWarnings("all") B card(final T card) { if ((this.cards == null)) this.cards = com.google.common.collect.ImmutableList.builder(); @@ -122,6 +120,8 @@ public class SuperBuilderSingularToBuilderGuava { this.users = null; return self(); } + protected abstract @java.lang.SuppressWarnings("all") B self(); + public abstract @java.lang.SuppressWarnings("all") C build(); public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { return (((((((((("SuperBuilderSingularToBuilderGuava.Parent.ParentBuilder(cards=" + this.cards) + ", frogs=") + this.frogs) + ", rawSet=") + this.rawSet) + ", passes=") + this.passes) + ", users=") + this.users) + ")"); } @@ -176,8 +176,6 @@ public class SuperBuilderSingularToBuilderGuava { private static @java.lang.SuppressWarnings("all") <T>void $fillValuesFromInstanceIntoBuilder(final SuperBuilderSingularToBuilderGuava.Child<T> instance, final SuperBuilderSingularToBuilderGuava.Child.ChildBuilder<T, ?, ?> b) { b.field3(instance.field3); } - protected abstract @java.lang.Override @java.lang.SuppressWarnings("all") B self(); - public abstract @java.lang.Override @java.lang.SuppressWarnings("all") C build(); /** * @return {@code this}. */ @@ -185,6 +183,8 @@ public class SuperBuilderSingularToBuilderGuava { this.field3 = field3; return self(); } + protected abstract @java.lang.Override @java.lang.SuppressWarnings("all") B 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 (((("SuperBuilderSingularToBuilderGuava.Child.ChildBuilder(super=" + super.toString()) + ", field3=") + this.field3) + ")"); } diff --git a/test/transform/resource/after-ecj/SuperBuilderWithCustomBuilderMethod.java b/test/transform/resource/after-ecj/SuperBuilderWithCustomBuilderMethod.java index 93b78c3d..7706e788 100644 --- a/test/transform/resource/after-ecj/SuperBuilderWithCustomBuilderMethod.java +++ b/test/transform/resource/after-ecj/SuperBuilderWithCustomBuilderMethod.java @@ -7,8 +7,6 @@ public class SuperBuilderWithCustomBuilderMethod { public ParentBuilder() { super(); } - protected abstract @java.lang.SuppressWarnings("all") B self(); - public abstract @java.lang.SuppressWarnings("all") C build(); /** * @return {@code this}. */ @@ -37,6 +35,8 @@ public class SuperBuilderWithCustomBuilderMethod { this.items.clear(); return self(); } + protected abstract @java.lang.SuppressWarnings("all") B self(); + public abstract @java.lang.SuppressWarnings("all") C build(); public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { return (((("SuperBuilderWithCustomBuilderMethod.Parent.ParentBuilder(field1=" + this.field1) + ", items=") + this.items) + ")"); } @@ -80,8 +80,6 @@ public class SuperBuilderWithCustomBuilderMethod { public ChildBuilder() { super(); } - protected abstract @java.lang.Override @java.lang.SuppressWarnings("all") B self(); - public abstract @java.lang.Override @java.lang.SuppressWarnings("all") C build(); /** * @return {@code this}. */ @@ -89,6 +87,8 @@ public class SuperBuilderWithCustomBuilderMethod { this.field3 = field3; return self(); } + protected abstract @java.lang.Override @java.lang.SuppressWarnings("all") B 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 (((("SuperBuilderWithCustomBuilderMethod.Child.ChildBuilder(super=" + super.toString()) + ", field3=") + this.field3) + ")"); } diff --git a/test/transform/resource/after-ecj/SuperBuilderWithDefaults.java b/test/transform/resource/after-ecj/SuperBuilderWithDefaults.java index 7c5a344a..b4edad5b 100644 --- a/test/transform/resource/after-ecj/SuperBuilderWithDefaults.java +++ b/test/transform/resource/after-ecj/SuperBuilderWithDefaults.java @@ -9,8 +9,6 @@ public class SuperBuilderWithDefaults { public ParentBuilder() { super(); } - protected abstract @java.lang.SuppressWarnings("all") B self(); - public abstract @java.lang.SuppressWarnings("all") C build(); /** * @return {@code this}. */ @@ -27,6 +25,8 @@ public class SuperBuilderWithDefaults { numberField$set = true; return self(); } + protected abstract @java.lang.SuppressWarnings("all") B self(); + public abstract @java.lang.SuppressWarnings("all") C build(); public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { return (((("SuperBuilderWithDefaults.Parent.ParentBuilder(millis$value=" + this.millis$value) + ", numberField$value=") + this.numberField$value) + ")"); } @@ -72,8 +72,6 @@ public class SuperBuilderWithDefaults { public ChildBuilder() { super(); } - protected abstract @java.lang.Override @java.lang.SuppressWarnings("all") B self(); - public abstract @java.lang.Override @java.lang.SuppressWarnings("all") C build(); /** * @return {@code this}. */ @@ -82,6 +80,8 @@ public class SuperBuilderWithDefaults { doubleField$set = true; return self(); } + protected abstract @java.lang.Override @java.lang.SuppressWarnings("all") B 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 (((("SuperBuilderWithDefaults.Child.ChildBuilder(super=" + super.toString()) + ", doubleField$value=") + this.doubleField$value) + ")"); } diff --git a/test/transform/resource/after-ecj/SuperBuilderWithDefaultsAndTargetTyping.java b/test/transform/resource/after-ecj/SuperBuilderWithDefaultsAndTargetTyping.java index 20fe1351..d4744e9b 100644 --- a/test/transform/resource/after-ecj/SuperBuilderWithDefaultsAndTargetTyping.java +++ b/test/transform/resource/after-ecj/SuperBuilderWithDefaultsAndTargetTyping.java @@ -8,8 +8,6 @@ public class SuperBuilderWithDefaultsAndTargetTyping { public ParentBuilder() { super(); } - protected abstract @java.lang.SuppressWarnings("all") B self(); - public abstract @java.lang.SuppressWarnings("all") C build(); /** * @return {@code this}. */ @@ -18,6 +16,8 @@ public class SuperBuilderWithDefaultsAndTargetTyping { foo$set = true; return self(); } + protected abstract @java.lang.SuppressWarnings("all") B self(); + public abstract @java.lang.SuppressWarnings("all") C build(); public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { return (("SuperBuilderWithDefaultsAndTargetTyping.Parent.ParentBuilder(foo$value=" + this.foo$value) + ")"); } @@ -55,8 +55,6 @@ public class SuperBuilderWithDefaultsAndTargetTyping { public ChildBuilder() { super(); } - protected abstract @java.lang.Override @java.lang.SuppressWarnings("all") B self(); - public abstract @java.lang.Override @java.lang.SuppressWarnings("all") C build(); /** * @return {@code this}. */ @@ -65,6 +63,8 @@ public class SuperBuilderWithDefaultsAndTargetTyping { foo$set = true; return self(); } + protected abstract @java.lang.Override @java.lang.SuppressWarnings("all") B 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 (((("SuperBuilderWithDefaultsAndTargetTyping.Child.ChildBuilder(super=" + super.toString()) + ", foo$value=") + this.foo$value) + ")"); } diff --git a/test/transform/resource/after-ecj/SuperBuilderWithGenerics.java b/test/transform/resource/after-ecj/SuperBuilderWithGenerics.java index db989687..b8a4fab9 100644 --- a/test/transform/resource/after-ecj/SuperBuilderWithGenerics.java +++ b/test/transform/resource/after-ecj/SuperBuilderWithGenerics.java @@ -7,8 +7,6 @@ public class SuperBuilderWithGenerics { public ParentBuilder() { super(); } - protected abstract @java.lang.SuppressWarnings("all") B self(); - public abstract @java.lang.SuppressWarnings("all") C build(); /** * @return {@code this}. */ @@ -37,6 +35,8 @@ public class SuperBuilderWithGenerics { this.items.clear(); return self(); } + protected abstract @java.lang.SuppressWarnings("all") B self(); + public abstract @java.lang.SuppressWarnings("all") C build(); public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { return (((("SuperBuilderWithGenerics.Parent.ParentBuilder(field1=" + this.field1) + ", items=") + this.items) + ")"); } @@ -80,8 +80,6 @@ public class SuperBuilderWithGenerics { public ChildBuilder() { super(); } - protected abstract @java.lang.Override @java.lang.SuppressWarnings("all") B self(); - public abstract @java.lang.Override @java.lang.SuppressWarnings("all") C build(); /** * @return {@code this}. */ @@ -89,6 +87,8 @@ public class SuperBuilderWithGenerics { this.field3 = field3; return self(); } + protected abstract @java.lang.Override @java.lang.SuppressWarnings("all") B 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 (((("SuperBuilderWithGenerics.Child.ChildBuilder(super=" + super.toString()) + ", field3=") + this.field3) + ")"); } diff --git a/test/transform/resource/after-ecj/SuperBuilderWithGenerics2.java b/test/transform/resource/after-ecj/SuperBuilderWithGenerics2.java index 96e681f4..d42f9d19 100644 --- a/test/transform/resource/after-ecj/SuperBuilderWithGenerics2.java +++ b/test/transform/resource/after-ecj/SuperBuilderWithGenerics2.java @@ -7,8 +7,6 @@ public class SuperBuilderWithGenerics2 { public ParentBuilder() { super(); } - protected abstract @java.lang.SuppressWarnings("all") B self(); - public abstract @java.lang.SuppressWarnings("all") C build(); /** * @return {@code this}. */ @@ -37,6 +35,8 @@ public class SuperBuilderWithGenerics2 { this.items.clear(); return self(); } + protected abstract @java.lang.SuppressWarnings("all") B self(); + public abstract @java.lang.SuppressWarnings("all") C build(); public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { return (((("SuperBuilderWithGenerics2.Parent.ParentBuilder(field1=" + this.field1) + ", items=") + this.items) + ")"); } @@ -80,8 +80,6 @@ public class SuperBuilderWithGenerics2 { public ChildBuilder() { super(); } - protected abstract @java.lang.Override @java.lang.SuppressWarnings("all") B self(); - public abstract @java.lang.Override @java.lang.SuppressWarnings("all") C build(); /** * @return {@code this}. */ @@ -89,6 +87,8 @@ public class SuperBuilderWithGenerics2 { this.field3 = field3; return self(); } + protected abstract @java.lang.Override @java.lang.SuppressWarnings("all") B 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 (((("SuperBuilderWithGenerics2.Child.ChildBuilder(super=" + super.toString()) + ", field3=") + this.field3) + ")"); } diff --git a/test/transform/resource/after-ecj/SuperBuilderWithGenerics3.java b/test/transform/resource/after-ecj/SuperBuilderWithGenerics3.java index 8184bb05..0b369835 100644 --- a/test/transform/resource/after-ecj/SuperBuilderWithGenerics3.java +++ b/test/transform/resource/after-ecj/SuperBuilderWithGenerics3.java @@ -6,8 +6,6 @@ public class SuperBuilderWithGenerics3 { public ParentBuilder() { super(); } - protected abstract @java.lang.SuppressWarnings("all") B self(); - public abstract @java.lang.SuppressWarnings("all") C build(); /** * @return {@code this}. */ @@ -15,6 +13,8 @@ public class SuperBuilderWithGenerics3 { this.str = str; return self(); } + protected abstract @java.lang.SuppressWarnings("all") B self(); + public abstract @java.lang.SuppressWarnings("all") C build(); public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { return (("SuperBuilderWithGenerics3.Parent.ParentBuilder(str=" + this.str) + ")"); } @@ -50,8 +50,6 @@ public class SuperBuilderWithGenerics3 { public ChildBuilder() { super(); } - protected abstract @java.lang.Override @java.lang.SuppressWarnings("all") B self(); - public abstract @java.lang.Override @java.lang.SuppressWarnings("all") C build(); /** * @return {@code this}. */ @@ -59,6 +57,8 @@ public class SuperBuilderWithGenerics3 { this.field3 = field3; return self(); } + protected abstract @java.lang.Override @java.lang.SuppressWarnings("all") B 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 (((("SuperBuilderWithGenerics3.Child.ChildBuilder(super=" + super.toString()) + ", field3=") + this.field3) + ")"); } diff --git a/test/transform/resource/after-ecj/SuperBuilderWithGenericsAndToBuilder.java b/test/transform/resource/after-ecj/SuperBuilderWithGenericsAndToBuilder.java index 829b50b9..e7d5dfae 100644 --- a/test/transform/resource/after-ecj/SuperBuilderWithGenericsAndToBuilder.java +++ b/test/transform/resource/after-ecj/SuperBuilderWithGenericsAndToBuilder.java @@ -16,8 +16,6 @@ public class SuperBuilderWithGenericsAndToBuilder { b.field1(instance.field1); b.items(((instance.items == null) ? java.util.Collections.<Integer, String>emptyMap() : instance.items)); } - protected abstract @java.lang.SuppressWarnings("all") B self(); - public abstract @java.lang.SuppressWarnings("all") C build(); /** * @return {@code this}. */ @@ -60,6 +58,8 @@ public class SuperBuilderWithGenericsAndToBuilder { } return self(); } + protected abstract @java.lang.SuppressWarnings("all") B self(); + public abstract @java.lang.SuppressWarnings("all") C build(); public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { return (((((("SuperBuilderWithGenericsAndToBuilder.Parent.ParentBuilder(field1=" + this.field1) + ", items$key=") + this.items$key) + ", items$value=") + this.items$value) + ")"); } @@ -117,8 +117,6 @@ public class SuperBuilderWithGenericsAndToBuilder { private static @java.lang.SuppressWarnings("all") <A>void $fillValuesFromInstanceIntoBuilder(final SuperBuilderWithGenericsAndToBuilder.Child<A> instance, final SuperBuilderWithGenericsAndToBuilder.Child.ChildBuilder<A, ?, ?> b) { b.field3(instance.field3); } - protected abstract @java.lang.Override @java.lang.SuppressWarnings("all") B self(); - public abstract @java.lang.Override @java.lang.SuppressWarnings("all") C build(); /** * @return {@code this}. */ @@ -126,6 +124,8 @@ public class SuperBuilderWithGenericsAndToBuilder { this.field3 = field3; return self(); } + protected abstract @java.lang.Override @java.lang.SuppressWarnings("all") B 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 (((("SuperBuilderWithGenericsAndToBuilder.Child.ChildBuilder(super=" + super.toString()) + ", field3=") + this.field3) + ")"); } diff --git a/test/transform/resource/after-ecj/SuperBuilderWithNonNull.java b/test/transform/resource/after-ecj/SuperBuilderWithNonNull.java index 28504f29..c7157649 100644 --- a/test/transform/resource/after-ecj/SuperBuilderWithNonNull.java +++ b/test/transform/resource/after-ecj/SuperBuilderWithNonNull.java @@ -7,8 +7,6 @@ public class SuperBuilderWithNonNull { public ParentBuilder() { super(); } - protected abstract @java.lang.SuppressWarnings("all") B self(); - public abstract @java.lang.SuppressWarnings("all") C build(); /** * @return {@code this}. */ @@ -21,6 +19,8 @@ public class SuperBuilderWithNonNull { nonNullParentField$set = true; return self(); } + protected abstract @java.lang.SuppressWarnings("all") B self(); + public abstract @java.lang.SuppressWarnings("all") C build(); public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { return (("SuperBuilderWithNonNull.Parent.ParentBuilder(nonNullParentField$value=" + this.nonNullParentField$value) + ")"); } @@ -61,8 +61,6 @@ public class SuperBuilderWithNonNull { public ChildBuilder() { super(); } - protected abstract @java.lang.Override @java.lang.SuppressWarnings("all") B self(); - public abstract @java.lang.Override @java.lang.SuppressWarnings("all") C build(); /** * @return {@code this}. */ @@ -74,6 +72,8 @@ public class SuperBuilderWithNonNull { this.nonNullChildField = nonNullChildField; return self(); } + protected abstract @java.lang.Override @java.lang.SuppressWarnings("all") B 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 (((("SuperBuilderWithNonNull.Child.ChildBuilder(super=" + super.toString()) + ", nonNullChildField=") + this.nonNullChildField) + ")"); } diff --git a/test/transform/resource/after-ecj/SuperBuilderWithOverloadedGeneratedMethods.java b/test/transform/resource/after-ecj/SuperBuilderWithOverloadedGeneratedMethods.java new file mode 100644 index 00000000..1c5e25c2 --- /dev/null +++ b/test/transform/resource/after-ecj/SuperBuilderWithOverloadedGeneratedMethods.java @@ -0,0 +1,86 @@ +public class SuperBuilderWithOverloadedGeneratedMethods { + public static @lombok.experimental.SuperBuilder class Parent { + public static abstract @java.lang.SuppressWarnings("all") class ParentBuilder<C extends SuperBuilderWithOverloadedGeneratedMethods.Parent, B extends SuperBuilderWithOverloadedGeneratedMethods.Parent.ParentBuilder<C, B>> { + private @java.lang.SuppressWarnings("all") int self; + public ParentBuilder() { + super(); + } + /** + * @return {@code this}. + */ + public @java.lang.SuppressWarnings("all") B self(final int self) { + this.self = self; + return self(); + } + protected abstract @java.lang.SuppressWarnings("all") B self(); + public abstract @java.lang.SuppressWarnings("all") C build(); + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (("SuperBuilderWithOverloadedGeneratedMethods.Parent.ParentBuilder(self=" + this.self) + ")"); + } + } + private static final @java.lang.SuppressWarnings("all") class ParentBuilderImpl extends SuperBuilderWithOverloadedGeneratedMethods.Parent.ParentBuilder<SuperBuilderWithOverloadedGeneratedMethods.Parent, SuperBuilderWithOverloadedGeneratedMethods.Parent.ParentBuilderImpl> { + private ParentBuilderImpl() { + super(); + } + protected @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderWithOverloadedGeneratedMethods.Parent.ParentBuilderImpl self() { + return this; + } + public @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderWithOverloadedGeneratedMethods.Parent build() { + return new SuperBuilderWithOverloadedGeneratedMethods.Parent(this); + } + } + int self; + protected @java.lang.SuppressWarnings("all") Parent(final SuperBuilderWithOverloadedGeneratedMethods.Parent.ParentBuilder<?, ?> b) { + super(); + this.self = b.self; + } + public static @java.lang.SuppressWarnings("all") SuperBuilderWithOverloadedGeneratedMethods.Parent.ParentBuilder<?, ?> builder() { + return new SuperBuilderWithOverloadedGeneratedMethods.Parent.ParentBuilderImpl(); + } + } + public static @lombok.experimental.SuperBuilder class Child extends Parent { + public static abstract @java.lang.SuppressWarnings("all") class ChildBuilder<C extends SuperBuilderWithOverloadedGeneratedMethods.Child, B extends SuperBuilderWithOverloadedGeneratedMethods.Child.ChildBuilder<C, B>> extends Parent.ParentBuilder<C, B> { + private @java.lang.SuppressWarnings("all") double build; + public ChildBuilder() { + super(); + } + /** + * @return {@code this}. + */ + public @java.lang.SuppressWarnings("all") B build(final double build) { + this.build = build; + return self(); + } + protected abstract @java.lang.Override @java.lang.SuppressWarnings("all") B 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 (((("SuperBuilderWithOverloadedGeneratedMethods.Child.ChildBuilder(super=" + super.toString()) + ", build=") + this.build) + ")"); + } + } + private static final @java.lang.SuppressWarnings("all") class ChildBuilderImpl extends SuperBuilderWithOverloadedGeneratedMethods.Child.ChildBuilder<SuperBuilderWithOverloadedGeneratedMethods.Child, SuperBuilderWithOverloadedGeneratedMethods.Child.ChildBuilderImpl> { + private ChildBuilderImpl() { + super(); + } + protected @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderWithOverloadedGeneratedMethods.Child.ChildBuilderImpl self() { + return this; + } + public @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderWithOverloadedGeneratedMethods.Child build() { + return new SuperBuilderWithOverloadedGeneratedMethods.Child(this); + } + } + double build; + protected @java.lang.SuppressWarnings("all") Child(final SuperBuilderWithOverloadedGeneratedMethods.Child.ChildBuilder<?, ?> b) { + super(b); + this.build = b.build; + } + public static @java.lang.SuppressWarnings("all") SuperBuilderWithOverloadedGeneratedMethods.Child.ChildBuilder<?, ?> builder() { + return new SuperBuilderWithOverloadedGeneratedMethods.Child.ChildBuilderImpl(); + } + } + public SuperBuilderWithOverloadedGeneratedMethods() { + super(); + } + public static void test() { + Child x = Child.builder().build(0.0).self(5).build(); + } +} diff --git a/test/transform/resource/after-ecj/SuperBuilderWithPrefixes.java b/test/transform/resource/after-ecj/SuperBuilderWithPrefixes.java index 303d53f6..ec035ba1 100644 --- a/test/transform/resource/after-ecj/SuperBuilderWithPrefixes.java +++ b/test/transform/resource/after-ecj/SuperBuilderWithPrefixes.java @@ -6,8 +6,6 @@ public SuperBuilderWithPrefixesBuilder() { super(); } - protected abstract @java.lang.SuppressWarnings("all") B self(); - public abstract @java.lang.SuppressWarnings("all") C build(); /** * @return {@code this}. */ @@ -43,6 +41,8 @@ this.items.clear(); return self(); } + protected abstract @java.lang.SuppressWarnings("all") B self(); + public abstract @java.lang.SuppressWarnings("all") C build(); public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { return (((((("SuperBuilderWithPrefixes.SuperBuilderWithPrefixesBuilder(field=" + this.field) + ", otherField=") + this.otherField) + ", items=") + this.items) + ")"); } diff --git a/test/transform/resource/after-ecj/SuperBuilderWithSetterPrefix.java b/test/transform/resource/after-ecj/SuperBuilderWithSetterPrefix.java index 3a1278c1..9f13b7ac 100644 --- a/test/transform/resource/after-ecj/SuperBuilderWithSetterPrefix.java +++ b/test/transform/resource/after-ecj/SuperBuilderWithSetterPrefix.java @@ -21,8 +21,6 @@ public class SuperBuilderWithSetterPrefix { b.withObtainViaStaticMethod(SuperBuilderWithSetterPrefix.Parent.staticMethod(instance)); b.withItems(((instance.items == null) ? java.util.Collections.<String>emptyList() : instance.items)); } - protected abstract @java.lang.SuppressWarnings("all") B self(); - public abstract @java.lang.SuppressWarnings("all") C build(); /** * @return {@code this}. */ @@ -72,6 +70,8 @@ public class SuperBuilderWithSetterPrefix { this.items.clear(); return self(); } + protected abstract @java.lang.SuppressWarnings("all") B self(); + public abstract @java.lang.SuppressWarnings("all") C build(); public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { return (((((((((("SuperBuilderWithSetterPrefix.Parent.ParentBuilder(field1=" + this.field1) + ", obtainViaField=") + this.obtainViaField) + ", obtainViaMethod=") + this.obtainViaMethod) + ", obtainViaStaticMethod=") + this.obtainViaStaticMethod) + ", items=") + this.items) + ")"); } @@ -138,8 +138,6 @@ public class SuperBuilderWithSetterPrefix { private static @java.lang.SuppressWarnings("all") void $fillValuesFromInstanceIntoBuilder(final SuperBuilderWithSetterPrefix.Child instance, final SuperBuilderWithSetterPrefix.Child.ChildBuilder<?, ?> b) { b.setField3(instance.field3); } - protected abstract @java.lang.Override @java.lang.SuppressWarnings("all") B self(); - public abstract @java.lang.Override @java.lang.SuppressWarnings("all") C build(); /** * @return {@code this}. */ @@ -147,6 +145,8 @@ public class SuperBuilderWithSetterPrefix { this.field3 = field3; return self(); } + protected abstract @java.lang.Override @java.lang.SuppressWarnings("all") B 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 (((("SuperBuilderWithSetterPrefix.Child.ChildBuilder(super=" + super.toString()) + ", field3=") + this.field3) + ")"); } diff --git a/test/transform/resource/after-ecj/ValSuperDefaultMethod.java b/test/transform/resource/after-ecj/ValSuperDefaultMethod.java new file mode 100644 index 00000000..cb0ec47c --- /dev/null +++ b/test/transform/resource/after-ecj/ValSuperDefaultMethod.java @@ -0,0 +1,14 @@ +import lombok.val; +class ValSuperDefaultMethod implements Default { + ValSuperDefaultMethod() { + super(); + } + public void test() { + final @val java.lang.String a = ""; + Default.super.method(); + } +} +interface Default { + default void method() { + } +}
\ No newline at end of file diff --git a/test/transform/resource/before/BuilderDefaultsArray.java b/test/transform/resource/before/BuilderDefaultsArray.java new file mode 100644 index 00000000..11fabc6a --- /dev/null +++ b/test/transform/resource/before/BuilderDefaultsArray.java @@ -0,0 +1,11 @@ +import lombok.Builder; +import lombok.Value; + +@Builder +public class BuilderDefaultsArray { + @Builder.Default + int[] x = {1,2}; + + @Builder.Default + java.lang.String[][] y = {}; +}
\ No newline at end of file diff --git a/test/transform/resource/before/ExtensionMethodNonStatic.java b/test/transform/resource/before/ExtensionMethodNonStatic.java new file mode 100644 index 00000000..9ccaaedd --- /dev/null +++ b/test/transform/resource/before/ExtensionMethodNonStatic.java @@ -0,0 +1,15 @@ +import lombok.experimental.ExtensionMethod; + +@ExtensionMethod({ExtensionMethodNonStatic.Extensions.class}) +class ExtensionMethodNonStatic { + public void test() { + String s = "test"; + s.startsWith(""); + } + + static class Extensions { + public boolean startsWith(String s, String prefix) { + return s.startsWith(prefix); + } + } +} 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/SuperBuilderWithOverloadedGeneratedMethods.java b/test/transform/resource/before/SuperBuilderWithOverloadedGeneratedMethods.java new file mode 100644 index 00000000..be6fea6a --- /dev/null +++ b/test/transform/resource/before/SuperBuilderWithOverloadedGeneratedMethods.java @@ -0,0 +1,15 @@ +public class SuperBuilderWithOverloadedGeneratedMethods { + @lombok.experimental.SuperBuilder + public static class Parent { + int self; + } + + @lombok.experimental.SuperBuilder + public static class Child extends Parent { + double build; + } + + public static void test() { + Child x = Child.builder().build(0.0).self(5).build(); + } +} 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 { diff --git a/test/transform/resource/before/ValSuperDefaultMethod.java b/test/transform/resource/before/ValSuperDefaultMethod.java new file mode 100644 index 00000000..93bcb153 --- /dev/null +++ b/test/transform/resource/before/ValSuperDefaultMethod.java @@ -0,0 +1,16 @@ +// version :9 +import lombok.val; + +class ValSuperDefaultMethod implements Default { + public void test() { + val a = ""; + Default.super.method(); + } + +} + +interface Default { + default void method() { + + } +}
\ No newline at end of file |