diff options
Diffstat (limited to 'test/transform/resource')
306 files changed, 7321 insertions, 3857 deletions
diff --git a/test/transform/resource/after-delombok/Accessors.java b/test/transform/resource/after-delombok/Accessors.java index 2773a17b..0e148b88 100644 --- a/test/transform/resource/after-delombok/Accessors.java +++ b/test/transform/resource/after-delombok/Accessors.java @@ -4,6 +4,9 @@ class AccessorsFluent { public String fieldName() { return this.fieldName; } + /** + * @return {@code this}. + */ @java.lang.SuppressWarnings("all") public AccessorsFluent fieldName(final String fieldName) { this.fieldName = fieldName; @@ -21,6 +24,9 @@ class AccessorsFluentOnClass { public String getOtherFieldWithOverride() { return this.otherFieldWithOverride; } + /** + * @return {@code this}. + */ @java.lang.SuppressWarnings("all") public AccessorsFluentOnClass fieldName(final String fieldName) { this.fieldName = fieldName; @@ -29,6 +35,9 @@ class AccessorsFluentOnClass { } class AccessorsChain { private boolean isRunning; + /** + * @return {@code this}. + */ @java.lang.SuppressWarnings("all") public AccessorsChain setRunning(final boolean isRunning) { this.isRunning = isRunning; @@ -93,6 +102,9 @@ class AccessorsPrefix3 { } class AccessorsFluentGenerics<T extends Number> { private String name; + /** + * @return {@code this}. + */ @java.lang.SuppressWarnings("all") public AccessorsFluentGenerics<T> name(final String name) { this.name = name; diff --git a/test/transform/resource/after-delombok/AccessorsConfiguration.java b/test/transform/resource/after-delombok/AccessorsConfiguration.java index f6604970..f52ff307 100644 --- a/test/transform/resource/after-delombok/AccessorsConfiguration.java +++ b/test/transform/resource/after-delombok/AccessorsConfiguration.java @@ -18,6 +18,9 @@ class AccessorsConfiguration2 { } class AccessorsConfiguration3 { private String fFieldName = ""; + /** + * @return {@code this}. + */ @java.lang.SuppressWarnings("all") public AccessorsConfiguration3 setFieldName(final String fFieldName) { this.fFieldName = fFieldName; diff --git a/test/transform/resource/after-delombok/BuilderAccessWithGetter.java b/test/transform/resource/after-delombok/BuilderAccessWithGetter.java new file mode 100644 index 00000000..f36403bf --- /dev/null +++ b/test/transform/resource/after-delombok/BuilderAccessWithGetter.java @@ -0,0 +1,49 @@ +public final class BuilderAccessWithGetter { + private final String string; + + @java.lang.SuppressWarnings("all") + BuilderAccessWithGetter(final String string) { + this.string = string; + } + + + @java.lang.SuppressWarnings("all") + private static class BuilderAccessWithGetterBuilder { + @java.lang.SuppressWarnings("all") + private String string; + + @java.lang.SuppressWarnings("all") + BuilderAccessWithGetterBuilder() { + } + + /** + * @return {@code this}. + */ + @java.lang.SuppressWarnings("all") + private BuilderAccessWithGetter.BuilderAccessWithGetterBuilder string(final String string) { + this.string = string; + return this; + } + + @java.lang.SuppressWarnings("all") + private BuilderAccessWithGetter build() { + return new BuilderAccessWithGetter(this.string); + } + + @java.lang.Override + @java.lang.SuppressWarnings("all") + public java.lang.String toString() { + return "BuilderAccessWithGetter.BuilderAccessWithGetterBuilder(string=" + this.string + ")"; + } + } + + @java.lang.SuppressWarnings("all") + private static BuilderAccessWithGetter.BuilderAccessWithGetterBuilder builder() { + return new BuilderAccessWithGetter.BuilderAccessWithGetterBuilder(); + } + + @java.lang.SuppressWarnings("all") + public String getString() { + return this.string; + } +} diff --git a/test/transform/resource/after-delombok/BuilderComplex.java b/test/transform/resource/after-delombok/BuilderComplex.java index 009ebe6c..591c2b4d 100644 --- a/test/transform/resource/after-delombok/BuilderComplex.java +++ b/test/transform/resource/after-delombok/BuilderComplex.java @@ -15,21 +15,33 @@ class BuilderComplex { @java.lang.SuppressWarnings("all") TestVoidName() { } + /** + * @return {@code this}. + */ @java.lang.SuppressWarnings("all") public BuilderComplex.TestVoidName<T> number(final T number) { this.number = number; return this; } + /** + * @return {@code this}. + */ @java.lang.SuppressWarnings("all") public BuilderComplex.TestVoidName<T> arg2(final int arg2) { this.arg2 = arg2; return this; } + /** + * @return {@code this}. + */ @java.lang.SuppressWarnings("all") public BuilderComplex.TestVoidName<T> arg3(final String arg3) { this.arg3 = arg3; return this; } + /** + * @return {@code this}. + */ @java.lang.SuppressWarnings("all") public BuilderComplex.TestVoidName<T> selfRef(final BuilderComplex selfRef) { this.selfRef = selfRef; diff --git a/test/transform/resource/after-delombok/BuilderCustomName.java b/test/transform/resource/after-delombok/BuilderCustomName.java index 4b423ee0..2e5924d3 100644 --- a/test/transform/resource/after-delombok/BuilderCustomName.java +++ b/test/transform/resource/after-delombok/BuilderCustomName.java @@ -9,6 +9,9 @@ class BuilderCustomName<T> { protected abstract B self(); @java.lang.SuppressWarnings("all") public abstract C build(); + /** + * @return {@code this}. + */ @java.lang.SuppressWarnings("all") public B field(final int field) { this.field = field; diff --git a/test/transform/resource/after-delombok/BuilderDefaults.java b/test/transform/resource/after-delombok/BuilderDefaults.java index 42b751ce..2170eed5 100644 --- a/test/transform/resource/after-delombok/BuilderDefaults.java +++ b/test/transform/resource/after-delombok/BuilderDefaults.java @@ -31,17 +31,26 @@ public final class BuilderDefaults { @java.lang.SuppressWarnings("all") BuilderDefaultsBuilder() { } + /** + * @return {@code this}. + */ @java.lang.SuppressWarnings("all") public BuilderDefaults.BuilderDefaultsBuilder x(final int x) { this.x$value = x; x$set = true; return this; } + /** + * @return {@code this}. + */ @java.lang.SuppressWarnings("all") public BuilderDefaults.BuilderDefaultsBuilder name(final String name) { this.name = name; return this; } + /** + * @return {@code this}. + */ @java.lang.SuppressWarnings("all") public BuilderDefaults.BuilderDefaultsBuilder z(final long z) { this.z$value = z; diff --git a/test/transform/resource/after-delombok/BuilderDefaultsGenerics.java b/test/transform/resource/after-delombok/BuilderDefaultsGenerics.java index 71dc7c5f..44d9491f 100644 --- a/test/transform/resource/after-delombok/BuilderDefaultsGenerics.java +++ b/test/transform/resource/after-delombok/BuilderDefaultsGenerics.java @@ -38,18 +38,27 @@ public class BuilderDefaultsGenerics<N extends Number, T, R extends List<T>> { @java.lang.SuppressWarnings("all") BuilderDefaultsGenericsBuilder() { } + /** + * @return {@code this}. + */ @java.lang.SuppressWarnings("all") public BuilderDefaultsGenerics.BuilderDefaultsGenericsBuilder<N, T, R> callable(final java.util.concurrent.Callable<N> callable) { this.callable$value = callable; callable$set = true; return this; } + /** + * @return {@code this}. + */ @java.lang.SuppressWarnings("all") public BuilderDefaultsGenerics.BuilderDefaultsGenericsBuilder<N, T, R> tee(final T tee) { this.tee$value = tee; tee$set = true; return this; } + /** + * @return {@code this}. + */ @java.lang.SuppressWarnings("all") public BuilderDefaultsGenerics.BuilderDefaultsGenericsBuilder<N, T, R> arrr(final R arrr) { this.arrr$value = arrr; diff --git a/test/transform/resource/after-delombok/BuilderDefaultsWarnings.java b/test/transform/resource/after-delombok/BuilderDefaultsWarnings.java index 356e072e..c7e37abe 100644 --- a/test/transform/resource/after-delombok/BuilderDefaultsWarnings.java +++ b/test/transform/resource/after-delombok/BuilderDefaultsWarnings.java @@ -1,6 +1,4 @@ //skip-idempotent -import lombok.Builder; -@Builder public class BuilderDefaultsWarnings { long x = System.currentTimeMillis(); final int y = 5; @@ -23,11 +21,17 @@ public class BuilderDefaultsWarnings { @java.lang.SuppressWarnings("all") BuilderDefaultsWarningsBuilder() { } + /** + * @return {@code this}. + */ @java.lang.SuppressWarnings("all") public BuilderDefaultsWarnings.BuilderDefaultsWarningsBuilder x(final long x) { this.x = x; return this; } + /** + * @return {@code this}. + */ @java.lang.SuppressWarnings("all") public BuilderDefaultsWarnings.BuilderDefaultsWarningsBuilder z(final int z) { this.z = z; @@ -81,7 +85,6 @@ public class BuilderDefaultsWarnings { } class NoBuilderButHasDefaults { private final long z = 5; - @Builder public NoBuilderButHasDefaults() { } @java.lang.SuppressWarnings("all") diff --git a/test/transform/resource/after-delombok/BuilderGenericMethod.java b/test/transform/resource/after-delombok/BuilderGenericMethod.java index d57f6415..36375952 100644 --- a/test/transform/resource/after-delombok/BuilderGenericMethod.java +++ b/test/transform/resource/after-delombok/BuilderGenericMethod.java @@ -13,11 +13,17 @@ class BuilderGenericMethod<T> { @java.lang.SuppressWarnings("all") MapBuilder() { } + /** + * @return {@code this}. + */ @java.lang.SuppressWarnings("all") public BuilderGenericMethod<T>.MapBuilder<N> a(final int a) { this.a = a; return this; } + /** + * @return {@code this}. + */ @java.lang.SuppressWarnings("all") public BuilderGenericMethod<T>.MapBuilder<N> b(final long b) { this.b = b; diff --git a/test/transform/resource/after-delombok/BuilderInstanceMethod.java b/test/transform/resource/after-delombok/BuilderInstanceMethod.java index d0d5833f..2ee81dcb 100644 --- a/test/transform/resource/after-delombok/BuilderInstanceMethod.java +++ b/test/transform/resource/after-delombok/BuilderInstanceMethod.java @@ -16,21 +16,33 @@ class BuilderInstanceMethod<T> { @java.lang.SuppressWarnings("all") StringBuilder() { } + /** + * @return {@code this}. + */ @java.lang.SuppressWarnings("all") public BuilderInstanceMethod<T>.StringBuilder show(final int show) { this.show = show; return this; } + /** + * @return {@code this}. + */ @java.lang.SuppressWarnings("all") public BuilderInstanceMethod<T>.StringBuilder yes(final int yes) { this.yes = yes; return this; } + /** + * @return {@code this}. + */ @java.lang.SuppressWarnings("all") public BuilderInstanceMethod<T>.StringBuilder also(final List<T> also) { this.also = also; return this; } + /** + * @return {@code this}. + */ @java.lang.SuppressWarnings("all") public BuilderInstanceMethod<T>.StringBuilder $andMe(final int $andMe) { this.$andMe = $andMe; diff --git a/test/transform/resource/after-delombok/BuilderJavadoc.java b/test/transform/resource/after-delombok/BuilderJavadoc.java index c99bfe90..f7caa2d6 100644 --- a/test/transform/resource/after-delombok/BuilderJavadoc.java +++ b/test/transform/resource/after-delombok/BuilderJavadoc.java @@ -3,7 +3,6 @@ class BuilderJavadoc<T> { /** * basic gets only a builder setter. * @see #getsetwith - * * @return tag is removed from the setter. */ private final int basic; @@ -92,7 +91,6 @@ class BuilderJavadoc<T> { } /** * getsetwith gets a builder setter, an instance getter and setter, and a wither. - * * @return tag is moved to the getter. */ @java.lang.SuppressWarnings("all") diff --git a/test/transform/resource/after-delombok/BuilderSimple.java b/test/transform/resource/after-delombok/BuilderSimple.java index 925d0dd3..a43567b3 100644 --- a/test/transform/resource/after-delombok/BuilderSimple.java +++ b/test/transform/resource/after-delombok/BuilderSimple.java @@ -18,11 +18,17 @@ class BuilderSimple<T> { @java.lang.SuppressWarnings("all") BuilderSimpleBuilder() { } + /** + * @return {@code this}. + */ @java.lang.SuppressWarnings("all") public BuilderSimple.BuilderSimpleBuilder<T> yes(final int yes) { this.yes = yes; return this; } + /** + * @return {@code this}. + */ @java.lang.SuppressWarnings("all") public BuilderSimple.BuilderSimpleBuilder<T> also(final List<T> also) { this.also = also; diff --git a/test/transform/resource/after-delombok/BuilderSimpleWithSetterPrefix.java b/test/transform/resource/after-delombok/BuilderSimpleWithSetterPrefix.java index ef0d8fc6..3038fe39 100644 --- a/test/transform/resource/after-delombok/BuilderSimpleWithSetterPrefix.java +++ b/test/transform/resource/after-delombok/BuilderSimpleWithSetterPrefix.java @@ -12,6 +12,9 @@ class BuilderSimpleWithSetterPrefix<T> { @java.lang.SuppressWarnings("all") BuilderSimpleWithSetterPrefixBuilder() { } + /** + * @return {@code this}. + */ @java.lang.SuppressWarnings("all") public BuilderSimpleWithSetterPrefix.BuilderSimpleWithSetterPrefixBuilder<T> withUnprefixed(final int unprefixed) { this.unprefixed = unprefixed; diff --git a/test/transform/resource/after-delombok/BuilderSingularAnnotatedTypes.java b/test/transform/resource/after-delombok/BuilderSingularAnnotatedTypes.java index f6fa22de..7568d812 100644 --- a/test/transform/resource/after-delombok/BuilderSingularAnnotatedTypes.java +++ b/test/transform/resource/after-delombok/BuilderSingularAnnotatedTypes.java @@ -1,3 +1,4 @@ +//version 8: import java.lang.annotation.ElementType; import java.lang.annotation.Target; import java.util.Set; diff --git a/test/transform/resource/after-delombok/BuilderSingularAnnotatedTypesWithSetterPrefix.java b/test/transform/resource/after-delombok/BuilderSingularAnnotatedTypesWithSetterPrefix.java index 6dbbeee4..d58caf4d 100644 --- a/test/transform/resource/after-delombok/BuilderSingularAnnotatedTypesWithSetterPrefix.java +++ b/test/transform/resource/after-delombok/BuilderSingularAnnotatedTypesWithSetterPrefix.java @@ -1,3 +1,4 @@ +//version 8: import java.lang.annotation.ElementType; import java.lang.annotation.Target; import java.util.Set; diff --git a/test/transform/resource/after-delombok/BuilderSingularNoAuto.java b/test/transform/resource/after-delombok/BuilderSingularNoAuto.java index 8c30f926..de86383f 100644 --- a/test/transform/resource/after-delombok/BuilderSingularNoAuto.java +++ b/test/transform/resource/after-delombok/BuilderSingularNoAuto.java @@ -1,6 +1,5 @@ //skip-idempotent import java.util.List; -@lombok.Builder class BuilderSingularNoAuto { private List<String> things; private List<String> widgets; diff --git a/test/transform/resource/after-delombok/BuilderSingularNoAutoWithSetterPrefix.java b/test/transform/resource/after-delombok/BuilderSingularNoAutoWithSetterPrefix.java index 4207cf74..8858f145 100644 --- a/test/transform/resource/after-delombok/BuilderSingularNoAutoWithSetterPrefix.java +++ b/test/transform/resource/after-delombok/BuilderSingularNoAutoWithSetterPrefix.java @@ -1,6 +1,5 @@ //skip-idempotent import java.util.List; -@lombok.Builder(setterPrefix = "with") class BuilderSingularNoAutoWithSetterPrefix { private List<String> things; private List<String> widgets; diff --git a/test/transform/resource/after-delombok/BuilderSingularNullBehavior1.java b/test/transform/resource/after-delombok/BuilderSingularNullBehavior1.java index 32ad0a68..45ff97fa 100644 --- a/test/transform/resource/after-delombok/BuilderSingularNullBehavior1.java +++ b/test/transform/resource/after-delombok/BuilderSingularNullBehavior1.java @@ -1,3 +1,4 @@ +//version 8: import java.util.List; import java.util.Collection; class BuilderSingularNullBehavior1 { diff --git a/test/transform/resource/after-delombok/BuilderSingularNullBehavior2.java b/test/transform/resource/after-delombok/BuilderSingularNullBehavior2.java index e70877bf..5f605de4 100644 --- a/test/transform/resource/after-delombok/BuilderSingularNullBehavior2.java +++ b/test/transform/resource/after-delombok/BuilderSingularNullBehavior2.java @@ -1,3 +1,4 @@ +//version 8: springframework dep is too new to run on j6 import java.util.List; class BuilderSingularNullBehavior2 { private List<String> locations; diff --git a/test/transform/resource/after-delombok/BuilderTypeAnnos.java b/test/transform/resource/after-delombok/BuilderTypeAnnos.java index bd450d5b..f5ef42f7 100644 --- a/test/transform/resource/after-delombok/BuilderTypeAnnos.java +++ b/test/transform/resource/after-delombok/BuilderTypeAnnos.java @@ -22,6 +22,9 @@ class BuilderTypeAnnos { @java.lang.SuppressWarnings("all") BuilderTypeAnnosBuilder() { } + /** + * @return {@code this}. + */ @java.lang.SuppressWarnings("all") public BuilderTypeAnnos.BuilderTypeAnnosBuilder foo(@TA final List<String> foo) { this.foo = foo; diff --git a/test/transform/resource/after-delombok/BuilderTypeAnnosWithSetterPrefix.java b/test/transform/resource/after-delombok/BuilderTypeAnnosWithSetterPrefix.java index b221e69d..1fb7798a 100644 --- a/test/transform/resource/after-delombok/BuilderTypeAnnosWithSetterPrefix.java +++ b/test/transform/resource/after-delombok/BuilderTypeAnnosWithSetterPrefix.java @@ -22,6 +22,9 @@ class BuilderTypeAnnosWithSetterPrefix { @java.lang.SuppressWarnings("all") BuilderTypeAnnosWithSetterPrefixBuilder() { } + /** + * @return {@code this}. + */ @java.lang.SuppressWarnings("all") public BuilderTypeAnnosWithSetterPrefix.BuilderTypeAnnosWithSetterPrefixBuilder withFoo(@TA final List<String> foo) { this.foo = foo; diff --git a/test/transform/resource/after-delombok/BuilderWithAccessors.java b/test/transform/resource/after-delombok/BuilderWithAccessors.java index 3fa47034..a8a9bc11 100644 --- a/test/transform/resource/after-delombok/BuilderWithAccessors.java +++ b/test/transform/resource/after-delombok/BuilderWithAccessors.java @@ -23,21 +23,33 @@ class BuilderWithAccessors { @java.lang.SuppressWarnings("all") BuilderWithAccessorsBuilder() { } + /** + * @return {@code this}. + */ @java.lang.SuppressWarnings("all") public BuilderWithAccessors.BuilderWithAccessorsBuilder plower(final int plower) { this.plower = plower; return this; } + /** + * @return {@code this}. + */ @java.lang.SuppressWarnings("all") public BuilderWithAccessors.BuilderWithAccessorsBuilder upper(final int upper) { this.upper = upper; return this; } + /** + * @return {@code this}. + */ @java.lang.SuppressWarnings("all") public BuilderWithAccessors.BuilderWithAccessorsBuilder foo(final int foo) { this.foo = foo; return this; } + /** + * @return {@code this}. + */ @java.lang.SuppressWarnings("all") public BuilderWithAccessors.BuilderWithAccessorsBuilder _bar(final int _bar) { this._bar = _bar; diff --git a/test/transform/resource/after-delombok/BuilderWithBadNames.java b/test/transform/resource/after-delombok/BuilderWithBadNames.java index d77ca71c..c96fbc58 100644 --- a/test/transform/resource/after-delombok/BuilderWithBadNames.java +++ b/test/transform/resource/after-delombok/BuilderWithBadNames.java @@ -15,11 +15,17 @@ public class BuilderWithBadNames { @java.lang.SuppressWarnings("all") BuilderWithBadNamesBuilder() { } + /** + * @return {@code this}. + */ @java.lang.SuppressWarnings("all") public BuilderWithBadNames.BuilderWithBadNamesBuilder build(final String build) { this.build = build; return this; } + /** + * @return {@code this}. + */ @java.lang.SuppressWarnings("all") public BuilderWithBadNames.BuilderWithBadNamesBuilder toString(final String toString) { this.toString = toString; diff --git a/test/transform/resource/after-delombok/BuilderWithDeprecated.java b/test/transform/resource/after-delombok/BuilderWithDeprecated.java index b6a09376..f0729649 100644 --- a/test/transform/resource/after-delombok/BuilderWithDeprecated.java +++ b/test/transform/resource/after-delombok/BuilderWithDeprecated.java @@ -40,6 +40,9 @@ public class BuilderWithDeprecated { this.dep1 = dep1; return this; } + /** + * @return {@code this}. + */ @java.lang.Deprecated @java.lang.SuppressWarnings("all") public BuilderWithDeprecated.BuilderWithDeprecatedBuilder dep2(final int dep2) { diff --git a/test/transform/resource/after-delombok/BuilderWithDeprecatedAnnOnly.java b/test/transform/resource/after-delombok/BuilderWithDeprecatedAnnOnly.java new file mode 100644 index 00000000..d5c06465 --- /dev/null +++ b/test/transform/resource/after-delombok/BuilderWithDeprecatedAnnOnly.java @@ -0,0 +1,107 @@ +import com.google.common.collect.ImmutableList; +public class BuilderWithDeprecatedAnnOnly { + @Deprecated + int dep1; + @Deprecated + java.util.List<String> strings; + @Deprecated + ImmutableList<Integer> numbers; + @java.lang.SuppressWarnings("all") + BuilderWithDeprecatedAnnOnly(final int dep1, final java.util.List<String> strings, final ImmutableList<Integer> numbers) { + this.dep1 = dep1; + this.strings = strings; + this.numbers = numbers; + } + @java.lang.SuppressWarnings("all") + public static class BuilderWithDeprecatedAnnOnlyBuilder { + @java.lang.SuppressWarnings("all") + private int dep1; + @java.lang.SuppressWarnings("all") + private java.util.ArrayList<String> strings; + @java.lang.SuppressWarnings("all") + private com.google.common.collect.ImmutableList.Builder<Integer> numbers; + @java.lang.SuppressWarnings("all") + BuilderWithDeprecatedAnnOnlyBuilder() { + } + /** + * @return {@code this}. + */ + @java.lang.Deprecated + @java.lang.SuppressWarnings("all") + public BuilderWithDeprecatedAnnOnly.BuilderWithDeprecatedAnnOnlyBuilder dep1(final int dep1) { + this.dep1 = dep1; + return this; + } + @java.lang.Deprecated + @java.lang.SuppressWarnings("all") + public BuilderWithDeprecatedAnnOnly.BuilderWithDeprecatedAnnOnlyBuilder string(final String string) { + if (this.strings == null) this.strings = new java.util.ArrayList<String>(); + this.strings.add(string); + return this; + } + @java.lang.Deprecated + @java.lang.SuppressWarnings("all") + public BuilderWithDeprecatedAnnOnly.BuilderWithDeprecatedAnnOnlyBuilder strings(final java.util.Collection<? extends String> strings) { + if (strings == null) { + throw new java.lang.NullPointerException("strings cannot be null"); + } + if (this.strings == null) this.strings = new java.util.ArrayList<String>(); + this.strings.addAll(strings); + return this; + } + @java.lang.Deprecated + @java.lang.SuppressWarnings("all") + public BuilderWithDeprecatedAnnOnly.BuilderWithDeprecatedAnnOnlyBuilder clearStrings() { + if (this.strings != null) this.strings.clear(); + return this; + } + @java.lang.Deprecated + @java.lang.SuppressWarnings("all") + public BuilderWithDeprecatedAnnOnly.BuilderWithDeprecatedAnnOnlyBuilder number(final Integer number) { + if (this.numbers == null) this.numbers = com.google.common.collect.ImmutableList.builder(); + this.numbers.add(number); + return this; + } + @java.lang.Deprecated + @java.lang.SuppressWarnings("all") + public BuilderWithDeprecatedAnnOnly.BuilderWithDeprecatedAnnOnlyBuilder numbers(final java.lang.Iterable<? extends Integer> numbers) { + if (numbers == null) { + throw new java.lang.NullPointerException("numbers cannot be null"); + } + if (this.numbers == null) this.numbers = com.google.common.collect.ImmutableList.builder(); + this.numbers.addAll(numbers); + return this; + } + @java.lang.Deprecated + @java.lang.SuppressWarnings("all") + public BuilderWithDeprecatedAnnOnly.BuilderWithDeprecatedAnnOnlyBuilder clearNumbers() { + this.numbers = null; + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderWithDeprecatedAnnOnly build() { + java.util.List<String> strings; + switch (this.strings == null ? 0 : this.strings.size()) { + case 0: + strings = java.util.Collections.emptyList(); + break; + case 1: + strings = java.util.Collections.singletonList(this.strings.get(0)); + break; + default: + strings = java.util.Collections.unmodifiableList(new java.util.ArrayList<String>(this.strings)); + } + com.google.common.collect.ImmutableList<Integer> numbers = this.numbers == null ? com.google.common.collect.ImmutableList.<Integer>of() : this.numbers.build(); + return new BuilderWithDeprecatedAnnOnly(this.dep1, strings, numbers); + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public java.lang.String toString() { + return "BuilderWithDeprecatedAnnOnly.BuilderWithDeprecatedAnnOnlyBuilder(dep1=" + this.dep1 + ", strings=" + this.strings + ", numbers=" + this.numbers + ")"; + } + } + @java.lang.SuppressWarnings("all") + public static BuilderWithDeprecatedAnnOnly.BuilderWithDeprecatedAnnOnlyBuilder builder() { + return new BuilderWithDeprecatedAnnOnly.BuilderWithDeprecatedAnnOnlyBuilder(); + } +} diff --git a/test/transform/resource/after-delombok/BuilderWithExistingBuilderClass.java b/test/transform/resource/after-delombok/BuilderWithExistingBuilderClass.java index 88eeee64..9c7ac1ad 100644 --- a/test/transform/resource/after-delombok/BuilderWithExistingBuilderClass.java +++ b/test/transform/resource/after-delombok/BuilderWithExistingBuilderClass.java @@ -13,11 +13,17 @@ class BuilderWithExistingBuilderClass<T, K extends Number> { @java.lang.SuppressWarnings("all") BuilderWithExistingBuilderClassBuilder() { } + /** + * @return {@code this}. + */ @java.lang.SuppressWarnings("all") public BuilderWithExistingBuilderClass.BuilderWithExistingBuilderClassBuilder<Z> arg1(final Z arg1) { this.arg1 = arg1; return this; } + /** + * @return {@code this}. + */ @java.lang.SuppressWarnings("all") public BuilderWithExistingBuilderClass.BuilderWithExistingBuilderClassBuilder<Z> arg3(final String arg3) { this.arg3 = arg3; diff --git a/test/transform/resource/after-delombok/BuilderWithExistingBuilderClassWithSetterPrefix.java b/test/transform/resource/after-delombok/BuilderWithExistingBuilderClassWithSetterPrefix.java index b1ed5fef..c7da67f8 100644 --- a/test/transform/resource/after-delombok/BuilderWithExistingBuilderClassWithSetterPrefix.java +++ b/test/transform/resource/after-delombok/BuilderWithExistingBuilderClassWithSetterPrefix.java @@ -13,11 +13,17 @@ class BuilderWithExistingBuilderClassWithSetterPrefix<T, K extends Number> { @java.lang.SuppressWarnings("all") BuilderWithExistingBuilderClassWithSetterPrefixBuilder() { } + /** + * @return {@code this}. + */ @java.lang.SuppressWarnings("all") public BuilderWithExistingBuilderClassWithSetterPrefix.BuilderWithExistingBuilderClassWithSetterPrefixBuilder<Z> withArg1(final Z arg1) { this.arg1 = arg1; return this; } + /** + * @return {@code this}. + */ @java.lang.SuppressWarnings("all") public BuilderWithExistingBuilderClassWithSetterPrefix.BuilderWithExistingBuilderClassWithSetterPrefixBuilder<Z> withArg3(final String arg3) { this.arg3 = arg3; diff --git a/test/transform/resource/after-delombok/BuilderWithNoBuilderMethod.java b/test/transform/resource/after-delombok/BuilderWithNoBuilderMethod.java index d555ab06..61df4427 100644 --- a/test/transform/resource/after-delombok/BuilderWithNoBuilderMethod.java +++ b/test/transform/resource/after-delombok/BuilderWithNoBuilderMethod.java @@ -11,6 +11,9 @@ class BuilderWithNoBuilderMethod { @java.lang.SuppressWarnings("all") BuilderWithNoBuilderMethodBuilder() { } + /** + * @return {@code this}. + */ @java.lang.SuppressWarnings("all") public BuilderWithNoBuilderMethod.BuilderWithNoBuilderMethodBuilder a(final String a) { this.a = a; diff --git a/test/transform/resource/after-delombok/BuilderWithNonNull.java b/test/transform/resource/after-delombok/BuilderWithNonNull.java index 9858d5bd..00728ea7 100644 --- a/test/transform/resource/after-delombok/BuilderWithNonNull.java +++ b/test/transform/resource/after-delombok/BuilderWithNonNull.java @@ -1,3 +1,4 @@ +//version 8: class BuilderWithNonNull { @lombok.NonNull private final String id; @@ -15,6 +16,9 @@ class BuilderWithNonNull { @java.lang.SuppressWarnings("all") BuilderWithNonNullBuilder() { } + /** + * @return {@code this}. + */ @java.lang.SuppressWarnings("all") public BuilderWithNonNull.BuilderWithNonNullBuilder id(@lombok.NonNull final String id) { if (id == null) { diff --git a/test/transform/resource/after-delombok/BuilderWithNonNullWithSetterPrefix.java b/test/transform/resource/after-delombok/BuilderWithNonNullWithSetterPrefix.java index 8a27f443..f6dfed67 100644 --- a/test/transform/resource/after-delombok/BuilderWithNonNullWithSetterPrefix.java +++ b/test/transform/resource/after-delombok/BuilderWithNonNullWithSetterPrefix.java @@ -1,3 +1,4 @@ +//version 8: class BuilderWithNonNullWithSetterPrefix { @lombok.NonNull private final String id; @@ -15,6 +16,9 @@ class BuilderWithNonNullWithSetterPrefix { @java.lang.SuppressWarnings("all") BuilderWithNonNullWithSetterPrefixBuilder() { } + /** + * @return {@code this}. + */ @java.lang.SuppressWarnings("all") public BuilderWithNonNullWithSetterPrefix.BuilderWithNonNullWithSetterPrefixBuilder withId(@lombok.NonNull final String id) { if (id == null) { diff --git a/test/transform/resource/after-delombok/BuilderWithRecursiveGenerics.java b/test/transform/resource/after-delombok/BuilderWithRecursiveGenerics.java index 33dd7d10..a96fe1cc 100644 --- a/test/transform/resource/after-delombok/BuilderWithRecursiveGenerics.java +++ b/test/transform/resource/after-delombok/BuilderWithRecursiveGenerics.java @@ -19,11 +19,17 @@ public class BuilderWithRecursiveGenerics { @java.lang.SuppressWarnings("all") TestBuilder() { } + /** + * @return {@code this}. + */ @java.lang.SuppressWarnings("all") public BuilderWithRecursiveGenerics.Test.TestBuilder<Foo, Bar, Quz> foo(final Foo foo) { this.foo = foo; return this; } + /** + * @return {@code this}. + */ @java.lang.SuppressWarnings("all") public BuilderWithRecursiveGenerics.Test.TestBuilder<Foo, Bar, Quz> bar(final Bar bar) { this.bar = bar; diff --git a/test/transform/resource/after-delombok/BuilderWithToBuilder.java b/test/transform/resource/after-delombok/BuilderWithToBuilder.java index d98d09f6..0df43609 100644 --- a/test/transform/resource/after-delombok/BuilderWithToBuilder.java +++ b/test/transform/resource/after-delombok/BuilderWithToBuilder.java @@ -27,16 +27,25 @@ class BuilderWithToBuilder<T> { @java.lang.SuppressWarnings("all") BuilderWithToBuilderBuilder() { } + /** + * @return {@code this}. + */ @java.lang.SuppressWarnings("all") public BuilderWithToBuilder.BuilderWithToBuilderBuilder<T> one(final String one) { this.one = one; return this; } + /** + * @return {@code this}. + */ @java.lang.SuppressWarnings("all") public BuilderWithToBuilder.BuilderWithToBuilderBuilder<T> two(final String two) { this.two = two; return this; } + /** + * @return {@code this}. + */ @java.lang.SuppressWarnings("all") public BuilderWithToBuilder.BuilderWithToBuilderBuilder<T> foo(final T foo) { this.foo = foo; @@ -114,16 +123,25 @@ class ConstructorWithToBuilder<T> { @java.lang.SuppressWarnings("all") ConstructorWithToBuilderBuilder() { } + /** + * @return {@code this}. + */ @java.lang.SuppressWarnings("all") public ConstructorWithToBuilder.ConstructorWithToBuilderBuilder<T> mOne(final String mOne) { this.mOne = mOne; return this; } + /** + * @return {@code this}. + */ @java.lang.SuppressWarnings("all") public ConstructorWithToBuilder.ConstructorWithToBuilderBuilder<T> baz(final T baz) { this.baz = baz; return this; } + /** + * @return {@code this}. + */ @java.lang.SuppressWarnings("all") public ConstructorWithToBuilder.ConstructorWithToBuilderBuilder<T> bars(final com.google.common.collect.ImmutableList<T> bars) { this.bars = bars; @@ -147,4 +165,54 @@ class ConstructorWithToBuilder<T> { public ConstructorWithToBuilder.ConstructorWithToBuilderBuilder<T> toBuilder() { return new ConstructorWithToBuilder.ConstructorWithToBuilderBuilder<T>().mOne(this.mOne).baz(this.foo).bars(this.bars); } +} +class StaticMethodWithToBuilder<T> { + private T foo; + + public StaticMethodWithToBuilder(T foo) { + this.foo = foo; + } + + public static <T> StaticMethodWithToBuilder<T> of(T foo) { + return new StaticMethodWithToBuilder<T>(foo); + } + + @java.lang.SuppressWarnings("all") + public static class StaticMethodWithToBuilderBuilder<T> { + @java.lang.SuppressWarnings("all") + private T foo; + + @java.lang.SuppressWarnings("all") + StaticMethodWithToBuilderBuilder() { + } + /** + * @return {@code this}. + */ + @java.lang.SuppressWarnings("all") + public StaticMethodWithToBuilder.StaticMethodWithToBuilderBuilder<T> foo(final T foo) { + this.foo = foo; + return this; + } + + @java.lang.SuppressWarnings("all") + public StaticMethodWithToBuilder<T> build() { + return StaticMethodWithToBuilder.<T>of(this.foo); + } + + @java.lang.Override + @java.lang.SuppressWarnings("all") + public java.lang.String toString() { + return "StaticMethodWithToBuilder.StaticMethodWithToBuilderBuilder(foo=" + this.foo + ")"; + } + } + + @java.lang.SuppressWarnings("all") + public static <T> StaticMethodWithToBuilder.StaticMethodWithToBuilderBuilder<T> builder() { + return new StaticMethodWithToBuilder.StaticMethodWithToBuilderBuilder<T>(); + } + + @java.lang.SuppressWarnings("all") + public StaticMethodWithToBuilder.StaticMethodWithToBuilderBuilder<T> toBuilder() { + return new StaticMethodWithToBuilder.StaticMethodWithToBuilderBuilder<T>().foo(this.foo); + } }
\ No newline at end of file diff --git a/test/transform/resource/after-delombok/BuilderWithTolerate.java b/test/transform/resource/after-delombok/BuilderWithTolerate.java index daa02ac3..79494c49 100644 --- a/test/transform/resource/after-delombok/BuilderWithTolerate.java +++ b/test/transform/resource/after-delombok/BuilderWithTolerate.java @@ -14,6 +14,9 @@ public class BuilderWithTolerate { @java.lang.SuppressWarnings("all") BuilderWithTolerateBuilder() { } + /** + * @return {@code this}. + */ @java.lang.SuppressWarnings("all") public BuilderWithTolerate.BuilderWithTolerateBuilder value(final int value) { this.value = value; diff --git a/test/transform/resource/after-delombok/CheckerFrameworkBasic.java b/test/transform/resource/after-delombok/CheckerFrameworkBasic.java index 3077728c..2beafc4c 100644 --- a/test/transform/resource/after-delombok/CheckerFrameworkBasic.java +++ b/test/transform/resource/after-delombok/CheckerFrameworkBasic.java @@ -1,13 +1,8 @@ +//version 8: class CheckerFrameworkBasic { private final int x; private final int y; private int z; - @org.checkerframework.common.aliasing.qual.Unique - @java.lang.SuppressWarnings("all") - public CheckerFrameworkBasic(final int x, final int y) { - this.x = x; - this.y = y; - } @org.checkerframework.dataflow.qual.Pure @java.lang.SuppressWarnings("all") public int getX() { @@ -23,7 +18,10 @@ class CheckerFrameworkBasic { public int getZ() { return this.z; } - @org.checkerframework.checker.builder.qual.ReturnsReceiver + /** + * @return {@code this}. + */ + @org.checkerframework.common.returnsreceiver.qual.This @java.lang.SuppressWarnings("all") public CheckerFrameworkBasic setZ(final int z) { this.z = z; @@ -64,6 +62,15 @@ class CheckerFrameworkBasic { public java.lang.String toString() { return "CheckerFrameworkBasic(x=" + this.getX() + ", y=" + this.getY() + ", z=" + this.getZ() + ")"; } + @java.lang.SuppressWarnings("all") + public CheckerFrameworkBasic(final int x, final int y, final int z) { + this.x = x; + this.y = y; + this.z = z; + } + /** + * @return {@code this}. + */ @org.checkerframework.dataflow.qual.SideEffectFree @java.lang.SuppressWarnings("all") public CheckerFrameworkBasic withX(final int x) { diff --git a/test/transform/resource/after-delombok/CheckerFrameworkBuilder.java b/test/transform/resource/after-delombok/CheckerFrameworkBuilder.java index ace3adad..99272bd5 100644 --- a/test/transform/resource/after-delombok/CheckerFrameworkBuilder.java +++ b/test/transform/resource/after-delombok/CheckerFrameworkBuilder.java @@ -9,7 +9,6 @@ class CheckerFrameworkBuilder { private static int $default$x() { return 5; } - @org.checkerframework.common.aliasing.qual.Unique @java.lang.SuppressWarnings("all") CheckerFrameworkBuilder(final int x, final int y, final int z, final List<String> names) { this.x = x; @@ -29,37 +28,45 @@ class CheckerFrameworkBuilder { private int z; @java.lang.SuppressWarnings("all") private java.util.ArrayList<String> names; - @org.checkerframework.common.aliasing.qual.Unique @java.lang.SuppressWarnings("all") CheckerFrameworkBuilderBuilder() { } - @org.checkerframework.checker.builder.qual.ReturnsReceiver + /** + * @return {@code this}. + */ + @org.checkerframework.common.returnsreceiver.qual.This @java.lang.SuppressWarnings("all") - public CheckerFrameworkBuilder.CheckerFrameworkBuilderBuilder x(@org.checkerframework.checker.builder.qual.NotCalledMethods("x") CheckerFrameworkBuilder.CheckerFrameworkBuilderBuilder this, final int x) { + public CheckerFrameworkBuilder.CheckerFrameworkBuilderBuilder x(CheckerFrameworkBuilder.@org.checkerframework.checker.calledmethods.qual.NotCalledMethods("x") CheckerFrameworkBuilderBuilder this, final int x) { this.x$value = x; x$set = true; return this; } - @org.checkerframework.checker.builder.qual.ReturnsReceiver + /** + * @return {@code this}. + */ + @org.checkerframework.common.returnsreceiver.qual.This @java.lang.SuppressWarnings("all") - public CheckerFrameworkBuilder.CheckerFrameworkBuilderBuilder y(@org.checkerframework.checker.builder.qual.NotCalledMethods("y") CheckerFrameworkBuilder.CheckerFrameworkBuilderBuilder this, final int y) { + public CheckerFrameworkBuilder.CheckerFrameworkBuilderBuilder y(CheckerFrameworkBuilder.@org.checkerframework.checker.calledmethods.qual.NotCalledMethods("y") CheckerFrameworkBuilderBuilder this, final int y) { this.y = y; return this; } - @org.checkerframework.checker.builder.qual.ReturnsReceiver + /** + * @return {@code this}. + */ + @org.checkerframework.common.returnsreceiver.qual.This @java.lang.SuppressWarnings("all") - public CheckerFrameworkBuilder.CheckerFrameworkBuilderBuilder z(@org.checkerframework.checker.builder.qual.NotCalledMethods("z") CheckerFrameworkBuilder.CheckerFrameworkBuilderBuilder this, final int z) { + public CheckerFrameworkBuilder.CheckerFrameworkBuilderBuilder z(CheckerFrameworkBuilder.@org.checkerframework.checker.calledmethods.qual.NotCalledMethods("z") CheckerFrameworkBuilderBuilder this, final int z) { this.z = z; return this; } - @org.checkerframework.checker.builder.qual.ReturnsReceiver + @org.checkerframework.common.returnsreceiver.qual.This @java.lang.SuppressWarnings("all") public CheckerFrameworkBuilder.CheckerFrameworkBuilderBuilder name(final String name) { if (this.names == null) this.names = new java.util.ArrayList<String>(); this.names.add(name); return this; } - @org.checkerframework.checker.builder.qual.ReturnsReceiver + @org.checkerframework.common.returnsreceiver.qual.This @java.lang.SuppressWarnings("all") public CheckerFrameworkBuilder.CheckerFrameworkBuilderBuilder names(final java.util.Collection<? extends String> names) { if (names == null) { @@ -69,7 +76,7 @@ class CheckerFrameworkBuilder { this.names.addAll(names); return this; } - @org.checkerframework.checker.builder.qual.ReturnsReceiver + @org.checkerframework.common.returnsreceiver.qual.This @java.lang.SuppressWarnings("all") public CheckerFrameworkBuilder.CheckerFrameworkBuilderBuilder clearNames() { if (this.names != null) this.names.clear(); @@ -77,7 +84,7 @@ class CheckerFrameworkBuilder { } @org.checkerframework.dataflow.qual.SideEffectFree @java.lang.SuppressWarnings("all") - public CheckerFrameworkBuilder build(@org.checkerframework.checker.builder.qual.CalledMethods({"y", "z"}) CheckerFrameworkBuilder.CheckerFrameworkBuilderBuilder this) { + public CheckerFrameworkBuilder build(CheckerFrameworkBuilder.@org.checkerframework.checker.calledmethods.qual.CalledMethods({"y", "z"}) CheckerFrameworkBuilderBuilder this) { java.util.List<String> names; switch (this.names == null ? 0 : this.names.size()) { case 0: @@ -100,10 +107,10 @@ class CheckerFrameworkBuilder { return "CheckerFrameworkBuilder.CheckerFrameworkBuilderBuilder(x$value=" + this.x$value + ", y=" + this.y + ", z=" + this.z + ", names=" + this.names + ")"; } } - @org.checkerframework.common.aliasing.qual.Unique + @org.checkerframework.dataflow.qual.SideEffectFree @java.lang.SuppressWarnings("all") - public static CheckerFrameworkBuilder.CheckerFrameworkBuilderBuilder builder() { + public static CheckerFrameworkBuilder.@org.checkerframework.common.aliasing.qual.Unique CheckerFrameworkBuilderBuilder builder() { return new CheckerFrameworkBuilder.CheckerFrameworkBuilderBuilder(); } } diff --git a/test/transform/resource/after-delombok/CheckerFrameworkSuperBuilder.java b/test/transform/resource/after-delombok/CheckerFrameworkSuperBuilder.java index 30408c3b..8dcdaf10 100644 --- a/test/transform/resource/after-delombok/CheckerFrameworkSuperBuilder.java +++ b/test/transform/resource/after-delombok/CheckerFrameworkSuperBuilder.java @@ -1,4 +1,4 @@ -// skip-idempotent +//version 8: import java.util.List; class CheckerFrameworkSuperBuilder { public static class Parent { @@ -22,40 +22,49 @@ class CheckerFrameworkSuperBuilder { private int z; @java.lang.SuppressWarnings("all") private java.util.ArrayList<String> names; - @org.checkerframework.checker.builder.qual.ReturnsReceiver + @org.checkerframework.common.returnsreceiver.qual.This @org.checkerframework.dataflow.qual.Pure @java.lang.SuppressWarnings("all") protected abstract B self(); @org.checkerframework.dataflow.qual.SideEffectFree @java.lang.SuppressWarnings("all") - public abstract C build(@org.checkerframework.checker.builder.qual.CalledMethods({"y", "z"}) CheckerFrameworkSuperBuilder.Parent this); - @org.checkerframework.checker.builder.qual.ReturnsReceiver + public abstract C build(CheckerFrameworkSuperBuilder.Parent.@org.checkerframework.checker.calledmethods.qual.CalledMethods({"y", "z"}) ParentBuilder<C, B> this); + /** + * @return {@code this}. + */ + @org.checkerframework.common.returnsreceiver.qual.This @java.lang.SuppressWarnings("all") - public B x(@org.checkerframework.checker.builder.qual.NotCalledMethods("x") CheckerFrameworkSuperBuilder.Parent.ParentBuilder<C, B> this, final int x) { + public B x(CheckerFrameworkSuperBuilder.Parent.@org.checkerframework.checker.calledmethods.qual.NotCalledMethods("x") ParentBuilder<C, B> this, final int x) { this.x$value = x; x$set = true; return self(); } - @org.checkerframework.checker.builder.qual.ReturnsReceiver + /** + * @return {@code this}. + */ + @org.checkerframework.common.returnsreceiver.qual.This @java.lang.SuppressWarnings("all") - public B y(@org.checkerframework.checker.builder.qual.NotCalledMethods("y") CheckerFrameworkSuperBuilder.Parent.ParentBuilder<C, B> this, final int y) { + public B y(CheckerFrameworkSuperBuilder.Parent.@org.checkerframework.checker.calledmethods.qual.NotCalledMethods("y") ParentBuilder<C, B> this, final int y) { this.y = y; return self(); } - @org.checkerframework.checker.builder.qual.ReturnsReceiver + /** + * @return {@code this}. + */ + @org.checkerframework.common.returnsreceiver.qual.This @java.lang.SuppressWarnings("all") - public B z(@org.checkerframework.checker.builder.qual.NotCalledMethods("z") CheckerFrameworkSuperBuilder.Parent.ParentBuilder<C, B> this, final int z) { + public B z(CheckerFrameworkSuperBuilder.Parent.@org.checkerframework.checker.calledmethods.qual.NotCalledMethods("z") ParentBuilder<C, B> this, final int z) { this.z = z; return self(); } - @org.checkerframework.checker.builder.qual.ReturnsReceiver + @org.checkerframework.common.returnsreceiver.qual.This @java.lang.SuppressWarnings("all") public B name(final String name) { if (this.names == null) this.names = new java.util.ArrayList<String>(); this.names.add(name); return self(); } - @org.checkerframework.checker.builder.qual.ReturnsReceiver + @org.checkerframework.common.returnsreceiver.qual.This @java.lang.SuppressWarnings("all") public B names(final java.util.Collection<? extends String> names) { if (names == null) { @@ -65,7 +74,7 @@ class CheckerFrameworkSuperBuilder { this.names.addAll(names); return self(); } - @org.checkerframework.checker.builder.qual.ReturnsReceiver + @org.checkerframework.common.returnsreceiver.qual.This @java.lang.SuppressWarnings("all") public B clearNames() { if (this.names != null) this.names.clear(); @@ -80,12 +89,11 @@ class CheckerFrameworkSuperBuilder { } @java.lang.SuppressWarnings("all") private static final class ParentBuilderImpl extends CheckerFrameworkSuperBuilder.Parent.ParentBuilder<CheckerFrameworkSuperBuilder.Parent, CheckerFrameworkSuperBuilder.Parent.ParentBuilderImpl> { - @org.checkerframework.common.aliasing.qual.Unique @java.lang.SuppressWarnings("all") private ParentBuilderImpl() { } @java.lang.Override - @org.checkerframework.checker.builder.qual.ReturnsReceiver + @org.checkerframework.common.returnsreceiver.qual.This @org.checkerframework.dataflow.qual.Pure @java.lang.SuppressWarnings("all") protected CheckerFrameworkSuperBuilder.Parent.ParentBuilderImpl self() { @@ -94,7 +102,7 @@ class CheckerFrameworkSuperBuilder { @org.checkerframework.dataflow.qual.SideEffectFree @java.lang.Override @java.lang.SuppressWarnings("all") - public CheckerFrameworkSuperBuilder.Parent build(@org.checkerframework.checker.builder.qual.CalledMethods({"y", "z"}) CheckerFrameworkSuperBuilder.Parent.ParentBuilderImpl this) { + public CheckerFrameworkSuperBuilder.Parent build(CheckerFrameworkSuperBuilder.Parent.@org.checkerframework.checker.calledmethods.qual.CalledMethods({"y", "z"}) ParentBuilderImpl this) { return new CheckerFrameworkSuperBuilder.Parent(this); } } @@ -120,7 +128,7 @@ class CheckerFrameworkSuperBuilder { } @org.checkerframework.dataflow.qual.SideEffectFree @java.lang.SuppressWarnings("all") - public static CheckerFrameworkSuperBuilder.Parent.ParentBuilder<?, ?> builder() { + public static CheckerFrameworkSuperBuilder.Parent.@org.checkerframework.common.aliasing.qual.Unique ParentBuilder<?, ?> builder() { return new CheckerFrameworkSuperBuilder.Parent.ParentBuilderImpl(); } } @@ -140,24 +148,30 @@ class CheckerFrameworkSuperBuilder { @java.lang.SuppressWarnings("all") private int b; @java.lang.Override - @org.checkerframework.checker.builder.qual.ReturnsReceiver + @org.checkerframework.common.returnsreceiver.qual.This @org.checkerframework.dataflow.qual.Pure @java.lang.SuppressWarnings("all") protected abstract B self(); @org.checkerframework.dataflow.qual.SideEffectFree @java.lang.Override @java.lang.SuppressWarnings("all") - public abstract C build(@org.checkerframework.checker.builder.qual.CalledMethods("b") CheckerFrameworkSuperBuilder.ZChild this); - @org.checkerframework.checker.builder.qual.ReturnsReceiver + public abstract C build(CheckerFrameworkSuperBuilder.ZChild.@org.checkerframework.checker.calledmethods.qual.CalledMethods("b") ZChildBuilder<C, B> this); + /** + * @return {@code this}. + */ + @org.checkerframework.common.returnsreceiver.qual.This @java.lang.SuppressWarnings("all") - public B a(@org.checkerframework.checker.builder.qual.NotCalledMethods("a") CheckerFrameworkSuperBuilder.ZChild.ZChildBuilder<C, B> this, final int a) { + public B a(CheckerFrameworkSuperBuilder.ZChild.@org.checkerframework.checker.calledmethods.qual.NotCalledMethods("a") ZChildBuilder<C, B> this, final int a) { this.a$value = a; a$set = true; return self(); } - @org.checkerframework.checker.builder.qual.ReturnsReceiver + /** + * @return {@code this}. + */ + @org.checkerframework.common.returnsreceiver.qual.This @java.lang.SuppressWarnings("all") - public B b(@org.checkerframework.checker.builder.qual.NotCalledMethods("b") CheckerFrameworkSuperBuilder.ZChild.ZChildBuilder<C, B> this, final int b) { + public B b(CheckerFrameworkSuperBuilder.ZChild.@org.checkerframework.checker.calledmethods.qual.NotCalledMethods("b") ZChildBuilder<C, B> this, final int b) { this.b = b; return self(); } @@ -170,12 +184,11 @@ class CheckerFrameworkSuperBuilder { } @java.lang.SuppressWarnings("all") private static final class ZChildBuilderImpl extends CheckerFrameworkSuperBuilder.ZChild.ZChildBuilder<CheckerFrameworkSuperBuilder.ZChild, CheckerFrameworkSuperBuilder.ZChild.ZChildBuilderImpl> { - @org.checkerframework.common.aliasing.qual.Unique @java.lang.SuppressWarnings("all") private ZChildBuilderImpl() { } @java.lang.Override - @org.checkerframework.checker.builder.qual.ReturnsReceiver + @org.checkerframework.common.returnsreceiver.qual.This @org.checkerframework.dataflow.qual.Pure @java.lang.SuppressWarnings("all") protected CheckerFrameworkSuperBuilder.ZChild.ZChildBuilderImpl self() { @@ -184,7 +197,7 @@ class CheckerFrameworkSuperBuilder { @org.checkerframework.dataflow.qual.SideEffectFree @java.lang.Override @java.lang.SuppressWarnings("all") - public CheckerFrameworkSuperBuilder.ZChild build(@org.checkerframework.checker.builder.qual.CalledMethods("b") CheckerFrameworkSuperBuilder.ZChild.ZChildBuilderImpl this) { + public CheckerFrameworkSuperBuilder.ZChild build(CheckerFrameworkSuperBuilder.ZChild.@org.checkerframework.checker.calledmethods.qual.CalledMethods("b") ZChildBuilderImpl this) { return new CheckerFrameworkSuperBuilder.ZChild(this); } } @@ -198,7 +211,7 @@ class CheckerFrameworkSuperBuilder { } @org.checkerframework.dataflow.qual.SideEffectFree @java.lang.SuppressWarnings("all") - public static CheckerFrameworkSuperBuilder.ZChild.ZChildBuilder<?, ?> builder() { + public static CheckerFrameworkSuperBuilder.ZChild.@org.checkerframework.common.aliasing.qual.Unique ZChildBuilder<?, ?> builder() { return new CheckerFrameworkSuperBuilder.ZChild.ZChildBuilderImpl(); } } diff --git a/test/transform/resource/after-delombok/ConstructorsWithAccessors.java b/test/transform/resource/after-delombok/ConstructorsWithAccessors.java index 3614d682..7097d5a2 100644 --- a/test/transform/resource/after-delombok/ConstructorsWithAccessors.java +++ b/test/transform/resource/after-delombok/ConstructorsWithAccessors.java @@ -1,3 +1,4 @@ +//version 8: class ConstructorsWithAccessors { int plower; int pUpper; diff --git a/test/transform/resource/after-delombok/ConstructorsWithBuilderDefaults.java b/test/transform/resource/after-delombok/ConstructorsWithBuilderDefaults.java index d5ac9bad..bcc9a57e 100644 --- a/test/transform/resource/after-delombok/ConstructorsWithBuilderDefaults.java +++ b/test/transform/resource/after-delombok/ConstructorsWithBuilderDefaults.java @@ -16,12 +16,18 @@ final class ConstructorsWithBuilderDefaults { @java.lang.SuppressWarnings("all") ConstructorsWithBuilderDefaultsBuilder() { } + /** + * @return {@code this}. + */ @java.lang.SuppressWarnings("all") public ConstructorsWithBuilderDefaults.ConstructorsWithBuilderDefaultsBuilder x(final int x) { this.x$value = x; x$set = true; return this; } + /** + * @return {@code this}. + */ @java.lang.SuppressWarnings("all") public ConstructorsWithBuilderDefaults.ConstructorsWithBuilderDefaultsBuilder y(final int y) { this.y = y; diff --git a/test/transform/resource/after-delombok/ConstructorsWithBuilderDefaults2.java b/test/transform/resource/after-delombok/ConstructorsWithBuilderDefaults2.java index 9609f62b..f62167c6 100644 --- a/test/transform/resource/after-delombok/ConstructorsWithBuilderDefaults2.java +++ b/test/transform/resource/after-delombok/ConstructorsWithBuilderDefaults2.java @@ -33,18 +33,27 @@ final class ConstructorsWithBuilderDefaults<T> { @java.lang.SuppressWarnings("all") ConstructorsWithBuilderDefaultsBuilder() { } + /** + * @return {@code this}. + */ @java.lang.SuppressWarnings("all") public ConstructorsWithBuilderDefaults.ConstructorsWithBuilderDefaultsBuilder<T> z(final java.util.List<T> z) { this.z$value = z; z$set = true; return this; } + /** + * @return {@code this}. + */ @java.lang.SuppressWarnings("all") public ConstructorsWithBuilderDefaults.ConstructorsWithBuilderDefaultsBuilder<T> x(final T x) { this.x$value = x; x$set = true; return this; } + /** + * @return {@code this}. + */ @java.lang.SuppressWarnings("all") public ConstructorsWithBuilderDefaults.ConstructorsWithBuilderDefaultsBuilder<T> q(final T q) { this.q = q; diff --git a/test/transform/resource/after-delombok/DataOnLocalClass.java b/test/transform/resource/after-delombok/DataOnLocalClass.java index 80f3ca83..0d863f4f 100644 --- a/test/transform/resource/after-delombok/DataOnLocalClass.java +++ b/test/transform/resource/after-delombok/DataOnLocalClass.java @@ -1,3 +1,4 @@ +//version 8: class DataOnLocalClass1 { public static void main(String[] args) { class Local { diff --git a/test/transform/resource/after-delombok/DataWithOverrideEqualsAndHashCode.java b/test/transform/resource/after-delombok/DataWithOverrideEqualsAndHashCode.java new file mode 100644 index 00000000..7e84dda4 --- /dev/null +++ b/test/transform/resource/after-delombok/DataWithOverrideEqualsAndHashCode.java @@ -0,0 +1,25 @@ +class DataWithOverrideEqualsAndHashCode { + + class Data1 { + } + + class Data2 extends Data1 { + public int hashCode() { + return 42; + } + + public boolean equals(Object other) { + return false; + } + + @java.lang.SuppressWarnings("all") + public Data2() { + } + + @java.lang.Override + @java.lang.SuppressWarnings("all") + public java.lang.String toString() { + return "DataWithOverrideEqualsAndHashCode.Data2()"; + } + } +} diff --git a/test/transform/resource/after-delombok/EqualsAndHashCodeAnnotated.java b/test/transform/resource/after-delombok/EqualsAndHashCodeAnnotated.java index 64b6f4d3..d99fc71c 100644 --- a/test/transform/resource/after-delombok/EqualsAndHashCodeAnnotated.java +++ b/test/transform/resource/after-delombok/EqualsAndHashCodeAnnotated.java @@ -1,3 +1,4 @@ +//version 8: import java.lang.annotation.*; class EqualsAndHashCodeAnnotated { diff --git a/test/transform/resource/after-delombok/EqualsAndHashCodeCache.java b/test/transform/resource/after-delombok/EqualsAndHashCodeCache.java new file mode 100644 index 00000000..4f3574b6 --- /dev/null +++ b/test/transform/resource/after-delombok/EqualsAndHashCodeCache.java @@ -0,0 +1,167 @@ +class EqualsAndHashCode { + @java.lang.SuppressWarnings("all") + private transient int $hashCodeCache; + int x; + boolean[] y; + Object[] z; + String a; + String b; + @java.lang.Override + @java.lang.SuppressWarnings("all") + public boolean equals(final java.lang.Object o) { + if (o == this) return true; + if (!(o instanceof EqualsAndHashCode)) return false; + final EqualsAndHashCode other = (EqualsAndHashCode) o; + if (!other.canEqual((java.lang.Object) this)) return false; + if (this.x != other.x) return false; + if (!java.util.Arrays.equals(this.y, other.y)) return false; + if (!java.util.Arrays.deepEquals(this.z, other.z)) return false; + final java.lang.Object this$a = this.a; + final java.lang.Object other$a = other.a; + if (this$a == null ? other$a != null : !this$a.equals(other$a)) return false; + final java.lang.Object this$b = this.b; + final java.lang.Object other$b = other.b; + if (this$b == null ? other$b != null : !this$b.equals(other$b)) return false; + return true; + } + @java.lang.SuppressWarnings("all") + protected boolean canEqual(final java.lang.Object other) { + return other instanceof EqualsAndHashCode; + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public int hashCode() { + if (this.$hashCodeCache != 0) return this.$hashCodeCache; + final int PRIME = 59; + int result = 1; + result = result * PRIME + this.x; + result = result * PRIME + java.util.Arrays.hashCode(this.y); + result = result * PRIME + java.util.Arrays.deepHashCode(this.z); + final java.lang.Object $a = this.a; + result = result * PRIME + ($a == null ? 43 : $a.hashCode()); + final java.lang.Object $b = this.b; + result = result * PRIME + ($b == null ? 43 : $b.hashCode()); + if (result == 0) result = java.lang.Integer.MIN_VALUE; + this.$hashCodeCache = result; + return result; + } +} +final class EqualsAndHashCode2 { + @java.lang.SuppressWarnings("all") + private transient int $hashCodeCache; + int x; + long y; + float f; + double d; + boolean b; + @java.lang.Override + @java.lang.SuppressWarnings("all") + public boolean equals(final java.lang.Object o) { + if (o == this) return true; + if (!(o instanceof EqualsAndHashCode2)) return false; + final EqualsAndHashCode2 other = (EqualsAndHashCode2) o; + if (this.x != other.x) return false; + if (this.y != other.y) return false; + if (java.lang.Float.compare(this.f, other.f) != 0) return false; + if (java.lang.Double.compare(this.d, other.d) != 0) return false; + if (this.b != other.b) return false; + return true; + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public int hashCode() { + if (this.$hashCodeCache != 0) return this.$hashCodeCache; + final int PRIME = 59; + int result = 1; + result = result * PRIME + this.x; + final long $y = this.y; + result = result * PRIME + (int) ($y >>> 32 ^ $y); + result = result * PRIME + java.lang.Float.floatToIntBits(this.f); + final long $d = java.lang.Double.doubleToLongBits(this.d); + result = result * PRIME + (int) ($d >>> 32 ^ $d); + result = result * PRIME + (this.b ? 79 : 97); + if (result == 0) result = java.lang.Integer.MIN_VALUE; + this.$hashCodeCache = result; + return result; + } +} +final class EqualsAndHashCode3 extends EqualsAndHashCode { + @java.lang.SuppressWarnings("all") + private transient int $hashCodeCache; + @java.lang.Override + @java.lang.SuppressWarnings("all") + public boolean equals(final java.lang.Object o) { + if (o == this) return true; + if (!(o instanceof EqualsAndHashCode3)) return false; + final EqualsAndHashCode3 other = (EqualsAndHashCode3) o; + if (!other.canEqual((java.lang.Object) this)) return false; + return true; + } + @java.lang.SuppressWarnings("all") + protected boolean canEqual(final java.lang.Object other) { + return other instanceof EqualsAndHashCode3; + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public int hashCode() { + if (this.$hashCodeCache != 0) return this.$hashCodeCache; + int result = 1; + if (result == 0) result = java.lang.Integer.MIN_VALUE; + this.$hashCodeCache = result; + return result; + } +} +class EqualsAndHashCode4 extends EqualsAndHashCode { + @java.lang.SuppressWarnings("all") + private transient int $hashCodeCache; + @java.lang.Override + @java.lang.SuppressWarnings("all") + public boolean equals(final java.lang.Object o) { + if (o == this) return true; + if (!(o instanceof EqualsAndHashCode4)) return false; + final EqualsAndHashCode4 other = (EqualsAndHashCode4) o; + if (!other.canEqual((java.lang.Object) this)) return false; + if (!super.equals(o)) return false; + return true; + } + @java.lang.SuppressWarnings("all") + protected boolean canEqual(final java.lang.Object other) { + return other instanceof EqualsAndHashCode4; + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public int hashCode() { + if (this.$hashCodeCache != 0) return this.$hashCodeCache; + int result = super.hashCode(); + if (result == 0) result = java.lang.Integer.MIN_VALUE; + this.$hashCodeCache = result; + return result; + } +} +final class EqualsAndHashCode5 extends EqualsAndHashCode { + @java.lang.SuppressWarnings("all") + private transient int $hashCodeCache; + @java.lang.Override + @java.lang.SuppressWarnings("all") + public boolean equals(final java.lang.Object o) { + if (o == this) return true; + if (!(o instanceof EqualsAndHashCode5)) return false; + final EqualsAndHashCode5 other = (EqualsAndHashCode5) o; + if (!other.canEqual((java.lang.Object) this)) return false; + if (!super.equals(o)) return false; + return true; + } + @java.lang.SuppressWarnings("all") + protected boolean canEqual(final java.lang.Object other) { + return other instanceof EqualsAndHashCode5; + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public int hashCode() { + if (this.$hashCodeCache != 0) return this.$hashCodeCache; + int result = super.hashCode(); + if (result == 0) result = java.lang.Integer.MIN_VALUE; + this.$hashCodeCache = result; + return result; + } +} diff --git a/test/transform/resource/after-delombok/ExtensionMethodAutoboxing.java b/test/transform/resource/after-delombok/ExtensionMethodAutoboxing.java new file mode 100644 index 00000000..f274cabb --- /dev/null +++ b/test/transform/resource/after-delombok/ExtensionMethodAutoboxing.java @@ -0,0 +1,20 @@ +class ExtensionMethodAutoboxing { + public void test() { + Long l1 = 1L; + long l2 = 1L; + Integer i1 = 1; + int i2 = 1; + String string = "test"; + ExtensionMethodAutoboxing.Extensions.boxing(string, l1, i1); + ExtensionMethodAutoboxing.Extensions.boxing(string, l1, i2); + ExtensionMethodAutoboxing.Extensions.boxing(string, l2, i1); + ExtensionMethodAutoboxing.Extensions.boxing(string, l2, i2); + } + + + static class Extensions { + public static String boxing(String string, Long a, int b) { + return string + " " + a + " " + b; + } + } +}
\ No newline at end of file diff --git a/test/transform/resource/after-delombok/ExtensionMethodChain.java b/test/transform/resource/after-delombok/ExtensionMethodChain.java new file mode 100644 index 00000000..77f79dea --- /dev/null +++ b/test/transform/resource/after-delombok/ExtensionMethodChain.java @@ -0,0 +1,15 @@ +import java.util.Arrays; +import java.util.List; + +class ExtensionMethodChain { + public void test() { + ExtensionMethodChain.Extensions.intValue("1").intValue(); + } + + + static class Extensions { + public static Integer intValue(String s) { + return Integer.valueOf(s); + } + } +}
\ No newline at end of file diff --git a/test/transform/resource/after-delombok/ExtensionMethodFunctional.java b/test/transform/resource/after-delombok/ExtensionMethodFunctional.java new file mode 100644 index 00000000..2b82a957 --- /dev/null +++ b/test/transform/resource/after-delombok/ExtensionMethodFunctional.java @@ -0,0 +1,42 @@ +// version 8: +import java.util.function.Consumer; +import java.util.function.Function; +import java.util.List; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +class ExtensionMethodFunctional { + public void test() { + String test = "test"; + test = ExtensionMethodFunctional.Extensions.map(test, s -> ExtensionMethodFunctional.Extensions.reverse(s)); + ExtensionMethodFunctional.Extensions.consume(test, s -> System.out.println("1: " + s), s -> System.out.println("2: " + s)); + ExtensionMethodFunctional.Extensions.consume(test, System.out::println, System.out::println); + ExtensionMethodFunctional.Extensions.toList1(Stream.of("a", "b", "c").map(String::toUpperCase)); + List<Integer> i2 = ExtensionMethodFunctional.Extensions.toList2(Stream.of("a", "b", "c").map(String::toUpperCase)); + } + + static class Extensions { + public static <T, R> R map(T value, Function<T, R> mapper) { + return mapper.apply(value); + } + + public static String reverse(String string) { + return new StringBuilder(string).reverse().toString(); + } + + @SafeVarargs + public static <T> void consume(T o, Consumer<T>... consumer) { + for (int i = 0; i < consumer.length; i++) { + consumer[i].accept(o); + } + } + + public static <T> List<T> toList1(Stream<T> stream) { + return (List<T>) stream.collect(Collectors.toList()); + } + + public static <T, U> List<U> toList2(Stream<T> stream) { + return null; + } + } +} diff --git a/test/transform/resource/after-delombok/ExtensionMethodGeneric.java b/test/transform/resource/after-delombok/ExtensionMethodGeneric.java new file mode 100644 index 00000000..8559b7ff --- /dev/null +++ b/test/transform/resource/after-delombok/ExtensionMethodGeneric.java @@ -0,0 +1,33 @@ +import java.util.List; +import java.util.Map; + +class ExtensionMethodGeneric { + public void test() { + List<String> stringList = null; + List<Number> numberList = null; + ExtensionMethodGeneric.Extensions.test(stringList); + ExtensionMethodGeneric.Extensions.test(stringList, numberList); + ExtensionMethodGeneric.Extensions.test(ExtensionMethodGeneric.Extensions.test(stringList, stringList), numberList); + Integer i = ExtensionMethodGeneric.Extensions.test2(stringList); + Map<String, Integer> map = null; + List<String> l = ExtensionMethodGeneric.Extensions.test(map, stringList, numberList); + } + + static class Extensions { + public static <T> List<T> test(List<String> obj, List<T> list) { + return null; + } + + public static <K, V> K test(Map<String, Integer> obj, K k, V v) { + return k; + } + + public static <T> T test(List<T> list) { + return null; + } + + public static <T, U> U test2(List<T> list) { + return null; + } + } +} diff --git a/test/transform/resource/after-delombok/ExtensionMethodNames.java b/test/transform/resource/after-delombok/ExtensionMethodNames.java new file mode 100644 index 00000000..45f76ee4 --- /dev/null +++ b/test/transform/resource/after-delombok/ExtensionMethodNames.java @@ -0,0 +1,27 @@ +package a; + +class ExtensionMethodNames { + + public void instanceCalls() { + a.Extensions.ext((new Test())); + Test t = new Test(); + a.Extensions.ext(t); + Test Test = new Test(); + a.Extensions.ext(Test); + } + + public void staticCalls() { + Test.ext(); + a.Test.ext(); + } +} + +class Extensions { + public static void ext(Test t) { + } +} + +class Test { + public static void ext() { + } +}
\ No newline at end of file diff --git a/test/transform/resource/after-delombok/ExtensionMethodSuppress.java b/test/transform/resource/after-delombok/ExtensionMethodSuppress.java new file mode 100644 index 00000000..d9e7cb28 --- /dev/null +++ b/test/transform/resource/after-delombok/ExtensionMethodSuppress.java @@ -0,0 +1,33 @@ +class ExtensionMethodSuppress { + public void test() { + Test.staticMethod(); + Test test = new Test(); + Extensions.instanceMethod(test); + Extensions.staticMethod(test); + } +} + +class ExtensionMethodKeep { + public void test() { + Test.staticMethod(); + Test test = new Test(); + test.instanceMethod(); + test.staticMethod(); + } +} + +class Test { + public static void staticMethod() { + } + + public void instanceMethod() { + } +} + +class Extensions { + public static void staticMethod(Test test) { + } + + public static void instanceMethod(Test test) { + } +}
\ No newline at end of file diff --git a/test/transform/resource/after-delombok/ExtensionMethodVarargs.java b/test/transform/resource/after-delombok/ExtensionMethodVarargs.java new file mode 100644 index 00000000..237b73ef --- /dev/null +++ b/test/transform/resource/after-delombok/ExtensionMethodVarargs.java @@ -0,0 +1,19 @@ +class ExtensionMethodVarargs { + public void test() { + Long l1 = 1L; + long l2 = 1L; + Integer i1 = 1; + int i2 = 1; + ExtensionMethodVarargs.Extensions.format("%d %d %d %d", l1, l2, i1, i2); + ExtensionMethodVarargs.Extensions.format("%d", l1); + ExtensionMethodVarargs.Extensions.format("", new Integer[] {1, 2}); + ExtensionMethodVarargs.Extensions.format("", new Integer[] {1, 2}, new Integer[] {1, 2}); + } + + + static class Extensions { + public static String format(String string, Object... params) { + return String.format(string, params); + } + } +}
\ No newline at end of file diff --git a/test/transform/resource/after-delombok/GetterLazyArguments.java b/test/transform/resource/after-delombok/GetterLazyArguments.java index a8a422c0..604513cd 100644 --- a/test/transform/resource/after-delombok/GetterLazyArguments.java +++ b/test/transform/resource/after-delombok/GetterLazyArguments.java @@ -1,3 +1,4 @@ +// version 8: class GetterLazyArguments { static String fun() { return null; diff --git a/test/transform/resource/after-delombok/GetterOnClass.java b/test/transform/resource/after-delombok/GetterOnClass.java index f0025370..ae845e54 100644 --- a/test/transform/resource/after-delombok/GetterOnClass.java +++ b/test/transform/resource/after-delombok/GetterOnClass.java @@ -1,3 +1,4 @@ +//version 8: class GetterOnClass1 { boolean isNone; boolean isPublic; diff --git a/test/transform/resource/after-delombok/I2335_BuilderMultipleObtainVia.java b/test/transform/resource/after-delombok/I2335_BuilderMultipleObtainVia.java index f9cd424d..6cf390ed 100644 --- a/test/transform/resource/after-delombok/I2335_BuilderMultipleObtainVia.java +++ b/test/transform/resource/after-delombok/I2335_BuilderMultipleObtainVia.java @@ -26,11 +26,17 @@ public class I2335_BuilderMultipleObtainVia { @java.lang.SuppressWarnings("all") I2335_BuilderMultipleObtainViaBuilder() { } + /** + * @return {@code this}. + */ @java.lang.SuppressWarnings("all") public I2335_BuilderMultipleObtainVia.I2335_BuilderMultipleObtainViaBuilder theString(final String theString) { this.theString = theString; return this; } + /** + * @return {@code this}. + */ @java.lang.SuppressWarnings("all") public I2335_BuilderMultipleObtainVia.I2335_BuilderMultipleObtainViaBuilder theLong(final Long theLong) { this.theLong = theLong; diff --git a/test/transform/resource/after-delombok/JacksonBuilderSingular.java b/test/transform/resource/after-delombok/JacksonBuilderSingular.java index feaa6832..b2bbfa5a 100644 --- a/test/transform/resource/after-delombok/JacksonBuilderSingular.java +++ b/test/transform/resource/after-delombok/JacksonBuilderSingular.java @@ -1,3 +1,4 @@ +//version 8: Jackson deps are at least Java7+. import java.util.List; import java.util.Map; import com.fasterxml.jackson.annotation.JsonAnySetter; diff --git a/test/transform/resource/after-delombok/JacksonJsonProperty.java b/test/transform/resource/after-delombok/JacksonJsonProperty.java index 9ca8d7de..7bb17dfd 100644 --- a/test/transform/resource/after-delombok/JacksonJsonProperty.java +++ b/test/transform/resource/after-delombok/JacksonJsonProperty.java @@ -1,3 +1,4 @@ +//version 8: Jackson deps are at least Java7+. import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonSetter; import com.fasterxml.jackson.annotation.Nulls; @@ -16,6 +17,9 @@ public class JacksonJsonProperty { @java.lang.SuppressWarnings("all") JacksonJsonPropertyBuilder() { } + /** + * @return {@code this}. + */ @JsonProperty("kebab-case-prop") @JsonSetter(nulls = Nulls.SKIP) @java.lang.SuppressWarnings("all") diff --git a/test/transform/resource/after-delombok/JacksonizedBuilderComplex.java b/test/transform/resource/after-delombok/JacksonizedBuilderComplex.java index 30f6b9af..ed0ca9e7 100644 --- a/test/transform/resource/after-delombok/JacksonizedBuilderComplex.java +++ b/test/transform/resource/after-delombok/JacksonizedBuilderComplex.java @@ -1,3 +1,4 @@ +//version 8: Jackson deps are at least Java7+. //CONF: lombok.builder.className = Test*Name import java.util.List; @com.fasterxml.jackson.databind.annotation.JsonDeserialize(builder = JacksonizedBuilderComplex.TestVoidName.class) @@ -18,21 +19,33 @@ class JacksonizedBuilderComplex { @java.lang.SuppressWarnings("all") TestVoidName() { } + /** + * @return {@code this}. + */ @java.lang.SuppressWarnings("all") public JacksonizedBuilderComplex.TestVoidName<T> withNumber(final T number) { this.number = number; return this; } + /** + * @return {@code this}. + */ @java.lang.SuppressWarnings("all") public JacksonizedBuilderComplex.TestVoidName<T> withArg2(final int arg2) { this.arg2 = arg2; return this; } + /** + * @return {@code this}. + */ @java.lang.SuppressWarnings("all") public JacksonizedBuilderComplex.TestVoidName<T> withArg3(final String arg3) { this.arg3 = arg3; return this; } + /** + * @return {@code this}. + */ @java.lang.SuppressWarnings("all") public JacksonizedBuilderComplex.TestVoidName<T> withSelfRef(final JacksonizedBuilderComplex selfRef) { this.selfRef = selfRef; diff --git a/test/transform/resource/after-delombok/JacksonizedBuilderSimple.java b/test/transform/resource/after-delombok/JacksonizedBuilderSimple.java index bd79df90..cb8390d2 100644 --- a/test/transform/resource/after-delombok/JacksonizedBuilderSimple.java +++ b/test/transform/resource/after-delombok/JacksonizedBuilderSimple.java @@ -1,3 +1,4 @@ +//version 8: Jackson deps are at least Java7+. import java.util.List; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; @JsonIgnoreProperties(ignoreUnknown = true) @@ -23,11 +24,17 @@ class JacksonizedBuilderSimple<T> { @java.lang.SuppressWarnings("all") JacksonizedBuilderSimpleBuilder() { } + /** + * @return {@code this}. + */ @java.lang.SuppressWarnings("all") public JacksonizedBuilderSimple.JacksonizedBuilderSimpleBuilder<T> yes(final int yes) { this.yes = yes; return this; } + /** + * @return {@code this}. + */ @java.lang.SuppressWarnings("all") public JacksonizedBuilderSimple.JacksonizedBuilderSimpleBuilder<T> also(final List<T> also) { this.also = also; diff --git a/test/transform/resource/after-delombok/JacksonizedSuperBuilderSimple.java b/test/transform/resource/after-delombok/JacksonizedSuperBuilderSimple.java index 7fd3f8dc..88a51f41 100644 --- a/test/transform/resource/after-delombok/JacksonizedSuperBuilderSimple.java +++ b/test/transform/resource/after-delombok/JacksonizedSuperBuilderSimple.java @@ -1,55 +1,59 @@ -public class JacksonizedSuperBuilderSimple {
- @com.fasterxml.jackson.annotation.JsonIgnoreProperties(ignoreUnknown = true)
- @com.fasterxml.jackson.databind.annotation.JsonDeserialize(builder = JacksonizedSuperBuilderSimple.Parent.ParentBuilderImpl.class)
- public static class Parent {
- int field1;
- @java.lang.SuppressWarnings("all")
- 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();
- @java.lang.SuppressWarnings("all")
- public B field1(final int field1) {
- this.field1 = field1;
- return self();
- }
- @java.lang.Override
- @java.lang.SuppressWarnings("all")
- public java.lang.String toString() {
- return "JacksonizedSuperBuilderSimple.Parent.ParentBuilder(field1=" + this.field1 + ")";
- }
- }
- @java.lang.SuppressWarnings("all")
- @com.fasterxml.jackson.annotation.JsonIgnoreProperties(ignoreUnknown = true)
- @com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder(withPrefix = "", buildMethodName = "build")
- static final class ParentBuilderImpl extends JacksonizedSuperBuilderSimple.Parent.ParentBuilder<JacksonizedSuperBuilderSimple.Parent, JacksonizedSuperBuilderSimple.Parent.ParentBuilderImpl> {
- @java.lang.SuppressWarnings("all")
- private ParentBuilderImpl() {
- }
- @java.lang.Override
- @java.lang.SuppressWarnings("all")
- protected JacksonizedSuperBuilderSimple.Parent.ParentBuilderImpl self() {
- return this;
- }
- @java.lang.Override
- @java.lang.SuppressWarnings("all")
- public JacksonizedSuperBuilderSimple.Parent build() {
- return new JacksonizedSuperBuilderSimple.Parent(this);
- }
- }
- @java.lang.SuppressWarnings("all")
- protected Parent(final JacksonizedSuperBuilderSimple.Parent.ParentBuilder<?, ?> b) {
- this.field1 = b.field1;
- }
- @java.lang.SuppressWarnings("all")
- public static JacksonizedSuperBuilderSimple.Parent.ParentBuilder<?, ?> builder() {
- return new JacksonizedSuperBuilderSimple.Parent.ParentBuilderImpl();
- }
- }
- public static void test() {
- Parent x = Parent.builder().field1(5).build();
- }
-}
+//version 8: Jackson deps are at least Java7+. +public class JacksonizedSuperBuilderSimple { + @com.fasterxml.jackson.annotation.JsonIgnoreProperties(ignoreUnknown = true) + @com.fasterxml.jackson.databind.annotation.JsonDeserialize(builder = JacksonizedSuperBuilderSimple.Parent.ParentBuilderImpl.class) + public static class Parent { + int field1; + @java.lang.SuppressWarnings("all") + 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}. + */ + @java.lang.SuppressWarnings("all") + public B field1(final int field1) { + this.field1 = field1; + return self(); + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public java.lang.String toString() { + return "JacksonizedSuperBuilderSimple.Parent.ParentBuilder(field1=" + this.field1 + ")"; + } + } + @java.lang.SuppressWarnings("all") + @com.fasterxml.jackson.annotation.JsonIgnoreProperties(ignoreUnknown = true) + @com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder(withPrefix = "", buildMethodName = "build") + static final class ParentBuilderImpl extends JacksonizedSuperBuilderSimple.Parent.ParentBuilder<JacksonizedSuperBuilderSimple.Parent, JacksonizedSuperBuilderSimple.Parent.ParentBuilderImpl> { + @java.lang.SuppressWarnings("all") + private ParentBuilderImpl() { + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + protected JacksonizedSuperBuilderSimple.Parent.ParentBuilderImpl self() { + return this; + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public JacksonizedSuperBuilderSimple.Parent build() { + return new JacksonizedSuperBuilderSimple.Parent(this); + } + } + @java.lang.SuppressWarnings("all") + protected Parent(final JacksonizedSuperBuilderSimple.Parent.ParentBuilder<?, ?> b) { + this.field1 = b.field1; + } + @java.lang.SuppressWarnings("all") + public static JacksonizedSuperBuilderSimple.Parent.ParentBuilder<?, ?> builder() { + return new JacksonizedSuperBuilderSimple.Parent.ParentBuilderImpl(); + } + } + public static void test() { + Parent x = Parent.builder().field1(5).build(); + } +} diff --git a/test/transform/resource/after-delombok/JacksonizedSuperBuilderWithJsonDeserialize.java b/test/transform/resource/after-delombok/JacksonizedSuperBuilderWithJsonDeserialize.java index a94d5f5b..1ed38f05 100644 --- a/test/transform/resource/after-delombok/JacksonizedSuperBuilderWithJsonDeserialize.java +++ b/test/transform/resource/after-delombok/JacksonizedSuperBuilderWithJsonDeserialize.java @@ -1,5 +1,4 @@ //skip-idempotent -@lombok.experimental.SuperBuilder @com.fasterxml.jackson.databind.annotation.JsonDeserialize public class JacksonizedSuperBuilderWithJsonDeserialize { int field1; @@ -11,6 +10,9 @@ public class JacksonizedSuperBuilderWithJsonDeserialize { protected abstract B self(); @java.lang.SuppressWarnings("all") public abstract C build(); + /** + * @return {@code this}. + */ @java.lang.SuppressWarnings("all") public B field1(final int field1) { this.field1 = field1; diff --git a/test/transform/resource/after-delombok/JavadocMultiline.java b/test/transform/resource/after-delombok/JavadocMultiline.java new file mode 100644 index 00000000..cc8b1148 --- /dev/null +++ b/test/transform/resource/after-delombok/JavadocMultiline.java @@ -0,0 +1,51 @@ +class JavadocMultiline { + /** + * This is a list of booleans. + */ + private java.util.List<Boolean> booleans; + /** + * This is a list of booleans. + */ + private java.util.List<Boolean> booleans2; + + /** + * This is a list of booleans. + * + * @return A list of booleans to set for this object. This is a Javadoc return that is long + * enough to wrap to multiple lines. + */ + @java.lang.SuppressWarnings("all") + public java.util.List<Boolean> getBooleans() { + return this.booleans; + } + + /** + * This is a list of booleans. + */ + @java.lang.SuppressWarnings("all") + public java.util.List<Boolean> getBooleans2() { + return this.booleans2; + } + + /** + * This is a list of booleans. + * + * @param booleans A list of booleans to set for this object. This is a Javadoc param that is + * long enough to wrap to multiple lines. + */ + @java.lang.SuppressWarnings("all") + public void setBooleans(final java.util.List<Boolean> booleans) { + this.booleans = booleans; + } + + /** + * This is a list of booleans. + * + * @param booleans A list of booleans to set for this object. This is a Javadoc param that is + * long enough to wrap to multiple lines. + */ + @java.lang.SuppressWarnings("all") + public void setBooleans2(final java.util.List<Boolean> booleans2) { + this.booleans2 = booleans2; + } +}
\ No newline at end of file diff --git a/test/transform/resource/after-delombok/LoggerLog4j2.java b/test/transform/resource/after-delombok/LoggerLog4j2.java index b32c7722..cba516f2 100644 --- a/test/transform/resource/after-delombok/LoggerLog4j2.java +++ b/test/transform/resource/after-delombok/LoggerLog4j2.java @@ -1,3 +1,4 @@ +//version 8: class LoggerLog4j2 { @java.lang.SuppressWarnings("all") private static final org.apache.logging.log4j.Logger log = org.apache.logging.log4j.LogManager.getLogger(LoggerLog4j2.class); diff --git a/test/transform/resource/after-delombok/LoggerSlf4j.java b/test/transform/resource/after-delombok/LoggerSlf4j.java index 70f11ae4..152c8708 100644 --- a/test/transform/resource/after-delombok/LoggerSlf4j.java +++ b/test/transform/resource/after-delombok/LoggerSlf4j.java @@ -29,8 +29,3 @@ class LoggerSlf4jWithTwoStaticFields { private static final org.slf4j.Logger log = org.slf4j.LoggerFactory.getLogger(LoggerSlf4jWithTwoStaticFields.TOPIC + LoggerSlf4jWithTwoStaticFields.TOPIC); static final String TOPIC = "StaticField"; } - -class LoggerSlf4jWithTwoLiterals { - @java.lang.SuppressWarnings("all") - private static final org.slf4j.Logger log = org.slf4j.LoggerFactory.getLogger("A" + "B"); -}
\ No newline at end of file diff --git a/test/transform/resource/after-delombok/LoggerSlf4jInvalidTopic.java b/test/transform/resource/after-delombok/LoggerSlf4jInvalidTopic.java deleted file mode 100644 index 86e6ae2c..00000000 --- a/test/transform/resource/after-delombok/LoggerSlf4jInvalidTopic.java +++ /dev/null @@ -1,5 +0,0 @@ -import lombok.extern.slf4j.Slf4j; - -@Slf4j(topic = 42) -class LoggerSlf4jWithIntegerTopic { -}
\ No newline at end of file diff --git a/test/transform/resource/after-delombok/NonNullOnParameter.java b/test/transform/resource/after-delombok/NonNullOnParameter.java index 4f6df920..95fd13ec 100644 --- a/test/transform/resource/after-delombok/NonNullOnParameter.java +++ b/test/transform/resource/after-delombok/NonNullOnParameter.java @@ -1,3 +1,4 @@ +//version 8: class NonNullOnParameter extends Thread { NonNullOnParameter(@lombok.NonNull String arg) { this(arg, ""); diff --git a/test/transform/resource/after-delombok/NonNullOnParameterAbstract.java b/test/transform/resource/after-delombok/NonNullOnParameterAbstract.java index 88577f25..df496931 100644 --- a/test/transform/resource/after-delombok/NonNullOnParameterAbstract.java +++ b/test/transform/resource/after-delombok/NonNullOnParameterAbstract.java @@ -1,3 +1,4 @@ +//version 8: abstract class NonNullOnParameterAbstract { public void test(@lombok.NonNull String arg) { if (arg == null) { diff --git a/test/transform/resource/after-delombok/NonNullPlain.java b/test/transform/resource/after-delombok/NonNullPlain.java index 24377237..9fc29042 100644 --- a/test/transform/resource/after-delombok/NonNullPlain.java +++ b/test/transform/resource/after-delombok/NonNullPlain.java @@ -1,3 +1,4 @@ +//version 8: import java.lang.annotation.*; class NonNullPlain { @lombok.NonNull diff --git a/test/transform/resource/after-delombok/NonNullTypeUse.java b/test/transform/resource/after-delombok/NonNullTypeUse.java index 7c438501..b80a6da8 100644 --- a/test/transform/resource/after-delombok/NonNullTypeUse.java +++ b/test/transform/resource/after-delombok/NonNullTypeUse.java @@ -1,3 +1,4 @@ +//version 8: import lombok.NonNull; class NonNullTypeUse { void test1(@NonNull String[][][] args) { diff --git a/test/transform/resource/after-delombok/NonNullWithAlternateException.java b/test/transform/resource/after-delombok/NonNullWithAlternateException.java index 7f30fd1f..e76feca2 100644 --- a/test/transform/resource/after-delombok/NonNullWithAlternateException.java +++ b/test/transform/resource/after-delombok/NonNullWithAlternateException.java @@ -1,3 +1,4 @@ +//version 8: public class NonNullWithAlternateException { @lombok.NonNull private String test; diff --git a/test/transform/resource/after-delombok/NonNullWithAssertion.java b/test/transform/resource/after-delombok/NonNullWithAssertion.java index 15dc0254..318d85b9 100644 --- a/test/transform/resource/after-delombok/NonNullWithAssertion.java +++ b/test/transform/resource/after-delombok/NonNullWithAssertion.java @@ -1,3 +1,4 @@ +//version 8: public class NonNullWithAssertion { @lombok.NonNull private String test; diff --git a/test/transform/resource/after-delombok/NonNullWithGuava.java b/test/transform/resource/after-delombok/NonNullWithGuava.java index b3c13d30..efa5878e 100644 --- a/test/transform/resource/after-delombok/NonNullWithGuava.java +++ b/test/transform/resource/after-delombok/NonNullWithGuava.java @@ -1,3 +1,4 @@ +//version 8: import static com.google.common.base.Preconditions.*; public class NonNullWithGuava { @lombok.NonNull diff --git a/test/transform/resource/after-delombok/NonNullWithJdk.java b/test/transform/resource/after-delombok/NonNullWithJdk.java index d7e2958c..725d90c7 100644 --- a/test/transform/resource/after-delombok/NonNullWithJdk.java +++ b/test/transform/resource/after-delombok/NonNullWithJdk.java @@ -1,4 +1,4 @@ -//version 7: +//version 8: import static java.util.Objects.*; public class NonNullWithJdk { @lombok.NonNull diff --git a/test/transform/resource/after-delombok/NonNullWithSneakyThrows.java b/test/transform/resource/after-delombok/NonNullWithSneakyThrows.java index 44640164..cd7f8092 100644 --- a/test/transform/resource/after-delombok/NonNullWithSneakyThrows.java +++ b/test/transform/resource/after-delombok/NonNullWithSneakyThrows.java @@ -1,3 +1,4 @@ +//version 8: class NonNullWithSneakyThrows { void test(@lombok.NonNull String in) { try { diff --git a/test/transform/resource/after-delombok/NullAnnotatedCheckerFrameworkSuperBuilder.java b/test/transform/resource/after-delombok/NullAnnotatedCheckerFrameworkSuperBuilder.java new file mode 100644 index 00000000..25a76c6d --- /dev/null +++ b/test/transform/resource/after-delombok/NullAnnotatedCheckerFrameworkSuperBuilder.java @@ -0,0 +1,237 @@ +//version 8: +//CONF: lombok.addNullAnnotations = checkerframework +import java.util.List; + +class NullAnnotatedCheckerFrameworkSuperBuilder { + + public static class Parent { + int x; + int y; + int z; + List<String> names; + + @java.lang.SuppressWarnings("all") + private static int $default$x() { + return 5; + } + + + @java.lang.SuppressWarnings("all") + public static abstract class ParentBuilder<C extends NullAnnotatedCheckerFrameworkSuperBuilder.Parent, B extends NullAnnotatedCheckerFrameworkSuperBuilder.Parent.ParentBuilder<C, B>> { + @java.lang.SuppressWarnings("all") + private boolean x$set; + @java.lang.SuppressWarnings("all") + private int x$value; + @java.lang.SuppressWarnings("all") + private int y; + @java.lang.SuppressWarnings("all") + private int z; + @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}. + */ + @org.checkerframework.checker.nullness.qual.NonNull + @java.lang.SuppressWarnings("all") + public B x(final int x) { + this.x$value = x; + x$set = true; + return self(); + } + + /** + * @return {@code this}. + */ + @org.checkerframework.checker.nullness.qual.NonNull + @java.lang.SuppressWarnings("all") + public B y(final int y) { + this.y = y; + return self(); + } + + /** + * @return {@code this}. + */ + @org.checkerframework.checker.nullness.qual.NonNull + @java.lang.SuppressWarnings("all") + public B z(final int z) { + this.z = z; + return self(); + } + + @org.checkerframework.checker.nullness.qual.NonNull + @java.lang.SuppressWarnings("all") + public B name(final String name) { + if (this.names == null) this.names = new java.util.ArrayList<String>(); + this.names.add(name); + return self(); + } + + @org.checkerframework.checker.nullness.qual.NonNull + @java.lang.SuppressWarnings("all") + public B names(final java.util.@org.checkerframework.checker.nullness.qual.NonNull Collection<? extends String> names) { + if (names == null) { + throw new java.lang.NullPointerException("names cannot be null"); + } + if (this.names == null) this.names = new java.util.ArrayList<String>(); + this.names.addAll(names); + return self(); + } + + @org.checkerframework.checker.nullness.qual.NonNull + @java.lang.SuppressWarnings("all") + public B clearNames() { + if (this.names != null) this.names.clear(); + return self(); + } + + @java.lang.Override + @java.lang.SuppressWarnings("all") + public 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 + ")"; + } + } + + + @java.lang.SuppressWarnings("all") + private static final class ParentBuilderImpl extends NullAnnotatedCheckerFrameworkSuperBuilder.Parent.ParentBuilder<NullAnnotatedCheckerFrameworkSuperBuilder.Parent, NullAnnotatedCheckerFrameworkSuperBuilder.Parent.ParentBuilderImpl> { + @java.lang.SuppressWarnings("all") + private ParentBuilderImpl() { + } + + @java.lang.Override + @java.lang.SuppressWarnings("all") + protected NullAnnotatedCheckerFrameworkSuperBuilder.Parent.ParentBuilderImpl self() { + return this; + } + + @java.lang.Override + @java.lang.SuppressWarnings("all") + public NullAnnotatedCheckerFrameworkSuperBuilder.@org.checkerframework.checker.nullness.qual.NonNull Parent build() { + return new NullAnnotatedCheckerFrameworkSuperBuilder.Parent(this); + } + } + + @java.lang.SuppressWarnings("all") + protected Parent(final NullAnnotatedCheckerFrameworkSuperBuilder.Parent.ParentBuilder<?, ?> b) { + if (b.x$set) this.x = b.x$value; + else this.x = NullAnnotatedCheckerFrameworkSuperBuilder.Parent.$default$x(); + this.y = b.y; + this.z = b.z; + java.util.List<String> names; + switch (b.names == null ? 0 : b.names.size()) { + case 0: + names = java.util.Collections.emptyList(); + break; + case 1: + names = java.util.Collections.singletonList(b.names.get(0)); + break; + default: + names = java.util.Collections.unmodifiableList(new java.util.ArrayList<String>(b.names)); + } + this.names = names; + } + + @java.lang.SuppressWarnings("all") + public static NullAnnotatedCheckerFrameworkSuperBuilder.Parent.@org.checkerframework.checker.nullness.qual.NonNull ParentBuilder<?, ?> builder() { + return new NullAnnotatedCheckerFrameworkSuperBuilder.Parent.ParentBuilderImpl(); + } + } + + + public static class ZChild extends Parent { + int a; + int b; + + @java.lang.SuppressWarnings("all") + private static int $default$a() { + return 1; + } + + + @java.lang.SuppressWarnings("all") + public static abstract class ZChildBuilder<C extends NullAnnotatedCheckerFrameworkSuperBuilder.ZChild, B extends NullAnnotatedCheckerFrameworkSuperBuilder.ZChild.ZChildBuilder<C, B>> extends Parent.ParentBuilder<C, B> { + @java.lang.SuppressWarnings("all") + private boolean a$set; + @java.lang.SuppressWarnings("all") + private int a$value; + @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}. + */ + @org.checkerframework.checker.nullness.qual.NonNull + @java.lang.SuppressWarnings("all") + public B a(final int a) { + this.a$value = a; + a$set = true; + return self(); + } + + /** + * @return {@code this}. + */ + @org.checkerframework.checker.nullness.qual.NonNull + @java.lang.SuppressWarnings("all") + public B b(final int b) { + this.b = b; + return self(); + } + + @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 + ")"; + } + } + + + @java.lang.SuppressWarnings("all") + private static final class ZChildBuilderImpl extends NullAnnotatedCheckerFrameworkSuperBuilder.ZChild.ZChildBuilder<NullAnnotatedCheckerFrameworkSuperBuilder.ZChild, NullAnnotatedCheckerFrameworkSuperBuilder.ZChild.ZChildBuilderImpl> { + @java.lang.SuppressWarnings("all") + private ZChildBuilderImpl() { + } + + @java.lang.Override + @java.lang.SuppressWarnings("all") + protected NullAnnotatedCheckerFrameworkSuperBuilder.ZChild.ZChildBuilderImpl self() { + return this; + } + + @java.lang.Override + @java.lang.SuppressWarnings("all") + public NullAnnotatedCheckerFrameworkSuperBuilder.@org.checkerframework.checker.nullness.qual.NonNull ZChild build() { + return new NullAnnotatedCheckerFrameworkSuperBuilder.ZChild(this); + } + } + + @java.lang.SuppressWarnings("all") + protected ZChild(final NullAnnotatedCheckerFrameworkSuperBuilder.ZChild.ZChildBuilder<?, ?> b) { + super(b); + if (b.a$set) this.a = b.a$value; + else this.a = NullAnnotatedCheckerFrameworkSuperBuilder.ZChild.$default$a(); + this.b = b.b; + } + + @java.lang.SuppressWarnings("all") + public static NullAnnotatedCheckerFrameworkSuperBuilder.ZChild.@org.checkerframework.checker.nullness.qual.NonNull ZChildBuilder<?, ?> builder() { + return new NullAnnotatedCheckerFrameworkSuperBuilder.ZChild.ZChildBuilderImpl(); + } + } +} diff --git a/test/transform/resource/after-delombok/NullLibrary1.java b/test/transform/resource/after-delombok/NullLibrary1.java index e426e3d3..e299be3d 100644 --- a/test/transform/resource/after-delombok/NullLibrary1.java +++ b/test/transform/resource/after-delombok/NullLibrary1.java @@ -1,3 +1,4 @@ +//version 8: public class NullLibrary1 { String foo; @java.lang.Override @@ -34,6 +35,9 @@ public class NullLibrary1 { public NullLibrary1(final String foo) { this.foo = foo; } + /** + * @return a clone of this object, except with this updated property (returns {@code this} if an identical value is passed). + */ @org.eclipse.jdt.annotation.NonNull @java.lang.SuppressWarnings("all") public NullLibrary1 withFoo(final String foo) { diff --git a/test/transform/resource/after-delombok/NullLibrary2.java b/test/transform/resource/after-delombok/NullLibrary2.java index 8f48c8a5..fec143c2 100644 --- a/test/transform/resource/after-delombok/NullLibrary2.java +++ b/test/transform/resource/after-delombok/NullLibrary2.java @@ -1,3 +1,4 @@ +//version 8: springframework dep is too new to run on j6 public class NullLibrary2 { String foo; @java.lang.Override @@ -35,6 +36,9 @@ public class NullLibrary2 { public NullLibrary2(final String foo) { this.foo = foo; } + /** + * @return a clone of this object, except with this updated property (returns {@code this} if an identical value is passed). + */ @org.springframework.lang.NonNull @java.lang.SuppressWarnings("all") public NullLibrary2 withFoo(final String foo) { diff --git a/test/transform/resource/after-delombok/SetterOnClass.java b/test/transform/resource/after-delombok/SetterOnClass.java index 24f376cb..d95a280f 100644 --- a/test/transform/resource/after-delombok/SetterOnClass.java +++ b/test/transform/resource/after-delombok/SetterOnClass.java @@ -1,3 +1,4 @@ +//version 8: class SetterOnClass1 { boolean isNone; boolean isPublic; diff --git a/test/transform/resource/after-delombok/StaticConstructor.java b/test/transform/resource/after-delombok/StaticConstructor.java index f9c862d7..4de6dbe5 100644 --- a/test/transform/resource/after-delombok/StaticConstructor.java +++ b/test/transform/resource/after-delombok/StaticConstructor.java @@ -1,3 +1,4 @@ +//version 8: public class StaticConstructor { String name; @java.lang.SuppressWarnings("all") diff --git a/test/transform/resource/after-delombok/SuperBuilderAbstract.java b/test/transform/resource/after-delombok/SuperBuilderAbstract.java index a5825bf4..727c5beb 100644 --- a/test/transform/resource/after-delombok/SuperBuilderAbstract.java +++ b/test/transform/resource/after-delombok/SuperBuilderAbstract.java @@ -1,129 +1,138 @@ -public class SuperBuilderAbstract {
- public static class Parent {
- int parentField;
- @java.lang.SuppressWarnings("all")
- 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();
- @java.lang.SuppressWarnings("all")
- public B parentField(final int parentField) {
- this.parentField = parentField;
- return self();
- }
- @java.lang.Override
- @java.lang.SuppressWarnings("all")
- public java.lang.String toString() {
- return "SuperBuilderAbstract.Parent.ParentBuilder(parentField=" + this.parentField + ")";
- }
- }
- @java.lang.SuppressWarnings("all")
- private static final class ParentBuilderImpl extends SuperBuilderAbstract.Parent.ParentBuilder<SuperBuilderAbstract.Parent, SuperBuilderAbstract.Parent.ParentBuilderImpl> {
- @java.lang.SuppressWarnings("all")
- private ParentBuilderImpl() {
- }
- @java.lang.Override
- @java.lang.SuppressWarnings("all")
- protected SuperBuilderAbstract.Parent.ParentBuilderImpl self() {
- return this;
- }
- @java.lang.Override
- @java.lang.SuppressWarnings("all")
- public SuperBuilderAbstract.Parent build() {
- return new SuperBuilderAbstract.Parent(this);
- }
- }
- @java.lang.SuppressWarnings("all")
- protected Parent(final SuperBuilderAbstract.Parent.ParentBuilder<?, ?> b) {
- this.parentField = b.parentField;
- }
- @java.lang.SuppressWarnings("all")
- public static SuperBuilderAbstract.Parent.ParentBuilder<?, ?> builder() {
- return new SuperBuilderAbstract.Parent.ParentBuilderImpl();
- }
- }
- public static abstract class Child extends Parent {
- double childField;
- @java.lang.SuppressWarnings("all")
- 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();
- @java.lang.SuppressWarnings("all")
- public B childField(final double childField) {
- this.childField = childField;
- return self();
- }
- @java.lang.Override
- @java.lang.SuppressWarnings("all")
- public java.lang.String toString() {
- return "SuperBuilderAbstract.Child.ChildBuilder(super=" + super.toString() + ", childField=" + this.childField + ")";
- }
- }
- @java.lang.SuppressWarnings("all")
- protected Child(final SuperBuilderAbstract.Child.ChildBuilder<?, ?> b) {
- super(b);
- this.childField = b.childField;
- }
- }
- public static class GrandChild extends Child {
- String grandChildField;
- @java.lang.SuppressWarnings("all")
- 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();
- @java.lang.SuppressWarnings("all")
- public B grandChildField(final String grandChildField) {
- this.grandChildField = grandChildField;
- return self();
- }
- @java.lang.Override
- @java.lang.SuppressWarnings("all")
- public java.lang.String toString() {
- return "SuperBuilderAbstract.GrandChild.GrandChildBuilder(super=" + super.toString() + ", grandChildField=" + this.grandChildField + ")";
- }
- }
- @java.lang.SuppressWarnings("all")
- private static final class GrandChildBuilderImpl extends SuperBuilderAbstract.GrandChild.GrandChildBuilder<SuperBuilderAbstract.GrandChild, SuperBuilderAbstract.GrandChild.GrandChildBuilderImpl> {
- @java.lang.SuppressWarnings("all")
- private GrandChildBuilderImpl() {
- }
- @java.lang.Override
- @java.lang.SuppressWarnings("all")
- protected SuperBuilderAbstract.GrandChild.GrandChildBuilderImpl self() {
- return this;
- }
- @java.lang.Override
- @java.lang.SuppressWarnings("all")
- public SuperBuilderAbstract.GrandChild build() {
- return new SuperBuilderAbstract.GrandChild(this);
- }
- }
- @java.lang.SuppressWarnings("all")
- protected GrandChild(final SuperBuilderAbstract.GrandChild.GrandChildBuilder<?, ?> b) {
- super(b);
- this.grandChildField = b.grandChildField;
- }
- @java.lang.SuppressWarnings("all")
- public static SuperBuilderAbstract.GrandChild.GrandChildBuilder<?, ?> builder() {
- return new SuperBuilderAbstract.GrandChild.GrandChildBuilderImpl();
- }
- }
- public static void test() {
- GrandChild x = GrandChild.builder().grandChildField("").parentField(5).childField(2.5).build();
- }
-}
+public class SuperBuilderAbstract { + public static class Parent { + int parentField; + @java.lang.SuppressWarnings("all") + 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}. + */ + @java.lang.SuppressWarnings("all") + public B parentField(final int parentField) { + this.parentField = parentField; + return self(); + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public java.lang.String toString() { + return "SuperBuilderAbstract.Parent.ParentBuilder(parentField=" + this.parentField + ")"; + } + } + @java.lang.SuppressWarnings("all") + private static final class ParentBuilderImpl extends SuperBuilderAbstract.Parent.ParentBuilder<SuperBuilderAbstract.Parent, SuperBuilderAbstract.Parent.ParentBuilderImpl> { + @java.lang.SuppressWarnings("all") + private ParentBuilderImpl() { + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + protected SuperBuilderAbstract.Parent.ParentBuilderImpl self() { + return this; + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public SuperBuilderAbstract.Parent build() { + return new SuperBuilderAbstract.Parent(this); + } + } + @java.lang.SuppressWarnings("all") + protected Parent(final SuperBuilderAbstract.Parent.ParentBuilder<?, ?> b) { + this.parentField = b.parentField; + } + @java.lang.SuppressWarnings("all") + public static SuperBuilderAbstract.Parent.ParentBuilder<?, ?> builder() { + return new SuperBuilderAbstract.Parent.ParentBuilderImpl(); + } + } + public static abstract class Child extends Parent { + double childField; + @java.lang.SuppressWarnings("all") + 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}. + */ + @java.lang.SuppressWarnings("all") + public B childField(final double childField) { + this.childField = childField; + return self(); + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public java.lang.String toString() { + return "SuperBuilderAbstract.Child.ChildBuilder(super=" + super.toString() + ", childField=" + this.childField + ")"; + } + } + @java.lang.SuppressWarnings("all") + protected Child(final SuperBuilderAbstract.Child.ChildBuilder<?, ?> b) { + super(b); + this.childField = b.childField; + } + } + public static class GrandChild extends Child { + String grandChildField; + @java.lang.SuppressWarnings("all") + 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}. + */ + @java.lang.SuppressWarnings("all") + public B grandChildField(final String grandChildField) { + this.grandChildField = grandChildField; + return self(); + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public java.lang.String toString() { + return "SuperBuilderAbstract.GrandChild.GrandChildBuilder(super=" + super.toString() + ", grandChildField=" + this.grandChildField + ")"; + } + } + @java.lang.SuppressWarnings("all") + private static final class GrandChildBuilderImpl extends SuperBuilderAbstract.GrandChild.GrandChildBuilder<SuperBuilderAbstract.GrandChild, SuperBuilderAbstract.GrandChild.GrandChildBuilderImpl> { + @java.lang.SuppressWarnings("all") + private GrandChildBuilderImpl() { + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + protected SuperBuilderAbstract.GrandChild.GrandChildBuilderImpl self() { + return this; + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public SuperBuilderAbstract.GrandChild build() { + return new SuperBuilderAbstract.GrandChild(this); + } + } + @java.lang.SuppressWarnings("all") + protected GrandChild(final SuperBuilderAbstract.GrandChild.GrandChildBuilder<?, ?> b) { + super(b); + this.grandChildField = b.grandChildField; + } + @java.lang.SuppressWarnings("all") + public static SuperBuilderAbstract.GrandChild.GrandChildBuilder<?, ?> builder() { + return new SuperBuilderAbstract.GrandChild.GrandChildBuilderImpl(); + } + } + public static void test() { + GrandChild x = GrandChild.builder().grandChildField("").parentField(5).childField(2.5).build(); + } +} diff --git a/test/transform/resource/after-delombok/SuperBuilderAbstractToBuilder.java b/test/transform/resource/after-delombok/SuperBuilderAbstractToBuilder.java index aef3976f..53962c60 100644 --- a/test/transform/resource/after-delombok/SuperBuilderAbstractToBuilder.java +++ b/test/transform/resource/after-delombok/SuperBuilderAbstractToBuilder.java @@ -1,168 +1,177 @@ -public class SuperBuilderAbstractToBuilder {
- public static class Parent {
- int parentField;
- @java.lang.SuppressWarnings("all")
- public static abstract class ParentBuilder<C extends SuperBuilderAbstractToBuilder.Parent, B extends SuperBuilderAbstractToBuilder.Parent.ParentBuilder<C, B>> {
- @java.lang.SuppressWarnings("all")
- private int parentField;
- @java.lang.SuppressWarnings("all")
- protected B $fillValuesFrom(final C instance) {
- SuperBuilderAbstractToBuilder.Parent.ParentBuilder.$fillValuesFromInstanceIntoBuilder(instance, this);
- return self();
- }
- @java.lang.SuppressWarnings("all")
- 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();
- @java.lang.SuppressWarnings("all")
- public B parentField(final int parentField) {
- this.parentField = parentField;
- return self();
- }
- @java.lang.Override
- @java.lang.SuppressWarnings("all")
- public java.lang.String toString() {
- return "SuperBuilderAbstractToBuilder.Parent.ParentBuilder(parentField=" + this.parentField + ")";
- }
- }
- @java.lang.SuppressWarnings("all")
- private static final class ParentBuilderImpl extends SuperBuilderAbstractToBuilder.Parent.ParentBuilder<SuperBuilderAbstractToBuilder.Parent, SuperBuilderAbstractToBuilder.Parent.ParentBuilderImpl> {
- @java.lang.SuppressWarnings("all")
- private ParentBuilderImpl() {
- }
- @java.lang.Override
- @java.lang.SuppressWarnings("all")
- protected SuperBuilderAbstractToBuilder.Parent.ParentBuilderImpl self() {
- return this;
- }
- @java.lang.Override
- @java.lang.SuppressWarnings("all")
- public SuperBuilderAbstractToBuilder.Parent build() {
- return new SuperBuilderAbstractToBuilder.Parent(this);
- }
- }
- @java.lang.SuppressWarnings("all")
- protected Parent(final SuperBuilderAbstractToBuilder.Parent.ParentBuilder<?, ?> b) {
- this.parentField = b.parentField;
- }
- @java.lang.SuppressWarnings("all")
- public static SuperBuilderAbstractToBuilder.Parent.ParentBuilder<?, ?> builder() {
- return new SuperBuilderAbstractToBuilder.Parent.ParentBuilderImpl();
- }
- @java.lang.SuppressWarnings("all")
- public SuperBuilderAbstractToBuilder.Parent.ParentBuilder<?, ?> toBuilder() {
- return new SuperBuilderAbstractToBuilder.Parent.ParentBuilderImpl().$fillValuesFrom(this);
- }
- }
- public static abstract class Child extends Parent {
- double childField;
- @java.lang.SuppressWarnings("all")
- public static abstract class ChildBuilder<C extends SuperBuilderAbstractToBuilder.Child, B extends SuperBuilderAbstractToBuilder.Child.ChildBuilder<C, B>> extends Parent.ParentBuilder<C, B> {
- @java.lang.SuppressWarnings("all")
- private double childField;
- @java.lang.Override
- @java.lang.SuppressWarnings("all")
- protected B $fillValuesFrom(final C instance) {
- super.$fillValuesFrom(instance);
- SuperBuilderAbstractToBuilder.Child.ChildBuilder.$fillValuesFromInstanceIntoBuilder(instance, this);
- return self();
- }
- @java.lang.SuppressWarnings("all")
- 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();
- @java.lang.SuppressWarnings("all")
- public B childField(final double childField) {
- this.childField = childField;
- return self();
- }
- @java.lang.Override
- @java.lang.SuppressWarnings("all")
- public java.lang.String toString() {
- return "SuperBuilderAbstractToBuilder.Child.ChildBuilder(super=" + super.toString() + ", childField=" + this.childField + ")";
- }
- }
- @java.lang.SuppressWarnings("all")
- protected Child(final SuperBuilderAbstractToBuilder.Child.ChildBuilder<?, ?> b) {
- super(b);
- this.childField = b.childField;
- }
- }
- public static class GrandChild extends Child {
- String grandChildField;
- @java.lang.SuppressWarnings("all")
- public static abstract class GrandChildBuilder<C extends SuperBuilderAbstractToBuilder.GrandChild, B extends SuperBuilderAbstractToBuilder.GrandChild.GrandChildBuilder<C, B>> extends Child.ChildBuilder<C, B> {
- @java.lang.SuppressWarnings("all")
- private String grandChildField;
- @java.lang.Override
- @java.lang.SuppressWarnings("all")
- protected B $fillValuesFrom(final C instance) {
- super.$fillValuesFrom(instance);
- SuperBuilderAbstractToBuilder.GrandChild.GrandChildBuilder.$fillValuesFromInstanceIntoBuilder(instance, this);
- return self();
- }
- @java.lang.SuppressWarnings("all")
- 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();
- @java.lang.SuppressWarnings("all")
- public B grandChildField(final String grandChildField) {
- this.grandChildField = grandChildField;
- return self();
- }
- @java.lang.Override
- @java.lang.SuppressWarnings("all")
- public java.lang.String toString() {
- return "SuperBuilderAbstractToBuilder.GrandChild.GrandChildBuilder(super=" + super.toString() + ", grandChildField=" + this.grandChildField + ")";
- }
- }
- @java.lang.SuppressWarnings("all")
- private static final class GrandChildBuilderImpl extends SuperBuilderAbstractToBuilder.GrandChild.GrandChildBuilder<SuperBuilderAbstractToBuilder.GrandChild, SuperBuilderAbstractToBuilder.GrandChild.GrandChildBuilderImpl> {
- @java.lang.SuppressWarnings("all")
- private GrandChildBuilderImpl() {
- }
- @java.lang.Override
- @java.lang.SuppressWarnings("all")
- protected SuperBuilderAbstractToBuilder.GrandChild.GrandChildBuilderImpl self() {
- return this;
- }
- @java.lang.Override
- @java.lang.SuppressWarnings("all")
- public SuperBuilderAbstractToBuilder.GrandChild build() {
- return new SuperBuilderAbstractToBuilder.GrandChild(this);
- }
- }
- @java.lang.SuppressWarnings("all")
- protected GrandChild(final SuperBuilderAbstractToBuilder.GrandChild.GrandChildBuilder<?, ?> b) {
- super(b);
- this.grandChildField = b.grandChildField;
- }
- @java.lang.SuppressWarnings("all")
- public static SuperBuilderAbstractToBuilder.GrandChild.GrandChildBuilder<?, ?> builder() {
- return new SuperBuilderAbstractToBuilder.GrandChild.GrandChildBuilderImpl();
- }
- @java.lang.SuppressWarnings("all")
- public SuperBuilderAbstractToBuilder.GrandChild.GrandChildBuilder<?, ?> toBuilder() {
- return new SuperBuilderAbstractToBuilder.GrandChild.GrandChildBuilderImpl().$fillValuesFrom(this);
- }
- }
- public static void test() {
- GrandChild x = GrandChild.builder().grandChildField("").parentField(5).childField(2.5).build().toBuilder().build();
- }
-}
+public class SuperBuilderAbstractToBuilder { + public static class Parent { + int parentField; + @java.lang.SuppressWarnings("all") + public static abstract class ParentBuilder<C extends SuperBuilderAbstractToBuilder.Parent, B extends SuperBuilderAbstractToBuilder.Parent.ParentBuilder<C, B>> { + @java.lang.SuppressWarnings("all") + private int parentField; + @java.lang.SuppressWarnings("all") + protected B $fillValuesFrom(final C instance) { + SuperBuilderAbstractToBuilder.Parent.ParentBuilder.$fillValuesFromInstanceIntoBuilder(instance, this); + return self(); + } + @java.lang.SuppressWarnings("all") + 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}. + */ + @java.lang.SuppressWarnings("all") + public B parentField(final int parentField) { + this.parentField = parentField; + return self(); + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public java.lang.String toString() { + return "SuperBuilderAbstractToBuilder.Parent.ParentBuilder(parentField=" + this.parentField + ")"; + } + } + @java.lang.SuppressWarnings("all") + private static final class ParentBuilderImpl extends SuperBuilderAbstractToBuilder.Parent.ParentBuilder<SuperBuilderAbstractToBuilder.Parent, SuperBuilderAbstractToBuilder.Parent.ParentBuilderImpl> { + @java.lang.SuppressWarnings("all") + private ParentBuilderImpl() { + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + protected SuperBuilderAbstractToBuilder.Parent.ParentBuilderImpl self() { + return this; + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public SuperBuilderAbstractToBuilder.Parent build() { + return new SuperBuilderAbstractToBuilder.Parent(this); + } + } + @java.lang.SuppressWarnings("all") + protected Parent(final SuperBuilderAbstractToBuilder.Parent.ParentBuilder<?, ?> b) { + this.parentField = b.parentField; + } + @java.lang.SuppressWarnings("all") + public static SuperBuilderAbstractToBuilder.Parent.ParentBuilder<?, ?> builder() { + return new SuperBuilderAbstractToBuilder.Parent.ParentBuilderImpl(); + } + @java.lang.SuppressWarnings("all") + public SuperBuilderAbstractToBuilder.Parent.ParentBuilder<?, ?> toBuilder() { + return new SuperBuilderAbstractToBuilder.Parent.ParentBuilderImpl().$fillValuesFrom(this); + } + } + public static abstract class Child extends Parent { + double childField; + @java.lang.SuppressWarnings("all") + public static abstract class ChildBuilder<C extends SuperBuilderAbstractToBuilder.Child, B extends SuperBuilderAbstractToBuilder.Child.ChildBuilder<C, B>> extends Parent.ParentBuilder<C, B> { + @java.lang.SuppressWarnings("all") + private double childField; + @java.lang.Override + @java.lang.SuppressWarnings("all") + protected B $fillValuesFrom(final C instance) { + super.$fillValuesFrom(instance); + SuperBuilderAbstractToBuilder.Child.ChildBuilder.$fillValuesFromInstanceIntoBuilder(instance, this); + return self(); + } + @java.lang.SuppressWarnings("all") + 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}. + */ + @java.lang.SuppressWarnings("all") + public B childField(final double childField) { + this.childField = childField; + return self(); + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public java.lang.String toString() { + return "SuperBuilderAbstractToBuilder.Child.ChildBuilder(super=" + super.toString() + ", childField=" + this.childField + ")"; + } + } + @java.lang.SuppressWarnings("all") + protected Child(final SuperBuilderAbstractToBuilder.Child.ChildBuilder<?, ?> b) { + super(b); + this.childField = b.childField; + } + } + public static class GrandChild extends Child { + String grandChildField; + @java.lang.SuppressWarnings("all") + public static abstract class GrandChildBuilder<C extends SuperBuilderAbstractToBuilder.GrandChild, B extends SuperBuilderAbstractToBuilder.GrandChild.GrandChildBuilder<C, B>> extends Child.ChildBuilder<C, B> { + @java.lang.SuppressWarnings("all") + private String grandChildField; + @java.lang.Override + @java.lang.SuppressWarnings("all") + protected B $fillValuesFrom(final C instance) { + super.$fillValuesFrom(instance); + SuperBuilderAbstractToBuilder.GrandChild.GrandChildBuilder.$fillValuesFromInstanceIntoBuilder(instance, this); + return self(); + } + @java.lang.SuppressWarnings("all") + 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}. + */ + @java.lang.SuppressWarnings("all") + public B grandChildField(final String grandChildField) { + this.grandChildField = grandChildField; + return self(); + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public java.lang.String toString() { + return "SuperBuilderAbstractToBuilder.GrandChild.GrandChildBuilder(super=" + super.toString() + ", grandChildField=" + this.grandChildField + ")"; + } + } + @java.lang.SuppressWarnings("all") + private static final class GrandChildBuilderImpl extends SuperBuilderAbstractToBuilder.GrandChild.GrandChildBuilder<SuperBuilderAbstractToBuilder.GrandChild, SuperBuilderAbstractToBuilder.GrandChild.GrandChildBuilderImpl> { + @java.lang.SuppressWarnings("all") + private GrandChildBuilderImpl() { + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + protected SuperBuilderAbstractToBuilder.GrandChild.GrandChildBuilderImpl self() { + return this; + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public SuperBuilderAbstractToBuilder.GrandChild build() { + return new SuperBuilderAbstractToBuilder.GrandChild(this); + } + } + @java.lang.SuppressWarnings("all") + protected GrandChild(final SuperBuilderAbstractToBuilder.GrandChild.GrandChildBuilder<?, ?> b) { + super(b); + this.grandChildField = b.grandChildField; + } + @java.lang.SuppressWarnings("all") + public static SuperBuilderAbstractToBuilder.GrandChild.GrandChildBuilder<?, ?> builder() { + return new SuperBuilderAbstractToBuilder.GrandChild.GrandChildBuilderImpl(); + } + @java.lang.SuppressWarnings("all") + public SuperBuilderAbstractToBuilder.GrandChild.GrandChildBuilder<?, ?> toBuilder() { + return new SuperBuilderAbstractToBuilder.GrandChild.GrandChildBuilderImpl().$fillValuesFrom(this); + } + } + public static void test() { + GrandChild x = GrandChild.builder().grandChildField("").parentField(5).childField(2.5).build().toBuilder().build(); + } +} diff --git a/test/transform/resource/after-delombok/SuperBuilderBasic.java b/test/transform/resource/after-delombok/SuperBuilderBasic.java index c3fa86f2..7fff2ef8 100644 --- a/test/transform/resource/after-delombok/SuperBuilderBasic.java +++ b/test/transform/resource/after-delombok/SuperBuilderBasic.java @@ -1,136 +1,142 @@ -import java.util.List;
-public class SuperBuilderBasic {
- public static class Parent {
- int field1;
- List<String> items;
- @java.lang.SuppressWarnings("all")
- public static abstract class ParentBuilder<C extends SuperBuilderBasic.Parent, B extends SuperBuilderBasic.Parent.ParentBuilder<C, B>> {
- @java.lang.SuppressWarnings("all")
- 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();
- @java.lang.SuppressWarnings("all")
- public B field1(final int field1) {
- this.field1 = field1;
- return self();
- }
- @java.lang.SuppressWarnings("all")
- public B item(final String item) {
- if (this.items == null) this.items = new java.util.ArrayList<String>();
- this.items.add(item);
- return self();
- }
- @java.lang.SuppressWarnings("all")
- public B items(final java.util.Collection<? extends String> items) {
- if (items == null) {
- throw new java.lang.NullPointerException("items cannot be null");
- }
- if (this.items == null) this.items = new java.util.ArrayList<String>();
- this.items.addAll(items);
- return self();
- }
- @java.lang.SuppressWarnings("all")
- public B clearItems() {
- if (this.items != null) this.items.clear();
- return self();
- }
- @java.lang.Override
- @java.lang.SuppressWarnings("all")
- public java.lang.String toString() {
- return "SuperBuilderBasic.Parent.ParentBuilder(field1=" + this.field1 + ", items=" + this.items + ")";
- }
- }
- @java.lang.SuppressWarnings("all")
- private static final class ParentBuilderImpl extends SuperBuilderBasic.Parent.ParentBuilder<SuperBuilderBasic.Parent, SuperBuilderBasic.Parent.ParentBuilderImpl> {
- @java.lang.SuppressWarnings("all")
- private ParentBuilderImpl() {
- }
- @java.lang.Override
- @java.lang.SuppressWarnings("all")
- protected SuperBuilderBasic.Parent.ParentBuilderImpl self() {
- return this;
- }
- @java.lang.Override
- @java.lang.SuppressWarnings("all")
- public SuperBuilderBasic.Parent build() {
- return new SuperBuilderBasic.Parent(this);
- }
- }
- @java.lang.SuppressWarnings("all")
- protected Parent(final SuperBuilderBasic.Parent.ParentBuilder<?, ?> b) {
- this.field1 = b.field1;
- java.util.List<String> items;
- switch (b.items == null ? 0 : b.items.size()) {
- case 0:
- items = java.util.Collections.emptyList();
- break;
- case 1:
- items = java.util.Collections.singletonList(b.items.get(0));
- break;
- default:
- items = java.util.Collections.unmodifiableList(new java.util.ArrayList<String>(b.items));
- }
- this.items = items;
- }
- @java.lang.SuppressWarnings("all")
- public static SuperBuilderBasic.Parent.ParentBuilder<?, ?> builder() {
- return new SuperBuilderBasic.Parent.ParentBuilderImpl();
- }
- }
- public static class Child extends SuperBuilderBasic.Parent {
- double field3;
- @java.lang.SuppressWarnings("all")
- 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();
- @java.lang.SuppressWarnings("all")
- public B field3(final double field3) {
- this.field3 = field3;
- return self();
- }
- @java.lang.Override
- @java.lang.SuppressWarnings("all")
- public java.lang.String toString() {
- return "SuperBuilderBasic.Child.ChildBuilder(super=" + super.toString() + ", field3=" + this.field3 + ")";
- }
- }
- @java.lang.SuppressWarnings("all")
- private static final class ChildBuilderImpl extends SuperBuilderBasic.Child.ChildBuilder<SuperBuilderBasic.Child, SuperBuilderBasic.Child.ChildBuilderImpl> {
- @java.lang.SuppressWarnings("all")
- private ChildBuilderImpl() {
- }
- @java.lang.Override
- @java.lang.SuppressWarnings("all")
- protected SuperBuilderBasic.Child.ChildBuilderImpl self() {
- return this;
- }
- @java.lang.Override
- @java.lang.SuppressWarnings("all")
- public SuperBuilderBasic.Child build() {
- return new SuperBuilderBasic.Child(this);
- }
- }
- @java.lang.SuppressWarnings("all")
- protected Child(final SuperBuilderBasic.Child.ChildBuilder<?, ?> b) {
- super(b);
- this.field3 = b.field3;
- }
- @java.lang.SuppressWarnings("all")
- public static SuperBuilderBasic.Child.ChildBuilder<?, ?> builder() {
- return new SuperBuilderBasic.Child.ChildBuilderImpl();
- }
- }
- public static void test() {
- Child x = Child.builder().field3(0.0).field1(5).item("").build();
- }
-}
+import java.util.List; +public class SuperBuilderBasic { + public static class Parent { + int field1; + List<String> items; + @java.lang.SuppressWarnings("all") + public static abstract class ParentBuilder<C extends SuperBuilderBasic.Parent, B extends SuperBuilderBasic.Parent.ParentBuilder<C, B>> { + @java.lang.SuppressWarnings("all") + 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}. + */ + @java.lang.SuppressWarnings("all") + public B field1(final int field1) { + this.field1 = field1; + return self(); + } + @java.lang.SuppressWarnings("all") + public B item(final String item) { + if (this.items == null) this.items = new java.util.ArrayList<String>(); + this.items.add(item); + return self(); + } + @java.lang.SuppressWarnings("all") + public B items(final java.util.Collection<? extends String> items) { + if (items == null) { + throw new java.lang.NullPointerException("items cannot be null"); + } + if (this.items == null) this.items = new java.util.ArrayList<String>(); + this.items.addAll(items); + return self(); + } + @java.lang.SuppressWarnings("all") + public B clearItems() { + if (this.items != null) this.items.clear(); + return self(); + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public java.lang.String toString() { + return "SuperBuilderBasic.Parent.ParentBuilder(field1=" + this.field1 + ", items=" + this.items + ")"; + } + } + @java.lang.SuppressWarnings("all") + private static final class ParentBuilderImpl extends SuperBuilderBasic.Parent.ParentBuilder<SuperBuilderBasic.Parent, SuperBuilderBasic.Parent.ParentBuilderImpl> { + @java.lang.SuppressWarnings("all") + private ParentBuilderImpl() { + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + protected SuperBuilderBasic.Parent.ParentBuilderImpl self() { + return this; + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public SuperBuilderBasic.Parent build() { + return new SuperBuilderBasic.Parent(this); + } + } + @java.lang.SuppressWarnings("all") + protected Parent(final SuperBuilderBasic.Parent.ParentBuilder<?, ?> b) { + this.field1 = b.field1; + java.util.List<String> items; + switch (b.items == null ? 0 : b.items.size()) { + case 0: + items = java.util.Collections.emptyList(); + break; + case 1: + items = java.util.Collections.singletonList(b.items.get(0)); + break; + default: + items = java.util.Collections.unmodifiableList(new java.util.ArrayList<String>(b.items)); + } + this.items = items; + } + @java.lang.SuppressWarnings("all") + public static SuperBuilderBasic.Parent.ParentBuilder<?, ?> builder() { + return new SuperBuilderBasic.Parent.ParentBuilderImpl(); + } + } + public static class Child extends SuperBuilderBasic.Parent { + double field3; + @java.lang.SuppressWarnings("all") + 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}. + */ + @java.lang.SuppressWarnings("all") + public B field3(final double field3) { + this.field3 = field3; + return self(); + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public java.lang.String toString() { + return "SuperBuilderBasic.Child.ChildBuilder(super=" + super.toString() + ", field3=" + this.field3 + ")"; + } + } + @java.lang.SuppressWarnings("all") + private static final class ChildBuilderImpl extends SuperBuilderBasic.Child.ChildBuilder<SuperBuilderBasic.Child, SuperBuilderBasic.Child.ChildBuilderImpl> { + @java.lang.SuppressWarnings("all") + private ChildBuilderImpl() { + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + protected SuperBuilderBasic.Child.ChildBuilderImpl self() { + return this; + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public SuperBuilderBasic.Child build() { + return new SuperBuilderBasic.Child(this); + } + } + @java.lang.SuppressWarnings("all") + protected Child(final SuperBuilderBasic.Child.ChildBuilder<?, ?> b) { + super(b); + this.field3 = b.field3; + } + @java.lang.SuppressWarnings("all") + public static SuperBuilderBasic.Child.ChildBuilder<?, ?> builder() { + return new SuperBuilderBasic.Child.ChildBuilderImpl(); + } + } + public static void test() { + Child x = Child.builder().field3(0.0).field1(5).item("").build(); + } +} diff --git a/test/transform/resource/after-delombok/SuperBuilderBasicToBuilder.java b/test/transform/resource/after-delombok/SuperBuilderBasicToBuilder.java index c0a80f93..add6f841 100644 --- a/test/transform/resource/after-delombok/SuperBuilderBasicToBuilder.java +++ b/test/transform/resource/after-delombok/SuperBuilderBasicToBuilder.java @@ -1,201 +1,216 @@ -import java.util.List;
-public class SuperBuilderBasicToBuilder {
- public static class Parent {
- private int field1;
- int obtainViaField;
- int obtainViaMethod;
- String obtainViaStaticMethod;
- List<String> items;
- private int method() {
- return 2;
- }
- private static String staticMethod(Parent instance) {
- return "staticMethod";
- }
- @java.lang.SuppressWarnings("all")
- public static abstract class ParentBuilder<C extends SuperBuilderBasicToBuilder.Parent, B extends SuperBuilderBasicToBuilder.Parent.ParentBuilder<C, B>> {
- @java.lang.SuppressWarnings("all")
- private int field1;
- @java.lang.SuppressWarnings("all")
- private int obtainViaField;
- @java.lang.SuppressWarnings("all")
- private int obtainViaMethod;
- @java.lang.SuppressWarnings("all")
- private String obtainViaStaticMethod;
- @java.lang.SuppressWarnings("all")
- private java.util.ArrayList<String> items;
- @java.lang.SuppressWarnings("all")
- protected B $fillValuesFrom(final C instance) {
- SuperBuilderBasicToBuilder.Parent.ParentBuilder.$fillValuesFromInstanceIntoBuilder(instance, this);
- return self();
- }
- @java.lang.SuppressWarnings("all")
- private static void $fillValuesFromInstanceIntoBuilder(final SuperBuilderBasicToBuilder.Parent instance, final SuperBuilderBasicToBuilder.Parent.ParentBuilder<?, ?> b) {
- b.field1(instance.field1);
- b.obtainViaField(instance.field1);
- b.obtainViaMethod(instance.method());
- b.obtainViaStaticMethod(SuperBuilderBasicToBuilder.Parent.staticMethod(instance));
- b.items(instance.items == null ? java.util.Collections.emptyList() : instance.items);
- }
- @java.lang.SuppressWarnings("all")
- protected abstract B self();
- @java.lang.SuppressWarnings("all")
- public abstract C build();
- @java.lang.SuppressWarnings("all")
- public B field1(final int field1) {
- this.field1 = field1;
- return self();
- }
- @java.lang.SuppressWarnings("all")
- public B obtainViaField(final int obtainViaField) {
- this.obtainViaField = obtainViaField;
- return self();
- }
- @java.lang.SuppressWarnings("all")
- public B obtainViaMethod(final int obtainViaMethod) {
- this.obtainViaMethod = obtainViaMethod;
- return self();
- }
- @java.lang.SuppressWarnings("all")
- public B obtainViaStaticMethod(final String obtainViaStaticMethod) {
- this.obtainViaStaticMethod = obtainViaStaticMethod;
- return self();
- }
- @java.lang.SuppressWarnings("all")
- public B item(final String item) {
- if (this.items == null) this.items = new java.util.ArrayList<String>();
- this.items.add(item);
- return self();
- }
- @java.lang.SuppressWarnings("all")
- public B items(final java.util.Collection<? extends String> items) {
- if (items == null) {
- throw new java.lang.NullPointerException("items cannot be null");
- }
- if (this.items == null) this.items = new java.util.ArrayList<String>();
- this.items.addAll(items);
- return self();
- }
- @java.lang.SuppressWarnings("all")
- public B clearItems() {
- if (this.items != null) this.items.clear();
- return self();
- }
- @java.lang.Override
- @java.lang.SuppressWarnings("all")
- public java.lang.String toString() {
- return "SuperBuilderBasicToBuilder.Parent.ParentBuilder(field1=" + this.field1 + ", obtainViaField=" + this.obtainViaField + ", obtainViaMethod=" + this.obtainViaMethod + ", obtainViaStaticMethod=" + this.obtainViaStaticMethod + ", items=" + this.items + ")";
- }
- }
- @java.lang.SuppressWarnings("all")
- private static final class ParentBuilderImpl extends SuperBuilderBasicToBuilder.Parent.ParentBuilder<SuperBuilderBasicToBuilder.Parent, SuperBuilderBasicToBuilder.Parent.ParentBuilderImpl> {
- @java.lang.SuppressWarnings("all")
- private ParentBuilderImpl() {
- }
- @java.lang.Override
- @java.lang.SuppressWarnings("all")
- protected SuperBuilderBasicToBuilder.Parent.ParentBuilderImpl self() {
- return this;
- }
- @java.lang.Override
- @java.lang.SuppressWarnings("all")
- public SuperBuilderBasicToBuilder.Parent build() {
- return new SuperBuilderBasicToBuilder.Parent(this);
- }
- }
- @java.lang.SuppressWarnings("all")
- protected Parent(final SuperBuilderBasicToBuilder.Parent.ParentBuilder<?, ?> b) {
- this.field1 = b.field1;
- this.obtainViaField = b.obtainViaField;
- this.obtainViaMethod = b.obtainViaMethod;
- this.obtainViaStaticMethod = b.obtainViaStaticMethod;
- java.util.List<String> items;
- switch (b.items == null ? 0 : b.items.size()) {
- case 0:
- items = java.util.Collections.emptyList();
- break;
- case 1:
- items = java.util.Collections.singletonList(b.items.get(0));
- break;
- default:
- items = java.util.Collections.unmodifiableList(new java.util.ArrayList<String>(b.items));
- }
- this.items = items;
- }
- @java.lang.SuppressWarnings("all")
- public static SuperBuilderBasicToBuilder.Parent.ParentBuilder<?, ?> builder() {
- return new SuperBuilderBasicToBuilder.Parent.ParentBuilderImpl();
- }
- @java.lang.SuppressWarnings("all")
- public SuperBuilderBasicToBuilder.Parent.ParentBuilder<?, ?> toBuilder() {
- return new SuperBuilderBasicToBuilder.Parent.ParentBuilderImpl().$fillValuesFrom(this);
- }
- }
- public static class Child extends Parent {
- private double field3;
- @java.lang.SuppressWarnings("all")
- public static abstract class ChildBuilder<C extends SuperBuilderBasicToBuilder.Child, B extends SuperBuilderBasicToBuilder.Child.ChildBuilder<C, B>> extends Parent.ParentBuilder<C, B> {
- @java.lang.SuppressWarnings("all")
- private double field3;
- @java.lang.Override
- @java.lang.SuppressWarnings("all")
- protected B $fillValuesFrom(final C instance) {
- super.$fillValuesFrom(instance);
- SuperBuilderBasicToBuilder.Child.ChildBuilder.$fillValuesFromInstanceIntoBuilder(instance, this);
- return self();
- }
- @java.lang.SuppressWarnings("all")
- 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();
- @java.lang.SuppressWarnings("all")
- public B field3(final double field3) {
- this.field3 = field3;
- return self();
- }
- @java.lang.Override
- @java.lang.SuppressWarnings("all")
- public java.lang.String toString() {
- return "SuperBuilderBasicToBuilder.Child.ChildBuilder(super=" + super.toString() + ", field3=" + this.field3 + ")";
- }
- }
- @java.lang.SuppressWarnings("all")
- private static final class ChildBuilderImpl extends SuperBuilderBasicToBuilder.Child.ChildBuilder<SuperBuilderBasicToBuilder.Child, SuperBuilderBasicToBuilder.Child.ChildBuilderImpl> {
- @java.lang.SuppressWarnings("all")
- private ChildBuilderImpl() {
- }
- @java.lang.Override
- @java.lang.SuppressWarnings("all")
- protected SuperBuilderBasicToBuilder.Child.ChildBuilderImpl self() {
- return this;
- }
- @java.lang.Override
- @java.lang.SuppressWarnings("all")
- public SuperBuilderBasicToBuilder.Child build() {
- return new SuperBuilderBasicToBuilder.Child(this);
- }
- }
- @java.lang.SuppressWarnings("all")
- protected Child(final SuperBuilderBasicToBuilder.Child.ChildBuilder<?, ?> b) {
- super(b);
- this.field3 = b.field3;
- }
- @java.lang.SuppressWarnings("all")
- public static SuperBuilderBasicToBuilder.Child.ChildBuilder<?, ?> builder() {
- return new SuperBuilderBasicToBuilder.Child.ChildBuilderImpl();
- }
- @java.lang.SuppressWarnings("all")
- public SuperBuilderBasicToBuilder.Child.ChildBuilder<?, ?> toBuilder() {
- return new SuperBuilderBasicToBuilder.Child.ChildBuilderImpl().$fillValuesFrom(this);
- }
- }
- public static void test() {
- Child x = Child.builder().field3(0.0).field1(5).item("").build().toBuilder().build();
- }
-}
+import java.util.List; +public class SuperBuilderBasicToBuilder { + public static class Parent { + private int field1; + int obtainViaField; + int obtainViaMethod; + String obtainViaStaticMethod; + List<String> items; + private int method() { + return 2; + } + private static String staticMethod(Parent instance) { + return "staticMethod"; + } + @java.lang.SuppressWarnings("all") + public static abstract class ParentBuilder<C extends SuperBuilderBasicToBuilder.Parent, B extends SuperBuilderBasicToBuilder.Parent.ParentBuilder<C, B>> { + @java.lang.SuppressWarnings("all") + private int field1; + @java.lang.SuppressWarnings("all") + private int obtainViaField; + @java.lang.SuppressWarnings("all") + private int obtainViaMethod; + @java.lang.SuppressWarnings("all") + private String obtainViaStaticMethod; + @java.lang.SuppressWarnings("all") + private java.util.ArrayList<String> items; + @java.lang.SuppressWarnings("all") + protected B $fillValuesFrom(final C instance) { + SuperBuilderBasicToBuilder.Parent.ParentBuilder.$fillValuesFromInstanceIntoBuilder(instance, this); + return self(); + } + @java.lang.SuppressWarnings("all") + private static void $fillValuesFromInstanceIntoBuilder(final SuperBuilderBasicToBuilder.Parent instance, final SuperBuilderBasicToBuilder.Parent.ParentBuilder<?, ?> b) { + b.field1(instance.field1); + b.obtainViaField(instance.field1); + b.obtainViaMethod(instance.method()); + 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}. + */ + @java.lang.SuppressWarnings("all") + public B field1(final int field1) { + this.field1 = field1; + return self(); + } + /** + * @return {@code this}. + */ + @java.lang.SuppressWarnings("all") + public B obtainViaField(final int obtainViaField) { + this.obtainViaField = obtainViaField; + return self(); + } + /** + * @return {@code this}. + */ + @java.lang.SuppressWarnings("all") + public B obtainViaMethod(final int obtainViaMethod) { + this.obtainViaMethod = obtainViaMethod; + return self(); + } + /** + * @return {@code this}. + */ + @java.lang.SuppressWarnings("all") + public B obtainViaStaticMethod(final String obtainViaStaticMethod) { + this.obtainViaStaticMethod = obtainViaStaticMethod; + return self(); + } + @java.lang.SuppressWarnings("all") + public B item(final String item) { + if (this.items == null) this.items = new java.util.ArrayList<String>(); + this.items.add(item); + return self(); + } + @java.lang.SuppressWarnings("all") + public B items(final java.util.Collection<? extends String> items) { + if (items == null) { + throw new java.lang.NullPointerException("items cannot be null"); + } + if (this.items == null) this.items = new java.util.ArrayList<String>(); + this.items.addAll(items); + return self(); + } + @java.lang.SuppressWarnings("all") + public B clearItems() { + if (this.items != null) this.items.clear(); + return self(); + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public java.lang.String toString() { + return "SuperBuilderBasicToBuilder.Parent.ParentBuilder(field1=" + this.field1 + ", obtainViaField=" + this.obtainViaField + ", obtainViaMethod=" + this.obtainViaMethod + ", obtainViaStaticMethod=" + this.obtainViaStaticMethod + ", items=" + this.items + ")"; + } + } + @java.lang.SuppressWarnings("all") + private static final class ParentBuilderImpl extends SuperBuilderBasicToBuilder.Parent.ParentBuilder<SuperBuilderBasicToBuilder.Parent, SuperBuilderBasicToBuilder.Parent.ParentBuilderImpl> { + @java.lang.SuppressWarnings("all") + private ParentBuilderImpl() { + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + protected SuperBuilderBasicToBuilder.Parent.ParentBuilderImpl self() { + return this; + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public SuperBuilderBasicToBuilder.Parent build() { + return new SuperBuilderBasicToBuilder.Parent(this); + } + } + @java.lang.SuppressWarnings("all") + protected Parent(final SuperBuilderBasicToBuilder.Parent.ParentBuilder<?, ?> b) { + this.field1 = b.field1; + this.obtainViaField = b.obtainViaField; + this.obtainViaMethod = b.obtainViaMethod; + this.obtainViaStaticMethod = b.obtainViaStaticMethod; + java.util.List<String> items; + switch (b.items == null ? 0 : b.items.size()) { + case 0: + items = java.util.Collections.emptyList(); + break; + case 1: + items = java.util.Collections.singletonList(b.items.get(0)); + break; + default: + items = java.util.Collections.unmodifiableList(new java.util.ArrayList<String>(b.items)); + } + this.items = items; + } + @java.lang.SuppressWarnings("all") + public static SuperBuilderBasicToBuilder.Parent.ParentBuilder<?, ?> builder() { + return new SuperBuilderBasicToBuilder.Parent.ParentBuilderImpl(); + } + @java.lang.SuppressWarnings("all") + public SuperBuilderBasicToBuilder.Parent.ParentBuilder<?, ?> toBuilder() { + return new SuperBuilderBasicToBuilder.Parent.ParentBuilderImpl().$fillValuesFrom(this); + } + } + public static class Child extends Parent { + private double field3; + @java.lang.SuppressWarnings("all") + public static abstract class ChildBuilder<C extends SuperBuilderBasicToBuilder.Child, B extends SuperBuilderBasicToBuilder.Child.ChildBuilder<C, B>> extends Parent.ParentBuilder<C, B> { + @java.lang.SuppressWarnings("all") + private double field3; + @java.lang.Override + @java.lang.SuppressWarnings("all") + protected B $fillValuesFrom(final C instance) { + super.$fillValuesFrom(instance); + SuperBuilderBasicToBuilder.Child.ChildBuilder.$fillValuesFromInstanceIntoBuilder(instance, this); + return self(); + } + @java.lang.SuppressWarnings("all") + 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}. + */ + @java.lang.SuppressWarnings("all") + public B field3(final double field3) { + this.field3 = field3; + return self(); + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public java.lang.String toString() { + return "SuperBuilderBasicToBuilder.Child.ChildBuilder(super=" + super.toString() + ", field3=" + this.field3 + ")"; + } + } + @java.lang.SuppressWarnings("all") + private static final class ChildBuilderImpl extends SuperBuilderBasicToBuilder.Child.ChildBuilder<SuperBuilderBasicToBuilder.Child, SuperBuilderBasicToBuilder.Child.ChildBuilderImpl> { + @java.lang.SuppressWarnings("all") + private ChildBuilderImpl() { + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + protected SuperBuilderBasicToBuilder.Child.ChildBuilderImpl self() { + return this; + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public SuperBuilderBasicToBuilder.Child build() { + return new SuperBuilderBasicToBuilder.Child(this); + } + } + @java.lang.SuppressWarnings("all") + protected Child(final SuperBuilderBasicToBuilder.Child.ChildBuilder<?, ?> b) { + super(b); + this.field3 = b.field3; + } + @java.lang.SuppressWarnings("all") + public static SuperBuilderBasicToBuilder.Child.ChildBuilder<?, ?> builder() { + return new SuperBuilderBasicToBuilder.Child.ChildBuilderImpl(); + } + @java.lang.SuppressWarnings("all") + public SuperBuilderBasicToBuilder.Child.ChildBuilder<?, ?> toBuilder() { + return new SuperBuilderBasicToBuilder.Child.ChildBuilderImpl().$fillValuesFrom(this); + } + } + public static void test() { + Child x = Child.builder().field3(0.0).field1(5).item("").build().toBuilder().build(); + } +} diff --git a/test/transform/resource/after-delombok/SuperBuilderCustomized.java b/test/transform/resource/after-delombok/SuperBuilderCustomized.java index f66133c9..3a0bbd9b 100644 --- a/test/transform/resource/after-delombok/SuperBuilderCustomized.java +++ b/test/transform/resource/after-delombok/SuperBuilderCustomized.java @@ -1,100 +1,103 @@ -import java.util.List;
-public class SuperBuilderCustomized {
- public static class Parent {
- public static abstract class ParentBuilder<C extends Parent, B extends ParentBuilder<C, B>> {
- @java.lang.SuppressWarnings("all")
- private int field1;
- public B resetToDefault() {
- field1 = 0;
- return self();
- }
- public B field1(int field1) {
- this.field1 = field1 + 1;
- 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 "SuperBuilderCustomized.Parent.ParentBuilder(field1=" + this.field1 + ")";
- }
- }
- int field1;
- protected Parent(ParentBuilder<?, ?> b) {
- if (b.field1 == 0) throw new IllegalArgumentException("field1 must be != 0");
- this.field1 = b.field1;
- }
- public static SuperBuilderCustomized.Parent.ParentBuilder<?, ?> builder(int field1) {
- return new SuperBuilderCustomized.Parent.ParentBuilderImpl().field1(field1);
- }
- @java.lang.SuppressWarnings("all")
- private static final class ParentBuilderImpl extends SuperBuilderCustomized.Parent.ParentBuilder<SuperBuilderCustomized.Parent, SuperBuilderCustomized.Parent.ParentBuilderImpl> {
- @java.lang.SuppressWarnings("all")
- private ParentBuilderImpl() {
- }
- @java.lang.Override
- @java.lang.SuppressWarnings("all")
- protected SuperBuilderCustomized.Parent.ParentBuilderImpl self() {
- return this;
- }
- @java.lang.Override
- @java.lang.SuppressWarnings("all")
- public SuperBuilderCustomized.Parent build() {
- return new SuperBuilderCustomized.Parent(this);
- }
- }
- }
- public static class Child extends Parent {
- private static final class ChildBuilderImpl extends ChildBuilder<Child, ChildBuilderImpl> {
- @Override
- public Child build() {
- this.resetToDefault();
- return new Child(this);
- }
- @java.lang.SuppressWarnings("all")
- private ChildBuilderImpl() {
- }
- @java.lang.Override
- @java.lang.SuppressWarnings("all")
- protected SuperBuilderCustomized.Child.ChildBuilderImpl self() {
- return this;
- }
- }
- double field2;
- public static ChildBuilder<?, ?> builder() {
- return new ChildBuilderImpl().field2(10.0);
- }
- @java.lang.SuppressWarnings("all")
- 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();
- @java.lang.SuppressWarnings("all")
- public B field2(final double field2) {
- this.field2 = field2;
- return self();
- }
- @java.lang.Override
- @java.lang.SuppressWarnings("all")
- public java.lang.String toString() {
- return "SuperBuilderCustomized.Child.ChildBuilder(super=" + super.toString() + ", field2=" + this.field2 + ")";
- }
- }
- @java.lang.SuppressWarnings("all")
- protected Child(final SuperBuilderCustomized.Child.ChildBuilder<?, ?> b) {
- super(b);
- this.field2 = b.field2;
- }
- }
- public static void test() {
- Child x = Child.builder().field2(1.0).field1(5).resetToDefault().build();
- }
-}
+import java.util.List; +public class SuperBuilderCustomized { + public static class Parent { + public static abstract class ParentBuilder<C extends Parent, B extends ParentBuilder<C, B>> { + @java.lang.SuppressWarnings("all") + private int field1; + public B resetToDefault() { + field1 = 0; + return self(); + } + public B field1(int field1) { + this.field1 = field1 + 1; + 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 "SuperBuilderCustomized.Parent.ParentBuilder(field1=" + this.field1 + ")"; + } + } + int field1; + protected Parent(ParentBuilder<?, ?> b) { + if (b.field1 == 0) throw new IllegalArgumentException("field1 must be != 0"); + this.field1 = b.field1; + } + public static SuperBuilderCustomized.Parent.ParentBuilder<?, ?> builder(int field1) { + return new SuperBuilderCustomized.Parent.ParentBuilderImpl().field1(field1); + } + @java.lang.SuppressWarnings("all") + private static final class ParentBuilderImpl extends SuperBuilderCustomized.Parent.ParentBuilder<SuperBuilderCustomized.Parent, SuperBuilderCustomized.Parent.ParentBuilderImpl> { + @java.lang.SuppressWarnings("all") + private ParentBuilderImpl() { + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + protected SuperBuilderCustomized.Parent.ParentBuilderImpl self() { + return this; + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public SuperBuilderCustomized.Parent build() { + return new SuperBuilderCustomized.Parent(this); + } + } + } + public static class Child extends Parent { + private static final class ChildBuilderImpl extends ChildBuilder<Child, ChildBuilderImpl> { + @Override + public Child build() { + this.resetToDefault(); + return new Child(this); + } + @java.lang.SuppressWarnings("all") + private ChildBuilderImpl() { + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + protected SuperBuilderCustomized.Child.ChildBuilderImpl self() { + return this; + } + } + double field2; + public static ChildBuilder<?, ?> builder() { + return new ChildBuilderImpl().field2(10.0); + } + @java.lang.SuppressWarnings("all") + 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}. + */ + @java.lang.SuppressWarnings("all") + public B field2(final double field2) { + this.field2 = field2; + return self(); + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public java.lang.String toString() { + return "SuperBuilderCustomized.Child.ChildBuilder(super=" + super.toString() + ", field2=" + this.field2 + ")"; + } + } + @java.lang.SuppressWarnings("all") + protected Child(final SuperBuilderCustomized.Child.ChildBuilder<?, ?> b) { + super(b); + this.field2 = b.field2; + } + } + public static void test() { + Child x = Child.builder().field2(1.0).field1(5).resetToDefault().build(); + } +} diff --git a/test/transform/resource/after-delombok/SuperBuilderCustomizedWithSetterPrefix.java b/test/transform/resource/after-delombok/SuperBuilderCustomizedWithSetterPrefix.java index 8cc5dfe0..cee5ac89 100644 --- a/test/transform/resource/after-delombok/SuperBuilderCustomizedWithSetterPrefix.java +++ b/test/transform/resource/after-delombok/SuperBuilderCustomizedWithSetterPrefix.java @@ -1,50 +1,50 @@ -import java.util.List;
-public class SuperBuilderCustomizedWithSetterPrefix {
- public static class Parent {
- public static abstract class ParentBuilder<C extends Parent, B extends ParentBuilder<C, B>> {
- @java.lang.SuppressWarnings("all")
- private int field1;
- public B setField1(int field1) {
- this.field1 = field1 + 1;
- 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 "SuperBuilderCustomizedWithSetterPrefix.Parent.ParentBuilder(field1=" + this.field1 + ")";
- }
- }
- int field1;
- @java.lang.SuppressWarnings("all")
- private static final class ParentBuilderImpl extends SuperBuilderCustomizedWithSetterPrefix.Parent.ParentBuilder<SuperBuilderCustomizedWithSetterPrefix.Parent, SuperBuilderCustomizedWithSetterPrefix.Parent.ParentBuilderImpl> {
- @java.lang.SuppressWarnings("all")
- private ParentBuilderImpl() {
- }
- @java.lang.Override
- @java.lang.SuppressWarnings("all")
- protected SuperBuilderCustomizedWithSetterPrefix.Parent.ParentBuilderImpl self() {
- return this;
- }
- @java.lang.Override
- @java.lang.SuppressWarnings("all")
- public SuperBuilderCustomizedWithSetterPrefix.Parent build() {
- return new SuperBuilderCustomizedWithSetterPrefix.Parent(this);
- }
- }
- @java.lang.SuppressWarnings("all")
- protected Parent(final SuperBuilderCustomizedWithSetterPrefix.Parent.ParentBuilder<?, ?> b) {
- this.field1 = b.field1;
- }
- @java.lang.SuppressWarnings("all")
- public static SuperBuilderCustomizedWithSetterPrefix.Parent.ParentBuilder<?, ?> builder() {
- return new SuperBuilderCustomizedWithSetterPrefix.Parent.ParentBuilderImpl();
- }
- }
- public static void test() {
- Parent x = Parent.builder().setField1(5).build();
- }
-}
+import java.util.List; +public class SuperBuilderCustomizedWithSetterPrefix { + public static class Parent { + public static abstract class ParentBuilder<C extends Parent, B extends ParentBuilder<C, B>> { + @java.lang.SuppressWarnings("all") + private int field1; + public B setField1(int field1) { + this.field1 = field1 + 1; + 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 "SuperBuilderCustomizedWithSetterPrefix.Parent.ParentBuilder(field1=" + this.field1 + ")"; + } + } + int field1; + @java.lang.SuppressWarnings("all") + private static final class ParentBuilderImpl extends SuperBuilderCustomizedWithSetterPrefix.Parent.ParentBuilder<SuperBuilderCustomizedWithSetterPrefix.Parent, SuperBuilderCustomizedWithSetterPrefix.Parent.ParentBuilderImpl> { + @java.lang.SuppressWarnings("all") + private ParentBuilderImpl() { + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + protected SuperBuilderCustomizedWithSetterPrefix.Parent.ParentBuilderImpl self() { + return this; + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public SuperBuilderCustomizedWithSetterPrefix.Parent build() { + return new SuperBuilderCustomizedWithSetterPrefix.Parent(this); + } + } + @java.lang.SuppressWarnings("all") + protected Parent(final SuperBuilderCustomizedWithSetterPrefix.Parent.ParentBuilder<?, ?> b) { + this.field1 = b.field1; + } + @java.lang.SuppressWarnings("all") + public static SuperBuilderCustomizedWithSetterPrefix.Parent.ParentBuilder<?, ?> builder() { + return new SuperBuilderCustomizedWithSetterPrefix.Parent.ParentBuilderImpl(); + } + } + public static void test() { + Parent x = Parent.builder().setField1(5).build(); + } +} diff --git a/test/transform/resource/after-delombok/SuperBuilderInitializer.java b/test/transform/resource/after-delombok/SuperBuilderInitializer.java new file mode 100644 index 00000000..95943aa9 --- /dev/null +++ b/test/transform/resource/after-delombok/SuperBuilderInitializer.java @@ -0,0 +1,74 @@ +class SuperBuilderInitializer { + + public static class One { + private String world; + + { + world = "Hello"; + } + + private static final String world2; + + static { + world2 = "Hello"; + } + + + @java.lang.SuppressWarnings("all") + public static abstract class OneBuilder<C extends SuperBuilderInitializer.One, B extends SuperBuilderInitializer.One.OneBuilder<C, B>> { + @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}. + */ + @java.lang.SuppressWarnings("all") + public B world(final String world) { + this.world = world; + return self(); + } + + @java.lang.Override + @java.lang.SuppressWarnings("all") + public java.lang.String toString() { + return "SuperBuilderInitializer.One.OneBuilder(world=" + this.world + ")"; + } + } + + + @java.lang.SuppressWarnings("all") + private static final class OneBuilderImpl extends SuperBuilderInitializer.One.OneBuilder<SuperBuilderInitializer.One, SuperBuilderInitializer.One.OneBuilderImpl> { + @java.lang.SuppressWarnings("all") + private OneBuilderImpl() { + } + + @java.lang.Override + @java.lang.SuppressWarnings("all") + protected SuperBuilderInitializer.One.OneBuilderImpl self() { + return this; + } + + @java.lang.Override + @java.lang.SuppressWarnings("all") + public SuperBuilderInitializer.One build() { + return new SuperBuilderInitializer.One(this); + } + } + + @java.lang.SuppressWarnings("all") + protected One(final SuperBuilderInitializer.One.OneBuilder<?, ?> b) { + this.world = b.world; + } + + @java.lang.SuppressWarnings("all") + public static SuperBuilderInitializer.One.OneBuilder<?, ?> builder() { + return new SuperBuilderInitializer.One.OneBuilderImpl(); + } + } +} diff --git a/test/transform/resource/after-delombok/SuperBuilderNameClashes.java b/test/transform/resource/after-delombok/SuperBuilderNameClashes.java index baf47dc4..8cef4e11 100644 --- a/test/transform/resource/after-delombok/SuperBuilderNameClashes.java +++ b/test/transform/resource/after-delombok/SuperBuilderNameClashes.java @@ -1,124 +1,127 @@ -public class SuperBuilderNameClashes {
- public static class GenericsClash<B, C, C2> {
- @java.lang.SuppressWarnings("all")
- public static abstract class GenericsClashBuilder<B, C, C2, C3 extends SuperBuilderNameClashes.GenericsClash<B, C, C2>, B2 extends SuperBuilderNameClashes.GenericsClash.GenericsClashBuilder<B, C, C2, C3, B2>> {
- @java.lang.SuppressWarnings("all")
- protected abstract B2 self();
- @java.lang.SuppressWarnings("all")
- public abstract C3 build();
- @java.lang.Override
- @java.lang.SuppressWarnings("all")
- public java.lang.String toString() {
- return "SuperBuilderNameClashes.GenericsClash.GenericsClashBuilder()";
- }
- }
- @java.lang.SuppressWarnings("all")
- private static final class GenericsClashBuilderImpl<B, C, C2> extends SuperBuilderNameClashes.GenericsClash.GenericsClashBuilder<B, C, C2, SuperBuilderNameClashes.GenericsClash<B, C, C2>, SuperBuilderNameClashes.GenericsClash.GenericsClashBuilderImpl<B, C, C2>> {
- @java.lang.SuppressWarnings("all")
- private GenericsClashBuilderImpl() {
- }
- @java.lang.Override
- @java.lang.SuppressWarnings("all")
- protected SuperBuilderNameClashes.GenericsClash.GenericsClashBuilderImpl<B, C, C2> self() {
- return this;
- }
- @java.lang.Override
- @java.lang.SuppressWarnings("all")
- public SuperBuilderNameClashes.GenericsClash<B, C, C2> build() {
- return new SuperBuilderNameClashes.GenericsClash<B, C, C2>(this);
- }
- }
- @java.lang.SuppressWarnings("all")
- protected GenericsClash(final SuperBuilderNameClashes.GenericsClash.GenericsClashBuilder<B, C, C2, ?, ?> b) {
- }
- @java.lang.SuppressWarnings("all")
- public static <B, C, C2> SuperBuilderNameClashes.GenericsClash.GenericsClashBuilder<B, C, C2, ?, ?> builder() {
- return new SuperBuilderNameClashes.GenericsClash.GenericsClashBuilderImpl<B, C, C2>();
- }
- }
- public static class B {
- @java.lang.SuppressWarnings("all")
- public static abstract class BBuilder<C extends SuperBuilderNameClashes.B, B2 extends SuperBuilderNameClashes.B.BBuilder<C, B2>> {
- @java.lang.SuppressWarnings("all")
- protected abstract B2 self();
- @java.lang.SuppressWarnings("all")
- public abstract C build();
- @java.lang.Override
- @java.lang.SuppressWarnings("all")
- public java.lang.String toString() {
- return "SuperBuilderNameClashes.B.BBuilder()";
- }
- }
- @java.lang.SuppressWarnings("all")
- private static final class BBuilderImpl extends SuperBuilderNameClashes.B.BBuilder<SuperBuilderNameClashes.B, SuperBuilderNameClashes.B.BBuilderImpl> {
- @java.lang.SuppressWarnings("all")
- private BBuilderImpl() {
- }
- @java.lang.Override
- @java.lang.SuppressWarnings("all")
- protected SuperBuilderNameClashes.B.BBuilderImpl self() {
- return this;
- }
- @java.lang.Override
- @java.lang.SuppressWarnings("all")
- public SuperBuilderNameClashes.B build() {
- return new SuperBuilderNameClashes.B(this);
- }
- }
- @java.lang.SuppressWarnings("all")
- protected B(final SuperBuilderNameClashes.B.BBuilder<?, ?> b) {
- }
- @java.lang.SuppressWarnings("all")
- public static SuperBuilderNameClashes.B.BBuilder<?, ?> builder() {
- return new SuperBuilderNameClashes.B.BBuilderImpl();
- }
- }
- public static class C2 {
- }
- public static class C {
- C2 c2;
- @java.lang.SuppressWarnings("all")
- 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();
- @java.lang.SuppressWarnings("all")
- public B c2(final C2 c2) {
- this.c2 = c2;
- return self();
- }
- @java.lang.Override
- @java.lang.SuppressWarnings("all")
- public java.lang.String toString() {
- return "SuperBuilderNameClashes.C.CBuilder(c2=" + this.c2 + ")";
- }
- }
- @java.lang.SuppressWarnings("all")
- private static final class CBuilderImpl extends SuperBuilderNameClashes.C.CBuilder<SuperBuilderNameClashes.C, SuperBuilderNameClashes.C.CBuilderImpl> {
- @java.lang.SuppressWarnings("all")
- private CBuilderImpl() {
- }
- @java.lang.Override
- @java.lang.SuppressWarnings("all")
- protected SuperBuilderNameClashes.C.CBuilderImpl self() {
- return this;
- }
- @java.lang.Override
- @java.lang.SuppressWarnings("all")
- public SuperBuilderNameClashes.C build() {
- return new SuperBuilderNameClashes.C(this);
- }
- }
- @java.lang.SuppressWarnings("all")
- protected C(final SuperBuilderNameClashes.C.CBuilder<?, ?> b) {
- this.c2 = b.c2;
- }
- @java.lang.SuppressWarnings("all")
- public static SuperBuilderNameClashes.C.CBuilder<?, ?> builder() {
- return new SuperBuilderNameClashes.C.CBuilderImpl();
- }
- }
-}
+public class SuperBuilderNameClashes { + public static class GenericsClash<B, C, C2> { + @java.lang.SuppressWarnings("all") + public static abstract class GenericsClashBuilder<B, C, C2, C3 extends SuperBuilderNameClashes.GenericsClash<B, C, C2>, B2 extends SuperBuilderNameClashes.GenericsClash.GenericsClashBuilder<B, C, C2, C3, B2>> { + @java.lang.SuppressWarnings("all") + protected abstract B2 self(); + @java.lang.SuppressWarnings("all") + public abstract C3 build(); + @java.lang.Override + @java.lang.SuppressWarnings("all") + public java.lang.String toString() { + return "SuperBuilderNameClashes.GenericsClash.GenericsClashBuilder()"; + } + } + @java.lang.SuppressWarnings("all") + private static final class GenericsClashBuilderImpl<B, C, C2> extends SuperBuilderNameClashes.GenericsClash.GenericsClashBuilder<B, C, C2, SuperBuilderNameClashes.GenericsClash<B, C, C2>, SuperBuilderNameClashes.GenericsClash.GenericsClashBuilderImpl<B, C, C2>> { + @java.lang.SuppressWarnings("all") + private GenericsClashBuilderImpl() { + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + protected SuperBuilderNameClashes.GenericsClash.GenericsClashBuilderImpl<B, C, C2> self() { + return this; + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public SuperBuilderNameClashes.GenericsClash<B, C, C2> build() { + return new SuperBuilderNameClashes.GenericsClash<B, C, C2>(this); + } + } + @java.lang.SuppressWarnings("all") + protected GenericsClash(final SuperBuilderNameClashes.GenericsClash.GenericsClashBuilder<B, C, C2, ?, ?> b) { + } + @java.lang.SuppressWarnings("all") + public static <B, C, C2> SuperBuilderNameClashes.GenericsClash.GenericsClashBuilder<B, C, C2, ?, ?> builder() { + return new SuperBuilderNameClashes.GenericsClash.GenericsClashBuilderImpl<B, C, C2>(); + } + } + public static class B { + @java.lang.SuppressWarnings("all") + public static abstract class BBuilder<C extends SuperBuilderNameClashes.B, B2 extends SuperBuilderNameClashes.B.BBuilder<C, B2>> { + @java.lang.SuppressWarnings("all") + protected abstract B2 self(); + @java.lang.SuppressWarnings("all") + public abstract C build(); + @java.lang.Override + @java.lang.SuppressWarnings("all") + public java.lang.String toString() { + return "SuperBuilderNameClashes.B.BBuilder()"; + } + } + @java.lang.SuppressWarnings("all") + private static final class BBuilderImpl extends SuperBuilderNameClashes.B.BBuilder<SuperBuilderNameClashes.B, SuperBuilderNameClashes.B.BBuilderImpl> { + @java.lang.SuppressWarnings("all") + private BBuilderImpl() { + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + protected SuperBuilderNameClashes.B.BBuilderImpl self() { + return this; + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public SuperBuilderNameClashes.B build() { + return new SuperBuilderNameClashes.B(this); + } + } + @java.lang.SuppressWarnings("all") + protected B(final SuperBuilderNameClashes.B.BBuilder<?, ?> b) { + } + @java.lang.SuppressWarnings("all") + public static SuperBuilderNameClashes.B.BBuilder<?, ?> builder() { + return new SuperBuilderNameClashes.B.BBuilderImpl(); + } + } + public static class C2 { + } + public static class C { + C2 c2; + @java.lang.SuppressWarnings("all") + 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}. + */ + @java.lang.SuppressWarnings("all") + public B c2(final C2 c2) { + this.c2 = c2; + return self(); + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public java.lang.String toString() { + return "SuperBuilderNameClashes.C.CBuilder(c2=" + this.c2 + ")"; + } + } + @java.lang.SuppressWarnings("all") + private static final class CBuilderImpl extends SuperBuilderNameClashes.C.CBuilder<SuperBuilderNameClashes.C, SuperBuilderNameClashes.C.CBuilderImpl> { + @java.lang.SuppressWarnings("all") + private CBuilderImpl() { + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + protected SuperBuilderNameClashes.C.CBuilderImpl self() { + return this; + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public SuperBuilderNameClashes.C build() { + return new SuperBuilderNameClashes.C(this); + } + } + @java.lang.SuppressWarnings("all") + protected C(final SuperBuilderNameClashes.C.CBuilder<?, ?> b) { + this.c2 = b.c2; + } + @java.lang.SuppressWarnings("all") + public static SuperBuilderNameClashes.C.CBuilder<?, ?> builder() { + return new SuperBuilderNameClashes.C.CBuilderImpl(); + } + } +} diff --git a/test/transform/resource/after-delombok/SuperBuilderNestedGenericTypes.java b/test/transform/resource/after-delombok/SuperBuilderNestedGenericTypes.java index ad738c01..fadc0580 100644 --- a/test/transform/resource/after-delombok/SuperBuilderNestedGenericTypes.java +++ b/test/transform/resource/after-delombok/SuperBuilderNestedGenericTypes.java @@ -1,41 +1,41 @@ -public class SuperBuilderNestedGenericTypes {
- public static abstract class Generic<T extends Generic<?>> {
- @java.lang.SuppressWarnings("all")
- public static abstract class GenericBuilder<T extends Generic<?>, C extends SuperBuilderNestedGenericTypes.Generic<T>, B extends SuperBuilderNestedGenericTypes.Generic.GenericBuilder<T, C, B>> {
- @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 "SuperBuilderNestedGenericTypes.Generic.GenericBuilder()";
- }
- }
- @java.lang.SuppressWarnings("all")
- protected Generic(final SuperBuilderNestedGenericTypes.Generic.GenericBuilder<T, ?, ?> b) {
- }
- }
- public static abstract class NestedGeneric<T extends OtherGeneric<?>> extends Generic<NestedGeneric<? extends OtherGeneric<?>>> {
- @java.lang.SuppressWarnings("all")
- public static abstract class NestedGenericBuilder<T extends OtherGeneric<?>, C extends SuperBuilderNestedGenericTypes.NestedGeneric<T>, B extends SuperBuilderNestedGenericTypes.NestedGeneric.NestedGenericBuilder<T, C, B>> extends Generic.GenericBuilder<NestedGeneric<? extends OtherGeneric<?>>, C, B> {
- @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 "SuperBuilderNestedGenericTypes.NestedGeneric.NestedGenericBuilder(super=" + super.toString() + ")";
- }
- }
- @java.lang.SuppressWarnings("all")
- protected NestedGeneric(final SuperBuilderNestedGenericTypes.NestedGeneric.NestedGenericBuilder<T, ?, ?> b) {
- super(b);
- }
- }
- public interface OtherGeneric<T> {
- }
-}
+public class SuperBuilderNestedGenericTypes { + public static abstract class Generic<T extends Generic<?>> { + @java.lang.SuppressWarnings("all") + public static abstract class GenericBuilder<T extends Generic<?>, C extends SuperBuilderNestedGenericTypes.Generic<T>, B extends SuperBuilderNestedGenericTypes.Generic.GenericBuilder<T, C, B>> { + @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 "SuperBuilderNestedGenericTypes.Generic.GenericBuilder()"; + } + } + @java.lang.SuppressWarnings("all") + protected Generic(final SuperBuilderNestedGenericTypes.Generic.GenericBuilder<T, ?, ?> b) { + } + } + public static abstract class NestedGeneric<T extends OtherGeneric<?>> extends Generic<NestedGeneric<? extends OtherGeneric<?>>> { + @java.lang.SuppressWarnings("all") + public static abstract class NestedGenericBuilder<T extends OtherGeneric<?>, C extends SuperBuilderNestedGenericTypes.NestedGeneric<T>, B extends SuperBuilderNestedGenericTypes.NestedGeneric.NestedGenericBuilder<T, C, B>> extends Generic.GenericBuilder<NestedGeneric<? extends OtherGeneric<?>>, C, B> { + @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 "SuperBuilderNestedGenericTypes.NestedGeneric.NestedGenericBuilder(super=" + super.toString() + ")"; + } + } + @java.lang.SuppressWarnings("all") + protected NestedGeneric(final SuperBuilderNestedGenericTypes.NestedGeneric.NestedGenericBuilder<T, ?, ?> b) { + super(b); + } + } + public interface OtherGeneric<T> { + } +} diff --git a/test/transform/resource/after-delombok/SuperBuilderSingularAnnotatedTypes.java b/test/transform/resource/after-delombok/SuperBuilderSingularAnnotatedTypes.java index f6e0f024..ad51816a 100644 --- a/test/transform/resource/after-delombok/SuperBuilderSingularAnnotatedTypes.java +++ b/test/transform/resource/after-delombok/SuperBuilderSingularAnnotatedTypes.java @@ -1,3 +1,4 @@ +//version 8: import java.lang.annotation.ElementType; import java.lang.annotation.Target; import java.util.Set; diff --git a/test/transform/resource/after-delombok/SuperBuilderSingularCustomized.java b/test/transform/resource/after-delombok/SuperBuilderSingularCustomized.java new file mode 100644 index 00000000..04cfd9f2 --- /dev/null +++ b/test/transform/resource/after-delombok/SuperBuilderSingularCustomized.java @@ -0,0 +1,77 @@ +import java.util.Set; +class SuperBuilderSingularCustomized { + private Set<String> foos; + public static abstract class SuperBuilderSingularCustomizedBuilder<C extends SuperBuilderSingularCustomized, B extends SuperBuilderSingularCustomized.SuperBuilderSingularCustomizedBuilder<C, B>> { + @java.lang.SuppressWarnings("all") + private java.util.ArrayList<String> foos; + public B custom(final String value) { + 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); + return self(); + } + @java.lang.SuppressWarnings("all") + public B foos(final java.util.Collection<? extends String> foos) { + if (foos == null) { + throw new java.lang.NullPointerException("foos cannot be null"); + } + if (this.foos == null) this.foos = new java.util.ArrayList<String>(); + this.foos.addAll(foos); + return self(); + } + @java.lang.SuppressWarnings("all") + public B clearFoos() { + if (this.foos != null) this.foos.clear(); + return self(); + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public java.lang.String toString() { + return "SuperBuilderSingularCustomized.SuperBuilderSingularCustomizedBuilder(foos=" + this.foos + ")"; + } + } + @java.lang.SuppressWarnings("all") + private static final class SuperBuilderSingularCustomizedBuilderImpl extends SuperBuilderSingularCustomized.SuperBuilderSingularCustomizedBuilder<SuperBuilderSingularCustomized, SuperBuilderSingularCustomized.SuperBuilderSingularCustomizedBuilderImpl> { + @java.lang.SuppressWarnings("all") + private SuperBuilderSingularCustomizedBuilderImpl() { + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + protected SuperBuilderSingularCustomized.SuperBuilderSingularCustomizedBuilderImpl self() { + return this; + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public SuperBuilderSingularCustomized build() { + return new SuperBuilderSingularCustomized(this); + } + } + @java.lang.SuppressWarnings("all") + protected SuperBuilderSingularCustomized(final SuperBuilderSingularCustomized.SuperBuilderSingularCustomizedBuilder<?, ?> b) { + java.util.Set<String> foos; + switch (b.foos == null ? 0 : b.foos.size()) { + case 0: + foos = java.util.Collections.emptySet(); + break; + case 1: + foos = java.util.Collections.singleton(b.foos.get(0)); + break; + default: + foos = new java.util.LinkedHashSet<String>(b.foos.size() < 1073741824 ? 1 + b.foos.size() + (b.foos.size() - 3) / 3 : java.lang.Integer.MAX_VALUE); + foos.addAll(b.foos); + foos = java.util.Collections.unmodifiableSet(foos); + } + this.foos = foos; + } + @java.lang.SuppressWarnings("all") + public static SuperBuilderSingularCustomized.SuperBuilderSingularCustomizedBuilder<?, ?> builder() { + return new SuperBuilderSingularCustomized.SuperBuilderSingularCustomizedBuilderImpl(); + } +}
\ No newline at end of file diff --git a/test/transform/resource/after-delombok/SuperBuilderWithCustomBuilderMethod.java b/test/transform/resource/after-delombok/SuperBuilderWithCustomBuilderMethod.java index cfa39295..9237a148 100644 --- a/test/transform/resource/after-delombok/SuperBuilderWithCustomBuilderMethod.java +++ b/test/transform/resource/after-delombok/SuperBuilderWithCustomBuilderMethod.java @@ -1,135 +1,142 @@ -import java.util.List;
-public class SuperBuilderWithCustomBuilderMethod {
- public static class Parent<A> {
- A field1;
- List<String> items;
- @java.lang.SuppressWarnings("all")
- public static abstract class ParentBuilder<A, C extends SuperBuilderWithCustomBuilderMethod.Parent<A>, B extends SuperBuilderWithCustomBuilderMethod.Parent.ParentBuilder<A, C, B>> {
- @java.lang.SuppressWarnings("all")
- 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();
- @java.lang.SuppressWarnings("all")
- public B field1(final A field1) {
- this.field1 = field1;
- return self();
- }
- @java.lang.SuppressWarnings("all")
- public B item(final String item) {
- if (this.items == null) this.items = new java.util.ArrayList<String>();
- this.items.add(item);
- return self();
- }
- @java.lang.SuppressWarnings("all")
- public B items(final java.util.Collection<? extends String> items) {
- if (items == null) {
- throw new java.lang.NullPointerException("items cannot be null");
- }
- if (this.items == null) this.items = new java.util.ArrayList<String>();
- this.items.addAll(items);
- return self();
- }
- @java.lang.SuppressWarnings("all")
- public B clearItems() {
- if (this.items != null) this.items.clear();
- return self();
- }
- @java.lang.Override
- @java.lang.SuppressWarnings("all")
- public java.lang.String toString() {
- return "SuperBuilderWithCustomBuilderMethod.Parent.ParentBuilder(field1=" + this.field1 + ", items=" + this.items + ")";
- }
- }
- @java.lang.SuppressWarnings("all")
- private static final class ParentBuilderImpl<A> extends SuperBuilderWithCustomBuilderMethod.Parent.ParentBuilder<A, SuperBuilderWithCustomBuilderMethod.Parent<A>, SuperBuilderWithCustomBuilderMethod.Parent.ParentBuilderImpl<A>> {
- @java.lang.SuppressWarnings("all")
- private ParentBuilderImpl() {
- }
- @java.lang.Override
- @java.lang.SuppressWarnings("all")
- protected SuperBuilderWithCustomBuilderMethod.Parent.ParentBuilderImpl<A> self() {
- return this;
- }
- @java.lang.Override
- @java.lang.SuppressWarnings("all")
- public SuperBuilderWithCustomBuilderMethod.Parent<A> build() {
- return new SuperBuilderWithCustomBuilderMethod.Parent<A>(this);
- }
- }
- @java.lang.SuppressWarnings("all")
- protected Parent(final SuperBuilderWithCustomBuilderMethod.Parent.ParentBuilder<A, ?, ?> b) {
- this.field1 = b.field1;
- java.util.List<String> items;
- switch (b.items == null ? 0 : b.items.size()) {
- case 0:
- items = java.util.Collections.emptyList();
- break;
- case 1:
- items = java.util.Collections.singletonList(b.items.get(0));
- break;
- default:
- items = java.util.Collections.unmodifiableList(new java.util.ArrayList<String>(b.items));
- }
- this.items = items;
- }
- @java.lang.SuppressWarnings("all")
- public static <A> SuperBuilderWithCustomBuilderMethod.Parent.ParentBuilder<A, ?, ?> builder() {
- return new SuperBuilderWithCustomBuilderMethod.Parent.ParentBuilderImpl<A>();
- }
- }
- public static class Child<A> extends Parent<A> {
- double field3;
- public static <A> ChildBuilder<A, ?, ?> builder() {
- return new ChildBuilderImpl<A>().item("default item");
- }
- @java.lang.SuppressWarnings("all")
- 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();
- @java.lang.SuppressWarnings("all")
- public B field3(final double field3) {
- this.field3 = field3;
- return self();
- }
- @java.lang.Override
- @java.lang.SuppressWarnings("all")
- public java.lang.String toString() {
- return "SuperBuilderWithCustomBuilderMethod.Child.ChildBuilder(super=" + super.toString() + ", field3=" + this.field3 + ")";
- }
- }
- @java.lang.SuppressWarnings("all")
- private static final class ChildBuilderImpl<A> extends SuperBuilderWithCustomBuilderMethod.Child.ChildBuilder<A, SuperBuilderWithCustomBuilderMethod.Child<A>, SuperBuilderWithCustomBuilderMethod.Child.ChildBuilderImpl<A>> {
- @java.lang.SuppressWarnings("all")
- private ChildBuilderImpl() {
- }
- @java.lang.Override
- @java.lang.SuppressWarnings("all")
- protected SuperBuilderWithCustomBuilderMethod.Child.ChildBuilderImpl<A> self() {
- return this;
- }
- @java.lang.Override
- @java.lang.SuppressWarnings("all")
- public SuperBuilderWithCustomBuilderMethod.Child<A> build() {
- return new SuperBuilderWithCustomBuilderMethod.Child<A>(this);
- }
- }
- @java.lang.SuppressWarnings("all")
- protected Child(final SuperBuilderWithCustomBuilderMethod.Child.ChildBuilder<A, ?, ?> b) {
- super(b);
- this.field3 = b.field3;
- }
- }
- public static void test() {
- Child<Integer> x = Child.<Integer>builder().field3(0.0).field1(5).item("").build();
- }
-}
+//version 8: Javac 6 will error out due to `ChildBuilder` not existing before properly running lombok. Giving j6 support status, not worth fixing. +import java.util.List; +public class SuperBuilderWithCustomBuilderMethod { + public static class Parent<A> { + A field1; + List<String> items; + @java.lang.SuppressWarnings("all") + public static abstract class ParentBuilder<A, C extends SuperBuilderWithCustomBuilderMethod.Parent<A>, B extends SuperBuilderWithCustomBuilderMethod.Parent.ParentBuilder<A, C, B>> { + @java.lang.SuppressWarnings("all") + 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}. + */ + @java.lang.SuppressWarnings("all") + public B field1(final A field1) { + this.field1 = field1; + return self(); + } + @java.lang.SuppressWarnings("all") + public B item(final String item) { + if (this.items == null) this.items = new java.util.ArrayList<String>(); + this.items.add(item); + return self(); + } + @java.lang.SuppressWarnings("all") + public B items(final java.util.Collection<? extends String> items) { + if (items == null) { + throw new java.lang.NullPointerException("items cannot be null"); + } + if (this.items == null) this.items = new java.util.ArrayList<String>(); + this.items.addAll(items); + return self(); + } + @java.lang.SuppressWarnings("all") + public B clearItems() { + if (this.items != null) this.items.clear(); + return self(); + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public java.lang.String toString() { + return "SuperBuilderWithCustomBuilderMethod.Parent.ParentBuilder(field1=" + this.field1 + ", items=" + this.items + ")"; + } + } + @java.lang.SuppressWarnings("all") + private static final class ParentBuilderImpl<A> extends SuperBuilderWithCustomBuilderMethod.Parent.ParentBuilder<A, SuperBuilderWithCustomBuilderMethod.Parent<A>, SuperBuilderWithCustomBuilderMethod.Parent.ParentBuilderImpl<A>> { + @java.lang.SuppressWarnings("all") + private ParentBuilderImpl() { + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + protected SuperBuilderWithCustomBuilderMethod.Parent.ParentBuilderImpl<A> self() { + return this; + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public SuperBuilderWithCustomBuilderMethod.Parent<A> build() { + return new SuperBuilderWithCustomBuilderMethod.Parent<A>(this); + } + } + @java.lang.SuppressWarnings("all") + protected Parent(final SuperBuilderWithCustomBuilderMethod.Parent.ParentBuilder<A, ?, ?> b) { + this.field1 = b.field1; + java.util.List<String> items; + switch (b.items == null ? 0 : b.items.size()) { + case 0: + items = java.util.Collections.emptyList(); + break; + case 1: + items = java.util.Collections.singletonList(b.items.get(0)); + break; + default: + items = java.util.Collections.unmodifiableList(new java.util.ArrayList<String>(b.items)); + } + this.items = items; + } + @java.lang.SuppressWarnings("all") + public static <A> SuperBuilderWithCustomBuilderMethod.Parent.ParentBuilder<A, ?, ?> builder() { + return new SuperBuilderWithCustomBuilderMethod.Parent.ParentBuilderImpl<A>(); + } + } + public static class Child<A> extends Parent<A> { + double field3; + public static <A> ChildBuilder<A, ?, ?> builder() { + return new ChildBuilderImpl<A>().item("default item"); + } + @java.lang.SuppressWarnings("all") + 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}. + */ + @java.lang.SuppressWarnings("all") + public B field3(final double field3) { + this.field3 = field3; + return self(); + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public java.lang.String toString() { + return "SuperBuilderWithCustomBuilderMethod.Child.ChildBuilder(super=" + super.toString() + ", field3=" + this.field3 + ")"; + } + } + @java.lang.SuppressWarnings("all") + private static final class ChildBuilderImpl<A> extends SuperBuilderWithCustomBuilderMethod.Child.ChildBuilder<A, SuperBuilderWithCustomBuilderMethod.Child<A>, SuperBuilderWithCustomBuilderMethod.Child.ChildBuilderImpl<A>> { + @java.lang.SuppressWarnings("all") + private ChildBuilderImpl() { + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + protected SuperBuilderWithCustomBuilderMethod.Child.ChildBuilderImpl<A> self() { + return this; + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public SuperBuilderWithCustomBuilderMethod.Child<A> build() { + return new SuperBuilderWithCustomBuilderMethod.Child<A>(this); + } + } + @java.lang.SuppressWarnings("all") + protected Child(final SuperBuilderWithCustomBuilderMethod.Child.ChildBuilder<A, ?, ?> b) { + super(b); + this.field3 = b.field3; + } + } + public static void test() { + Child<Integer> x = Child.<Integer>builder().field3(0.0).field1(5).item("").build(); + } +} diff --git a/test/transform/resource/after-delombok/SuperBuilderWithDefaults.java b/test/transform/resource/after-delombok/SuperBuilderWithDefaults.java index ad56cea2..a9d92ff9 100644 --- a/test/transform/resource/after-delombok/SuperBuilderWithDefaults.java +++ b/test/transform/resource/after-delombok/SuperBuilderWithDefaults.java @@ -1,134 +1,143 @@ -import java.util.List;
-public class SuperBuilderWithDefaults {
- public static class Parent<N extends Number> {
- private long millis;
- private N numberField;
- @java.lang.SuppressWarnings("all")
- private static <N extends Number> long $default$millis() {
- return System.currentTimeMillis();
- }
- @java.lang.SuppressWarnings("all")
- private static <N extends Number> N $default$numberField() {
- return null;
- }
- @java.lang.SuppressWarnings("all")
- public static abstract class ParentBuilder<N extends Number, C extends SuperBuilderWithDefaults.Parent<N>, B extends SuperBuilderWithDefaults.Parent.ParentBuilder<N, C, B>> {
- @java.lang.SuppressWarnings("all")
- private boolean millis$set;
- @java.lang.SuppressWarnings("all")
- private long millis$value;
- @java.lang.SuppressWarnings("all")
- 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();
- @java.lang.SuppressWarnings("all")
- public B millis(final long millis) {
- this.millis$value = millis;
- millis$set = true;
- return self();
- }
- @java.lang.SuppressWarnings("all")
- public B numberField(final N numberField) {
- this.numberField$value = numberField;
- numberField$set = true;
- return self();
- }
- @java.lang.Override
- @java.lang.SuppressWarnings("all")
- public java.lang.String toString() {
- return "SuperBuilderWithDefaults.Parent.ParentBuilder(millis$value=" + this.millis$value + ", numberField$value=" + this.numberField$value + ")";
- }
- }
- @java.lang.SuppressWarnings("all")
- private static final class ParentBuilderImpl<N extends Number> extends SuperBuilderWithDefaults.Parent.ParentBuilder<N, SuperBuilderWithDefaults.Parent<N>, SuperBuilderWithDefaults.Parent.ParentBuilderImpl<N>> {
- @java.lang.SuppressWarnings("all")
- private ParentBuilderImpl() {
- }
- @java.lang.Override
- @java.lang.SuppressWarnings("all")
- protected SuperBuilderWithDefaults.Parent.ParentBuilderImpl<N> self() {
- return this;
- }
- @java.lang.Override
- @java.lang.SuppressWarnings("all")
- public SuperBuilderWithDefaults.Parent<N> build() {
- return new SuperBuilderWithDefaults.Parent<N>(this);
- }
- }
- @java.lang.SuppressWarnings("all")
- protected Parent(final SuperBuilderWithDefaults.Parent.ParentBuilder<N, ?, ?> b) {
- if (b.millis$set) this.millis = b.millis$value;
- else this.millis = SuperBuilderWithDefaults.Parent.<N>$default$millis();
- if (b.numberField$set) this.numberField = b.numberField$value;
- else this.numberField = SuperBuilderWithDefaults.Parent.<N>$default$numberField();
- }
- @java.lang.SuppressWarnings("all")
- public static <N extends Number> SuperBuilderWithDefaults.Parent.ParentBuilder<N, ?, ?> builder() {
- return new SuperBuilderWithDefaults.Parent.ParentBuilderImpl<N>();
- }
- }
- public static class Child extends Parent<Integer> {
- private double doubleField;
- @java.lang.SuppressWarnings("all")
- private static double $default$doubleField() {
- return Math.PI;
- }
- @java.lang.SuppressWarnings("all")
- public static abstract class ChildBuilder<C extends SuperBuilderWithDefaults.Child, B extends SuperBuilderWithDefaults.Child.ChildBuilder<C, B>> extends Parent.ParentBuilder<Integer, C, B> {
- @java.lang.SuppressWarnings("all")
- 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();
- @java.lang.SuppressWarnings("all")
- public B doubleField(final double doubleField) {
- this.doubleField$value = doubleField;
- doubleField$set = true;
- return self();
- }
- @java.lang.Override
- @java.lang.SuppressWarnings("all")
- public java.lang.String toString() {
- return "SuperBuilderWithDefaults.Child.ChildBuilder(super=" + super.toString() + ", doubleField$value=" + this.doubleField$value + ")";
- }
- }
- @java.lang.SuppressWarnings("all")
- private static final class ChildBuilderImpl extends SuperBuilderWithDefaults.Child.ChildBuilder<SuperBuilderWithDefaults.Child, SuperBuilderWithDefaults.Child.ChildBuilderImpl> {
- @java.lang.SuppressWarnings("all")
- private ChildBuilderImpl() {
- }
- @java.lang.Override
- @java.lang.SuppressWarnings("all")
- protected SuperBuilderWithDefaults.Child.ChildBuilderImpl self() {
- return this;
- }
- @java.lang.Override
- @java.lang.SuppressWarnings("all")
- public SuperBuilderWithDefaults.Child build() {
- return new SuperBuilderWithDefaults.Child(this);
- }
- }
- @java.lang.SuppressWarnings("all")
- protected Child(final SuperBuilderWithDefaults.Child.ChildBuilder<?, ?> b) {
- super(b);
- if (b.doubleField$set) this.doubleField = b.doubleField$value;
- else this.doubleField = SuperBuilderWithDefaults.Child.$default$doubleField();
- }
- @java.lang.SuppressWarnings("all")
- public static SuperBuilderWithDefaults.Child.ChildBuilder<?, ?> builder() {
- return new SuperBuilderWithDefaults.Child.ChildBuilderImpl();
- }
- }
- public static void test() {
- Child x = Child.builder().doubleField(0.1).numberField(5).millis(1234567890L).build();
- }
-}
+import java.util.List; +public class SuperBuilderWithDefaults { + public static class Parent<N extends Number> { + private long millis; + private N numberField; + @java.lang.SuppressWarnings("all") + private static <N extends Number> long $default$millis() { + return System.currentTimeMillis(); + } + @java.lang.SuppressWarnings("all") + private static <N extends Number> N $default$numberField() { + return null; + } + @java.lang.SuppressWarnings("all") + public static abstract class ParentBuilder<N extends Number, C extends SuperBuilderWithDefaults.Parent<N>, B extends SuperBuilderWithDefaults.Parent.ParentBuilder<N, C, B>> { + @java.lang.SuppressWarnings("all") + private boolean millis$set; + @java.lang.SuppressWarnings("all") + private long millis$value; + @java.lang.SuppressWarnings("all") + 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}. + */ + @java.lang.SuppressWarnings("all") + public B millis(final long millis) { + this.millis$value = millis; + millis$set = true; + return self(); + } + /** + * @return {@code this}. + */ + @java.lang.SuppressWarnings("all") + public B numberField(final N numberField) { + this.numberField$value = numberField; + numberField$set = true; + return self(); + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public java.lang.String toString() { + return "SuperBuilderWithDefaults.Parent.ParentBuilder(millis$value=" + this.millis$value + ", numberField$value=" + this.numberField$value + ")"; + } + } + @java.lang.SuppressWarnings("all") + private static final class ParentBuilderImpl<N extends Number> extends SuperBuilderWithDefaults.Parent.ParentBuilder<N, SuperBuilderWithDefaults.Parent<N>, SuperBuilderWithDefaults.Parent.ParentBuilderImpl<N>> { + @java.lang.SuppressWarnings("all") + private ParentBuilderImpl() { + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + protected SuperBuilderWithDefaults.Parent.ParentBuilderImpl<N> self() { + return this; + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public SuperBuilderWithDefaults.Parent<N> build() { + return new SuperBuilderWithDefaults.Parent<N>(this); + } + } + @java.lang.SuppressWarnings("all") + protected Parent(final SuperBuilderWithDefaults.Parent.ParentBuilder<N, ?, ?> b) { + if (b.millis$set) this.millis = b.millis$value; + else this.millis = SuperBuilderWithDefaults.Parent.<N>$default$millis(); + if (b.numberField$set) this.numberField = b.numberField$value; + else this.numberField = SuperBuilderWithDefaults.Parent.<N>$default$numberField(); + } + @java.lang.SuppressWarnings("all") + public static <N extends Number> SuperBuilderWithDefaults.Parent.ParentBuilder<N, ?, ?> builder() { + return new SuperBuilderWithDefaults.Parent.ParentBuilderImpl<N>(); + } + } + public static class Child extends Parent<Integer> { + private double doubleField; + @java.lang.SuppressWarnings("all") + private static double $default$doubleField() { + return Math.PI; + } + @java.lang.SuppressWarnings("all") + public static abstract class ChildBuilder<C extends SuperBuilderWithDefaults.Child, B extends SuperBuilderWithDefaults.Child.ChildBuilder<C, B>> extends Parent.ParentBuilder<Integer, C, B> { + @java.lang.SuppressWarnings("all") + 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}. + */ + @java.lang.SuppressWarnings("all") + public B doubleField(final double doubleField) { + this.doubleField$value = doubleField; + doubleField$set = true; + return self(); + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public java.lang.String toString() { + return "SuperBuilderWithDefaults.Child.ChildBuilder(super=" + super.toString() + ", doubleField$value=" + this.doubleField$value + ")"; + } + } + @java.lang.SuppressWarnings("all") + private static final class ChildBuilderImpl extends SuperBuilderWithDefaults.Child.ChildBuilder<SuperBuilderWithDefaults.Child, SuperBuilderWithDefaults.Child.ChildBuilderImpl> { + @java.lang.SuppressWarnings("all") + private ChildBuilderImpl() { + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + protected SuperBuilderWithDefaults.Child.ChildBuilderImpl self() { + return this; + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public SuperBuilderWithDefaults.Child build() { + return new SuperBuilderWithDefaults.Child(this); + } + } + @java.lang.SuppressWarnings("all") + protected Child(final SuperBuilderWithDefaults.Child.ChildBuilder<?, ?> b) { + super(b); + if (b.doubleField$set) this.doubleField = b.doubleField$value; + else this.doubleField = SuperBuilderWithDefaults.Child.$default$doubleField(); + } + @java.lang.SuppressWarnings("all") + public static SuperBuilderWithDefaults.Child.ChildBuilder<?, ?> builder() { + return new SuperBuilderWithDefaults.Child.ChildBuilderImpl(); + } + } + public static void test() { + Child x = Child.builder().doubleField(0.1).numberField(5).millis(1234567890L).build(); + } +} diff --git a/test/transform/resource/after-delombok/SuperBuilderWithExistingConstructor.java b/test/transform/resource/after-delombok/SuperBuilderWithExistingConstructor.java new file mode 100644 index 00000000..c6ab1072 --- /dev/null +++ b/test/transform/resource/after-delombok/SuperBuilderWithExistingConstructor.java @@ -0,0 +1,39 @@ +public class SuperBuilderWithExistingConstructor { + public SuperBuilderWithExistingConstructor() { + } + @java.lang.SuppressWarnings("all") + public static abstract class SuperBuilderWithExistingConstructorBuilder<C extends SuperBuilderWithExistingConstructor, B extends SuperBuilderWithExistingConstructor.SuperBuilderWithExistingConstructorBuilder<C, B>> { + @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 "SuperBuilderWithExistingConstructor.SuperBuilderWithExistingConstructorBuilder()"; + } + } + @java.lang.SuppressWarnings("all") + private static final class SuperBuilderWithExistingConstructorBuilderImpl extends SuperBuilderWithExistingConstructor.SuperBuilderWithExistingConstructorBuilder<SuperBuilderWithExistingConstructor, SuperBuilderWithExistingConstructor.SuperBuilderWithExistingConstructorBuilderImpl> { + @java.lang.SuppressWarnings("all") + private SuperBuilderWithExistingConstructorBuilderImpl() { + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + protected SuperBuilderWithExistingConstructor.SuperBuilderWithExistingConstructorBuilderImpl self() { + return this; + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public SuperBuilderWithExistingConstructor build() { + return new SuperBuilderWithExistingConstructor(this); + } + } + @java.lang.SuppressWarnings("all") + protected SuperBuilderWithExistingConstructor(final SuperBuilderWithExistingConstructor.SuperBuilderWithExistingConstructorBuilder<?, ?> b) { + } + @java.lang.SuppressWarnings("all") + public static SuperBuilderWithExistingConstructor.SuperBuilderWithExistingConstructorBuilder<?, ?> builder() { + return new SuperBuilderWithExistingConstructor.SuperBuilderWithExistingConstructorBuilderImpl(); + } +}
\ No newline at end of file diff --git a/test/transform/resource/after-delombok/SuperBuilderWithGenerics.java b/test/transform/resource/after-delombok/SuperBuilderWithGenerics.java index f5627211..017ebf31 100644 --- a/test/transform/resource/after-delombok/SuperBuilderWithGenerics.java +++ b/test/transform/resource/after-delombok/SuperBuilderWithGenerics.java @@ -1,136 +1,142 @@ -import java.util.List;
-public class SuperBuilderWithGenerics {
- public static class Parent<A> {
- A field1;
- List<String> items;
- @java.lang.SuppressWarnings("all")
- public static abstract class ParentBuilder<A, C extends SuperBuilderWithGenerics.Parent<A>, B extends SuperBuilderWithGenerics.Parent.ParentBuilder<A, C, B>> {
- @java.lang.SuppressWarnings("all")
- 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();
- @java.lang.SuppressWarnings("all")
- public B field1(final A field1) {
- this.field1 = field1;
- return self();
- }
- @java.lang.SuppressWarnings("all")
- public B item(final String item) {
- if (this.items == null) this.items = new java.util.ArrayList<String>();
- this.items.add(item);
- return self();
- }
- @java.lang.SuppressWarnings("all")
- public B items(final java.util.Collection<? extends String> items) {
- if (items == null) {
- throw new java.lang.NullPointerException("items cannot be null");
- }
- if (this.items == null) this.items = new java.util.ArrayList<String>();
- this.items.addAll(items);
- return self();
- }
- @java.lang.SuppressWarnings("all")
- public B clearItems() {
- if (this.items != null) this.items.clear();
- return self();
- }
- @java.lang.Override
- @java.lang.SuppressWarnings("all")
- public java.lang.String toString() {
- return "SuperBuilderWithGenerics.Parent.ParentBuilder(field1=" + this.field1 + ", items=" + this.items + ")";
- }
- }
- @java.lang.SuppressWarnings("all")
- private static final class ParentBuilderImpl<A> extends SuperBuilderWithGenerics.Parent.ParentBuilder<A, SuperBuilderWithGenerics.Parent<A>, SuperBuilderWithGenerics.Parent.ParentBuilderImpl<A>> {
- @java.lang.SuppressWarnings("all")
- private ParentBuilderImpl() {
- }
- @java.lang.Override
- @java.lang.SuppressWarnings("all")
- protected SuperBuilderWithGenerics.Parent.ParentBuilderImpl<A> self() {
- return this;
- }
- @java.lang.Override
- @java.lang.SuppressWarnings("all")
- public SuperBuilderWithGenerics.Parent<A> build() {
- return new SuperBuilderWithGenerics.Parent<A>(this);
- }
- }
- @java.lang.SuppressWarnings("all")
- protected Parent(final SuperBuilderWithGenerics.Parent.ParentBuilder<A, ?, ?> b) {
- this.field1 = b.field1;
- java.util.List<String> items;
- switch (b.items == null ? 0 : b.items.size()) {
- case 0:
- items = java.util.Collections.emptyList();
- break;
- case 1:
- items = java.util.Collections.singletonList(b.items.get(0));
- break;
- default:
- items = java.util.Collections.unmodifiableList(new java.util.ArrayList<String>(b.items));
- }
- this.items = items;
- }
- @java.lang.SuppressWarnings("all")
- public static <A> SuperBuilderWithGenerics.Parent.ParentBuilder<A, ?, ?> builder() {
- return new SuperBuilderWithGenerics.Parent.ParentBuilderImpl<A>();
- }
- }
- public static class Child<A> extends Parent<A> {
- double field3;
- @java.lang.SuppressWarnings("all")
- 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();
- @java.lang.SuppressWarnings("all")
- public B field3(final double field3) {
- this.field3 = field3;
- return self();
- }
- @java.lang.Override
- @java.lang.SuppressWarnings("all")
- public java.lang.String toString() {
- return "SuperBuilderWithGenerics.Child.ChildBuilder(super=" + super.toString() + ", field3=" + this.field3 + ")";
- }
- }
- @java.lang.SuppressWarnings("all")
- private static final class ChildBuilderImpl<A> extends SuperBuilderWithGenerics.Child.ChildBuilder<A, SuperBuilderWithGenerics.Child<A>, SuperBuilderWithGenerics.Child.ChildBuilderImpl<A>> {
- @java.lang.SuppressWarnings("all")
- private ChildBuilderImpl() {
- }
- @java.lang.Override
- @java.lang.SuppressWarnings("all")
- protected SuperBuilderWithGenerics.Child.ChildBuilderImpl<A> self() {
- return this;
- }
- @java.lang.Override
- @java.lang.SuppressWarnings("all")
- public SuperBuilderWithGenerics.Child<A> build() {
- return new SuperBuilderWithGenerics.Child<A>(this);
- }
- }
- @java.lang.SuppressWarnings("all")
- protected Child(final SuperBuilderWithGenerics.Child.ChildBuilder<A, ?, ?> b) {
- super(b);
- this.field3 = b.field3;
- }
- @java.lang.SuppressWarnings("all")
- public static <A> SuperBuilderWithGenerics.Child.ChildBuilder<A, ?, ?> builder() {
- return new SuperBuilderWithGenerics.Child.ChildBuilderImpl<A>();
- }
- }
- public static void test() {
- Child<Integer> x = Child.<Integer>builder().field3(0.0).field1(5).item("").build();
- }
-}
+import java.util.List; +public class SuperBuilderWithGenerics { + public static class Parent<A> { + A field1; + List<String> items; + @java.lang.SuppressWarnings("all") + public static abstract class ParentBuilder<A, C extends SuperBuilderWithGenerics.Parent<A>, B extends SuperBuilderWithGenerics.Parent.ParentBuilder<A, C, B>> { + @java.lang.SuppressWarnings("all") + 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}. + */ + @java.lang.SuppressWarnings("all") + public B field1(final A field1) { + this.field1 = field1; + return self(); + } + @java.lang.SuppressWarnings("all") + public B item(final String item) { + if (this.items == null) this.items = new java.util.ArrayList<String>(); + this.items.add(item); + return self(); + } + @java.lang.SuppressWarnings("all") + public B items(final java.util.Collection<? extends String> items) { + if (items == null) { + throw new java.lang.NullPointerException("items cannot be null"); + } + if (this.items == null) this.items = new java.util.ArrayList<String>(); + this.items.addAll(items); + return self(); + } + @java.lang.SuppressWarnings("all") + public B clearItems() { + if (this.items != null) this.items.clear(); + return self(); + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public java.lang.String toString() { + return "SuperBuilderWithGenerics.Parent.ParentBuilder(field1=" + this.field1 + ", items=" + this.items + ")"; + } + } + @java.lang.SuppressWarnings("all") + private static final class ParentBuilderImpl<A> extends SuperBuilderWithGenerics.Parent.ParentBuilder<A, SuperBuilderWithGenerics.Parent<A>, SuperBuilderWithGenerics.Parent.ParentBuilderImpl<A>> { + @java.lang.SuppressWarnings("all") + private ParentBuilderImpl() { + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + protected SuperBuilderWithGenerics.Parent.ParentBuilderImpl<A> self() { + return this; + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public SuperBuilderWithGenerics.Parent<A> build() { + return new SuperBuilderWithGenerics.Parent<A>(this); + } + } + @java.lang.SuppressWarnings("all") + protected Parent(final SuperBuilderWithGenerics.Parent.ParentBuilder<A, ?, ?> b) { + this.field1 = b.field1; + java.util.List<String> items; + switch (b.items == null ? 0 : b.items.size()) { + case 0: + items = java.util.Collections.emptyList(); + break; + case 1: + items = java.util.Collections.singletonList(b.items.get(0)); + break; + default: + items = java.util.Collections.unmodifiableList(new java.util.ArrayList<String>(b.items)); + } + this.items = items; + } + @java.lang.SuppressWarnings("all") + public static <A> SuperBuilderWithGenerics.Parent.ParentBuilder<A, ?, ?> builder() { + return new SuperBuilderWithGenerics.Parent.ParentBuilderImpl<A>(); + } + } + public static class Child<A> extends Parent<A> { + double field3; + @java.lang.SuppressWarnings("all") + 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}. + */ + @java.lang.SuppressWarnings("all") + public B field3(final double field3) { + this.field3 = field3; + return self(); + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public java.lang.String toString() { + return "SuperBuilderWithGenerics.Child.ChildBuilder(super=" + super.toString() + ", field3=" + this.field3 + ")"; + } + } + @java.lang.SuppressWarnings("all") + private static final class ChildBuilderImpl<A> extends SuperBuilderWithGenerics.Child.ChildBuilder<A, SuperBuilderWithGenerics.Child<A>, SuperBuilderWithGenerics.Child.ChildBuilderImpl<A>> { + @java.lang.SuppressWarnings("all") + private ChildBuilderImpl() { + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + protected SuperBuilderWithGenerics.Child.ChildBuilderImpl<A> self() { + return this; + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public SuperBuilderWithGenerics.Child<A> build() { + return new SuperBuilderWithGenerics.Child<A>(this); + } + } + @java.lang.SuppressWarnings("all") + protected Child(final SuperBuilderWithGenerics.Child.ChildBuilder<A, ?, ?> b) { + super(b); + this.field3 = b.field3; + } + @java.lang.SuppressWarnings("all") + public static <A> SuperBuilderWithGenerics.Child.ChildBuilder<A, ?, ?> builder() { + return new SuperBuilderWithGenerics.Child.ChildBuilderImpl<A>(); + } + } + public static void test() { + Child<Integer> x = Child.<Integer>builder().field3(0.0).field1(5).item("").build(); + } +} diff --git a/test/transform/resource/after-delombok/SuperBuilderWithGenerics2.java b/test/transform/resource/after-delombok/SuperBuilderWithGenerics2.java index 2b4697d5..8c465b0e 100644 --- a/test/transform/resource/after-delombok/SuperBuilderWithGenerics2.java +++ b/test/transform/resource/after-delombok/SuperBuilderWithGenerics2.java @@ -1,136 +1,142 @@ -import java.util.List;
-public class SuperBuilderWithGenerics2 {
- public static class Parent<A> {
- A field1;
- List<String> items;
- @java.lang.SuppressWarnings("all")
- public static abstract class ParentBuilder<A, C extends SuperBuilderWithGenerics2.Parent<A>, B extends SuperBuilderWithGenerics2.Parent.ParentBuilder<A, C, B>> {
- @java.lang.SuppressWarnings("all")
- 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();
- @java.lang.SuppressWarnings("all")
- public B field1(final A field1) {
- this.field1 = field1;
- return self();
- }
- @java.lang.SuppressWarnings("all")
- public B item(final String item) {
- if (this.items == null) this.items = new java.util.ArrayList<String>();
- this.items.add(item);
- return self();
- }
- @java.lang.SuppressWarnings("all")
- public B items(final java.util.Collection<? extends String> items) {
- if (items == null) {
- throw new java.lang.NullPointerException("items cannot be null");
- }
- if (this.items == null) this.items = new java.util.ArrayList<String>();
- this.items.addAll(items);
- return self();
- }
- @java.lang.SuppressWarnings("all")
- public B clearItems() {
- if (this.items != null) this.items.clear();
- return self();
- }
- @java.lang.Override
- @java.lang.SuppressWarnings("all")
- public java.lang.String toString() {
- return "SuperBuilderWithGenerics2.Parent.ParentBuilder(field1=" + this.field1 + ", items=" + this.items + ")";
- }
- }
- @java.lang.SuppressWarnings("all")
- private static final class ParentBuilderImpl<A> extends SuperBuilderWithGenerics2.Parent.ParentBuilder<A, SuperBuilderWithGenerics2.Parent<A>, SuperBuilderWithGenerics2.Parent.ParentBuilderImpl<A>> {
- @java.lang.SuppressWarnings("all")
- private ParentBuilderImpl() {
- }
- @java.lang.Override
- @java.lang.SuppressWarnings("all")
- protected SuperBuilderWithGenerics2.Parent.ParentBuilderImpl<A> self() {
- return this;
- }
- @java.lang.Override
- @java.lang.SuppressWarnings("all")
- public SuperBuilderWithGenerics2.Parent<A> build() {
- return new SuperBuilderWithGenerics2.Parent<A>(this);
- }
- }
- @java.lang.SuppressWarnings("all")
- protected Parent(final SuperBuilderWithGenerics2.Parent.ParentBuilder<A, ?, ?> b) {
- this.field1 = b.field1;
- java.util.List<String> items;
- switch (b.items == null ? 0 : b.items.size()) {
- case 0:
- items = java.util.Collections.emptyList();
- break;
- case 1:
- items = java.util.Collections.singletonList(b.items.get(0));
- break;
- default:
- items = java.util.Collections.unmodifiableList(new java.util.ArrayList<String>(b.items));
- }
- this.items = items;
- }
- @java.lang.SuppressWarnings("all")
- public static <A> SuperBuilderWithGenerics2.Parent.ParentBuilder<A, ?, ?> builder() {
- return new SuperBuilderWithGenerics2.Parent.ParentBuilderImpl<A>();
- }
- }
- public static class Child<A> extends Parent<String> {
- A field3;
- @java.lang.SuppressWarnings("all")
- 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();
- @java.lang.SuppressWarnings("all")
- public B field3(final A field3) {
- this.field3 = field3;
- return self();
- }
- @java.lang.Override
- @java.lang.SuppressWarnings("all")
- public java.lang.String toString() {
- return "SuperBuilderWithGenerics2.Child.ChildBuilder(super=" + super.toString() + ", field3=" + this.field3 + ")";
- }
- }
- @java.lang.SuppressWarnings("all")
- private static final class ChildBuilderImpl<A> extends SuperBuilderWithGenerics2.Child.ChildBuilder<A, SuperBuilderWithGenerics2.Child<A>, SuperBuilderWithGenerics2.Child.ChildBuilderImpl<A>> {
- @java.lang.SuppressWarnings("all")
- private ChildBuilderImpl() {
- }
- @java.lang.Override
- @java.lang.SuppressWarnings("all")
- protected SuperBuilderWithGenerics2.Child.ChildBuilderImpl<A> self() {
- return this;
- }
- @java.lang.Override
- @java.lang.SuppressWarnings("all")
- public SuperBuilderWithGenerics2.Child<A> build() {
- return new SuperBuilderWithGenerics2.Child<A>(this);
- }
- }
- @java.lang.SuppressWarnings("all")
- protected Child(final SuperBuilderWithGenerics2.Child.ChildBuilder<A, ?, ?> b) {
- super(b);
- this.field3 = b.field3;
- }
- @java.lang.SuppressWarnings("all")
- public static <A> SuperBuilderWithGenerics2.Child.ChildBuilder<A, ?, ?> builder2() {
- return new SuperBuilderWithGenerics2.Child.ChildBuilderImpl<A>();
- }
- }
- public static void test() {
- Child<Integer> x = Child.<Integer>builder2().field3(1).field1("value").item("").build();
- }
-}
+import java.util.List; +public class SuperBuilderWithGenerics2 { + public static class Parent<A> { + A field1; + List<String> items; + @java.lang.SuppressWarnings("all") + public static abstract class ParentBuilder<A, C extends SuperBuilderWithGenerics2.Parent<A>, B extends SuperBuilderWithGenerics2.Parent.ParentBuilder<A, C, B>> { + @java.lang.SuppressWarnings("all") + 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}. + */ + @java.lang.SuppressWarnings("all") + public B field1(final A field1) { + this.field1 = field1; + return self(); + } + @java.lang.SuppressWarnings("all") + public B item(final String item) { + if (this.items == null) this.items = new java.util.ArrayList<String>(); + this.items.add(item); + return self(); + } + @java.lang.SuppressWarnings("all") + public B items(final java.util.Collection<? extends String> items) { + if (items == null) { + throw new java.lang.NullPointerException("items cannot be null"); + } + if (this.items == null) this.items = new java.util.ArrayList<String>(); + this.items.addAll(items); + return self(); + } + @java.lang.SuppressWarnings("all") + public B clearItems() { + if (this.items != null) this.items.clear(); + return self(); + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public java.lang.String toString() { + return "SuperBuilderWithGenerics2.Parent.ParentBuilder(field1=" + this.field1 + ", items=" + this.items + ")"; + } + } + @java.lang.SuppressWarnings("all") + private static final class ParentBuilderImpl<A> extends SuperBuilderWithGenerics2.Parent.ParentBuilder<A, SuperBuilderWithGenerics2.Parent<A>, SuperBuilderWithGenerics2.Parent.ParentBuilderImpl<A>> { + @java.lang.SuppressWarnings("all") + private ParentBuilderImpl() { + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + protected SuperBuilderWithGenerics2.Parent.ParentBuilderImpl<A> self() { + return this; + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public SuperBuilderWithGenerics2.Parent<A> build() { + return new SuperBuilderWithGenerics2.Parent<A>(this); + } + } + @java.lang.SuppressWarnings("all") + protected Parent(final SuperBuilderWithGenerics2.Parent.ParentBuilder<A, ?, ?> b) { + this.field1 = b.field1; + java.util.List<String> items; + switch (b.items == null ? 0 : b.items.size()) { + case 0: + items = java.util.Collections.emptyList(); + break; + case 1: + items = java.util.Collections.singletonList(b.items.get(0)); + break; + default: + items = java.util.Collections.unmodifiableList(new java.util.ArrayList<String>(b.items)); + } + this.items = items; + } + @java.lang.SuppressWarnings("all") + public static <A> SuperBuilderWithGenerics2.Parent.ParentBuilder<A, ?, ?> builder() { + return new SuperBuilderWithGenerics2.Parent.ParentBuilderImpl<A>(); + } + } + public static class Child<A> extends Parent<String> { + A field3; + @java.lang.SuppressWarnings("all") + 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}. + */ + @java.lang.SuppressWarnings("all") + public B field3(final A field3) { + this.field3 = field3; + return self(); + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public java.lang.String toString() { + return "SuperBuilderWithGenerics2.Child.ChildBuilder(super=" + super.toString() + ", field3=" + this.field3 + ")"; + } + } + @java.lang.SuppressWarnings("all") + private static final class ChildBuilderImpl<A> extends SuperBuilderWithGenerics2.Child.ChildBuilder<A, SuperBuilderWithGenerics2.Child<A>, SuperBuilderWithGenerics2.Child.ChildBuilderImpl<A>> { + @java.lang.SuppressWarnings("all") + private ChildBuilderImpl() { + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + protected SuperBuilderWithGenerics2.Child.ChildBuilderImpl<A> self() { + return this; + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public SuperBuilderWithGenerics2.Child<A> build() { + return new SuperBuilderWithGenerics2.Child<A>(this); + } + } + @java.lang.SuppressWarnings("all") + protected Child(final SuperBuilderWithGenerics2.Child.ChildBuilder<A, ?, ?> b) { + super(b); + this.field3 = b.field3; + } + @java.lang.SuppressWarnings("all") + public static <A> SuperBuilderWithGenerics2.Child.ChildBuilder<A, ?, ?> builder2() { + return new SuperBuilderWithGenerics2.Child.ChildBuilderImpl<A>(); + } + } + public static void test() { + Child<Integer> x = Child.<Integer>builder2().field3(1).field1("value").item("").build(); + } +} diff --git a/test/transform/resource/after-delombok/SuperBuilderWithGenerics3.java b/test/transform/resource/after-delombok/SuperBuilderWithGenerics3.java index b21f8fee..991d7cbe 100644 --- a/test/transform/resource/after-delombok/SuperBuilderWithGenerics3.java +++ b/test/transform/resource/after-delombok/SuperBuilderWithGenerics3.java @@ -10,6 +10,9 @@ public class SuperBuilderWithGenerics3 { protected abstract B self(); @java.lang.SuppressWarnings("all") public abstract C build(); + /** + * @return {@code this}. + */ @java.lang.SuppressWarnings("all") public B str(final String str) { this.str = str; @@ -60,6 +63,9 @@ public class SuperBuilderWithGenerics3 { @java.lang.Override @java.lang.SuppressWarnings("all") public abstract C build(); + /** + * @return {@code this}. + */ @java.lang.SuppressWarnings("all") public B field3(final double field3) { this.field3 = field3; diff --git a/test/transform/resource/after-delombok/SuperBuilderWithGenericsAndToBuilder.java b/test/transform/resource/after-delombok/SuperBuilderWithGenericsAndToBuilder.java index 48d51fba..28c48db3 100644 --- a/test/transform/resource/after-delombok/SuperBuilderWithGenericsAndToBuilder.java +++ b/test/transform/resource/after-delombok/SuperBuilderWithGenericsAndToBuilder.java @@ -1,182 +1,188 @@ -import java.util.Map;
-public class SuperBuilderWithGenericsAndToBuilder {
- public static class Parent<A> {
- A field1;
- Map<Integer, String> items;
- @java.lang.SuppressWarnings("all")
- public static abstract class ParentBuilder<A, C extends SuperBuilderWithGenericsAndToBuilder.Parent<A>, B extends SuperBuilderWithGenericsAndToBuilder.Parent.ParentBuilder<A, C, B>> {
- @java.lang.SuppressWarnings("all")
- private A field1;
- @java.lang.SuppressWarnings("all")
- private java.util.ArrayList<Integer> items$key;
- @java.lang.SuppressWarnings("all")
- private java.util.ArrayList<String> items$value;
- @java.lang.SuppressWarnings("all")
- protected B $fillValuesFrom(final C instance) {
- SuperBuilderWithGenericsAndToBuilder.Parent.ParentBuilder.$fillValuesFromInstanceIntoBuilder(instance, this);
- return self();
- }
- @java.lang.SuppressWarnings("all")
- private static <A> void $fillValuesFromInstanceIntoBuilder(final SuperBuilderWithGenericsAndToBuilder.Parent<A> instance, final SuperBuilderWithGenericsAndToBuilder.Parent.ParentBuilder<A, ?, ?> b) {
- b.field1(instance.field1);
- b.items(instance.items == null ? java.util.Collections.emptyMap() : instance.items);
- }
- @java.lang.SuppressWarnings("all")
- protected abstract B self();
- @java.lang.SuppressWarnings("all")
- public abstract C build();
- @java.lang.SuppressWarnings("all")
- public B field1(final A field1) {
- this.field1 = field1;
- return self();
- }
- @java.lang.SuppressWarnings("all")
- public B item(final Integer itemKey, final String itemValue) {
- if (this.items$key == null) {
- this.items$key = new java.util.ArrayList<Integer>();
- this.items$value = new java.util.ArrayList<String>();
- }
- this.items$key.add(itemKey);
- this.items$value.add(itemValue);
- return self();
- }
- @java.lang.SuppressWarnings("all")
- public B items(final java.util.Map<? extends Integer, ? extends String> items) {
- if (items == null) {
- throw new java.lang.NullPointerException("items cannot be null");
- }
- if (this.items$key == null) {
- this.items$key = new java.util.ArrayList<Integer>();
- this.items$value = new java.util.ArrayList<String>();
- }
- for (final java.util.Map.Entry<? extends Integer, ? extends String> $lombokEntry : items.entrySet()) {
- this.items$key.add($lombokEntry.getKey());
- this.items$value.add($lombokEntry.getValue());
- }
- return self();
- }
- @java.lang.SuppressWarnings("all")
- public B clearItems() {
- if (this.items$key != null) {
- this.items$key.clear();
- this.items$value.clear();
- }
- return self();
- }
- @java.lang.Override
- @java.lang.SuppressWarnings("all")
- public java.lang.String toString() {
- return "SuperBuilderWithGenericsAndToBuilder.Parent.ParentBuilder(field1=" + this.field1 + ", items$key=" + this.items$key + ", items$value=" + this.items$value + ")";
- }
- }
- @java.lang.SuppressWarnings("all")
- private static final class ParentBuilderImpl<A> extends SuperBuilderWithGenericsAndToBuilder.Parent.ParentBuilder<A, SuperBuilderWithGenericsAndToBuilder.Parent<A>, SuperBuilderWithGenericsAndToBuilder.Parent.ParentBuilderImpl<A>> {
- @java.lang.SuppressWarnings("all")
- private ParentBuilderImpl() {
- }
- @java.lang.Override
- @java.lang.SuppressWarnings("all")
- protected SuperBuilderWithGenericsAndToBuilder.Parent.ParentBuilderImpl<A> self() {
- return this;
- }
- @java.lang.Override
- @java.lang.SuppressWarnings("all")
- public SuperBuilderWithGenericsAndToBuilder.Parent<A> build() {
- return new SuperBuilderWithGenericsAndToBuilder.Parent<A>(this);
- }
- }
- @java.lang.SuppressWarnings("all")
- protected Parent(final SuperBuilderWithGenericsAndToBuilder.Parent.ParentBuilder<A, ?, ?> b) {
- this.field1 = b.field1;
- java.util.Map<Integer, String> items;
- switch (b.items$key == null ? 0 : b.items$key.size()) {
- case 0:
- items = java.util.Collections.emptyMap();
- break;
- case 1:
- items = java.util.Collections.singletonMap(b.items$key.get(0), b.items$value.get(0));
- break;
- default:
- items = new java.util.LinkedHashMap<Integer, String>(b.items$key.size() < 1073741824 ? 1 + b.items$key.size() + (b.items$key.size() - 3) / 3 : java.lang.Integer.MAX_VALUE);
- for (int $i = 0; $i < b.items$key.size(); $i++) items.put(b.items$key.get($i), (String) b.items$value.get($i));
- items = java.util.Collections.unmodifiableMap(items);
- }
- this.items = items;
- }
- @java.lang.SuppressWarnings("all")
- public static <A> SuperBuilderWithGenericsAndToBuilder.Parent.ParentBuilder<A, ?, ?> builder() {
- return new SuperBuilderWithGenericsAndToBuilder.Parent.ParentBuilderImpl<A>();
- }
- @java.lang.SuppressWarnings("all")
- public SuperBuilderWithGenericsAndToBuilder.Parent.ParentBuilder<A, ?, ?> toBuilder() {
- return new SuperBuilderWithGenericsAndToBuilder.Parent.ParentBuilderImpl<A>().$fillValuesFrom(this);
- }
- }
- public static class Child<A> extends Parent<A> {
- double field3;
- @java.lang.SuppressWarnings("all")
- public static abstract class ChildBuilder<A, C extends SuperBuilderWithGenericsAndToBuilder.Child<A>, B extends SuperBuilderWithGenericsAndToBuilder.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 B $fillValuesFrom(final C instance) {
- super.$fillValuesFrom(instance);
- SuperBuilderWithGenericsAndToBuilder.Child.ChildBuilder.$fillValuesFromInstanceIntoBuilder(instance, this);
- return self();
- }
- @java.lang.SuppressWarnings("all")
- 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();
- @java.lang.SuppressWarnings("all")
- public B field3(final double field3) {
- this.field3 = field3;
- return self();
- }
- @java.lang.Override
- @java.lang.SuppressWarnings("all")
- public java.lang.String toString() {
- return "SuperBuilderWithGenericsAndToBuilder.Child.ChildBuilder(super=" + super.toString() + ", field3=" + this.field3 + ")";
- }
- }
- @java.lang.SuppressWarnings("all")
- private static final class ChildBuilderImpl<A> extends SuperBuilderWithGenericsAndToBuilder.Child.ChildBuilder<A, SuperBuilderWithGenericsAndToBuilder.Child<A>, SuperBuilderWithGenericsAndToBuilder.Child.ChildBuilderImpl<A>> {
- @java.lang.SuppressWarnings("all")
- private ChildBuilderImpl() {
- }
- @java.lang.Override
- @java.lang.SuppressWarnings("all")
- protected SuperBuilderWithGenericsAndToBuilder.Child.ChildBuilderImpl<A> self() {
- return this;
- }
- @java.lang.Override
- @java.lang.SuppressWarnings("all")
- public SuperBuilderWithGenericsAndToBuilder.Child<A> build() {
- return new SuperBuilderWithGenericsAndToBuilder.Child<A>(this);
- }
- }
- @java.lang.SuppressWarnings("all")
- protected Child(final SuperBuilderWithGenericsAndToBuilder.Child.ChildBuilder<A, ?, ?> b) {
- super(b);
- this.field3 = b.field3;
- }
- @java.lang.SuppressWarnings("all")
- public static <A> SuperBuilderWithGenericsAndToBuilder.Child.ChildBuilder<A, ?, ?> builder() {
- return new SuperBuilderWithGenericsAndToBuilder.Child.ChildBuilderImpl<A>();
- }
- @java.lang.SuppressWarnings("all")
- public SuperBuilderWithGenericsAndToBuilder.Child.ChildBuilder<A, ?, ?> toBuilder() {
- return new SuperBuilderWithGenericsAndToBuilder.Child.ChildBuilderImpl<A>().$fillValuesFrom(this);
- }
- }
- public static void test() {
- Child<Integer> x = Child.<Integer>builder().field3(0.0).field1(5).item(5, "").build().toBuilder().build();
- }
-}
+import java.util.Map; +public class SuperBuilderWithGenericsAndToBuilder { + public static class Parent<A> { + A field1; + Map<Integer, String> items; + @java.lang.SuppressWarnings("all") + public static abstract class ParentBuilder<A, C extends SuperBuilderWithGenericsAndToBuilder.Parent<A>, B extends SuperBuilderWithGenericsAndToBuilder.Parent.ParentBuilder<A, C, B>> { + @java.lang.SuppressWarnings("all") + private A field1; + @java.lang.SuppressWarnings("all") + private java.util.ArrayList<Integer> items$key; + @java.lang.SuppressWarnings("all") + private java.util.ArrayList<String> items$value; + @java.lang.SuppressWarnings("all") + protected B $fillValuesFrom(final C instance) { + SuperBuilderWithGenericsAndToBuilder.Parent.ParentBuilder.$fillValuesFromInstanceIntoBuilder(instance, this); + return self(); + } + @java.lang.SuppressWarnings("all") + private static <A> void $fillValuesFromInstanceIntoBuilder(final SuperBuilderWithGenericsAndToBuilder.Parent<A> instance, final SuperBuilderWithGenericsAndToBuilder.Parent.ParentBuilder<A, ?, ?> b) { + 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}. + */ + @java.lang.SuppressWarnings("all") + public B field1(final A field1) { + this.field1 = field1; + return self(); + } + @java.lang.SuppressWarnings("all") + public B item(final Integer itemKey, final String itemValue) { + if (this.items$key == null) { + this.items$key = new java.util.ArrayList<Integer>(); + this.items$value = new java.util.ArrayList<String>(); + } + this.items$key.add(itemKey); + this.items$value.add(itemValue); + return self(); + } + @java.lang.SuppressWarnings("all") + public B items(final java.util.Map<? extends Integer, ? extends String> items) { + if (items == null) { + throw new java.lang.NullPointerException("items cannot be null"); + } + if (this.items$key == null) { + this.items$key = new java.util.ArrayList<Integer>(); + this.items$value = new java.util.ArrayList<String>(); + } + for (final java.util.Map.Entry<? extends Integer, ? extends String> $lombokEntry : items.entrySet()) { + this.items$key.add($lombokEntry.getKey()); + this.items$value.add($lombokEntry.getValue()); + } + return self(); + } + @java.lang.SuppressWarnings("all") + public B clearItems() { + if (this.items$key != null) { + this.items$key.clear(); + this.items$value.clear(); + } + return self(); + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public java.lang.String toString() { + return "SuperBuilderWithGenericsAndToBuilder.Parent.ParentBuilder(field1=" + this.field1 + ", items$key=" + this.items$key + ", items$value=" + this.items$value + ")"; + } + } + @java.lang.SuppressWarnings("all") + private static final class ParentBuilderImpl<A> extends SuperBuilderWithGenericsAndToBuilder.Parent.ParentBuilder<A, SuperBuilderWithGenericsAndToBuilder.Parent<A>, SuperBuilderWithGenericsAndToBuilder.Parent.ParentBuilderImpl<A>> { + @java.lang.SuppressWarnings("all") + private ParentBuilderImpl() { + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + protected SuperBuilderWithGenericsAndToBuilder.Parent.ParentBuilderImpl<A> self() { + return this; + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public SuperBuilderWithGenericsAndToBuilder.Parent<A> build() { + return new SuperBuilderWithGenericsAndToBuilder.Parent<A>(this); + } + } + @java.lang.SuppressWarnings("all") + protected Parent(final SuperBuilderWithGenericsAndToBuilder.Parent.ParentBuilder<A, ?, ?> b) { + this.field1 = b.field1; + java.util.Map<Integer, String> items; + switch (b.items$key == null ? 0 : b.items$key.size()) { + case 0: + items = java.util.Collections.emptyMap(); + break; + case 1: + items = java.util.Collections.singletonMap(b.items$key.get(0), b.items$value.get(0)); + break; + default: + items = new java.util.LinkedHashMap<Integer, String>(b.items$key.size() < 1073741824 ? 1 + b.items$key.size() + (b.items$key.size() - 3) / 3 : java.lang.Integer.MAX_VALUE); + for (int $i = 0; $i < b.items$key.size(); $i++) items.put(b.items$key.get($i), (String) b.items$value.get($i)); + items = java.util.Collections.unmodifiableMap(items); + } + this.items = items; + } + @java.lang.SuppressWarnings("all") + public static <A> SuperBuilderWithGenericsAndToBuilder.Parent.ParentBuilder<A, ?, ?> builder() { + return new SuperBuilderWithGenericsAndToBuilder.Parent.ParentBuilderImpl<A>(); + } + @java.lang.SuppressWarnings("all") + public SuperBuilderWithGenericsAndToBuilder.Parent.ParentBuilder<A, ?, ?> toBuilder() { + return new SuperBuilderWithGenericsAndToBuilder.Parent.ParentBuilderImpl<A>().$fillValuesFrom(this); + } + } + public static class Child<A> extends Parent<A> { + double field3; + @java.lang.SuppressWarnings("all") + public static abstract class ChildBuilder<A, C extends SuperBuilderWithGenericsAndToBuilder.Child<A>, B extends SuperBuilderWithGenericsAndToBuilder.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 B $fillValuesFrom(final C instance) { + super.$fillValuesFrom(instance); + SuperBuilderWithGenericsAndToBuilder.Child.ChildBuilder.$fillValuesFromInstanceIntoBuilder(instance, this); + return self(); + } + @java.lang.SuppressWarnings("all") + 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}. + */ + @java.lang.SuppressWarnings("all") + public B field3(final double field3) { + this.field3 = field3; + return self(); + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public java.lang.String toString() { + return "SuperBuilderWithGenericsAndToBuilder.Child.ChildBuilder(super=" + super.toString() + ", field3=" + this.field3 + ")"; + } + } + @java.lang.SuppressWarnings("all") + private static final class ChildBuilderImpl<A> extends SuperBuilderWithGenericsAndToBuilder.Child.ChildBuilder<A, SuperBuilderWithGenericsAndToBuilder.Child<A>, SuperBuilderWithGenericsAndToBuilder.Child.ChildBuilderImpl<A>> { + @java.lang.SuppressWarnings("all") + private ChildBuilderImpl() { + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + protected SuperBuilderWithGenericsAndToBuilder.Child.ChildBuilderImpl<A> self() { + return this; + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public SuperBuilderWithGenericsAndToBuilder.Child<A> build() { + return new SuperBuilderWithGenericsAndToBuilder.Child<A>(this); + } + } + @java.lang.SuppressWarnings("all") + protected Child(final SuperBuilderWithGenericsAndToBuilder.Child.ChildBuilder<A, ?, ?> b) { + super(b); + this.field3 = b.field3; + } + @java.lang.SuppressWarnings("all") + public static <A> SuperBuilderWithGenericsAndToBuilder.Child.ChildBuilder<A, ?, ?> builder() { + return new SuperBuilderWithGenericsAndToBuilder.Child.ChildBuilderImpl<A>(); + } + @java.lang.SuppressWarnings("all") + public SuperBuilderWithGenericsAndToBuilder.Child.ChildBuilder<A, ?, ?> toBuilder() { + return new SuperBuilderWithGenericsAndToBuilder.Child.ChildBuilderImpl<A>().$fillValuesFrom(this); + } + } + public static void test() { + Child<Integer> x = Child.<Integer>builder().field3(0.0).field1(5).item(5, "").build().toBuilder().build(); + } +} diff --git a/test/transform/resource/after-delombok/SuperBuilderWithNonNull.java b/test/transform/resource/after-delombok/SuperBuilderWithNonNull.java index 7c9a5a13..a3e15e8d 100644 --- a/test/transform/resource/after-delombok/SuperBuilderWithNonNull.java +++ b/test/transform/resource/after-delombok/SuperBuilderWithNonNull.java @@ -1,123 +1,130 @@ -import java.util.List;
-public class SuperBuilderWithNonNull {
- public static class Parent {
- @lombok.NonNull
- final String nonNullParentField;
- @java.lang.SuppressWarnings("all")
- private static String $default$nonNullParentField() {
- return "default";
- }
- @java.lang.SuppressWarnings("all")
- public static abstract class ParentBuilder<C extends SuperBuilderWithNonNull.Parent, B extends SuperBuilderWithNonNull.Parent.ParentBuilder<C, B>> {
- @java.lang.SuppressWarnings("all")
- 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();
- @java.lang.SuppressWarnings("all")
- public B nonNullParentField(@lombok.NonNull final String nonNullParentField) {
- if (nonNullParentField == null) {
- throw new java.lang.NullPointerException("nonNullParentField is marked non-null but is null");
- }
- this.nonNullParentField$value = nonNullParentField;
- nonNullParentField$set = true;
- return self();
- }
- @java.lang.Override
- @java.lang.SuppressWarnings("all")
- public java.lang.String toString() {
- return "SuperBuilderWithNonNull.Parent.ParentBuilder(nonNullParentField$value=" + this.nonNullParentField$value + ")";
- }
- }
- @java.lang.SuppressWarnings("all")
- private static final class ParentBuilderImpl extends SuperBuilderWithNonNull.Parent.ParentBuilder<SuperBuilderWithNonNull.Parent, SuperBuilderWithNonNull.Parent.ParentBuilderImpl> {
- @java.lang.SuppressWarnings("all")
- private ParentBuilderImpl() {
- }
- @java.lang.Override
- @java.lang.SuppressWarnings("all")
- protected SuperBuilderWithNonNull.Parent.ParentBuilderImpl self() {
- return this;
- }
- @java.lang.Override
- @java.lang.SuppressWarnings("all")
- public SuperBuilderWithNonNull.Parent build() {
- return new SuperBuilderWithNonNull.Parent(this);
- }
- }
- @java.lang.SuppressWarnings("all")
- protected Parent(final SuperBuilderWithNonNull.Parent.ParentBuilder<?, ?> b) {
- if (b.nonNullParentField$set) this.nonNullParentField = b.nonNullParentField$value;
- else this.nonNullParentField = SuperBuilderWithNonNull.Parent.$default$nonNullParentField();
- if (nonNullParentField == null) {
- throw new java.lang.NullPointerException("nonNullParentField is marked non-null but is null");
- }
- }
- @java.lang.SuppressWarnings("all")
- public static SuperBuilderWithNonNull.Parent.ParentBuilder<?, ?> builder() {
- return new SuperBuilderWithNonNull.Parent.ParentBuilderImpl();
- }
- }
- public static class Child extends Parent {
- @lombok.NonNull
- String nonNullChildField;
- @java.lang.SuppressWarnings("all")
- 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();
- @java.lang.SuppressWarnings("all")
- public B nonNullChildField(@lombok.NonNull final String nonNullChildField) {
- if (nonNullChildField == null) {
- throw new java.lang.NullPointerException("nonNullChildField is marked non-null but is null");
- }
- this.nonNullChildField = nonNullChildField;
- return self();
- }
- @java.lang.Override
- @java.lang.SuppressWarnings("all")
- public java.lang.String toString() {
- return "SuperBuilderWithNonNull.Child.ChildBuilder(super=" + super.toString() + ", nonNullChildField=" + this.nonNullChildField + ")";
- }
- }
- @java.lang.SuppressWarnings("all")
- private static final class ChildBuilderImpl extends SuperBuilderWithNonNull.Child.ChildBuilder<SuperBuilderWithNonNull.Child, SuperBuilderWithNonNull.Child.ChildBuilderImpl> {
- @java.lang.SuppressWarnings("all")
- private ChildBuilderImpl() {
- }
- @java.lang.Override
- @java.lang.SuppressWarnings("all")
- protected SuperBuilderWithNonNull.Child.ChildBuilderImpl self() {
- return this;
- }
- @java.lang.Override
- @java.lang.SuppressWarnings("all")
- public SuperBuilderWithNonNull.Child build() {
- return new SuperBuilderWithNonNull.Child(this);
- }
- }
- @java.lang.SuppressWarnings("all")
- protected Child(final SuperBuilderWithNonNull.Child.ChildBuilder<?, ?> b) {
- super(b);
- this.nonNullChildField = b.nonNullChildField;
- if (nonNullChildField == null) {
- throw new java.lang.NullPointerException("nonNullChildField is marked non-null but is null");
- }
- }
- @java.lang.SuppressWarnings("all")
- public static SuperBuilderWithNonNull.Child.ChildBuilder<?, ?> builder() {
- return new SuperBuilderWithNonNull.Child.ChildBuilderImpl();
- }
- }
- public static void test() {
- Child x = Child.builder().nonNullChildField("child").nonNullParentField("parent").build();
- }
-}
+//version 8: +import java.util.List; +public class SuperBuilderWithNonNull { + public static class Parent { + @lombok.NonNull + final String nonNullParentField; + @java.lang.SuppressWarnings("all") + private static String $default$nonNullParentField() { + return "default"; + } + @java.lang.SuppressWarnings("all") + public static abstract class ParentBuilder<C extends SuperBuilderWithNonNull.Parent, B extends SuperBuilderWithNonNull.Parent.ParentBuilder<C, B>> { + @java.lang.SuppressWarnings("all") + 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}. + */ + @java.lang.SuppressWarnings("all") + public B nonNullParentField(@lombok.NonNull final String nonNullParentField) { + if (nonNullParentField == null) { + throw new java.lang.NullPointerException("nonNullParentField is marked non-null but is null"); + } + this.nonNullParentField$value = nonNullParentField; + nonNullParentField$set = true; + return self(); + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public java.lang.String toString() { + return "SuperBuilderWithNonNull.Parent.ParentBuilder(nonNullParentField$value=" + this.nonNullParentField$value + ")"; + } + } + @java.lang.SuppressWarnings("all") + private static final class ParentBuilderImpl extends SuperBuilderWithNonNull.Parent.ParentBuilder<SuperBuilderWithNonNull.Parent, SuperBuilderWithNonNull.Parent.ParentBuilderImpl> { + @java.lang.SuppressWarnings("all") + private ParentBuilderImpl() { + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + protected SuperBuilderWithNonNull.Parent.ParentBuilderImpl self() { + return this; + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public SuperBuilderWithNonNull.Parent build() { + return new SuperBuilderWithNonNull.Parent(this); + } + } + @java.lang.SuppressWarnings("all") + protected Parent(final SuperBuilderWithNonNull.Parent.ParentBuilder<?, ?> b) { + if (b.nonNullParentField$set) this.nonNullParentField = b.nonNullParentField$value; + else this.nonNullParentField = SuperBuilderWithNonNull.Parent.$default$nonNullParentField(); + if (nonNullParentField == null) { + throw new java.lang.NullPointerException("nonNullParentField is marked non-null but is null"); + } + } + @java.lang.SuppressWarnings("all") + public static SuperBuilderWithNonNull.Parent.ParentBuilder<?, ?> builder() { + return new SuperBuilderWithNonNull.Parent.ParentBuilderImpl(); + } + } + public static class Child extends Parent { + @lombok.NonNull + String nonNullChildField; + @java.lang.SuppressWarnings("all") + 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}. + */ + @java.lang.SuppressWarnings("all") + public B nonNullChildField(@lombok.NonNull final String nonNullChildField) { + if (nonNullChildField == null) { + throw new java.lang.NullPointerException("nonNullChildField is marked non-null but is null"); + } + this.nonNullChildField = nonNullChildField; + return self(); + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public java.lang.String toString() { + return "SuperBuilderWithNonNull.Child.ChildBuilder(super=" + super.toString() + ", nonNullChildField=" + this.nonNullChildField + ")"; + } + } + @java.lang.SuppressWarnings("all") + private static final class ChildBuilderImpl extends SuperBuilderWithNonNull.Child.ChildBuilder<SuperBuilderWithNonNull.Child, SuperBuilderWithNonNull.Child.ChildBuilderImpl> { + @java.lang.SuppressWarnings("all") + private ChildBuilderImpl() { + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + protected SuperBuilderWithNonNull.Child.ChildBuilderImpl self() { + return this; + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public SuperBuilderWithNonNull.Child build() { + return new SuperBuilderWithNonNull.Child(this); + } + } + @java.lang.SuppressWarnings("all") + protected Child(final SuperBuilderWithNonNull.Child.ChildBuilder<?, ?> b) { + super(b); + this.nonNullChildField = b.nonNullChildField; + if (nonNullChildField == null) { + throw new java.lang.NullPointerException("nonNullChildField is marked non-null but is null"); + } + } + @java.lang.SuppressWarnings("all") + public static SuperBuilderWithNonNull.Child.ChildBuilder<?, ?> builder() { + return new SuperBuilderWithNonNull.Child.ChildBuilderImpl(); + } + } + public static void test() { + Child x = Child.builder().nonNullChildField("child").nonNullParentField("parent").build(); + } +} diff --git a/test/transform/resource/after-delombok/SuperBuilderWithPrefixes.java b/test/transform/resource/after-delombok/SuperBuilderWithPrefixes.java index 9662c4d9..16325113 100644 --- a/test/transform/resource/after-delombok/SuperBuilderWithPrefixes.java +++ b/test/transform/resource/after-delombok/SuperBuilderWithPrefixes.java @@ -14,11 +14,17 @@ class SuperBuilderWithPrefixes { protected abstract B self(); @java.lang.SuppressWarnings("all") public abstract C build(); + /** + * @return {@code this}. + */ @java.lang.SuppressWarnings("all") public B field(final int field) { this.field = field; return self(); } + /** + * @return {@code this}. + */ @java.lang.SuppressWarnings("all") public B otherField(final int otherField) { this.otherField = otherField; diff --git a/test/transform/resource/after-delombok/SuperBuilderWithSetterPrefix.java b/test/transform/resource/after-delombok/SuperBuilderWithSetterPrefix.java index 28395fcd..88db8511 100644 --- a/test/transform/resource/after-delombok/SuperBuilderWithSetterPrefix.java +++ b/test/transform/resource/after-delombok/SuperBuilderWithSetterPrefix.java @@ -1,201 +1,216 @@ -import java.util.List;
-public class SuperBuilderWithSetterPrefix {
- public static class Parent {
- private int field1;
- int obtainViaField;
- int obtainViaMethod;
- String obtainViaStaticMethod;
- List<String> items;
- private int method() {
- return 2;
- }
- private static String staticMethod(Parent instance) {
- return "staticMethod";
- }
- @java.lang.SuppressWarnings("all")
- public static abstract class ParentBuilder<C extends SuperBuilderWithSetterPrefix.Parent, B extends SuperBuilderWithSetterPrefix.Parent.ParentBuilder<C, B>> {
- @java.lang.SuppressWarnings("all")
- private int field1;
- @java.lang.SuppressWarnings("all")
- private int obtainViaField;
- @java.lang.SuppressWarnings("all")
- private int obtainViaMethod;
- @java.lang.SuppressWarnings("all")
- private String obtainViaStaticMethod;
- @java.lang.SuppressWarnings("all")
- private java.util.ArrayList<String> items;
- @java.lang.SuppressWarnings("all")
- protected B $fillValuesFrom(final C instance) {
- SuperBuilderWithSetterPrefix.Parent.ParentBuilder.$fillValuesFromInstanceIntoBuilder(instance, this);
- return self();
- }
- @java.lang.SuppressWarnings("all")
- private static void $fillValuesFromInstanceIntoBuilder(final SuperBuilderWithSetterPrefix.Parent instance, final SuperBuilderWithSetterPrefix.Parent.ParentBuilder<?, ?> b) {
- b.withField1(instance.field1);
- b.withObtainViaField(instance.field1);
- b.withObtainViaMethod(instance.method());
- b.withObtainViaStaticMethod(SuperBuilderWithSetterPrefix.Parent.staticMethod(instance));
- b.withItems(instance.items == null ? java.util.Collections.emptyList() : instance.items);
- }
- @java.lang.SuppressWarnings("all")
- protected abstract B self();
- @java.lang.SuppressWarnings("all")
- public abstract C build();
- @java.lang.SuppressWarnings("all")
- public B withField1(final int field1) {
- this.field1 = field1;
- return self();
- }
- @java.lang.SuppressWarnings("all")
- public B withObtainViaField(final int obtainViaField) {
- this.obtainViaField = obtainViaField;
- return self();
- }
- @java.lang.SuppressWarnings("all")
- public B withObtainViaMethod(final int obtainViaMethod) {
- this.obtainViaMethod = obtainViaMethod;
- return self();
- }
- @java.lang.SuppressWarnings("all")
- public B withObtainViaStaticMethod(final String obtainViaStaticMethod) {
- this.obtainViaStaticMethod = obtainViaStaticMethod;
- return self();
- }
- @java.lang.SuppressWarnings("all")
- public B withItem(final String item) {
- if (this.items == null) this.items = new java.util.ArrayList<String>();
- this.items.add(item);
- return self();
- }
- @java.lang.SuppressWarnings("all")
- public B withItems(final java.util.Collection<? extends String> items) {
- if (items == null) {
- throw new java.lang.NullPointerException("items cannot be null");
- }
- if (this.items == null) this.items = new java.util.ArrayList<String>();
- this.items.addAll(items);
- return self();
- }
- @java.lang.SuppressWarnings("all")
- public B clearItems() {
- if (this.items != null) this.items.clear();
- return self();
- }
- @java.lang.Override
- @java.lang.SuppressWarnings("all")
- public java.lang.String toString() {
- return "SuperBuilderWithSetterPrefix.Parent.ParentBuilder(field1=" + this.field1 + ", obtainViaField=" + this.obtainViaField + ", obtainViaMethod=" + this.obtainViaMethod + ", obtainViaStaticMethod=" + this.obtainViaStaticMethod + ", items=" + this.items + ")";
- }
- }
- @java.lang.SuppressWarnings("all")
- private static final class ParentBuilderImpl extends SuperBuilderWithSetterPrefix.Parent.ParentBuilder<SuperBuilderWithSetterPrefix.Parent, SuperBuilderWithSetterPrefix.Parent.ParentBuilderImpl> {
- @java.lang.SuppressWarnings("all")
- private ParentBuilderImpl() {
- }
- @java.lang.Override
- @java.lang.SuppressWarnings("all")
- protected SuperBuilderWithSetterPrefix.Parent.ParentBuilderImpl self() {
- return this;
- }
- @java.lang.Override
- @java.lang.SuppressWarnings("all")
- public SuperBuilderWithSetterPrefix.Parent build() {
- return new SuperBuilderWithSetterPrefix.Parent(this);
- }
- }
- @java.lang.SuppressWarnings("all")
- protected Parent(final SuperBuilderWithSetterPrefix.Parent.ParentBuilder<?, ?> b) {
- this.field1 = b.field1;
- this.obtainViaField = b.obtainViaField;
- this.obtainViaMethod = b.obtainViaMethod;
- this.obtainViaStaticMethod = b.obtainViaStaticMethod;
- java.util.List<String> items;
- switch (b.items == null ? 0 : b.items.size()) {
- case 0:
- items = java.util.Collections.emptyList();
- break;
- case 1:
- items = java.util.Collections.singletonList(b.items.get(0));
- break;
- default:
- items = java.util.Collections.unmodifiableList(new java.util.ArrayList<String>(b.items));
- }
- this.items = items;
- }
- @java.lang.SuppressWarnings("all")
- public static SuperBuilderWithSetterPrefix.Parent.ParentBuilder<?, ?> builder() {
- return new SuperBuilderWithSetterPrefix.Parent.ParentBuilderImpl();
- }
- @java.lang.SuppressWarnings("all")
- public SuperBuilderWithSetterPrefix.Parent.ParentBuilder<?, ?> toBuilder() {
- return new SuperBuilderWithSetterPrefix.Parent.ParentBuilderImpl().$fillValuesFrom(this);
- }
- }
- public static class Child extends Parent {
- private double field3;
- @java.lang.SuppressWarnings("all")
- public static abstract class ChildBuilder<C extends SuperBuilderWithSetterPrefix.Child, B extends SuperBuilderWithSetterPrefix.Child.ChildBuilder<C, B>> extends Parent.ParentBuilder<C, B> {
- @java.lang.SuppressWarnings("all")
- private double field3;
- @java.lang.Override
- @java.lang.SuppressWarnings("all")
- protected B $fillValuesFrom(final C instance) {
- super.$fillValuesFrom(instance);
- SuperBuilderWithSetterPrefix.Child.ChildBuilder.$fillValuesFromInstanceIntoBuilder(instance, this);
- return self();
- }
- @java.lang.SuppressWarnings("all")
- 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();
- @java.lang.SuppressWarnings("all")
- public B setField3(final double field3) {
- this.field3 = field3;
- return self();
- }
- @java.lang.Override
- @java.lang.SuppressWarnings("all")
- public java.lang.String toString() {
- return "SuperBuilderWithSetterPrefix.Child.ChildBuilder(super=" + super.toString() + ", field3=" + this.field3 + ")";
- }
- }
- @java.lang.SuppressWarnings("all")
- private static final class ChildBuilderImpl extends SuperBuilderWithSetterPrefix.Child.ChildBuilder<SuperBuilderWithSetterPrefix.Child, SuperBuilderWithSetterPrefix.Child.ChildBuilderImpl> {
- @java.lang.SuppressWarnings("all")
- private ChildBuilderImpl() {
- }
- @java.lang.Override
- @java.lang.SuppressWarnings("all")
- protected SuperBuilderWithSetterPrefix.Child.ChildBuilderImpl self() {
- return this;
- }
- @java.lang.Override
- @java.lang.SuppressWarnings("all")
- public SuperBuilderWithSetterPrefix.Child build() {
- return new SuperBuilderWithSetterPrefix.Child(this);
- }
- }
- @java.lang.SuppressWarnings("all")
- protected Child(final SuperBuilderWithSetterPrefix.Child.ChildBuilder<?, ?> b) {
- super(b);
- this.field3 = b.field3;
- }
- @java.lang.SuppressWarnings("all")
- public static SuperBuilderWithSetterPrefix.Child.ChildBuilder<?, ?> builder() {
- return new SuperBuilderWithSetterPrefix.Child.ChildBuilderImpl();
- }
- @java.lang.SuppressWarnings("all")
- public SuperBuilderWithSetterPrefix.Child.ChildBuilder<?, ?> toBuilder() {
- return new SuperBuilderWithSetterPrefix.Child.ChildBuilderImpl().$fillValuesFrom(this);
- }
- }
- public static void test() {
- Child x = Child.builder().setField3(0.0).withField1(5).withItem("").build().toBuilder().build();
- }
-}
+import java.util.List; +public class SuperBuilderWithSetterPrefix { + public static class Parent { + private int field1; + int obtainViaField; + int obtainViaMethod; + String obtainViaStaticMethod; + List<String> items; + private int method() { + return 2; + } + private static String staticMethod(Parent instance) { + return "staticMethod"; + } + @java.lang.SuppressWarnings("all") + public static abstract class ParentBuilder<C extends SuperBuilderWithSetterPrefix.Parent, B extends SuperBuilderWithSetterPrefix.Parent.ParentBuilder<C, B>> { + @java.lang.SuppressWarnings("all") + private int field1; + @java.lang.SuppressWarnings("all") + private int obtainViaField; + @java.lang.SuppressWarnings("all") + private int obtainViaMethod; + @java.lang.SuppressWarnings("all") + private String obtainViaStaticMethod; + @java.lang.SuppressWarnings("all") + private java.util.ArrayList<String> items; + @java.lang.SuppressWarnings("all") + protected B $fillValuesFrom(final C instance) { + SuperBuilderWithSetterPrefix.Parent.ParentBuilder.$fillValuesFromInstanceIntoBuilder(instance, this); + return self(); + } + @java.lang.SuppressWarnings("all") + private static void $fillValuesFromInstanceIntoBuilder(final SuperBuilderWithSetterPrefix.Parent instance, final SuperBuilderWithSetterPrefix.Parent.ParentBuilder<?, ?> b) { + b.withField1(instance.field1); + b.withObtainViaField(instance.field1); + b.withObtainViaMethod(instance.method()); + 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}. + */ + @java.lang.SuppressWarnings("all") + public B withField1(final int field1) { + this.field1 = field1; + return self(); + } + /** + * @return {@code this}. + */ + @java.lang.SuppressWarnings("all") + public B withObtainViaField(final int obtainViaField) { + this.obtainViaField = obtainViaField; + return self(); + } + /** + * @return {@code this}. + */ + @java.lang.SuppressWarnings("all") + public B withObtainViaMethod(final int obtainViaMethod) { + this.obtainViaMethod = obtainViaMethod; + return self(); + } + /** + * @return {@code this}. + */ + @java.lang.SuppressWarnings("all") + public B withObtainViaStaticMethod(final String obtainViaStaticMethod) { + this.obtainViaStaticMethod = obtainViaStaticMethod; + return self(); + } + @java.lang.SuppressWarnings("all") + public B withItem(final String item) { + if (this.items == null) this.items = new java.util.ArrayList<String>(); + this.items.add(item); + return self(); + } + @java.lang.SuppressWarnings("all") + public B withItems(final java.util.Collection<? extends String> items) { + if (items == null) { + throw new java.lang.NullPointerException("items cannot be null"); + } + if (this.items == null) this.items = new java.util.ArrayList<String>(); + this.items.addAll(items); + return self(); + } + @java.lang.SuppressWarnings("all") + public B clearItems() { + if (this.items != null) this.items.clear(); + return self(); + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public java.lang.String toString() { + return "SuperBuilderWithSetterPrefix.Parent.ParentBuilder(field1=" + this.field1 + ", obtainViaField=" + this.obtainViaField + ", obtainViaMethod=" + this.obtainViaMethod + ", obtainViaStaticMethod=" + this.obtainViaStaticMethod + ", items=" + this.items + ")"; + } + } + @java.lang.SuppressWarnings("all") + private static final class ParentBuilderImpl extends SuperBuilderWithSetterPrefix.Parent.ParentBuilder<SuperBuilderWithSetterPrefix.Parent, SuperBuilderWithSetterPrefix.Parent.ParentBuilderImpl> { + @java.lang.SuppressWarnings("all") + private ParentBuilderImpl() { + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + protected SuperBuilderWithSetterPrefix.Parent.ParentBuilderImpl self() { + return this; + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public SuperBuilderWithSetterPrefix.Parent build() { + return new SuperBuilderWithSetterPrefix.Parent(this); + } + } + @java.lang.SuppressWarnings("all") + protected Parent(final SuperBuilderWithSetterPrefix.Parent.ParentBuilder<?, ?> b) { + this.field1 = b.field1; + this.obtainViaField = b.obtainViaField; + this.obtainViaMethod = b.obtainViaMethod; + this.obtainViaStaticMethod = b.obtainViaStaticMethod; + java.util.List<String> items; + switch (b.items == null ? 0 : b.items.size()) { + case 0: + items = java.util.Collections.emptyList(); + break; + case 1: + items = java.util.Collections.singletonList(b.items.get(0)); + break; + default: + items = java.util.Collections.unmodifiableList(new java.util.ArrayList<String>(b.items)); + } + this.items = items; + } + @java.lang.SuppressWarnings("all") + public static SuperBuilderWithSetterPrefix.Parent.ParentBuilder<?, ?> builder() { + return new SuperBuilderWithSetterPrefix.Parent.ParentBuilderImpl(); + } + @java.lang.SuppressWarnings("all") + public SuperBuilderWithSetterPrefix.Parent.ParentBuilder<?, ?> toBuilder() { + return new SuperBuilderWithSetterPrefix.Parent.ParentBuilderImpl().$fillValuesFrom(this); + } + } + public static class Child extends Parent { + private double field3; + @java.lang.SuppressWarnings("all") + public static abstract class ChildBuilder<C extends SuperBuilderWithSetterPrefix.Child, B extends SuperBuilderWithSetterPrefix.Child.ChildBuilder<C, B>> extends Parent.ParentBuilder<C, B> { + @java.lang.SuppressWarnings("all") + private double field3; + @java.lang.Override + @java.lang.SuppressWarnings("all") + protected B $fillValuesFrom(final C instance) { + super.$fillValuesFrom(instance); + SuperBuilderWithSetterPrefix.Child.ChildBuilder.$fillValuesFromInstanceIntoBuilder(instance, this); + return self(); + } + @java.lang.SuppressWarnings("all") + 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}. + */ + @java.lang.SuppressWarnings("all") + public B setField3(final double field3) { + this.field3 = field3; + return self(); + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public java.lang.String toString() { + return "SuperBuilderWithSetterPrefix.Child.ChildBuilder(super=" + super.toString() + ", field3=" + this.field3 + ")"; + } + } + @java.lang.SuppressWarnings("all") + private static final class ChildBuilderImpl extends SuperBuilderWithSetterPrefix.Child.ChildBuilder<SuperBuilderWithSetterPrefix.Child, SuperBuilderWithSetterPrefix.Child.ChildBuilderImpl> { + @java.lang.SuppressWarnings("all") + private ChildBuilderImpl() { + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + protected SuperBuilderWithSetterPrefix.Child.ChildBuilderImpl self() { + return this; + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public SuperBuilderWithSetterPrefix.Child build() { + return new SuperBuilderWithSetterPrefix.Child(this); + } + } + @java.lang.SuppressWarnings("all") + protected Child(final SuperBuilderWithSetterPrefix.Child.ChildBuilder<?, ?> b) { + super(b); + this.field3 = b.field3; + } + @java.lang.SuppressWarnings("all") + public static SuperBuilderWithSetterPrefix.Child.ChildBuilder<?, ?> builder() { + return new SuperBuilderWithSetterPrefix.Child.ChildBuilderImpl(); + } + @java.lang.SuppressWarnings("all") + public SuperBuilderWithSetterPrefix.Child.ChildBuilder<?, ?> toBuilder() { + return new SuperBuilderWithSetterPrefix.Child.ChildBuilderImpl().$fillValuesFrom(this); + } + } + public static void test() { + Child x = Child.builder().setField3(0.0).withField1(5).withItem("").build().toBuilder().build(); + } +} diff --git a/test/transform/resource/after-delombok/Tolerate.java b/test/transform/resource/after-delombok/Tolerate.java index c3e3d7fd..2539f091 100644 --- a/test/transform/resource/after-delombok/Tolerate.java +++ b/test/transform/resource/after-delombok/Tolerate.java @@ -1,54 +1,39 @@ import java.util.regex.Pattern; - class Tolerate { - private Pattern pattern; - @lombok.experimental.Tolerate public void setPattern(String pattern) { setPattern(Pattern.compile(pattern)); } - @java.lang.SuppressWarnings("all") - - public void setPattern(final Pattern pattern) { this.pattern = pattern; } - @java.lang.SuppressWarnings("all") - - public Pattern getPattern() { return this.pattern; } } class Tolerate2 { private final Pattern pattern; - @lombok.experimental.Tolerate public Tolerate2 withPattern(String pattern) { return withPattern(Pattern.compile(pattern)); } - public Tolerate2 withPattern(String nameGlob, String extensionGlob) { return withPattern(nameGlob.replace("*", ".*") + "\\." + extensionGlob.replace("*", ".*")); } - @java.lang.SuppressWarnings("all") - - public Pattern getPattern() { return this.pattern; } - + /** + * @return a clone of this object, except with this updated property (returns {@code this} if an identical value is passed). + */ @java.lang.SuppressWarnings("all") - - public Tolerate2 withPattern(final Pattern pattern) { return this.pattern == pattern ? this : new Tolerate2(pattern); } - @java.lang.SuppressWarnings("all") public Tolerate2(final Pattern pattern) { this.pattern = pattern; diff --git a/test/transform/resource/after-delombok/TypeUseAnnotations.java b/test/transform/resource/after-delombok/TypeUseAnnotations.java index fbf32577..37c24c53 100644 --- a/test/transform/resource/after-delombok/TypeUseAnnotations.java +++ b/test/transform/resource/after-delombok/TypeUseAnnotations.java @@ -1,3 +1,4 @@ +//version 8: import java.lang.annotation.ElementType; import java.lang.annotation.Target; import java.util.List; diff --git a/test/transform/resource/after-delombok/ValDelegateMethodReference.java b/test/transform/resource/after-delombok/ValDelegateMethodReference.java index 186e2aaa..c62edd66 100644 --- a/test/transform/resource/after-delombok/ValDelegateMethodReference.java +++ b/test/transform/resource/after-delombok/ValDelegateMethodReference.java @@ -1,3 +1,4 @@ +//version 8: import java.util.function.Function; public class ValDelegateMethodReference { diff --git a/test/transform/resource/after-delombok/ValWeirdTypes.java b/test/transform/resource/after-delombok/ValWeirdTypes.java index bc18fdac..b3ecfc49 100644 --- a/test/transform/resource/after-delombok/ValWeirdTypes.java +++ b/test/transform/resource/after-delombok/ValWeirdTypes.java @@ -1,3 +1,4 @@ +// version 8: In java6/7, lub types worked differently, so, the `arraysAsList` method has a slightly different inferred type there. import java.math.BigDecimal; import java.util.*; public class ValWeirdTypes<Z> { diff --git a/test/transform/resource/after-delombok/WithAlreadyExists.java b/test/transform/resource/after-delombok/WithAlreadyExists.java index a9cb975d..6997deb9 100644 --- a/test/transform/resource/after-delombok/WithAlreadyExists.java +++ b/test/transform/resource/after-delombok/WithAlreadyExists.java @@ -32,6 +32,9 @@ class With5 { } With5(String foo) { } + /** + * @return a clone of this object, except with this updated property (returns {@code this} if an identical value is passed). + */ @java.lang.SuppressWarnings("all") public With5 withFoo(final String foo) { return this.foo == foo ? this : new With5(foo); @@ -43,6 +46,9 @@ class With6 { } With6(String foo) { } + /** + * @return a clone of this object, except with this updated property (returns {@code this} if an identical value is passed). + */ @java.lang.SuppressWarnings("all") public With6 withFoo(final String foo) { return this.foo == foo ? this : new With6(foo); diff --git a/test/transform/resource/after-delombok/WithAndAllArgsConstructor.java b/test/transform/resource/after-delombok/WithAndAllArgsConstructor.java index 131e792c..4a88bb0e 100644 --- a/test/transform/resource/after-delombok/WithAndAllArgsConstructor.java +++ b/test/transform/resource/after-delombok/WithAndAllArgsConstructor.java @@ -11,10 +11,16 @@ class WithAndAllArgsConstructor<T, J extends T, L extends java.lang.Number> { this.y = y; this.z = z; } + /** + * @return a clone of this object, except with this updated property (returns {@code this} if an identical value is passed). + */ @java.lang.SuppressWarnings("all") public WithAndAllArgsConstructor<T, J, L> withTest(final J test) { return this.test == test ? this : new WithAndAllArgsConstructor<T, J, L>(test, this.test2, this.y, this.z); } + /** + * @return a clone of this object, except with this updated property (returns {@code this} if an identical value is passed). + */ @java.lang.SuppressWarnings("all") public WithAndAllArgsConstructor<T, J, L> withTest2(final java.util.List<L> test2) { return this.test2 == test2 ? this : new WithAndAllArgsConstructor<T, J, L>(this.test, test2, this.y, this.z); diff --git a/test/transform/resource/after-delombok/WithByNullAnnos.java b/test/transform/resource/after-delombok/WithByNullAnnos.java index cdaed973..04d64f16 100644 --- a/test/transform/resource/after-delombok/WithByNullAnnos.java +++ b/test/transform/resource/after-delombok/WithByNullAnnos.java @@ -1,3 +1,4 @@ +//version 8: import java.util.List; public class WithByNullAnnos { final List<String> test; diff --git a/test/transform/resource/after-delombok/WithByTypes.java b/test/transform/resource/after-delombok/WithByTypes.java index e5e2fb07..f1f1ef5f 100644 --- a/test/transform/resource/after-delombok/WithByTypes.java +++ b/test/transform/resource/after-delombok/WithByTypes.java @@ -1,3 +1,4 @@ +//version 8: public class WithByTypes<T> { private final int a; private final long b; diff --git a/test/transform/resource/after-delombok/WithMethodAbstract.java b/test/transform/resource/after-delombok/WithMethodAbstract.java index 16f6f060..250330f7 100644 --- a/test/transform/resource/after-delombok/WithMethodAbstract.java +++ b/test/transform/resource/after-delombok/WithMethodAbstract.java @@ -1,5 +1,8 @@ abstract class WithMethodAbstract { String foo; + /** + * @return a clone of this object, except with this updated property (returns {@code this} if an identical value is passed). + */ @java.lang.SuppressWarnings("all") public abstract WithMethodAbstract withFoo(final String foo); } diff --git a/test/transform/resource/after-delombok/WithMethodMarkedDeprecated.java b/test/transform/resource/after-delombok/WithMethodMarkedDeprecated.java index d81e76ed..dad6ff9b 100644 --- a/test/transform/resource/after-delombok/WithMethodMarkedDeprecated.java +++ b/test/transform/resource/after-delombok/WithMethodMarkedDeprecated.java @@ -7,6 +7,9 @@ class WithMethodMarkedDeprecated { int javadoc; WithMethodMarkedDeprecated(int annotation, int javadoc) { } + /** + * @return a clone of this object, except with this updated property (returns {@code this} if an identical value is passed). + */ @java.lang.Deprecated @java.lang.SuppressWarnings("all") public WithMethodMarkedDeprecated withAnnotation(final int annotation) { diff --git a/test/transform/resource/after-delombok/WithMethodMarkedDeprecatedAnnOnly.java b/test/transform/resource/after-delombok/WithMethodMarkedDeprecatedAnnOnly.java new file mode 100644 index 00000000..41139a0f --- /dev/null +++ b/test/transform/resource/after-delombok/WithMethodMarkedDeprecatedAnnOnly.java @@ -0,0 +1,14 @@ +class WithMethodMarkedDeprecatedAnnOnly { + @Deprecated + int annotation; + WithMethodMarkedDeprecatedAnnOnly(int annotation) { + } + /** + * @return a clone of this object, except with this updated property (returns {@code this} if an identical value is passed). + */ + @java.lang.Deprecated + @java.lang.SuppressWarnings("all") + public WithMethodMarkedDeprecatedAnnOnly withAnnotation(final int annotation) { + return this.annotation == annotation ? this : new WithMethodMarkedDeprecatedAnnOnly(annotation); + } +} diff --git a/test/transform/resource/after-delombok/WithNested.java b/test/transform/resource/after-delombok/WithNested.java index 27b65577..b186dabf 100644 --- a/test/transform/resource/after-delombok/WithNested.java +++ b/test/transform/resource/after-delombok/WithNested.java @@ -5,6 +5,9 @@ public interface WithNested<Z> { public IAmStaticReally(final String x) { this.x = x; } + /** + * @return a clone of this object, except with this updated property (returns {@code this} if an identical value is passed). + */ @java.lang.SuppressWarnings("all") public WithNested.IAmStaticReally withX(final String x) { return this.x == x ? this : new WithNested.IAmStaticReally(x); diff --git a/test/transform/resource/after-delombok/WithOnClass.java b/test/transform/resource/after-delombok/WithOnClass.java index d6fb6fdf..0fa973eb 100644 --- a/test/transform/resource/after-delombok/WithOnClass.java +++ b/test/transform/resource/after-delombok/WithOnClass.java @@ -1,8 +1,12 @@ +//version 8: class WithOnClass1 { boolean isNone; boolean isPublic; WithOnClass1(boolean isNone, boolean isPublic) { } + /** + * @return a clone of this object, except with this updated property (returns {@code this} if an identical value is passed). + */ @java.lang.SuppressWarnings("all") public WithOnClass1 withPublic(final boolean isPublic) { return this.isPublic == isPublic ? this : new WithOnClass1(this.isNone, isPublic); @@ -14,10 +18,16 @@ class WithOnClass2 { boolean isPackage; WithOnClass2(boolean isNone, boolean isProtected, boolean isPackage) { } + /** + * @return a clone of this object, except with this updated property (returns {@code this} if an identical value is passed). + */ @java.lang.SuppressWarnings("all") protected WithOnClass2 withProtected(final boolean isProtected) { return this.isProtected == isProtected ? this : new WithOnClass2(this.isNone, isProtected, this.isPackage); } + /** + * @return a clone of this object, except with this updated property (returns {@code this} if an identical value is passed). + */ @java.lang.SuppressWarnings("all") WithOnClass2 withPackage(final boolean isPackage) { return this.isPackage == isPackage ? this : new WithOnClass2(this.isNone, this.isProtected, isPackage); @@ -29,10 +39,16 @@ class WithOnClass3 { String nonNull; WithOnClass3(String couldBeNull, String nonNull) { } + /** + * @return a clone of this object, except with this updated property (returns {@code this} if an identical value is passed). + */ @java.lang.SuppressWarnings("all") public WithOnClass3 withCouldBeNull(final String couldBeNull) { return this.couldBeNull == couldBeNull ? this : new WithOnClass3(couldBeNull, this.nonNull); } + /** + * @return a clone of this object, except with this updated property (returns {@code this} if an identical value is passed). + */ @java.lang.SuppressWarnings("all") public WithOnClass3 withNonNull(@lombok.NonNull final String nonNull) { if (nonNull == null) { @@ -47,6 +63,9 @@ class WithOnClass4 { WithOnClass4(int y) { this.fY = y; } + /** + * @return a clone of this object, except with this updated property (returns {@code this} if an identical value is passed). + */ @java.lang.SuppressWarnings("all") public WithOnClass4 withY(final int fY) { return this.fY == fY ? this : new WithOnClass4(fY); diff --git a/test/transform/resource/after-delombok/WithPlain.java b/test/transform/resource/after-delombok/WithPlain.java index 01fca04e..6a1c46e6 100644 --- a/test/transform/resource/after-delombok/WithPlain.java +++ b/test/transform/resource/after-delombok/WithPlain.java @@ -1,3 +1,4 @@ +//version 8: springframework dep is too new to run on j6 class WithPlain { int i; final int foo; @@ -5,11 +6,17 @@ class WithPlain { this.i = i; this.foo = foo; } + /** + * @return a clone of this object, except with this updated property (returns {@code this} if an identical value is passed). + */ @org.springframework.lang.NonNull @java.lang.SuppressWarnings("all") public WithPlain withI(final int i) { return this.i == i ? this : new WithPlain(i, this.foo); } + /** + * @return a clone of this object, except with this updated property (returns {@code this} if an identical value is passed). + */ @org.springframework.lang.NonNull @java.lang.SuppressWarnings("all") public WithPlain withFoo(final int foo) { diff --git a/test/transform/resource/after-delombok/WithWithGenerics.java b/test/transform/resource/after-delombok/WithWithGenerics.java index ac34f01a..d1cd3380 100644 --- a/test/transform/resource/after-delombok/WithWithGenerics.java +++ b/test/transform/resource/after-delombok/WithWithGenerics.java @@ -5,14 +5,23 @@ class WithWithGenerics<T, J extends T, L extends java.lang.Number> { int $i; public WithWithGenerics(J test, java.util.List<L> test2, java.util.List<? extends L> test3) { } + /** + * @return a clone of this object, except with this updated property (returns {@code this} if an identical value is passed). + */ @java.lang.SuppressWarnings("all") public WithWithGenerics<T, J, L> withTest(final J test) { return this.test == test ? this : new WithWithGenerics<T, J, L>(test, this.test2, this.test3); } + /** + * @return a clone of this object, except with this updated property (returns {@code this} if an identical value is passed). + */ @java.lang.SuppressWarnings("all") public WithWithGenerics<T, J, L> withTest2(final java.util.List<L> test2) { return this.test2 == test2 ? this : new WithWithGenerics<T, J, L>(this.test, test2, this.test3); } + /** + * @return a clone of this object, except with this updated property (returns {@code this} if an identical value is passed). + */ @java.lang.SuppressWarnings("all") public WithWithGenerics<T, J, L> withTest3(final java.util.List<? extends L> test3) { return this.test3 == test3 ? this : new WithWithGenerics<T, J, L>(this.test, this.test2, test3); diff --git a/test/transform/resource/after-delombok/WithWithTypeAnnos.java b/test/transform/resource/after-delombok/WithWithTypeAnnos.java index bf7559ba..8bc1dc88 100644 --- a/test/transform/resource/after-delombok/WithWithTypeAnnos.java +++ b/test/transform/resource/after-delombok/WithWithTypeAnnos.java @@ -14,6 +14,9 @@ class WithWithTypeAnnos { WithWithTypeAnnos(@TA @TB List<String> foo) { this.foo = foo; } + /** + * @return a clone of this object, except with this updated property (returns {@code this} if an identical value is passed). + */ @java.lang.SuppressWarnings("all") public WithWithTypeAnnos withFoo(@TA final List<String> foo) { return this.foo == foo ? this : new WithWithTypeAnnos(foo); diff --git a/test/transform/resource/after-delombok/WitherAccessLevel.java b/test/transform/resource/after-delombok/WitherAccessLevel.java index c687d645..eec79cb6 100644 --- a/test/transform/resource/after-delombok/WitherAccessLevel.java +++ b/test/transform/resource/after-delombok/WitherAccessLevel.java @@ -7,22 +7,37 @@ class WitherAccessLevel { boolean value; WitherAccessLevel(boolean isNone, boolean isPrivate, boolean isPackage, boolean isProtected, boolean isPublic, boolean value) { } + /** + * @return a clone of this object, except with this updated property (returns {@code this} if an identical value is passed). + */ @java.lang.SuppressWarnings("all") private WitherAccessLevel withPrivate(final boolean isPrivate) { return this.isPrivate == isPrivate ? this : new WitherAccessLevel(this.isNone, isPrivate, this.isPackage, this.isProtected, this.isPublic, this.value); } + /** + * @return a clone of this object, except with this updated property (returns {@code this} if an identical value is passed). + */ @java.lang.SuppressWarnings("all") WitherAccessLevel withPackage(final boolean isPackage) { return this.isPackage == isPackage ? this : new WitherAccessLevel(this.isNone, this.isPrivate, isPackage, this.isProtected, this.isPublic, this.value); } + /** + * @return a clone of this object, except with this updated property (returns {@code this} if an identical value is passed). + */ @java.lang.SuppressWarnings("all") protected WitherAccessLevel withProtected(final boolean isProtected) { return this.isProtected == isProtected ? this : new WitherAccessLevel(this.isNone, this.isPrivate, this.isPackage, isProtected, this.isPublic, this.value); } + /** + * @return a clone of this object, except with this updated property (returns {@code this} if an identical value is passed). + */ @java.lang.SuppressWarnings("all") public WitherAccessLevel withPublic(final boolean isPublic) { return this.isPublic == isPublic ? this : new WitherAccessLevel(this.isNone, this.isPrivate, this.isPackage, this.isProtected, isPublic, this.value); } + /** + * @return a clone of this object, except with this updated property (returns {@code this} if an identical value is passed). + */ @java.lang.SuppressWarnings("all") public WitherAccessLevel withValue(final boolean value) { return this.value == value ? this : new WitherAccessLevel(this.isNone, this.isPrivate, this.isPackage, this.isProtected, this.isPublic, value); diff --git a/test/transform/resource/after-delombok/WitherLegacyStar.java b/test/transform/resource/after-delombok/WitherLegacyStar.java index 69da9278..90d55cee 100644 --- a/test/transform/resource/after-delombok/WitherLegacyStar.java +++ b/test/transform/resource/after-delombok/WitherLegacyStar.java @@ -3,6 +3,9 @@ class WitherLegacyStar { WitherLegacyStar(int i) { this.i = i; } + /** + * @return a clone of this object, except with this updated property (returns {@code this} if an identical value is passed). + */ @java.lang.SuppressWarnings("all") public WitherLegacyStar withI(final int i) { return this.i == i ? this : new WitherLegacyStar(i); diff --git a/test/transform/resource/after-ecj/Accessors.java b/test/transform/resource/after-ecj/Accessors.java index 8ac92e6e..cdc7b146 100644 --- a/test/transform/resource/after-ecj/Accessors.java +++ b/test/transform/resource/after-ecj/Accessors.java @@ -6,6 +6,9 @@ class AccessorsFluent { public @java.lang.SuppressWarnings("all") String fieldName() { return this.fieldName; } + /** + * @return {@code this}. + */ public @java.lang.SuppressWarnings("all") AccessorsFluent fieldName(final String fieldName) { this.fieldName = fieldName; return this; @@ -17,6 +20,9 @@ class AccessorsFluent { AccessorsFluentOnClass() { super(); } + /** + * @return {@code this}. + */ public @java.lang.SuppressWarnings("all") AccessorsFluentOnClass fieldName(final String fieldName) { this.fieldName = fieldName; return this; @@ -33,6 +39,9 @@ class AccessorsChain { AccessorsChain() { super(); } + /** + * @return {@code this}. + */ public @java.lang.SuppressWarnings("all") AccessorsChain setRunning(final boolean isRunning) { this.isRunning = isRunning; return this; @@ -102,6 +111,9 @@ class AccessorsFluentGenerics<T extends Number> { AccessorsFluentGenerics() { super(); } + /** + * @return {@code this}. + */ public @java.lang.SuppressWarnings("all") AccessorsFluentGenerics<T> name(final String name) { this.name = name; return this; diff --git a/test/transform/resource/after-ecj/AccessorsConfiguration.java b/test/transform/resource/after-ecj/AccessorsConfiguration.java index 6678e020..a844763c 100644 --- a/test/transform/resource/after-ecj/AccessorsConfiguration.java +++ b/test/transform/resource/after-ecj/AccessorsConfiguration.java @@ -24,6 +24,9 @@ class AccessorsConfiguration { AccessorsConfiguration3() { super(); } + /** + * @return {@code this}. + */ public @java.lang.SuppressWarnings("all") AccessorsConfiguration3 setFieldName(final String fFieldName) { this.fFieldName = fFieldName; return this; diff --git a/test/transform/resource/after-ecj/BuilderAccessWithGetter.java b/test/transform/resource/after-ecj/BuilderAccessWithGetter.java new file mode 100644 index 00000000..7ad5fa6a --- /dev/null +++ b/test/transform/resource/after-ecj/BuilderAccessWithGetter.java @@ -0,0 +1,35 @@ +import lombok.AccessLevel; +import lombok.Builder; +import lombok.Getter; +public final @Builder(access = AccessLevel.PRIVATE) class BuilderAccessWithGetter { + private static @java.lang.SuppressWarnings("all") class BuilderAccessWithGetterBuilder { + private @java.lang.SuppressWarnings("all") String string; + @java.lang.SuppressWarnings("all") BuilderAccessWithGetterBuilder() { + super(); + } + /** + * @return {@code this}. + */ + private @java.lang.SuppressWarnings("all") BuilderAccessWithGetter.BuilderAccessWithGetterBuilder string(final String string) { + this.string = string; + return this; + } + private @java.lang.SuppressWarnings("all") BuilderAccessWithGetter build() { + return new BuilderAccessWithGetter(this.string); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (("BuilderAccessWithGetter.BuilderAccessWithGetterBuilder(string=" + this.string) + ")"); + } + } + private final @Getter String string; + @java.lang.SuppressWarnings("all") BuilderAccessWithGetter(final String string) { + super(); + this.string = string; + } + private static @java.lang.SuppressWarnings("all") BuilderAccessWithGetter.BuilderAccessWithGetterBuilder builder() { + return new BuilderAccessWithGetter.BuilderAccessWithGetterBuilder(); + } + public @java.lang.SuppressWarnings("all") String getString() { + return this.string; + } +} diff --git a/test/transform/resource/after-ecj/BuilderComplex.java b/test/transform/resource/after-ecj/BuilderComplex.java index 6a28e114..ce6b0fd4 100644 --- a/test/transform/resource/after-ecj/BuilderComplex.java +++ b/test/transform/resource/after-ecj/BuilderComplex.java @@ -9,18 +9,30 @@ class BuilderComplex { @java.lang.SuppressWarnings("all") TestVoidName() { super(); } + /** + * @return {@code this}. + */ public @java.lang.SuppressWarnings("all") BuilderComplex.TestVoidName<T> number(final T number) { this.number = number; return this; } + /** + * @return {@code this}. + */ public @java.lang.SuppressWarnings("all") BuilderComplex.TestVoidName<T> arg2(final int arg2) { this.arg2 = arg2; return this; } + /** + * @return {@code this}. + */ public @java.lang.SuppressWarnings("all") BuilderComplex.TestVoidName<T> arg3(final String arg3) { this.arg3 = arg3; return this; } + /** + * @return {@code this}. + */ public @java.lang.SuppressWarnings("all") BuilderComplex.TestVoidName<T> selfRef(final BuilderComplex selfRef) { this.selfRef = selfRef; return this; diff --git a/test/transform/resource/after-ecj/BuilderConstructorJavadoc.java b/test/transform/resource/after-ecj/BuilderConstructorJavadoc.java index bb3916e8..29b6373b 100644 --- a/test/transform/resource/after-ecj/BuilderConstructorJavadoc.java +++ b/test/transform/resource/after-ecj/BuilderConstructorJavadoc.java @@ -16,10 +16,16 @@ class BuilderConstructorJavadoc<T> { @java.lang.SuppressWarnings("all") BuilderConstructorJavadocBuilder() { super(); } + /** + * @return {@code this}. + */ public @java.lang.SuppressWarnings("all") BuilderConstructorJavadoc.BuilderConstructorJavadocBuilder<T> basic(final int basic) { this.basic = basic; return this; } + /** + * @return {@code this}. + */ public @java.lang.SuppressWarnings("all") BuilderConstructorJavadoc.BuilderConstructorJavadocBuilder<T> multiline(final int multiline) { this.multiline = multiline; return this; diff --git a/test/transform/resource/after-ecj/BuilderCustomName.java b/test/transform/resource/after-ecj/BuilderCustomName.java index ee44cc75..652bdf16 100644 --- a/test/transform/resource/after-ecj/BuilderCustomName.java +++ b/test/transform/resource/after-ecj/BuilderCustomName.java @@ -7,6 +7,9 @@ import java.util.List; } protected abstract @java.lang.SuppressWarnings("all") B self(); public abstract @java.lang.SuppressWarnings("all") C build(); + /** + * @return {@code this}. + */ public @java.lang.SuppressWarnings("all") B field(final int field) { this.field = field; return self(); diff --git a/test/transform/resource/after-ecj/BuilderDefaults.java b/test/transform/resource/after-ecj/BuilderDefaults.java index c9be219d..37a00cbf 100644 --- a/test/transform/resource/after-ecj/BuilderDefaults.java +++ b/test/transform/resource/after-ecj/BuilderDefaults.java @@ -10,15 +10,24 @@ public final @Value @Builder class BuilderDefaults { @java.lang.SuppressWarnings("all") BuilderDefaultsBuilder() { super(); } + /** + * @return {@code this}. + */ public @java.lang.SuppressWarnings("all") BuilderDefaults.BuilderDefaultsBuilder x(final int x) { this.x$value = x; x$set = true; return this; } + /** + * @return {@code this}. + */ public @java.lang.SuppressWarnings("all") BuilderDefaults.BuilderDefaultsBuilder name(final String name) { this.name = name; return this; } + /** + * @return {@code this}. + */ public @java.lang.SuppressWarnings("all") BuilderDefaults.BuilderDefaultsBuilder z(final long z) { this.z$value = z; z$set = true; diff --git a/test/transform/resource/after-ecj/BuilderDefaultsGenerics.java b/test/transform/resource/after-ecj/BuilderDefaultsGenerics.java index 0dc06144..4f9a3cfd 100644 --- a/test/transform/resource/after-ecj/BuilderDefaultsGenerics.java +++ b/test/transform/resource/after-ecj/BuilderDefaultsGenerics.java @@ -11,16 +11,25 @@ public @Builder class BuilderDefaultsGenerics<N extends Number, T, R extends Lis @java.lang.SuppressWarnings("all") BuilderDefaultsGenericsBuilder() { super(); } + /** + * @return {@code this}. + */ public @java.lang.SuppressWarnings("all") BuilderDefaultsGenerics.BuilderDefaultsGenericsBuilder<N, T, R> callable(final java.util.concurrent.Callable<N> callable) { this.callable$value = callable; callable$set = true; return this; } + /** + * @return {@code this}. + */ public @java.lang.SuppressWarnings("all") BuilderDefaultsGenerics.BuilderDefaultsGenericsBuilder<N, T, R> tee(final T tee) { this.tee$value = tee; tee$set = true; return this; } + /** + * @return {@code this}. + */ public @java.lang.SuppressWarnings("all") BuilderDefaultsGenerics.BuilderDefaultsGenericsBuilder<N, T, R> arrr(final R arrr) { this.arrr$value = arrr; arrr$set = true; diff --git a/test/transform/resource/after-ecj/BuilderDefaultsWarnings.java b/test/transform/resource/after-ecj/BuilderDefaultsWarnings.java index bc773df3..16caf39e 100644 --- a/test/transform/resource/after-ecj/BuilderDefaultsWarnings.java +++ b/test/transform/resource/after-ecj/BuilderDefaultsWarnings.java @@ -8,10 +8,16 @@ public @Builder class BuilderDefaultsWarnings { @java.lang.SuppressWarnings("all") BuilderDefaultsWarningsBuilder() { super(); } + /** + * @return {@code this}. + */ public @java.lang.SuppressWarnings("all") BuilderDefaultsWarnings.BuilderDefaultsWarningsBuilder x(final long x) { this.x = x; return this; } + /** + * @return {@code this}. + */ public @java.lang.SuppressWarnings("all") BuilderDefaultsWarnings.BuilderDefaultsWarningsBuilder z(final int z) { this.z = z; return this; diff --git a/test/transform/resource/after-ecj/BuilderGenericMethod.java b/test/transform/resource/after-ecj/BuilderGenericMethod.java index 442d74dd..be35cf9e 100644 --- a/test/transform/resource/after-ecj/BuilderGenericMethod.java +++ b/test/transform/resource/after-ecj/BuilderGenericMethod.java @@ -8,10 +8,16 @@ class BuilderGenericMethod<T> { @java.lang.SuppressWarnings("all") MapBuilder() { super(); } + /** + * @return {@code this}. + */ public @java.lang.SuppressWarnings("all") BuilderGenericMethod<T>.MapBuilder<N> a(final int a) { this.a = a; return this; } + /** + * @return {@code this}. + */ public @java.lang.SuppressWarnings("all") BuilderGenericMethod<T>.MapBuilder<N> b(final long b) { this.b = b; return this; diff --git a/test/transform/resource/after-ecj/BuilderInstanceMethod.java b/test/transform/resource/after-ecj/BuilderInstanceMethod.java index e0bf16fd..33502ca9 100644 --- a/test/transform/resource/after-ecj/BuilderInstanceMethod.java +++ b/test/transform/resource/after-ecj/BuilderInstanceMethod.java @@ -8,18 +8,30 @@ class BuilderInstanceMethod<T> { @java.lang.SuppressWarnings("all") StringBuilder() { super(); } + /** + * @return {@code this}. + */ public @java.lang.SuppressWarnings("all") BuilderInstanceMethod<T>.StringBuilder show(final int show) { this.show = show; return this; } + /** + * @return {@code this}. + */ public @java.lang.SuppressWarnings("all") BuilderInstanceMethod<T>.StringBuilder yes(final int yes) { this.yes = yes; return this; } + /** + * @return {@code this}. + */ public @java.lang.SuppressWarnings("all") BuilderInstanceMethod<T>.StringBuilder also(final List<T> also) { this.also = also; return this; } + /** + * @return {@code this}. + */ public @java.lang.SuppressWarnings("all") BuilderInstanceMethod<T>.StringBuilder $andMe(final int $andMe) { this.$andMe = $andMe; return this; diff --git a/test/transform/resource/after-ecj/BuilderJavadoc.java b/test/transform/resource/after-ecj/BuilderJavadoc.java index 445b5417..f5790ee7 100644 --- a/test/transform/resource/after-ecj/BuilderJavadoc.java +++ b/test/transform/resource/after-ecj/BuilderJavadoc.java @@ -16,10 +16,21 @@ import java.util.List; @java.lang.SuppressWarnings("all") BuilderJavadocBuilder() { super(); } + /** + * basic gets only a builder setter. + * @see #getsetwith + * @param tag is moved to the setter. + * @return {@code this}. + */ public @java.lang.SuppressWarnings("all") BuilderJavadoc.BuilderJavadocBuilder<T> basic(final int basic) { this.basic = basic; return this; } + /** + * getsetwith gets a builder setter, an instance getter and setter, and a wither. + * @param tag is moved to the setters and wither. + * @return {@code this}. + */ public @java.lang.SuppressWarnings("all") BuilderJavadoc.BuilderJavadocBuilder<T> getsetwith(final int getsetwith) { this.getsetwith = getsetwith; return this; @@ -45,12 +56,25 @@ import java.util.List; public static @java.lang.SuppressWarnings("all") <T>BuilderJavadoc.BuilderJavadocBuilder<T> builder() { return new BuilderJavadoc.BuilderJavadocBuilder<T>(); } + /** + * getsetwith gets a builder setter, an instance getter and setter, and a wither. + * @return tag is moved to the getter. + */ public @java.lang.SuppressWarnings("all") int getGetsetwith() { return this.getsetwith; } + /** + * getsetwith gets a builder setter, an instance getter and setter, and a wither. + * @param tag is moved to the setters and wither. + */ public @java.lang.SuppressWarnings("all") void setGetsetwith(final int getsetwith) { this.getsetwith = getsetwith; } + /** + * getsetwith gets a builder setter, an instance getter and setter, and a wither. + * @param tag is moved to the setters and wither. + * @return a clone of this object, except with this updated property (returns {@code this} if an identical value is passed). + */ public @java.lang.SuppressWarnings("all") BuilderJavadoc<T> withGetsetwith(final int getsetwith) { return ((this.getsetwith == getsetwith) ? this : new BuilderJavadoc<T>(this.basic, getsetwith, this.predef, this.predefWithJavadoc)); } diff --git a/test/transform/resource/after-ecj/BuilderSimple.java b/test/transform/resource/after-ecj/BuilderSimple.java index 36804792..a991545e 100644 --- a/test/transform/resource/after-ecj/BuilderSimple.java +++ b/test/transform/resource/after-ecj/BuilderSimple.java @@ -6,10 +6,16 @@ import java.util.List; @java.lang.SuppressWarnings("all") BuilderSimpleBuilder() { super(); } + /** + * @return {@code this}. + */ public @java.lang.SuppressWarnings("all") BuilderSimple.BuilderSimpleBuilder<T> yes(final int yes) { this.yes = yes; return this; } + /** + * @return {@code this}. + */ public @java.lang.SuppressWarnings("all") BuilderSimple.BuilderSimpleBuilder<T> also(final List<T> also) { this.also = also; return this; diff --git a/test/transform/resource/after-ecj/BuilderSimpleWithSetterPrefix.java b/test/transform/resource/after-ecj/BuilderSimpleWithSetterPrefix.java index bcb3a4f5..51077a91 100644 --- a/test/transform/resource/after-ecj/BuilderSimpleWithSetterPrefix.java +++ b/test/transform/resource/after-ecj/BuilderSimpleWithSetterPrefix.java @@ -5,6 +5,9 @@ import java.util.List; @java.lang.SuppressWarnings("all") BuilderSimpleWithSetterPrefixBuilder() { super(); } + /** + * @return {@code this}. + */ public @java.lang.SuppressWarnings("all") BuilderSimpleWithSetterPrefix.BuilderSimpleWithSetterPrefixBuilder<T> withUnprefixed(final int unprefixed) { this.unprefixed = unprefixed; return this; diff --git a/test/transform/resource/after-ecj/BuilderSingularNullBehavior2.java b/test/transform/resource/after-ecj/BuilderSingularNullBehavior2.java index cf4bd91b..e1adccb5 100644 --- a/test/transform/resource/after-ecj/BuilderSingularNullBehavior2.java +++ b/test/transform/resource/after-ecj/BuilderSingularNullBehavior2.java @@ -1,3 +1,4 @@ +//version 8: springframework dep is too new to run on j6 import java.util.List; import lombok.Singular; @lombok.Builder class BuilderSingularNullBehavior2 { diff --git a/test/transform/resource/after-ecj/BuilderTypeAnnos.java b/test/transform/resource/after-ecj/BuilderTypeAnnos.java index 0037b435..cae7f2b4 100644 --- a/test/transform/resource/after-ecj/BuilderTypeAnnos.java +++ b/test/transform/resource/after-ecj/BuilderTypeAnnos.java @@ -11,6 +11,9 @@ import java.util.List; @java.lang.SuppressWarnings("all") BuilderTypeAnnosBuilder() { super(); } + /** + * @return {@code this}. + */ public @java.lang.SuppressWarnings("all") BuilderTypeAnnos.BuilderTypeAnnosBuilder foo(final @TA List<String> foo) { this.foo = foo; return this; diff --git a/test/transform/resource/after-ecj/BuilderTypeAnnosWithSetterPrefix.java b/test/transform/resource/after-ecj/BuilderTypeAnnosWithSetterPrefix.java index 2ca07414..a3e27985 100644 --- a/test/transform/resource/after-ecj/BuilderTypeAnnosWithSetterPrefix.java +++ b/test/transform/resource/after-ecj/BuilderTypeAnnosWithSetterPrefix.java @@ -11,6 +11,9 @@ import java.util.List; @java.lang.SuppressWarnings("all") BuilderTypeAnnosWithSetterPrefixBuilder() { super(); } + /** + * @return {@code this}. + */ public @java.lang.SuppressWarnings("all") BuilderTypeAnnosWithSetterPrefix.BuilderTypeAnnosWithSetterPrefixBuilder withFoo(final @TA List<String> foo) { this.foo = foo; return this; diff --git a/test/transform/resource/after-ecj/BuilderWithAccessors.java b/test/transform/resource/after-ecj/BuilderWithAccessors.java index 7b666077..2d9f80d5 100644 --- a/test/transform/resource/after-ecj/BuilderWithAccessors.java +++ b/test/transform/resource/after-ecj/BuilderWithAccessors.java @@ -7,18 +7,30 @@ @java.lang.SuppressWarnings("all") BuilderWithAccessorsBuilder() { super(); } + /** + * @return {@code this}. + */ public @java.lang.SuppressWarnings("all") BuilderWithAccessors.BuilderWithAccessorsBuilder plower(final int plower) { this.plower = plower; return this; } + /** + * @return {@code this}. + */ public @java.lang.SuppressWarnings("all") BuilderWithAccessors.BuilderWithAccessorsBuilder upper(final int upper) { this.upper = upper; return this; } + /** + * @return {@code this}. + */ public @java.lang.SuppressWarnings("all") BuilderWithAccessors.BuilderWithAccessorsBuilder foo(final int foo) { this.foo = foo; return this; } + /** + * @return {@code this}. + */ public @java.lang.SuppressWarnings("all") BuilderWithAccessors.BuilderWithAccessorsBuilder _bar(final int _bar) { this._bar = _bar; return this; diff --git a/test/transform/resource/after-ecj/BuilderWithBadNames.java b/test/transform/resource/after-ecj/BuilderWithBadNames.java index 9285021d..c0366e14 100644 --- a/test/transform/resource/after-ecj/BuilderWithBadNames.java +++ b/test/transform/resource/after-ecj/BuilderWithBadNames.java @@ -5,10 +5,16 @@ public @lombok.Builder class BuilderWithBadNames { @java.lang.SuppressWarnings("all") BuilderWithBadNamesBuilder() { super(); } + /** + * @return {@code this}. + */ public @java.lang.SuppressWarnings("all") BuilderWithBadNames.BuilderWithBadNamesBuilder build(final String build) { this.build = build; return this; } + /** + * @return {@code this}. + */ public @java.lang.SuppressWarnings("all") BuilderWithBadNames.BuilderWithBadNamesBuilder toString(final String toString) { this.toString = toString; return this; diff --git a/test/transform/resource/after-ecj/BuilderWithDeprecated.java b/test/transform/resource/after-ecj/BuilderWithDeprecated.java index 724a25e6..7e484b5d 100644 --- a/test/transform/resource/after-ecj/BuilderWithDeprecated.java +++ b/test/transform/resource/after-ecj/BuilderWithDeprecated.java @@ -10,10 +10,17 @@ public @Builder class BuilderWithDeprecated { @java.lang.SuppressWarnings("all") BuilderWithDeprecatedBuilder() { super(); } + /** + * @deprecated since always + * @return {@code this}. + */ public @java.lang.Deprecated @java.lang.SuppressWarnings("all") BuilderWithDeprecated.BuilderWithDeprecatedBuilder dep1(final String dep1) { this.dep1 = dep1; return this; } + /** + * @return {@code this}. + */ public @java.lang.Deprecated @java.lang.SuppressWarnings("all") BuilderWithDeprecated.BuilderWithDeprecatedBuilder dep2(final int dep2) { this.dep2 = dep2; return this; diff --git a/test/transform/resource/after-ecj/BuilderWithDeprecatedAnnOnly.java b/test/transform/resource/after-ecj/BuilderWithDeprecatedAnnOnly.java new file mode 100644 index 00000000..2c563387 --- /dev/null +++ b/test/transform/resource/after-ecj/BuilderWithDeprecatedAnnOnly.java @@ -0,0 +1,91 @@ +import com.google.common.collect.ImmutableList; +import lombok.Builder; +import lombok.Singular; +public @Builder class BuilderWithDeprecatedAnnOnly { + public static @java.lang.SuppressWarnings("all") class BuilderWithDeprecatedAnnOnlyBuilder { + private @java.lang.SuppressWarnings("all") int dep1; + private @java.lang.SuppressWarnings("all") java.util.ArrayList<String> strings; + private @java.lang.SuppressWarnings("all") com.google.common.collect.ImmutableList.Builder<Integer> numbers; + @java.lang.SuppressWarnings("all") BuilderWithDeprecatedAnnOnlyBuilder() { + super(); + } + /** + * @return {@code this}. + */ + public @java.lang.Deprecated @java.lang.SuppressWarnings("all") BuilderWithDeprecatedAnnOnly.BuilderWithDeprecatedAnnOnlyBuilder dep1(final int dep1) { + this.dep1 = dep1; + return this; + } + public @java.lang.Deprecated @java.lang.SuppressWarnings("all") BuilderWithDeprecatedAnnOnly.BuilderWithDeprecatedAnnOnlyBuilder string(final String string) { + if ((this.strings == null)) + this.strings = new java.util.ArrayList<String>(); + this.strings.add(string); + return this; + } + public @java.lang.Deprecated @java.lang.SuppressWarnings("all") BuilderWithDeprecatedAnnOnly.BuilderWithDeprecatedAnnOnlyBuilder strings(final java.util.Collection<? extends String> strings) { + if ((strings == null)) + { + throw new java.lang.NullPointerException("strings cannot be null"); + } + if ((this.strings == null)) + this.strings = new java.util.ArrayList<String>(); + this.strings.addAll(strings); + return this; + } + public @java.lang.Deprecated @java.lang.SuppressWarnings("all") BuilderWithDeprecatedAnnOnly.BuilderWithDeprecatedAnnOnlyBuilder clearStrings() { + if ((this.strings != null)) + this.strings.clear(); + return this; + } + public @java.lang.Deprecated @java.lang.SuppressWarnings("all") BuilderWithDeprecatedAnnOnly.BuilderWithDeprecatedAnnOnlyBuilder number(final Integer number) { + if ((this.numbers == null)) + this.numbers = com.google.common.collect.ImmutableList.builder(); + this.numbers.add(number); + return this; + } + public @java.lang.Deprecated @java.lang.SuppressWarnings("all") BuilderWithDeprecatedAnnOnly.BuilderWithDeprecatedAnnOnlyBuilder numbers(final java.lang.Iterable<? extends Integer> numbers) { + if ((numbers == null)) + { + throw new java.lang.NullPointerException("numbers cannot be null"); + } + if ((this.numbers == null)) + this.numbers = com.google.common.collect.ImmutableList.builder(); + this.numbers.addAll(numbers); + return this; + } + public @java.lang.Deprecated @java.lang.SuppressWarnings("all") BuilderWithDeprecatedAnnOnly.BuilderWithDeprecatedAnnOnlyBuilder clearNumbers() { + this.numbers = null; + return this; + } + public @java.lang.SuppressWarnings("all") BuilderWithDeprecatedAnnOnly build() { + java.util.List<String> strings; + switch (((this.strings == null) ? 0 : this.strings.size())) { + case 0 : + strings = java.util.Collections.emptyList(); + break; + case 1 : + strings = java.util.Collections.singletonList(this.strings.get(0)); + break; + default : + strings = java.util.Collections.unmodifiableList(new java.util.ArrayList<String>(this.strings)); + } + com.google.common.collect.ImmutableList<Integer> numbers = ((this.numbers == null) ? com.google.common.collect.ImmutableList.<Integer>of() : this.numbers.build()); + return new BuilderWithDeprecatedAnnOnly(this.dep1, strings, numbers); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (((((("BuilderWithDeprecatedAnnOnly.BuilderWithDeprecatedAnnOnlyBuilder(dep1=" + this.dep1) + ", strings=") + this.strings) + ", numbers=") + this.numbers) + ")"); + } + } + @Deprecated int dep1; + @Singular @Deprecated java.util.List<String> strings; + @Singular @Deprecated ImmutableList<Integer> numbers; + @java.lang.SuppressWarnings("all") BuilderWithDeprecatedAnnOnly(final int dep1, final java.util.List<String> strings, final ImmutableList<Integer> numbers) { + super(); + this.dep1 = dep1; + this.strings = strings; + this.numbers = numbers; + } + public static @java.lang.SuppressWarnings("all") BuilderWithDeprecatedAnnOnly.BuilderWithDeprecatedAnnOnlyBuilder builder() { + return new BuilderWithDeprecatedAnnOnly.BuilderWithDeprecatedAnnOnlyBuilder(); + } +} diff --git a/test/transform/resource/after-ecj/BuilderWithExistingBuilderClass.java b/test/transform/resource/after-ecj/BuilderWithExistingBuilderClass.java index ea7171f0..b8c716a7 100644 --- a/test/transform/resource/after-ecj/BuilderWithExistingBuilderClass.java +++ b/test/transform/resource/after-ecj/BuilderWithExistingBuilderClass.java @@ -9,10 +9,16 @@ class BuilderWithExistingBuilderClass<T, K extends Number> { @java.lang.SuppressWarnings("all") BuilderWithExistingBuilderClassBuilder() { super(); } + /** + * @return {@code this}. + */ public @java.lang.SuppressWarnings("all") BuilderWithExistingBuilderClass.BuilderWithExistingBuilderClassBuilder<Z> arg1(final Z arg1) { this.arg1 = arg1; return this; } + /** + * @return {@code this}. + */ public @java.lang.SuppressWarnings("all") BuilderWithExistingBuilderClass.BuilderWithExistingBuilderClassBuilder<Z> arg3(final String arg3) { this.arg3 = arg3; return this; diff --git a/test/transform/resource/after-ecj/BuilderWithExistingBuilderClassWithSetterPrefix.java b/test/transform/resource/after-ecj/BuilderWithExistingBuilderClassWithSetterPrefix.java index 4b8a5ff4..f3619019 100644 --- a/test/transform/resource/after-ecj/BuilderWithExistingBuilderClassWithSetterPrefix.java +++ b/test/transform/resource/after-ecj/BuilderWithExistingBuilderClassWithSetterPrefix.java @@ -9,10 +9,16 @@ class BuilderWithExistingBuilderClassWithSetterPrefix<T, K extends Number> { @java.lang.SuppressWarnings("all") BuilderWithExistingBuilderClassWithSetterPrefixBuilder() { super(); } + /** + * @return {@code this}. + */ public @java.lang.SuppressWarnings("all") BuilderWithExistingBuilderClassWithSetterPrefix.BuilderWithExistingBuilderClassWithSetterPrefixBuilder<Z> withArg1(final Z arg1) { this.arg1 = arg1; return this; } + /** + * @return {@code this}. + */ public @java.lang.SuppressWarnings("all") BuilderWithExistingBuilderClassWithSetterPrefix.BuilderWithExistingBuilderClassWithSetterPrefixBuilder<Z> withArg3(final String arg3) { this.arg3 = arg3; return this; diff --git a/test/transform/resource/after-ecj/BuilderWithNoBuilderMethod.java b/test/transform/resource/after-ecj/BuilderWithNoBuilderMethod.java index 8ad9b56e..d5cdf765 100644 --- a/test/transform/resource/after-ecj/BuilderWithNoBuilderMethod.java +++ b/test/transform/resource/after-ecj/BuilderWithNoBuilderMethod.java @@ -5,6 +5,9 @@ import lombok.Builder; @java.lang.SuppressWarnings("all") BuilderWithNoBuilderMethodBuilder() { super(); } + /** + * @return {@code this}. + */ public @java.lang.SuppressWarnings("all") BuilderWithNoBuilderMethod.BuilderWithNoBuilderMethodBuilder a(final String a) { this.a = a; return this; diff --git a/test/transform/resource/after-ecj/BuilderWithNonNull.java b/test/transform/resource/after-ecj/BuilderWithNonNull.java index 49fd863b..eb041fae 100644 --- a/test/transform/resource/after-ecj/BuilderWithNonNull.java +++ b/test/transform/resource/after-ecj/BuilderWithNonNull.java @@ -4,6 +4,9 @@ @java.lang.SuppressWarnings("all") BuilderWithNonNullBuilder() { super(); } + /** + * @return {@code this}. + */ public @java.lang.SuppressWarnings("all") BuilderWithNonNull.BuilderWithNonNullBuilder id(final @lombok.NonNull String id) { if ((id == null)) { diff --git a/test/transform/resource/after-ecj/BuilderWithNonNullWithSetterPrefix.java b/test/transform/resource/after-ecj/BuilderWithNonNullWithSetterPrefix.java index 0ae45a67..dc43f9a9 100644 --- a/test/transform/resource/after-ecj/BuilderWithNonNullWithSetterPrefix.java +++ b/test/transform/resource/after-ecj/BuilderWithNonNullWithSetterPrefix.java @@ -4,6 +4,9 @@ @java.lang.SuppressWarnings("all") BuilderWithNonNullWithSetterPrefixBuilder() { super(); } + /** + * @return {@code this}. + */ public @java.lang.SuppressWarnings("all") BuilderWithNonNullWithSetterPrefix.BuilderWithNonNullWithSetterPrefixBuilder withId(final @lombok.NonNull String id) { if ((id == null)) { diff --git a/test/transform/resource/after-ecj/BuilderWithRecursiveGenerics.java b/test/transform/resource/after-ecj/BuilderWithRecursiveGenerics.java index a004ff98..e42b9e5f 100644 --- a/test/transform/resource/after-ecj/BuilderWithRecursiveGenerics.java +++ b/test/transform/resource/after-ecj/BuilderWithRecursiveGenerics.java @@ -11,10 +11,16 @@ public class BuilderWithRecursiveGenerics { @java.lang.SuppressWarnings("all") TestBuilder() { super(); } + /** + * @return {@code this}. + */ public @java.lang.SuppressWarnings("all") BuilderWithRecursiveGenerics.Test.TestBuilder<Foo, Bar, Quz> foo(final Foo foo) { this.foo = foo; return this; } + /** + * @return {@code this}. + */ public @java.lang.SuppressWarnings("all") BuilderWithRecursiveGenerics.Test.TestBuilder<Foo, Bar, Quz> bar(final Bar bar) { this.bar = bar; return this; diff --git a/test/transform/resource/after-ecj/BuilderWithToBuilder.java b/test/transform/resource/after-ecj/BuilderWithToBuilder.java index 72fa3721..0ba3e11a 100644 --- a/test/transform/resource/after-ecj/BuilderWithToBuilder.java +++ b/test/transform/resource/after-ecj/BuilderWithToBuilder.java @@ -9,14 +9,23 @@ import lombok.Builder; @java.lang.SuppressWarnings("all") BuilderWithToBuilderBuilder() { super(); } + /** + * @return {@code this}. + */ public @java.lang.SuppressWarnings("all") BuilderWithToBuilder.BuilderWithToBuilderBuilder<T> one(final String one) { this.one = one; return this; } + /** + * @return {@code this}. + */ public @java.lang.SuppressWarnings("all") BuilderWithToBuilder.BuilderWithToBuilderBuilder<T> two(final String two) { this.two = two; return this; } + /** + * @return {@code this}. + */ public @java.lang.SuppressWarnings("all") BuilderWithToBuilder.BuilderWithToBuilderBuilder<T> foo(final T foo) { this.foo = foo; return this; @@ -93,14 +102,23 @@ import lombok.Builder; @java.lang.SuppressWarnings("all") ConstructorWithToBuilderBuilder() { super(); } + /** + * @return {@code this}. + */ public @java.lang.SuppressWarnings("all") ConstructorWithToBuilder.ConstructorWithToBuilderBuilder<T> mOne(final String mOne) { this.mOne = mOne; return this; } + /** + * @return {@code this}. + */ public @java.lang.SuppressWarnings("all") ConstructorWithToBuilder.ConstructorWithToBuilderBuilder<T> baz(final T baz) { this.baz = baz; return this; } + /** + * @return {@code this}. + */ public @java.lang.SuppressWarnings("all") ConstructorWithToBuilder.ConstructorWithToBuilderBuilder<T> bars(final com.google.common.collect.ImmutableList<T> bars) { this.bars = bars; return this; @@ -126,3 +144,38 @@ import lombok.Builder; return new ConstructorWithToBuilder.ConstructorWithToBuilderBuilder<T>().mOne(this.mOne).baz(this.foo).bars(this.bars); } } +class StaticMethodWithToBuilder<T> { + public static @java.lang.SuppressWarnings("all") class StaticMethodWithToBuilderBuilder<T> { + private @java.lang.SuppressWarnings("all") T foo; + @java.lang.SuppressWarnings("all") StaticMethodWithToBuilderBuilder() { + super(); + } + /** + * @return {@code this}. + */ + public @java.lang.SuppressWarnings("all") StaticMethodWithToBuilder.StaticMethodWithToBuilderBuilder<T> foo(final T foo) { + this.foo = foo; + return this; + } + public @java.lang.SuppressWarnings("all") StaticMethodWithToBuilder<T> build() { + return StaticMethodWithToBuilder.<T>of(this.foo); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (("StaticMethodWithToBuilder.StaticMethodWithToBuilderBuilder(foo=" + this.foo) + ")"); + } + } + private T foo; + public StaticMethodWithToBuilder(T foo) { + super(); + this.foo = foo; + } + public static @Builder(toBuilder = true) <T>StaticMethodWithToBuilder<T> of(T foo) { + return new StaticMethodWithToBuilder<T>(foo); + } + public static @java.lang.SuppressWarnings("all") <T>StaticMethodWithToBuilder.StaticMethodWithToBuilderBuilder<T> builder() { + return new StaticMethodWithToBuilder.StaticMethodWithToBuilderBuilder<T>(); + } + public @java.lang.SuppressWarnings("all") StaticMethodWithToBuilder.StaticMethodWithToBuilderBuilder<T> toBuilder() { + return new StaticMethodWithToBuilder.StaticMethodWithToBuilderBuilder<T>().foo(this.foo); + } +}
\ No newline at end of file diff --git a/test/transform/resource/after-ecj/BuilderWithTolerate.java b/test/transform/resource/after-ecj/BuilderWithTolerate.java index 79de7869..8b6fbb53 100644 --- a/test/transform/resource/after-ecj/BuilderWithTolerate.java +++ b/test/transform/resource/after-ecj/BuilderWithTolerate.java @@ -9,6 +9,9 @@ public @Builder class BuilderWithTolerate { @java.lang.SuppressWarnings("all") BuilderWithTolerateBuilder() { super(); } + /** + * @return {@code this}. + */ public @java.lang.SuppressWarnings("all") BuilderWithTolerate.BuilderWithTolerateBuilder value(final int value) { this.value = value; return this; diff --git a/test/transform/resource/after-ecj/CheckerFrameworkBasic.java b/test/transform/resource/after-ecj/CheckerFrameworkBasic.java index ce4d11f8..87466c7d 100644 --- a/test/transform/resource/after-ecj/CheckerFrameworkBasic.java +++ b/test/transform/resource/after-ecj/CheckerFrameworkBasic.java @@ -1,10 +1,14 @@ +import lombok.AllArgsConstructor; import lombok.Data; import lombok.experimental.Accessors; import lombok.With; -@Data @Accessors(chain = true) class CheckerFrameworkBasic { +@Data @AllArgsConstructor @Accessors(chain = true) class CheckerFrameworkBasic { private final @With int x; private final int y; private int z; + /** + * @return {@code this}. + */ public @org.checkerframework.dataflow.qual.SideEffectFree @java.lang.SuppressWarnings("all") CheckerFrameworkBasic withX(final int x) { return ((this.x == x) ? this : new CheckerFrameworkBasic(x, this.y, this.z)); } @@ -17,7 +21,10 @@ import lombok.With; public @org.checkerframework.dataflow.qual.SideEffectFree @java.lang.SuppressWarnings("all") int getZ() { return this.z; } - public @org.checkerframework.checker.builder.qual.ReturnsReceiver @java.lang.SuppressWarnings("all") CheckerFrameworkBasic setZ(final int z) { + /** + * @return {@code this}. + */ + public @org.checkerframework.common.returnsreceiver.qual.This @java.lang.SuppressWarnings("all") CheckerFrameworkBasic setZ(final int z) { this.z = z; return this; } @@ -51,9 +58,10 @@ import lombok.With; public @java.lang.Override @org.checkerframework.dataflow.qual.SideEffectFree @java.lang.SuppressWarnings("all") java.lang.String toString() { return (((((("CheckerFrameworkBasic(x=" + this.getX()) + ", y=") + this.getY()) + ", z=") + this.getZ()) + ")"); } - public @org.checkerframework.common.aliasing.qual.Unique @java.lang.SuppressWarnings("all") CheckerFrameworkBasic(final int x, final int y) { + public @java.lang.SuppressWarnings("all") CheckerFrameworkBasic(final int x, final int y, final int z) { super(); this.x = x; this.y = y; + this.z = z; } -} +}
\ No newline at end of file diff --git a/test/transform/resource/after-ecj/CheckerFrameworkBuilder.java b/test/transform/resource/after-ecj/CheckerFrameworkBuilder.java index 3f998df4..d5ad0991 100644 --- a/test/transform/resource/after-ecj/CheckerFrameworkBuilder.java +++ b/test/transform/resource/after-ecj/CheckerFrameworkBuilder.java @@ -8,29 +8,38 @@ import lombok.Singular; private @java.lang.SuppressWarnings("all") int y; private @java.lang.SuppressWarnings("all") int z; private @java.lang.SuppressWarnings("all") java.util.ArrayList<String> names; - @org.checkerframework.common.aliasing.qual.Unique @java.lang.SuppressWarnings("all") CheckerFrameworkBuilderBuilder() { + @java.lang.SuppressWarnings("all") CheckerFrameworkBuilderBuilder() { super(); } - public @org.checkerframework.checker.builder.qual.ReturnsReceiver @java.lang.SuppressWarnings("all") CheckerFrameworkBuilder.CheckerFrameworkBuilderBuilder x(final @org.checkerframework.checker.builder.qual.NotCalledMethods("x") CheckerFrameworkBuilder.CheckerFrameworkBuilderBuilder this, final int x) { + /** + * @return {@code this}. + */ + public @org.checkerframework.common.returnsreceiver.qual.This @java.lang.SuppressWarnings("all") CheckerFrameworkBuilder.CheckerFrameworkBuilderBuilder x(CheckerFrameworkBuilder.@org.checkerframework.checker.calledmethods.qual.NotCalledMethods("x") CheckerFrameworkBuilderBuilder this, final int x) { this.x$value = x; x$set = true; return this; } - public @org.checkerframework.checker.builder.qual.ReturnsReceiver @java.lang.SuppressWarnings("all") CheckerFrameworkBuilder.CheckerFrameworkBuilderBuilder y(final @org.checkerframework.checker.builder.qual.NotCalledMethods("y") CheckerFrameworkBuilder.CheckerFrameworkBuilderBuilder this, final int y) { + /** + * @return {@code this}. + */ + public @org.checkerframework.common.returnsreceiver.qual.This @java.lang.SuppressWarnings("all") CheckerFrameworkBuilder.CheckerFrameworkBuilderBuilder y(CheckerFrameworkBuilder.@org.checkerframework.checker.calledmethods.qual.NotCalledMethods("y") CheckerFrameworkBuilderBuilder this, final int y) { this.y = y; return this; } - public @org.checkerframework.checker.builder.qual.ReturnsReceiver @java.lang.SuppressWarnings("all") CheckerFrameworkBuilder.CheckerFrameworkBuilderBuilder z(final @org.checkerframework.checker.builder.qual.NotCalledMethods("z") CheckerFrameworkBuilder.CheckerFrameworkBuilderBuilder this, final int z) { + /** + * @return {@code this}. + */ + public @org.checkerframework.common.returnsreceiver.qual.This @java.lang.SuppressWarnings("all") CheckerFrameworkBuilder.CheckerFrameworkBuilderBuilder z(CheckerFrameworkBuilder.@org.checkerframework.checker.calledmethods.qual.NotCalledMethods("z") CheckerFrameworkBuilderBuilder this, final int z) { this.z = z; return this; } - public @org.checkerframework.checker.builder.qual.ReturnsReceiver @java.lang.SuppressWarnings("all") CheckerFrameworkBuilder.CheckerFrameworkBuilderBuilder name(final String name) { + public @org.checkerframework.common.returnsreceiver.qual.This @java.lang.SuppressWarnings("all") CheckerFrameworkBuilder.CheckerFrameworkBuilderBuilder name(final String name) { if ((this.names == null)) this.names = new java.util.ArrayList<String>(); this.names.add(name); return this; } - public @org.checkerframework.checker.builder.qual.ReturnsReceiver @java.lang.SuppressWarnings("all") CheckerFrameworkBuilder.CheckerFrameworkBuilderBuilder names(final java.util.Collection<? extends String> names) { + public @org.checkerframework.common.returnsreceiver.qual.This @java.lang.SuppressWarnings("all") CheckerFrameworkBuilder.CheckerFrameworkBuilderBuilder names(final java.util.Collection<? extends String> names) { if ((names == null)) { throw new java.lang.NullPointerException("names cannot be null"); @@ -40,12 +49,12 @@ import lombok.Singular; this.names.addAll(names); return this; } - public @org.checkerframework.checker.builder.qual.ReturnsReceiver @java.lang.SuppressWarnings("all") CheckerFrameworkBuilder.CheckerFrameworkBuilderBuilder clearNames() { + public @org.checkerframework.common.returnsreceiver.qual.This @java.lang.SuppressWarnings("all") CheckerFrameworkBuilder.CheckerFrameworkBuilderBuilder clearNames() { if ((this.names != null)) this.names.clear(); return this; } - public @org.checkerframework.dataflow.qual.SideEffectFree @java.lang.SuppressWarnings("all") CheckerFrameworkBuilder build(final @org.checkerframework.checker.builder.qual.CalledMethods({"y", "z"}) CheckerFrameworkBuilder.CheckerFrameworkBuilderBuilder this) { + public @org.checkerframework.dataflow.qual.SideEffectFree @java.lang.SuppressWarnings("all") CheckerFrameworkBuilder build(CheckerFrameworkBuilder.@org.checkerframework.checker.calledmethods.qual.CalledMethods({"y", "z"}) CheckerFrameworkBuilderBuilder this) { java.util.List<String> names; switch (((this.names == null) ? 0 : this.names.size())) { case 0 : @@ -73,14 +82,14 @@ import lombok.Singular; private static @java.lang.SuppressWarnings("all") int $default$x() { return 5; } - @org.checkerframework.common.aliasing.qual.Unique @java.lang.SuppressWarnings("all") CheckerFrameworkBuilder(final int x, final int y, final int z, final List<String> names) { + @java.lang.SuppressWarnings("all") CheckerFrameworkBuilder(final int x, final int y, final int z, final List<String> names) { super(); this.x = x; this.y = y; this.z = z; this.names = names; } - public static @org.checkerframework.common.aliasing.qual.Unique @org.checkerframework.dataflow.qual.SideEffectFree @java.lang.SuppressWarnings("all") CheckerFrameworkBuilder.CheckerFrameworkBuilderBuilder builder() { + public static @org.checkerframework.dataflow.qual.SideEffectFree @java.lang.SuppressWarnings("all") CheckerFrameworkBuilder.@org.checkerframework.common.aliasing.qual.Unique CheckerFrameworkBuilderBuilder builder() { return new CheckerFrameworkBuilder.CheckerFrameworkBuilderBuilder(); } }
\ 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 7c8ff0ed..6236fc72 100644 --- a/test/transform/resource/after-ecj/CheckerFrameworkSuperBuilder.java +++ b/test/transform/resource/after-ecj/CheckerFrameworkSuperBuilder.java @@ -11,28 +11,37 @@ class CheckerFrameworkSuperBuilder { public ParentBuilder() { super(); } - protected abstract @org.checkerframework.checker.builder.qual.ReturnsReceiver @org.checkerframework.dataflow.qual.Pure @java.lang.SuppressWarnings("all") B self(); - public abstract @org.checkerframework.dataflow.qual.SideEffectFree @java.lang.SuppressWarnings("all") C build(final @org.checkerframework.checker.builder.qual.CalledMethods({"y", "z"}) CheckerFrameworkSuperBuilder.Parent.ParentBuilder this); - public @org.checkerframework.checker.builder.qual.ReturnsReceiver @java.lang.SuppressWarnings("all") B x(final @org.checkerframework.checker.builder.qual.NotCalledMethods("x") CheckerFrameworkSuperBuilder.Parent.ParentBuilder this, final int x) { + protected abstract @org.checkerframework.common.returnsreceiver.qual.This @org.checkerframework.dataflow.qual.Pure @java.lang.SuppressWarnings("all") 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}. + */ + public @org.checkerframework.common.returnsreceiver.qual.This @java.lang.SuppressWarnings("all") B x(CheckerFrameworkSuperBuilder.Parent. @org.checkerframework.checker.calledmethods.qual.NotCalledMethods("x") ParentBuilder<C, B> this, final int x) { this.x$value = x; x$set = true; return self(); } - public @org.checkerframework.checker.builder.qual.ReturnsReceiver @java.lang.SuppressWarnings("all") B y(final @org.checkerframework.checker.builder.qual.NotCalledMethods("y") CheckerFrameworkSuperBuilder.Parent.ParentBuilder this, final int y) { + /** + * @return {@code this}. + */ + public @org.checkerframework.common.returnsreceiver.qual.This @java.lang.SuppressWarnings("all") B y(CheckerFrameworkSuperBuilder.Parent. @org.checkerframework.checker.calledmethods.qual.NotCalledMethods("y") ParentBuilder<C, B> this, final int y) { this.y = y; return self(); } - public @org.checkerframework.checker.builder.qual.ReturnsReceiver @java.lang.SuppressWarnings("all") B z(final @org.checkerframework.checker.builder.qual.NotCalledMethods("z") CheckerFrameworkSuperBuilder.Parent.ParentBuilder this, final int z) { + /** + * @return {@code this}. + */ + public @org.checkerframework.common.returnsreceiver.qual.This @java.lang.SuppressWarnings("all") B z(CheckerFrameworkSuperBuilder.Parent. @org.checkerframework.checker.calledmethods.qual.NotCalledMethods("z") ParentBuilder<C, B> this, final int z) { this.z = z; return self(); } - public @org.checkerframework.checker.builder.qual.ReturnsReceiver @java.lang.SuppressWarnings("all") B name(final String name) { + public @org.checkerframework.common.returnsreceiver.qual.This @java.lang.SuppressWarnings("all") B name(final String name) { if ((this.names == null)) this.names = new java.util.ArrayList<String>(); this.names.add(name); return self(); } - public @org.checkerframework.checker.builder.qual.ReturnsReceiver @java.lang.SuppressWarnings("all") B names(final java.util.Collection<? extends String> names) { + public @org.checkerframework.common.returnsreceiver.qual.This @java.lang.SuppressWarnings("all") B names(final java.util.Collection<? extends String> names) { if ((names == null)) { throw new java.lang.NullPointerException("names cannot be null"); @@ -42,7 +51,7 @@ class CheckerFrameworkSuperBuilder { this.names.addAll(names); return self(); } - public @org.checkerframework.checker.builder.qual.ReturnsReceiver @java.lang.SuppressWarnings("all") B clearNames() { + public @org.checkerframework.common.returnsreceiver.qual.This @java.lang.SuppressWarnings("all") B clearNames() { if ((this.names != null)) this.names.clear(); return self(); @@ -55,10 +64,10 @@ class CheckerFrameworkSuperBuilder { private ParentBuilderImpl() { super(); } - protected @java.lang.Override @org.checkerframework.checker.builder.qual.ReturnsReceiver @org.checkerframework.dataflow.qual.Pure @java.lang.SuppressWarnings("all") CheckerFrameworkSuperBuilder.Parent.ParentBuilderImpl self() { + protected @java.lang.Override @org.checkerframework.common.returnsreceiver.qual.This @org.checkerframework.dataflow.qual.Pure @java.lang.SuppressWarnings("all") CheckerFrameworkSuperBuilder.Parent.ParentBuilderImpl self() { return this; } - public @java.lang.Override @org.checkerframework.dataflow.qual.SideEffectFree @java.lang.SuppressWarnings("all") CheckerFrameworkSuperBuilder.Parent build(final @org.checkerframework.checker.builder.qual.CalledMethods({"y", "z"}) CheckerFrameworkSuperBuilder.Parent.ParentBuilderImpl this) { + public @java.lang.Override @org.checkerframework.dataflow.qual.SideEffectFree @java.lang.SuppressWarnings("all") CheckerFrameworkSuperBuilder.Parent build(CheckerFrameworkSuperBuilder.Parent.@org.checkerframework.checker.calledmethods.qual.CalledMethods({"y", "z"}) ParentBuilderImpl this) { return new CheckerFrameworkSuperBuilder.Parent(this); } } @@ -69,7 +78,7 @@ class CheckerFrameworkSuperBuilder { private static @java.lang.SuppressWarnings("all") int $default$x() { return 5; } - protected @org.checkerframework.common.aliasing.qual.Unique @java.lang.SuppressWarnings("all") Parent(final CheckerFrameworkSuperBuilder.Parent.ParentBuilder<?, ?> b) { + protected @org.checkerframework.dataflow.qual.SideEffectFree @java.lang.SuppressWarnings("all") Parent(final CheckerFrameworkSuperBuilder.Parent.ParentBuilder<?, ?> b) { super(); if (b.x$set) this.x = b.x$value; @@ -90,7 +99,7 @@ class CheckerFrameworkSuperBuilder { } this.names = names; } - public static @org.checkerframework.common.aliasing.qual.Unique @java.lang.SuppressWarnings("all") CheckerFrameworkSuperBuilder.Parent.ParentBuilder<?, ?> builder() { + public static @org.checkerframework.dataflow.qual.SideEffectFree @java.lang.SuppressWarnings("all") CheckerFrameworkSuperBuilder.Parent. @org.checkerframework.common.aliasing.qual.Unique ParentBuilder<?, ?> builder() { return new CheckerFrameworkSuperBuilder.Parent.ParentBuilderImpl(); } } @@ -102,14 +111,20 @@ class CheckerFrameworkSuperBuilder { public ZChildBuilder() { super(); } - protected abstract @java.lang.Override @org.checkerframework.checker.builder.qual.ReturnsReceiver @org.checkerframework.dataflow.qual.Pure @java.lang.SuppressWarnings("all") B self(); - public abstract @java.lang.Override @org.checkerframework.dataflow.qual.SideEffectFree @java.lang.SuppressWarnings("all") C build(final @org.checkerframework.checker.builder.qual.CalledMethods("b") CheckerFrameworkSuperBuilder.ZChild.ZChildBuilder this); - public @org.checkerframework.checker.builder.qual.ReturnsReceiver @java.lang.SuppressWarnings("all") B a(final @org.checkerframework.checker.builder.qual.NotCalledMethods("a") CheckerFrameworkSuperBuilder.ZChild.ZChildBuilder this, final int a) { + protected abstract @java.lang.Override @org.checkerframework.common.returnsreceiver.qual.This @org.checkerframework.dataflow.qual.Pure @java.lang.SuppressWarnings("all") 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}. + */ + public @org.checkerframework.common.returnsreceiver.qual.This @java.lang.SuppressWarnings("all") B a(CheckerFrameworkSuperBuilder.ZChild. @org.checkerframework.checker.calledmethods.qual.NotCalledMethods("a") ZChildBuilder<C, B> this, final int a) { this.a$value = a; a$set = true; return self(); } - public @org.checkerframework.checker.builder.qual.ReturnsReceiver @java.lang.SuppressWarnings("all") B b(final @org.checkerframework.checker.builder.qual.NotCalledMethods("b") CheckerFrameworkSuperBuilder.ZChild.ZChildBuilder this, final int b) { + /** + * @return {@code this}. + */ + public @org.checkerframework.common.returnsreceiver.qual.This @java.lang.SuppressWarnings("all") B b(CheckerFrameworkSuperBuilder.ZChild. @org.checkerframework.checker.calledmethods.qual.NotCalledMethods("b") ZChildBuilder<C, B> this, final int b) { this.b = b; return self(); } @@ -121,10 +136,10 @@ class CheckerFrameworkSuperBuilder { private ZChildBuilderImpl() { super(); } - protected @java.lang.Override @org.checkerframework.checker.builder.qual.ReturnsReceiver @org.checkerframework.dataflow.qual.Pure @java.lang.SuppressWarnings("all") CheckerFrameworkSuperBuilder.ZChild.ZChildBuilderImpl self() { + protected @java.lang.Override @org.checkerframework.common.returnsreceiver.qual.This @org.checkerframework.dataflow.qual.Pure @java.lang.SuppressWarnings("all") CheckerFrameworkSuperBuilder.ZChild.ZChildBuilderImpl self() { return this; } - public @java.lang.Override @org.checkerframework.dataflow.qual.SideEffectFree @java.lang.SuppressWarnings("all") CheckerFrameworkSuperBuilder.ZChild build(final @org.checkerframework.checker.builder.qual.CalledMethods("b") CheckerFrameworkSuperBuilder.ZChild.ZChildBuilderImpl this) { + public @java.lang.Override @org.checkerframework.dataflow.qual.SideEffectFree @java.lang.SuppressWarnings("all") CheckerFrameworkSuperBuilder.ZChild build(CheckerFrameworkSuperBuilder.ZChild.@org.checkerframework.checker.calledmethods.qual.CalledMethods("b") ZChildBuilderImpl this) { return new CheckerFrameworkSuperBuilder.ZChild(this); } } @@ -133,7 +148,7 @@ class CheckerFrameworkSuperBuilder { private static @java.lang.SuppressWarnings("all") int $default$a() { return 1; } - protected @org.checkerframework.common.aliasing.qual.Unique @java.lang.SuppressWarnings("all") ZChild(final CheckerFrameworkSuperBuilder.ZChild.ZChildBuilder<?, ?> b) { + protected @org.checkerframework.dataflow.qual.SideEffectFree @java.lang.SuppressWarnings("all") ZChild(final CheckerFrameworkSuperBuilder.ZChild.ZChildBuilder<?, ?> b) { super(b); if (b.a$set) this.a = b.a$value; @@ -141,7 +156,7 @@ class CheckerFrameworkSuperBuilder { this.a = CheckerFrameworkSuperBuilder.ZChild.$default$a(); this.b = b.b; } - public static @org.checkerframework.common.aliasing.qual.Unique @java.lang.SuppressWarnings("all") CheckerFrameworkSuperBuilder.ZChild.ZChildBuilder<?, ?> builder() { + public static @org.checkerframework.dataflow.qual.SideEffectFree @java.lang.SuppressWarnings("all") CheckerFrameworkSuperBuilder.ZChild. @org.checkerframework.common.aliasing.qual.Unique ZChildBuilder<?, ?> builder() { return new CheckerFrameworkSuperBuilder.ZChild.ZChildBuilderImpl(); } } diff --git a/test/transform/resource/after-ecj/ConstructorsWithBuilderDefaults.java b/test/transform/resource/after-ecj/ConstructorsWithBuilderDefaults.java index ba4ee605..1fcd97e3 100644 --- a/test/transform/resource/after-ecj/ConstructorsWithBuilderDefaults.java +++ b/test/transform/resource/after-ecj/ConstructorsWithBuilderDefaults.java @@ -10,11 +10,17 @@ final @NoArgsConstructor(force = true) @AllArgsConstructor @Builder @Value class @java.lang.SuppressWarnings("all") ConstructorsWithBuilderDefaultsBuilder() { super(); } + /** + * @return {@code this}. + */ public @java.lang.SuppressWarnings("all") ConstructorsWithBuilderDefaults.ConstructorsWithBuilderDefaultsBuilder x(final int x) { this.x$value = x; x$set = true; return this; } + /** + * @return {@code this}. + */ public @java.lang.SuppressWarnings("all") ConstructorsWithBuilderDefaults.ConstructorsWithBuilderDefaultsBuilder y(final int y) { this.y = y; return this; diff --git a/test/transform/resource/after-ecj/ConstructorsWithBuilderDefaults2.java b/test/transform/resource/after-ecj/ConstructorsWithBuilderDefaults2.java index 4355ee5c..4d6e7079 100644 --- a/test/transform/resource/after-ecj/ConstructorsWithBuilderDefaults2.java +++ b/test/transform/resource/after-ecj/ConstructorsWithBuilderDefaults2.java @@ -11,16 +11,25 @@ final @Builder @Value class ConstructorsWithBuilderDefaults<T> { @java.lang.SuppressWarnings("all") ConstructorsWithBuilderDefaultsBuilder() { super(); } + /** + * @return {@code this}. + */ public @java.lang.SuppressWarnings("all") ConstructorsWithBuilderDefaults.ConstructorsWithBuilderDefaultsBuilder<T> z(final java.util.List<T> z) { this.z$value = z; z$set = true; return this; } + /** + * @return {@code this}. + */ public @java.lang.SuppressWarnings("all") ConstructorsWithBuilderDefaults.ConstructorsWithBuilderDefaultsBuilder<T> x(final T x) { this.x$value = x; x$set = true; return this; } + /** + * @return {@code this}. + */ public @java.lang.SuppressWarnings("all") ConstructorsWithBuilderDefaults.ConstructorsWithBuilderDefaultsBuilder<T> q(final T q) { this.q = q; return this; diff --git a/test/transform/resource/after-ecj/DataWithOverrideEqualsAndHashCode.java b/test/transform/resource/after-ecj/DataWithOverrideEqualsAndHashCode.java new file mode 100644 index 00000000..2149321f --- /dev/null +++ b/test/transform/resource/after-ecj/DataWithOverrideEqualsAndHashCode.java @@ -0,0 +1,25 @@ +import lombok.Data; +class DataWithOverrideEqualsAndHashCode { + class Data1 { + Data1() { + super(); + } + } + @Data class Data2 extends Data1 { + public int hashCode() { + return 42; + } + public boolean equals(Object other) { + return false; + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return "DataWithOverrideEqualsAndHashCode.Data2()"; + } + public @java.lang.SuppressWarnings("all") Data2() { + super(); + } + } + DataWithOverrideEqualsAndHashCode() { + super(); + } +} diff --git a/test/transform/resource/after-ecj/EqualsAndHashCodeCache.java b/test/transform/resource/after-ecj/EqualsAndHashCodeCache.java new file mode 100644 index 00000000..7094b636 --- /dev/null +++ b/test/transform/resource/after-ecj/EqualsAndHashCodeCache.java @@ -0,0 +1,189 @@ +@lombok.EqualsAndHashCode(cacheStrategy = lombok.EqualsAndHashCode.CacheStrategy.LAZY) class EqualsAndHashCode { + private transient @java.lang.SuppressWarnings("all") int $hashCodeCache; + int x; + boolean[] y; + Object[] z; + String a; + String b; + EqualsAndHashCode() { + super(); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") boolean equals(final java.lang.Object o) { + if ((o == this)) + return true; + if ((! (o instanceof EqualsAndHashCode))) + return false; + final EqualsAndHashCode other = (EqualsAndHashCode) o; + if ((! other.canEqual((java.lang.Object) this))) + return false; + if ((this.x != other.x)) + return false; + if ((! java.util.Arrays.equals(this.y, other.y))) + return false; + if ((! java.util.Arrays.deepEquals(this.z, other.z))) + return false; + final java.lang.Object this$a = this.a; + final java.lang.Object other$a = other.a; + if (((this$a == null) ? (other$a != null) : (! this$a.equals(other$a)))) + return false; + final java.lang.Object this$b = this.b; + final java.lang.Object other$b = other.b; + if (((this$b == null) ? (other$b != null) : (! this$b.equals(other$b)))) + return false; + return true; + } + protected @java.lang.SuppressWarnings("all") boolean canEqual(final java.lang.Object other) { + return (other instanceof EqualsAndHashCode); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") int hashCode() { + if ((this.$hashCodeCache != 0)) + return this.$hashCodeCache; + final int PRIME = 59; + int result = 1; + result = ((result * PRIME) + this.x); + result = ((result * PRIME) + java.util.Arrays.hashCode(this.y)); + result = ((result * PRIME) + java.util.Arrays.deepHashCode(this.z)); + final java.lang.Object $a = this.a; + result = ((result * PRIME) + (($a == null) ? 43 : $a.hashCode())); + final java.lang.Object $b = this.b; + result = ((result * PRIME) + (($b == null) ? 43 : $b.hashCode())); + if ((result == 0)) + result = java.lang.Integer.MIN_VALUE; + this.$hashCodeCache = result; + return result; + } +} +final @lombok.EqualsAndHashCode(cacheStrategy = lombok.EqualsAndHashCode.CacheStrategy.LAZY) class EqualsAndHashCode2 { + private transient @java.lang.SuppressWarnings("all") int $hashCodeCache; + int x; + long y; + float f; + double d; + boolean b; + EqualsAndHashCode2() { + super(); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") boolean equals(final java.lang.Object o) { + if ((o == this)) + return true; + if ((! (o instanceof EqualsAndHashCode2))) + return false; + final EqualsAndHashCode2 other = (EqualsAndHashCode2) o; + if ((this.x != other.x)) + return false; + if ((this.y != other.y)) + return false; + if ((java.lang.Float.compare(this.f, other.f) != 0)) + return false; + if ((java.lang.Double.compare(this.d, other.d) != 0)) + return false; + if ((this.b != other.b)) + return false; + return true; + } + public @java.lang.Override @java.lang.SuppressWarnings("all") int hashCode() { + if ((this.$hashCodeCache != 0)) + return this.$hashCodeCache; + final int PRIME = 59; + int result = 1; + result = ((result * PRIME) + this.x); + final long $y = this.y; + result = ((result * PRIME) + (int) ($y ^ ($y >>> 32))); + result = ((result * PRIME) + java.lang.Float.floatToIntBits(this.f)); + final long $d = java.lang.Double.doubleToLongBits(this.d); + result = ((result * PRIME) + (int) ($d ^ ($d >>> 32))); + result = ((result * PRIME) + (this.b ? 79 : 97)); + if ((result == 0)) + result = java.lang.Integer.MIN_VALUE; + this.$hashCodeCache = result; + return result; + } +} +final @lombok.EqualsAndHashCode(callSuper = false,cacheStrategy = lombok.EqualsAndHashCode.CacheStrategy.LAZY) class EqualsAndHashCode3 extends EqualsAndHashCode { + private transient @java.lang.SuppressWarnings("all") int $hashCodeCache; + EqualsAndHashCode3() { + super(); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") boolean equals(final java.lang.Object o) { + if ((o == this)) + return true; + if ((! (o instanceof EqualsAndHashCode3))) + return false; + final EqualsAndHashCode3 other = (EqualsAndHashCode3) o; + if ((! other.canEqual((java.lang.Object) this))) + return false; + return true; + } + protected @java.lang.SuppressWarnings("all") boolean canEqual(final java.lang.Object other) { + return (other instanceof EqualsAndHashCode3); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") int hashCode() { + if ((this.$hashCodeCache != 0)) + return this.$hashCodeCache; + int result = 1; + if ((result == 0)) + result = java.lang.Integer.MIN_VALUE; + this.$hashCodeCache = result; + return result; + } +} +@lombok.EqualsAndHashCode(callSuper = true,cacheStrategy = lombok.EqualsAndHashCode.CacheStrategy.LAZY) class EqualsAndHashCode4 extends EqualsAndHashCode { + private transient @java.lang.SuppressWarnings("all") int $hashCodeCache; + EqualsAndHashCode4() { + super(); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") boolean equals(final java.lang.Object o) { + if ((o == this)) + return true; + if ((! (o instanceof EqualsAndHashCode4))) + return false; + final EqualsAndHashCode4 other = (EqualsAndHashCode4) o; + if ((! other.canEqual((java.lang.Object) this))) + return false; + if ((! super.equals(o))) + return false; + return true; + } + protected @java.lang.SuppressWarnings("all") boolean canEqual(final java.lang.Object other) { + return (other instanceof EqualsAndHashCode4); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") int hashCode() { + if ((this.$hashCodeCache != 0)) + return this.$hashCodeCache; + int result = super.hashCode(); + if ((result == 0)) + result = java.lang.Integer.MIN_VALUE; + this.$hashCodeCache = result; + return result; + } +} +final @lombok.EqualsAndHashCode(callSuper = true,cacheStrategy = lombok.EqualsAndHashCode.CacheStrategy.LAZY) class EqualsAndHashCode5 extends EqualsAndHashCode { + private transient @java.lang.SuppressWarnings("all") int $hashCodeCache; + EqualsAndHashCode5() { + super(); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") boolean equals(final java.lang.Object o) { + if ((o == this)) + return true; + if ((! (o instanceof EqualsAndHashCode5))) + return false; + final EqualsAndHashCode5 other = (EqualsAndHashCode5) o; + if ((! other.canEqual((java.lang.Object) this))) + return false; + if ((! super.equals(o))) + return false; + return true; + } + protected @java.lang.SuppressWarnings("all") boolean canEqual(final java.lang.Object other) { + return (other instanceof EqualsAndHashCode5); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") int hashCode() { + if ((this.$hashCodeCache != 0)) + return this.$hashCodeCache; + int result = super.hashCode(); + if ((result == 0)) + result = java.lang.Integer.MIN_VALUE; + this.$hashCodeCache = result; + return result; + } +} diff --git a/test/transform/resource/after-ecj/ExtensionMethodAutoboxing.java b/test/transform/resource/after-ecj/ExtensionMethodAutoboxing.java new file mode 100644 index 00000000..8bc2b30f --- /dev/null +++ b/test/transform/resource/after-ecj/ExtensionMethodAutoboxing.java @@ -0,0 +1,25 @@ +import lombok.experimental.ExtensionMethod; +@ExtensionMethod({ExtensionMethodAutoboxing.Extensions.class}) class ExtensionMethodAutoboxing { + static class Extensions { + Extensions() { + super(); + } + public static String boxing(String string, Long a, int b) { + return ((((string + " ") + a) + " ") + b); + } + } + ExtensionMethodAutoboxing() { + super(); + } + public void test() { + Long l1 = 1l; + long l2 = 1l; + Integer i1 = 1; + int i2 = 1; + String string = "test"; + ExtensionMethodAutoboxing.Extensions.boxing(string, l1, i1); + ExtensionMethodAutoboxing.Extensions.boxing(string, l1, i2); + ExtensionMethodAutoboxing.Extensions.boxing(string, l2, i1); + ExtensionMethodAutoboxing.Extensions.boxing(string, l2, i2); + } +}
\ No newline at end of file diff --git a/test/transform/resource/after-ecj/ExtensionMethodChain.java b/test/transform/resource/after-ecj/ExtensionMethodChain.java new file mode 100644 index 00000000..8eda4bf8 --- /dev/null +++ b/test/transform/resource/after-ecj/ExtensionMethodChain.java @@ -0,0 +1,19 @@ +import java.util.Arrays; +import java.util.List; +import lombok.experimental.ExtensionMethod; +@ExtensionMethod(ExtensionMethodChain.Extensions.class) class ExtensionMethodChain { + static class Extensions { + Extensions() { + super(); + } + public static Integer intValue(String s) { + return Integer.valueOf(s); + } + } + ExtensionMethodChain() { + super(); + } + public void test() { + ExtensionMethodChain.Extensions.intValue("1").intValue(); + } +}
\ No newline at end of file diff --git a/test/transform/resource/after-ecj/ExtensionMethodFunctional.java b/test/transform/resource/after-ecj/ExtensionMethodFunctional.java new file mode 100644 index 00000000..0971a9be --- /dev/null +++ b/test/transform/resource/after-ecj/ExtensionMethodFunctional.java @@ -0,0 +1,42 @@ +import java.util.function.Consumer; +import java.util.function.Function; +import java.util.List; +import java.util.stream.Collectors; +import java.util.stream.Stream; +import lombok.experimental.ExtensionMethod; +@ExtensionMethod(value = ExtensionMethodFunctional.Extensions.class,suppressBaseMethods = false) class ExtensionMethodFunctional { + static class Extensions { + Extensions() { + super(); + } + public static <T, R>R map(T value, Function<T, R> mapper) { + return mapper.apply(value); + } + public static String reverse(String string) { + return new StringBuilder(string).reverse().toString(); + } + public static @SafeVarargs <T>void consume(T o, Consumer<T>... consumer) { + for (int i = 0;; (i < consumer.length); i ++) + { + consumer[i].accept(o); + } + } + public static <T>List<T> toList1(Stream<T> stream) { + return (List<T>) stream.collect(Collectors.toList()); + } + public static <T, U>List<U> toList2(Stream<T> stream) { + return null; + } + } + ExtensionMethodFunctional() { + super(); + } + public void test() { + String test = "test"; + test = ExtensionMethodFunctional.Extensions.map(test, (<no type> s) -> ExtensionMethodFunctional.Extensions.reverse(s)); + ExtensionMethodFunctional.Extensions.consume(test, (<no type> s) -> System.out.println(("1: " + s)), (<no type> s) -> System.out.println(("2: " + s))); + ExtensionMethodFunctional.Extensions.consume(test, System.out::println, System.out::println); + ExtensionMethodFunctional.Extensions.toList1(Stream.of("a", "b", "c").map(String::toUpperCase)); + List<Integer> i2 = ExtensionMethodFunctional.Extensions.toList2(Stream.of("a", "b", "c").map(String::toUpperCase)); + } +} diff --git a/test/transform/resource/after-ecj/ExtensionMethodGeneric.java b/test/transform/resource/after-ecj/ExtensionMethodGeneric.java new file mode 100644 index 00000000..2bfab9cc --- /dev/null +++ b/test/transform/resource/after-ecj/ExtensionMethodGeneric.java @@ -0,0 +1,35 @@ +import java.util.List; +import java.util.Map; +import lombok.experimental.ExtensionMethod; +@ExtensionMethod(ExtensionMethodGeneric.Extensions.class) class ExtensionMethodGeneric { + static class Extensions { + Extensions() { + super(); + } + public static <T>List<T> test(List<String> obj, List<T> list) { + return null; + } + public static <K, V>K test(Map<String, Integer> obj, K k, V v) { + return k; + } + public static <T>T test(List<T> list) { + return null; + } + public static <T, U>U test2(List<T> list) { + return null; + } + } + ExtensionMethodGeneric() { + super(); + } + public void test() { + List<String> stringList = null; + List<Number> numberList = null; + ExtensionMethodGeneric.Extensions.test(stringList); + ExtensionMethodGeneric.Extensions.test(stringList, numberList); + ExtensionMethodGeneric.Extensions.test(ExtensionMethodGeneric.Extensions.test(stringList, stringList), numberList); + Integer i = ExtensionMethodGeneric.Extensions.test2(stringList); + Map<String, Integer> map = null; + List<String> l = ExtensionMethodGeneric.Extensions.test(map, stringList, numberList); + } +}
\ No newline at end of file diff --git a/test/transform/resource/after-ecj/ExtensionMethodNames.java b/test/transform/resource/after-ecj/ExtensionMethodNames.java new file mode 100644 index 00000000..015e8ac2 --- /dev/null +++ b/test/transform/resource/after-ecj/ExtensionMethodNames.java @@ -0,0 +1,32 @@ +package a; +import lombok.experimental.ExtensionMethod; +@ExtensionMethod(Extensions.class) class ExtensionMethodNames { + ExtensionMethodNames() { + super(); + } + public void instanceCalls() { + a.Extensions.ext(new Test()); + Test t = new Test(); + a.Extensions.ext(t); + Test Test = new Test(); + a.Extensions.ext(Test); + } + public void staticCalls() { + Test.ext(); + a.Test.ext(); + } +} +class Extensions { + Extensions() { + super(); + } + public static void ext(Test t) { + } +} +class Test { + Test() { + super(); + } + public static void ext() { + } +}
\ No newline at end of file diff --git a/test/transform/resource/after-ecj/ExtensionMethodNonStaticAccess.java b/test/transform/resource/after-ecj/ExtensionMethodNonStaticAccess.java new file mode 100644 index 00000000..c930a329 --- /dev/null +++ b/test/transform/resource/after-ecj/ExtensionMethodNonStaticAccess.java @@ -0,0 +1,22 @@ +class ExtensionMethodNonStaticAccess { + ExtensionMethodNonStaticAccess() { + super(); + } + public void method() { + Derived derived = new Derived(); + derived.staticMethod(); + } +} +class Base { + Base() { + super(); + } + static String staticMethod() { + return ""; + } +} +class Derived extends Base { + Derived() { + super(); + } +} diff --git a/test/transform/resource/after-ecj/ExtensionMethodSuppress.java b/test/transform/resource/after-ecj/ExtensionMethodSuppress.java new file mode 100644 index 00000000..83e4b57f --- /dev/null +++ b/test/transform/resource/after-ecj/ExtensionMethodSuppress.java @@ -0,0 +1,41 @@ +import lombok.experimental.ExtensionMethod; +@ExtensionMethod(Extensions.class) class ExtensionMethodSuppress { + ExtensionMethodSuppress() { + super(); + } + public void test() { + Test.staticMethod(); + Test test = new Test(); + Extensions.instanceMethod(test); + Extensions.staticMethod(test); + } +} +@ExtensionMethod(value = Extensions.class,suppressBaseMethods = false) class ExtensionMethodKeep { + ExtensionMethodKeep() { + super(); + } + public void test() { + Test.staticMethod(); + Test test = new Test(); + test.instanceMethod(); + test.staticMethod(); + } +} +class Test { + Test() { + super(); + } + public static void staticMethod() { + } + public void instanceMethod() { + } +} +class Extensions { + Extensions() { + super(); + } + public static void staticMethod(Test test) { + } + public static void instanceMethod(Test test) { + } +}
\ No newline at end of file diff --git a/test/transform/resource/after-ecj/ExtensionMethodVarargs.java b/test/transform/resource/after-ecj/ExtensionMethodVarargs.java new file mode 100644 index 00000000..727b6494 --- /dev/null +++ b/test/transform/resource/after-ecj/ExtensionMethodVarargs.java @@ -0,0 +1,24 @@ +import lombok.experimental.ExtensionMethod; +@ExtensionMethod(ExtensionMethodVarargs.Extensions.class) class ExtensionMethodVarargs { + static class Extensions { + Extensions() { + super(); + } + public static String format(String string, Object... params) { + return String.format(string, params); + } + } + ExtensionMethodVarargs() { + super(); + } + public void test() { + Long l1 = 1l; + long l2 = 1l; + Integer i1 = 1; + int i2 = 1; + ExtensionMethodVarargs.Extensions.format("%d %d %d %d", l1, l2, i1, i2); + ExtensionMethodVarargs.Extensions.format("%d", l1); + ExtensionMethodVarargs.Extensions.format("", new Integer[]{1, 2}); + ExtensionMethodVarargs.Extensions.format("", new Integer[]{1, 2}, new Integer[]{1, 2}); + } +}
\ No newline at end of file diff --git a/test/transform/resource/after-ecj/GetterDeprecated.java b/test/transform/resource/after-ecj/GetterDeprecated.java index 546f7fb7..087a60b8 100644 --- a/test/transform/resource/after-ecj/GetterDeprecated.java +++ b/test/transform/resource/after-ecj/GetterDeprecated.java @@ -8,6 +8,9 @@ class GetterDeprecated { public @java.lang.Deprecated @java.lang.SuppressWarnings("all") int getAnnotation() { return this.annotation; } + /** + * @deprecated + */ public @java.lang.Deprecated @java.lang.SuppressWarnings("all") int getJavadoc() { return this.javadoc; } diff --git a/test/transform/resource/after-ecj/GetterSetterJavadoc.java b/test/transform/resource/after-ecj/GetterSetterJavadoc.java index 4923fd02..c3308c51 100644 --- a/test/transform/resource/after-ecj/GetterSetterJavadoc.java +++ b/test/transform/resource/after-ecj/GetterSetterJavadoc.java @@ -1,8 +1,18 @@ @lombok.Data class GetterSetterJavadoc1 { private int fieldName; + /** + * Getter section + * + * @return Sky is blue1 + */ public @java.lang.SuppressWarnings("all") int getFieldName() { return this.fieldName; } + /** + * Some text + * + * @param fieldName Hello, World1 + */ public @java.lang.SuppressWarnings("all") void setFieldName(final int fieldName) { this.fieldName = fieldName; } @@ -39,9 +49,19 @@ class GetterSetterJavadoc2 { GetterSetterJavadoc2() { super(); } + /** + * Some text + * + * @return Sky is blue2 + */ public @java.lang.SuppressWarnings("all") int getFieldName() { return this.fieldName; } + /** + * Some text + * + * @param fieldName Hello, World2 + */ public @java.lang.SuppressWarnings("all") void setFieldName(final int fieldName) { this.fieldName = fieldName; } @@ -51,9 +71,17 @@ class GetterSetterJavadoc3 { GetterSetterJavadoc3() { super(); } + /** + * Getter section + * @return Sky is blue3 + */ public @java.lang.SuppressWarnings("all") int getFieldName() { return this.fieldName; } + /** + * Setter section + * @param fieldName Hello, World3 + */ public @java.lang.SuppressWarnings("all") void setFieldName(final int fieldName) { this.fieldName = fieldName; } @@ -63,9 +91,20 @@ class GetterSetterJavadoc3 { GetterSetterJavadoc4() { super(); } + /** + * Some text + * + * @return Sky is blue4 + */ public @java.lang.SuppressWarnings("all") int fieldName() { return this.fieldName; } + /** + * Some text + * + * @param fieldName Hello, World4 + * @return {@code this}. + */ public @java.lang.SuppressWarnings("all") GetterSetterJavadoc4 fieldName(final int fieldName) { this.fieldName = fieldName; return this; @@ -76,9 +115,18 @@ class GetterSetterJavadoc3 { GetterSetterJavadoc5() { super(); } + /** + * Getter section + * @return Sky is blue5 + */ public @java.lang.SuppressWarnings("all") int fieldName() { return this.fieldName; } + /** + * Setter section + * @param fieldName Hello, World5 + * @return Sky is blue5 + */ public @java.lang.SuppressWarnings("all") GetterSetterJavadoc5 fieldName(final int fieldName) { this.fieldName = fieldName; return this; diff --git a/test/transform/resource/after-ecj/I2335_BuilderMultipleObtainVia.java b/test/transform/resource/after-ecj/I2335_BuilderMultipleObtainVia.java index 9c5eb6ae..393fe42a 100644 --- a/test/transform/resource/after-ecj/I2335_BuilderMultipleObtainVia.java +++ b/test/transform/resource/after-ecj/I2335_BuilderMultipleObtainVia.java @@ -6,10 +6,16 @@ public @Builder class I2335_BuilderMultipleObtainVia { @java.lang.SuppressWarnings("all") I2335_BuilderMultipleObtainViaBuilder() { super(); } + /** + * @return {@code this}. + */ public @java.lang.SuppressWarnings("all") I2335_BuilderMultipleObtainVia.I2335_BuilderMultipleObtainViaBuilder theString(final String theString) { this.theString = theString; return this; } + /** + * @return {@code this}. + */ public @java.lang.SuppressWarnings("all") I2335_BuilderMultipleObtainVia.I2335_BuilderMultipleObtainViaBuilder theLong(final Long theLong) { this.theLong = theLong; return this; diff --git a/test/transform/resource/after-ecj/JacksonJsonProperty.java b/test/transform/resource/after-ecj/JacksonJsonProperty.java index 008f0256..c6d3d290 100644 --- a/test/transform/resource/after-ecj/JacksonJsonProperty.java +++ b/test/transform/resource/after-ecj/JacksonJsonProperty.java @@ -9,6 +9,9 @@ public @Builder class JacksonJsonProperty { @java.lang.SuppressWarnings("all") JacksonJsonPropertyBuilder() { super(); } + /** + * @return {@code this}. + */ public @JsonProperty("kebab-case-prop") @JsonSetter(nulls = Nulls.SKIP) @java.lang.SuppressWarnings("all") JacksonJsonProperty.JacksonJsonPropertyBuilder kebabCaseProp(final String kebabCaseProp) { this.kebabCaseProp = kebabCaseProp; return this; diff --git a/test/transform/resource/after-ecj/JacksonizedBuilderComplex.java b/test/transform/resource/after-ecj/JacksonizedBuilderComplex.java index 8a06b34b..6b95a6a2 100644 --- a/test/transform/resource/after-ecj/JacksonizedBuilderComplex.java +++ b/test/transform/resource/after-ecj/JacksonizedBuilderComplex.java @@ -10,18 +10,30 @@ import lombok.extern.jackson.Jacksonized; @java.lang.SuppressWarnings("all") TestVoidName() { super(); } + /** + * @return {@code this}. + */ public @java.lang.SuppressWarnings("all") JacksonizedBuilderComplex.TestVoidName<T> withNumber(final T number) { this.number = number; return this; } + /** + * @return {@code this}. + */ public @java.lang.SuppressWarnings("all") JacksonizedBuilderComplex.TestVoidName<T> withArg2(final int arg2) { this.arg2 = arg2; return this; } + /** + * @return {@code this}. + */ public @java.lang.SuppressWarnings("all") JacksonizedBuilderComplex.TestVoidName<T> withArg3(final String arg3) { this.arg3 = arg3; return this; } + /** + * @return {@code this}. + */ public @java.lang.SuppressWarnings("all") JacksonizedBuilderComplex.TestVoidName<T> withSelfRef(final JacksonizedBuilderComplex selfRef) { this.selfRef = selfRef; return this; diff --git a/test/transform/resource/after-ecj/JacksonizedBuilderSimple.java b/test/transform/resource/after-ecj/JacksonizedBuilderSimple.java index 2e0a4e0c..87910d47 100644 --- a/test/transform/resource/after-ecj/JacksonizedBuilderSimple.java +++ b/test/transform/resource/after-ecj/JacksonizedBuilderSimple.java @@ -8,10 +8,16 @@ import com.fasterxml.jackson.annotation.JsonIgnoreProperties; @java.lang.SuppressWarnings("all") JacksonizedBuilderSimpleBuilder() { super(); } + /** + * @return {@code this}. + */ public @java.lang.SuppressWarnings("all") JacksonizedBuilderSimple.JacksonizedBuilderSimpleBuilder<T> yes(final int yes) { this.yes = yes; return this; } + /** + * @return {@code this}. + */ public @java.lang.SuppressWarnings("all") JacksonizedBuilderSimple.JacksonizedBuilderSimpleBuilder<T> also(final List<T> also) { this.also = also; return this; diff --git a/test/transform/resource/after-ecj/JacksonizedSuperBuilderSimple.java b/test/transform/resource/after-ecj/JacksonizedSuperBuilderSimple.java index 8227162a..46709a66 100644 --- a/test/transform/resource/after-ecj/JacksonizedSuperBuilderSimple.java +++ b/test/transform/resource/after-ecj/JacksonizedSuperBuilderSimple.java @@ -7,6 +7,9 @@ public class JacksonizedSuperBuilderSimple { } protected abstract @java.lang.SuppressWarnings("all") B self(); public abstract @java.lang.SuppressWarnings("all") C build(); + /** + * @return {@code this}. + */ public @java.lang.SuppressWarnings("all") B field1(final int field1) { this.field1 = field1; return self(); diff --git a/test/transform/resource/after-ecj/JacksonizedSuperBuilderWithJsonDeserialize.java b/test/transform/resource/after-ecj/JacksonizedSuperBuilderWithJsonDeserialize.java index a5677275..62938eea 100644 --- a/test/transform/resource/after-ecj/JacksonizedSuperBuilderWithJsonDeserialize.java +++ b/test/transform/resource/after-ecj/JacksonizedSuperBuilderWithJsonDeserialize.java @@ -6,6 +6,9 @@ public @lombok.extern.jackson.Jacksonized @lombok.experimental.SuperBuilder @com } protected abstract @java.lang.SuppressWarnings("all") B self(); public abstract @java.lang.SuppressWarnings("all") C build(); + /** + * @return {@code this}. + */ public @java.lang.SuppressWarnings("all") B field1(final int field1) { this.field1 = field1; return self(); diff --git a/test/transform/resource/after-ecj/JavadocMultiline.java b/test/transform/resource/after-ecj/JavadocMultiline.java new file mode 100644 index 00000000..bf058975 --- /dev/null +++ b/test/transform/resource/after-ecj/JavadocMultiline.java @@ -0,0 +1,40 @@ +@lombok.Getter @lombok.Setter class JavadocMultiline { + private java.util.List<Boolean> booleans; + private java.util.List<Boolean> booleans2; + JavadocMultiline() { + super(); + } + /** + * This is a list of booleans. + * + * @return A list of booleans to set for this object. This is a Javadoc return that is long + * enough to wrap to multiple lines. + */ + public @java.lang.SuppressWarnings("all") java.util.List<Boolean> getBooleans() { + return this.booleans; + } + /** + * This is a list of booleans. + */ + public @java.lang.SuppressWarnings("all") java.util.List<Boolean> getBooleans2() { + return this.booleans2; + } + /** + * This is a list of booleans. + * + * @param booleans A list of booleans to set for this object. This is a Javadoc param that is + * long enough to wrap to multiple lines. + */ + public @java.lang.SuppressWarnings("all") void setBooleans(final java.util.List<Boolean> booleans) { + this.booleans = booleans; + } + /** + * This is a list of booleans. + * + * @param booleans A list of booleans to set for this object. This is a Javadoc param that is + * long enough to wrap to multiple lines. + */ + public @java.lang.SuppressWarnings("all") void setBooleans2(final java.util.List<Boolean> booleans2) { + this.booleans2 = booleans2; + } +} diff --git a/test/transform/resource/after-ecj/LoggerSlf4j.java b/test/transform/resource/after-ecj/LoggerSlf4j.java index c303a895..286d023b 100644 --- a/test/transform/resource/after-ecj/LoggerSlf4j.java +++ b/test/transform/resource/after-ecj/LoggerSlf4j.java @@ -56,11 +56,3 @@ class LoggerSlf4jOuter { super(); } } -@Slf4j(topic = ExtendedStringLiteral{AB}) class LoggerSlf4jWithTwoLiterals { - private static final org.slf4j.Logger log = org.slf4j.LoggerFactory.getLogger("AB"); - <clinit>() { - } - LoggerSlf4jWithTwoLiterals() { - super(); - } -}
\ No newline at end of file diff --git a/test/transform/resource/after-ecj/LoggerSlf4jInvalidTopic.java b/test/transform/resource/after-ecj/LoggerSlf4jInvalidTopic.java deleted file mode 100644 index 33e212e3..00000000 --- a/test/transform/resource/after-ecj/LoggerSlf4jInvalidTopic.java +++ /dev/null @@ -1,9 +0,0 @@ -import lombok.extern.slf4j.Slf4j; -@Slf4j(topic = 42) class LoggerSlf4jWithIntegerTopic { - private static final org.slf4j.Logger log = org.slf4j.LoggerFactory.getLogger(42); - <clinit>() { - } - LoggerSlf4jWithIntegerTopic() { - super(); - } -}
\ No newline at end of file diff --git a/test/transform/resource/after-ecj/NullAnnotatedCheckerFrameworkSuperBuilder.java b/test/transform/resource/after-ecj/NullAnnotatedCheckerFrameworkSuperBuilder.java new file mode 100644 index 00000000..94b708d2 --- /dev/null +++ b/test/transform/resource/after-ecj/NullAnnotatedCheckerFrameworkSuperBuilder.java @@ -0,0 +1,166 @@ +import java.util.List; +import lombok.Singular; +class NullAnnotatedCheckerFrameworkSuperBuilder { + public static @lombok.experimental.SuperBuilder class Parent { + public static abstract @java.lang.SuppressWarnings("all") class ParentBuilder<C extends NullAnnotatedCheckerFrameworkSuperBuilder.Parent, B extends NullAnnotatedCheckerFrameworkSuperBuilder.Parent.ParentBuilder<C, B>> { + private @java.lang.SuppressWarnings("all") int x$value; + private @java.lang.SuppressWarnings("all") boolean x$set; + private @java.lang.SuppressWarnings("all") int y; + private @java.lang.SuppressWarnings("all") int z; + private @java.lang.SuppressWarnings("all") java.util.ArrayList<String> names; + public ParentBuilder() { + super(); + } + protected abstract @java.lang.SuppressWarnings("all") B self(); + public abstract @java.lang.SuppressWarnings("all") C build(); + /** + * @return {@code this}. + */ + public @org.checkerframework.checker.nullness.qual.NonNull @java.lang.SuppressWarnings("all") B x(final int x) { + this.x$value = x; + x$set = true; + return self(); + } + /** + * @return {@code this}. + */ + public @org.checkerframework.checker.nullness.qual.NonNull @java.lang.SuppressWarnings("all") B y(final int y) { + this.y = y; + return self(); + } + /** + * @return {@code this}. + */ + public @org.checkerframework.checker.nullness.qual.NonNull @java.lang.SuppressWarnings("all") B z(final int z) { + this.z = z; + return self(); + } + public @org.checkerframework.checker.nullness.qual.NonNull @java.lang.SuppressWarnings("all") B name(final String name) { + if ((this.names == null)) + this.names = new java.util.ArrayList<String>(); + this.names.add(name); + return self(); + } + public @org.checkerframework.checker.nullness.qual.NonNull @java.lang.SuppressWarnings("all") B names(final java.util. @org.checkerframework.checker.nullness.qual.NonNull Collection<? extends String> names) { + if ((names == null)) + { + throw new java.lang.NullPointerException("names cannot be null"); + } + if ((this.names == null)) + this.names = new java.util.ArrayList<String>(); + this.names.addAll(names); + return self(); + } + public @org.checkerframework.checker.nullness.qual.NonNull @java.lang.SuppressWarnings("all") B clearNames() { + if ((this.names != null)) + this.names.clear(); + return self(); + } + 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) + ")"); + } + } + private static final @java.lang.SuppressWarnings("all") class ParentBuilderImpl extends NullAnnotatedCheckerFrameworkSuperBuilder.Parent.ParentBuilder<NullAnnotatedCheckerFrameworkSuperBuilder.Parent, NullAnnotatedCheckerFrameworkSuperBuilder.Parent.ParentBuilderImpl> { + private ParentBuilderImpl() { + super(); + } + protected @java.lang.Override @java.lang.SuppressWarnings("all") NullAnnotatedCheckerFrameworkSuperBuilder.Parent.ParentBuilderImpl self() { + return this; + } + public @java.lang.Override @java.lang.SuppressWarnings("all") NullAnnotatedCheckerFrameworkSuperBuilder.@org.checkerframework.checker.nullness.qual.NonNull Parent build() { + return new NullAnnotatedCheckerFrameworkSuperBuilder.Parent(this); + } + } + @lombok.Builder.Default int x; + int y; + int z; + @Singular List<String> names; + private static @java.lang.SuppressWarnings("all") int $default$x() { + return 5; + } + protected @java.lang.SuppressWarnings("all") Parent(final NullAnnotatedCheckerFrameworkSuperBuilder.Parent.ParentBuilder<?, ?> b) { + super(); + if (b.x$set) + this.x = b.x$value; + else + this.x = NullAnnotatedCheckerFrameworkSuperBuilder.Parent.$default$x(); + this.y = b.y; + this.z = b.z; + java.util.List<String> names; + switch (((b.names == null) ? 0 : b.names.size())) { + case 0 : + names = java.util.Collections.emptyList(); + break; + case 1 : + names = java.util.Collections.singletonList(b.names.get(0)); + break; + default : + names = java.util.Collections.unmodifiableList(new java.util.ArrayList<String>(b.names)); + } + this.names = names; + } + public static @java.lang.SuppressWarnings("all") NullAnnotatedCheckerFrameworkSuperBuilder.Parent. @org.checkerframework.checker.nullness.qual.NonNull ParentBuilder<?, ?> builder() { + return new NullAnnotatedCheckerFrameworkSuperBuilder.Parent.ParentBuilderImpl(); + } + } + public static @lombok.experimental.SuperBuilder class ZChild extends Parent { + public static abstract @java.lang.SuppressWarnings("all") class ZChildBuilder<C extends NullAnnotatedCheckerFrameworkSuperBuilder.ZChild, B extends NullAnnotatedCheckerFrameworkSuperBuilder.ZChild.ZChildBuilder<C, B>> extends Parent.ParentBuilder<C, B> { + private @java.lang.SuppressWarnings("all") int a$value; + private @java.lang.SuppressWarnings("all") boolean a$set; + private @java.lang.SuppressWarnings("all") int b; + 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}. + */ + public @org.checkerframework.checker.nullness.qual.NonNull @java.lang.SuppressWarnings("all") B a(final int a) { + this.a$value = a; + a$set = true; + return self(); + } + /** + * @return {@code this}. + */ + public @org.checkerframework.checker.nullness.qual.NonNull @java.lang.SuppressWarnings("all") B b(final int b) { + this.b = b; + return self(); + } + 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) + ")"); + } + } + private static final @java.lang.SuppressWarnings("all") class ZChildBuilderImpl extends NullAnnotatedCheckerFrameworkSuperBuilder.ZChild.ZChildBuilder<NullAnnotatedCheckerFrameworkSuperBuilder.ZChild, NullAnnotatedCheckerFrameworkSuperBuilder.ZChild.ZChildBuilderImpl> { + private ZChildBuilderImpl() { + super(); + } + protected @java.lang.Override @java.lang.SuppressWarnings("all") NullAnnotatedCheckerFrameworkSuperBuilder.ZChild.ZChildBuilderImpl self() { + return this; + } + public @java.lang.Override @java.lang.SuppressWarnings("all") NullAnnotatedCheckerFrameworkSuperBuilder.@org.checkerframework.checker.nullness.qual.NonNull ZChild build() { + return new NullAnnotatedCheckerFrameworkSuperBuilder.ZChild(this); + } + } + @lombok.Builder.Default int a; + int b; + private static @java.lang.SuppressWarnings("all") int $default$a() { + return 1; + } + protected @java.lang.SuppressWarnings("all") ZChild(final NullAnnotatedCheckerFrameworkSuperBuilder.ZChild.ZChildBuilder<?, ?> b) { + super(b); + if (b.a$set) + this.a = b.a$value; + else + this.a = NullAnnotatedCheckerFrameworkSuperBuilder.ZChild.$default$a(); + this.b = b.b; + } + public static @java.lang.SuppressWarnings("all") NullAnnotatedCheckerFrameworkSuperBuilder.ZChild. @org.checkerframework.checker.nullness.qual.NonNull ZChildBuilder<?, ?> builder() { + return new NullAnnotatedCheckerFrameworkSuperBuilder.ZChild.ZChildBuilderImpl(); + } + } + NullAnnotatedCheckerFrameworkSuperBuilder() { + super(); + } +}
\ No newline at end of file diff --git a/test/transform/resource/after-ecj/NullLibrary1.java b/test/transform/resource/after-ecj/NullLibrary1.java index baea9e7a..5856f3b4 100644 --- a/test/transform/resource/after-ecj/NullLibrary1.java +++ b/test/transform/resource/after-ecj/NullLibrary1.java @@ -1,5 +1,8 @@ public @lombok.EqualsAndHashCode @lombok.ToString @lombok.AllArgsConstructor class NullLibrary1 { @lombok.With String foo; + /** + * @return a clone of this object, except with this updated property (returns {@code this} if an identical value is passed). + */ public @org.eclipse.jdt.annotation.NonNull @java.lang.SuppressWarnings("all") NullLibrary1 withFoo(final String foo) { return ((this.foo == foo) ? this : new NullLibrary1(foo)); } diff --git a/test/transform/resource/after-ecj/NullLibrary2.java b/test/transform/resource/after-ecj/NullLibrary2.java index 60ad103f..e6a0723c 100644 --- a/test/transform/resource/after-ecj/NullLibrary2.java +++ b/test/transform/resource/after-ecj/NullLibrary2.java @@ -1,5 +1,8 @@ public @lombok.EqualsAndHashCode @lombok.ToString @lombok.AllArgsConstructor class NullLibrary2 { @lombok.With String foo; + /** + * @return a clone of this object, except with this updated property (returns {@code this} if an identical value is passed). + */ public @org.springframework.lang.NonNull @java.lang.SuppressWarnings("all") NullLibrary2 withFoo(final String foo) { return ((this.foo == foo) ? this : new NullLibrary2(foo)); } diff --git a/test/transform/resource/after-ecj/SetterAndWithMethodJavadoc.java b/test/transform/resource/after-ecj/SetterAndWithMethodJavadoc.java index dd64e358..c95b7bab 100644 --- a/test/transform/resource/after-ecj/SetterAndWithMethodJavadoc.java +++ b/test/transform/resource/after-ecj/SetterAndWithMethodJavadoc.java @@ -7,15 +7,33 @@ class SetterAndWithMethodJavadoc { this.i = i; this.j = j; } + /** + * Some value. + * @param the new value + */ public @java.lang.SuppressWarnings("all") void setI(final int i) { this.i = i; } + /** + * Some value. + * @param the new value + * @return a clone of this object, except with this updated property (returns {@code this} if an identical value is passed). + */ public @java.lang.SuppressWarnings("all") SetterAndWithMethodJavadoc withI(final int i) { return ((this.i == i) ? this : new SetterAndWithMethodJavadoc(i, this.j)); } + /** + * Set some other value. + * @param the new other value + */ public @java.lang.SuppressWarnings("all") void setJ(final int j) { this.j = j; } + /** + * Reinstantiate with some other value. + * @param the other new other value + * @return a clone of this object, except with this updated property (returns {@code this} if an identical value is passed). + */ public @java.lang.SuppressWarnings("all") SetterAndWithMethodJavadoc withJ(final int j) { return ((this.j == j) ? this : new SetterAndWithMethodJavadoc(this.i, j)); } diff --git a/test/transform/resource/after-ecj/SetterDeprecated.java b/test/transform/resource/after-ecj/SetterDeprecated.java index d76612b7..cc089566 100644 --- a/test/transform/resource/after-ecj/SetterDeprecated.java +++ b/test/transform/resource/after-ecj/SetterDeprecated.java @@ -8,6 +8,9 @@ class SetterDeprecated { public @java.lang.Deprecated @java.lang.SuppressWarnings("all") void setAnnotation(final int annotation) { this.annotation = annotation; } + /** + * @deprecated + */ public @java.lang.Deprecated @java.lang.SuppressWarnings("all") void setJavadoc(final int javadoc) { this.javadoc = javadoc; } diff --git a/test/transform/resource/after-ecj/SuperBuilderAbstract.java b/test/transform/resource/after-ecj/SuperBuilderAbstract.java index 51701668..2fef9451 100644 --- a/test/transform/resource/after-ecj/SuperBuilderAbstract.java +++ b/test/transform/resource/after-ecj/SuperBuilderAbstract.java @@ -1,102 +1,111 @@ -public class SuperBuilderAbstract {
- public static @lombok.experimental.SuperBuilder class Parent {
- public static abstract @java.lang.SuppressWarnings("all") class ParentBuilder<C extends SuperBuilderAbstract.Parent, B extends SuperBuilderAbstract.Parent.ParentBuilder<C, B>> {
- private @java.lang.SuppressWarnings("all") int parentField;
- public ParentBuilder() {
- super();
- }
- protected abstract @java.lang.SuppressWarnings("all") B self();
- public abstract @java.lang.SuppressWarnings("all") C build();
- public @java.lang.SuppressWarnings("all") B parentField(final int parentField) {
- this.parentField = parentField;
- return self();
- }
- public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() {
- return (("SuperBuilderAbstract.Parent.ParentBuilder(parentField=" + this.parentField) + ")");
- }
- }
- private static final @java.lang.SuppressWarnings("all") class ParentBuilderImpl extends SuperBuilderAbstract.Parent.ParentBuilder<SuperBuilderAbstract.Parent, SuperBuilderAbstract.Parent.ParentBuilderImpl> {
- private ParentBuilderImpl() {
- super();
- }
- protected @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderAbstract.Parent.ParentBuilderImpl self() {
- return this;
- }
- public @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderAbstract.Parent build() {
- return new SuperBuilderAbstract.Parent(this);
- }
- }
- int parentField;
- protected @java.lang.SuppressWarnings("all") Parent(final SuperBuilderAbstract.Parent.ParentBuilder<?, ?> b) {
- super();
- this.parentField = b.parentField;
- }
- public static @java.lang.SuppressWarnings("all") SuperBuilderAbstract.Parent.ParentBuilder<?, ?> builder() {
- return new SuperBuilderAbstract.Parent.ParentBuilderImpl();
- }
- }
- public static abstract @lombok.experimental.SuperBuilder class Child extends Parent {
- public static abstract @java.lang.SuppressWarnings("all") class ChildBuilder<C extends SuperBuilderAbstract.Child, B extends SuperBuilderAbstract.Child.ChildBuilder<C, B>> extends Parent.ParentBuilder<C, B> {
- private @java.lang.SuppressWarnings("all") double childField;
- 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();
- public @java.lang.SuppressWarnings("all") B childField(final double childField) {
- this.childField = childField;
- return self();
- }
- public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() {
- return (((("SuperBuilderAbstract.Child.ChildBuilder(super=" + super.toString()) + ", childField=") + this.childField) + ")");
- }
- }
- double childField;
- protected @java.lang.SuppressWarnings("all") Child(final SuperBuilderAbstract.Child.ChildBuilder<?, ?> b) {
- super(b);
- this.childField = b.childField;
- }
- }
- public static @lombok.experimental.SuperBuilder class GrandChild extends Child {
- public static abstract @java.lang.SuppressWarnings("all") class GrandChildBuilder<C extends SuperBuilderAbstract.GrandChild, B extends SuperBuilderAbstract.GrandChild.GrandChildBuilder<C, B>> extends Child.ChildBuilder<C, B> {
- private @java.lang.SuppressWarnings("all") String grandChildField;
- 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();
- public @java.lang.SuppressWarnings("all") B grandChildField(final String grandChildField) {
- this.grandChildField = grandChildField;
- return self();
- }
- public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() {
- return (((("SuperBuilderAbstract.GrandChild.GrandChildBuilder(super=" + super.toString()) + ", grandChildField=") + this.grandChildField) + ")");
- }
- }
- private static final @java.lang.SuppressWarnings("all") class GrandChildBuilderImpl extends SuperBuilderAbstract.GrandChild.GrandChildBuilder<SuperBuilderAbstract.GrandChild, SuperBuilderAbstract.GrandChild.GrandChildBuilderImpl> {
- private GrandChildBuilderImpl() {
- super();
- }
- protected @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderAbstract.GrandChild.GrandChildBuilderImpl self() {
- return this;
- }
- public @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderAbstract.GrandChild build() {
- return new SuperBuilderAbstract.GrandChild(this);
- }
- }
- String grandChildField;
- protected @java.lang.SuppressWarnings("all") GrandChild(final SuperBuilderAbstract.GrandChild.GrandChildBuilder<?, ?> b) {
- super(b);
- this.grandChildField = b.grandChildField;
- }
- public static @java.lang.SuppressWarnings("all") SuperBuilderAbstract.GrandChild.GrandChildBuilder<?, ?> builder() {
- return new SuperBuilderAbstract.GrandChild.GrandChildBuilderImpl();
- }
- }
- public SuperBuilderAbstract() {
- super();
- }
- public static void test() {
- GrandChild x = GrandChild.builder().grandChildField("").parentField(5).childField(2.5).build();
- }
-}
+public class SuperBuilderAbstract { + public static @lombok.experimental.SuperBuilder class Parent { + public static abstract @java.lang.SuppressWarnings("all") class ParentBuilder<C extends SuperBuilderAbstract.Parent, B extends SuperBuilderAbstract.Parent.ParentBuilder<C, B>> { + private @java.lang.SuppressWarnings("all") int parentField; + public ParentBuilder() { + super(); + } + protected abstract @java.lang.SuppressWarnings("all") B self(); + public abstract @java.lang.SuppressWarnings("all") C build(); + /** + * @return {@code this}. + */ + public @java.lang.SuppressWarnings("all") B parentField(final int parentField) { + this.parentField = parentField; + return self(); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (("SuperBuilderAbstract.Parent.ParentBuilder(parentField=" + this.parentField) + ")"); + } + } + private static final @java.lang.SuppressWarnings("all") class ParentBuilderImpl extends SuperBuilderAbstract.Parent.ParentBuilder<SuperBuilderAbstract.Parent, SuperBuilderAbstract.Parent.ParentBuilderImpl> { + private ParentBuilderImpl() { + super(); + } + protected @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderAbstract.Parent.ParentBuilderImpl self() { + return this; + } + public @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderAbstract.Parent build() { + return new SuperBuilderAbstract.Parent(this); + } + } + int parentField; + protected @java.lang.SuppressWarnings("all") Parent(final SuperBuilderAbstract.Parent.ParentBuilder<?, ?> b) { + super(); + this.parentField = b.parentField; + } + public static @java.lang.SuppressWarnings("all") SuperBuilderAbstract.Parent.ParentBuilder<?, ?> builder() { + return new SuperBuilderAbstract.Parent.ParentBuilderImpl(); + } + } + public static abstract @lombok.experimental.SuperBuilder class Child extends Parent { + public static abstract @java.lang.SuppressWarnings("all") class ChildBuilder<C extends SuperBuilderAbstract.Child, B extends SuperBuilderAbstract.Child.ChildBuilder<C, B>> extends Parent.ParentBuilder<C, B> { + private @java.lang.SuppressWarnings("all") double childField; + 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}. + */ + public @java.lang.SuppressWarnings("all") B childField(final double childField) { + this.childField = childField; + return self(); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (((("SuperBuilderAbstract.Child.ChildBuilder(super=" + super.toString()) + ", childField=") + this.childField) + ")"); + } + } + double childField; + protected @java.lang.SuppressWarnings("all") Child(final SuperBuilderAbstract.Child.ChildBuilder<?, ?> b) { + super(b); + this.childField = b.childField; + } + } + public static @lombok.experimental.SuperBuilder class GrandChild extends Child { + public static abstract @java.lang.SuppressWarnings("all") class GrandChildBuilder<C extends SuperBuilderAbstract.GrandChild, B extends SuperBuilderAbstract.GrandChild.GrandChildBuilder<C, B>> extends Child.ChildBuilder<C, B> { + private @java.lang.SuppressWarnings("all") String grandChildField; + 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}. + */ + public @java.lang.SuppressWarnings("all") B grandChildField(final String grandChildField) { + this.grandChildField = grandChildField; + return self(); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (((("SuperBuilderAbstract.GrandChild.GrandChildBuilder(super=" + super.toString()) + ", grandChildField=") + this.grandChildField) + ")"); + } + } + private static final @java.lang.SuppressWarnings("all") class GrandChildBuilderImpl extends SuperBuilderAbstract.GrandChild.GrandChildBuilder<SuperBuilderAbstract.GrandChild, SuperBuilderAbstract.GrandChild.GrandChildBuilderImpl> { + private GrandChildBuilderImpl() { + super(); + } + protected @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderAbstract.GrandChild.GrandChildBuilderImpl self() { + return this; + } + public @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderAbstract.GrandChild build() { + return new SuperBuilderAbstract.GrandChild(this); + } + } + String grandChildField; + protected @java.lang.SuppressWarnings("all") GrandChild(final SuperBuilderAbstract.GrandChild.GrandChildBuilder<?, ?> b) { + super(b); + this.grandChildField = b.grandChildField; + } + public static @java.lang.SuppressWarnings("all") SuperBuilderAbstract.GrandChild.GrandChildBuilder<?, ?> builder() { + return new SuperBuilderAbstract.GrandChild.GrandChildBuilderImpl(); + } + } + public SuperBuilderAbstract() { + super(); + } + public static void test() { + GrandChild x = GrandChild.builder().grandChildField("").parentField(5).childField(2.5).build(); + } +} diff --git a/test/transform/resource/after-ecj/SuperBuilderAbstractToBuilder.java b/test/transform/resource/after-ecj/SuperBuilderAbstractToBuilder.java index 4fa722e5..2d2cd422 100644 --- a/test/transform/resource/after-ecj/SuperBuilderAbstractToBuilder.java +++ b/test/transform/resource/after-ecj/SuperBuilderAbstractToBuilder.java @@ -1,131 +1,140 @@ -public class SuperBuilderAbstractToBuilder {
- public static @lombok.experimental.SuperBuilder(toBuilder = true) class Parent {
- public static abstract @java.lang.SuppressWarnings("all") class ParentBuilder<C extends SuperBuilderAbstractToBuilder.Parent, B extends SuperBuilderAbstractToBuilder.Parent.ParentBuilder<C, B>> {
- private @java.lang.SuppressWarnings("all") int parentField;
- public ParentBuilder() {
- super();
- }
- protected @java.lang.SuppressWarnings("all") B $fillValuesFrom(final C instance) {
- SuperBuilderAbstractToBuilder.Parent.ParentBuilder.$fillValuesFromInstanceIntoBuilder(instance, this);
- return self();
- }
- 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();
- public @java.lang.SuppressWarnings("all") B parentField(final int parentField) {
- this.parentField = parentField;
- return self();
- }
- public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() {
- return (("SuperBuilderAbstractToBuilder.Parent.ParentBuilder(parentField=" + this.parentField) + ")");
- }
- }
- private static final @java.lang.SuppressWarnings("all") class ParentBuilderImpl extends SuperBuilderAbstractToBuilder.Parent.ParentBuilder<SuperBuilderAbstractToBuilder.Parent, SuperBuilderAbstractToBuilder.Parent.ParentBuilderImpl> {
- private ParentBuilderImpl() {
- super();
- }
- protected @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderAbstractToBuilder.Parent.ParentBuilderImpl self() {
- return this;
- }
- public @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderAbstractToBuilder.Parent build() {
- return new SuperBuilderAbstractToBuilder.Parent(this);
- }
- }
- int parentField;
- protected @java.lang.SuppressWarnings("all") Parent(final SuperBuilderAbstractToBuilder.Parent.ParentBuilder<?, ?> b) {
- super();
- this.parentField = b.parentField;
- }
- public @java.lang.SuppressWarnings("all") SuperBuilderAbstractToBuilder.Parent.ParentBuilder<?, ?> toBuilder() {
- return new SuperBuilderAbstractToBuilder.Parent.ParentBuilderImpl().$fillValuesFrom(this);
- }
- public static @java.lang.SuppressWarnings("all") SuperBuilderAbstractToBuilder.Parent.ParentBuilder<?, ?> builder() {
- return new SuperBuilderAbstractToBuilder.Parent.ParentBuilderImpl();
- }
- }
- public static abstract @lombok.experimental.SuperBuilder(toBuilder = true) class Child extends Parent {
- public static abstract @java.lang.SuppressWarnings("all") class ChildBuilder<C extends SuperBuilderAbstractToBuilder.Child, B extends SuperBuilderAbstractToBuilder.Child.ChildBuilder<C, B>> extends Parent.ParentBuilder<C, B> {
- private @java.lang.SuppressWarnings("all") double childField;
- public ChildBuilder() {
- super();
- }
- protected @java.lang.Override @java.lang.SuppressWarnings("all") B $fillValuesFrom(final C instance) {
- super.$fillValuesFrom(instance);
- SuperBuilderAbstractToBuilder.Child.ChildBuilder.$fillValuesFromInstanceIntoBuilder(instance, this);
- return self();
- }
- 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();
- public @java.lang.SuppressWarnings("all") B childField(final double childField) {
- this.childField = childField;
- return self();
- }
- public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() {
- return (((("SuperBuilderAbstractToBuilder.Child.ChildBuilder(super=" + super.toString()) + ", childField=") + this.childField) + ")");
- }
- }
- double childField;
- protected @java.lang.SuppressWarnings("all") Child(final SuperBuilderAbstractToBuilder.Child.ChildBuilder<?, ?> b) {
- super(b);
- this.childField = b.childField;
- }
- }
- public static @lombok.experimental.SuperBuilder(toBuilder = true) class GrandChild extends Child {
- public static abstract @java.lang.SuppressWarnings("all") class GrandChildBuilder<C extends SuperBuilderAbstractToBuilder.GrandChild, B extends SuperBuilderAbstractToBuilder.GrandChild.GrandChildBuilder<C, B>> extends Child.ChildBuilder<C, B> {
- private @java.lang.SuppressWarnings("all") String grandChildField;
- public GrandChildBuilder() {
- super();
- }
- protected @java.lang.Override @java.lang.SuppressWarnings("all") B $fillValuesFrom(final C instance) {
- super.$fillValuesFrom(instance);
- SuperBuilderAbstractToBuilder.GrandChild.GrandChildBuilder.$fillValuesFromInstanceIntoBuilder(instance, this);
- return self();
- }
- 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();
- public @java.lang.SuppressWarnings("all") B grandChildField(final String grandChildField) {
- this.grandChildField = grandChildField;
- return self();
- }
- public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() {
- return (((("SuperBuilderAbstractToBuilder.GrandChild.GrandChildBuilder(super=" + super.toString()) + ", grandChildField=") + this.grandChildField) + ")");
- }
- }
- private static final @java.lang.SuppressWarnings("all") class GrandChildBuilderImpl extends SuperBuilderAbstractToBuilder.GrandChild.GrandChildBuilder<SuperBuilderAbstractToBuilder.GrandChild, SuperBuilderAbstractToBuilder.GrandChild.GrandChildBuilderImpl> {
- private GrandChildBuilderImpl() {
- super();
- }
- protected @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderAbstractToBuilder.GrandChild.GrandChildBuilderImpl self() {
- return this;
- }
- public @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderAbstractToBuilder.GrandChild build() {
- return new SuperBuilderAbstractToBuilder.GrandChild(this);
- }
- }
- String grandChildField;
- protected @java.lang.SuppressWarnings("all") GrandChild(final SuperBuilderAbstractToBuilder.GrandChild.GrandChildBuilder<?, ?> b) {
- super(b);
- this.grandChildField = b.grandChildField;
- }
- public @java.lang.SuppressWarnings("all") SuperBuilderAbstractToBuilder.GrandChild.GrandChildBuilder<?, ?> toBuilder() {
- return new SuperBuilderAbstractToBuilder.GrandChild.GrandChildBuilderImpl().$fillValuesFrom(this);
- }
- public static @java.lang.SuppressWarnings("all") SuperBuilderAbstractToBuilder.GrandChild.GrandChildBuilder<?, ?> builder() {
- return new SuperBuilderAbstractToBuilder.GrandChild.GrandChildBuilderImpl();
- }
- }
- public SuperBuilderAbstractToBuilder() {
- super();
- }
- public static void test() {
- GrandChild x = GrandChild.builder().grandChildField("").parentField(5).childField(2.5).build().toBuilder().build();
- }
-}
+public class SuperBuilderAbstractToBuilder { + public static @lombok.experimental.SuperBuilder(toBuilder = true) class Parent { + public static abstract @java.lang.SuppressWarnings("all") class ParentBuilder<C extends SuperBuilderAbstractToBuilder.Parent, B extends SuperBuilderAbstractToBuilder.Parent.ParentBuilder<C, B>> { + private @java.lang.SuppressWarnings("all") int parentField; + public ParentBuilder() { + super(); + } + protected @java.lang.SuppressWarnings("all") B $fillValuesFrom(final C instance) { + SuperBuilderAbstractToBuilder.Parent.ParentBuilder.$fillValuesFromInstanceIntoBuilder(instance, this); + return self(); + } + 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}. + */ + public @java.lang.SuppressWarnings("all") B parentField(final int parentField) { + this.parentField = parentField; + return self(); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (("SuperBuilderAbstractToBuilder.Parent.ParentBuilder(parentField=" + this.parentField) + ")"); + } + } + private static final @java.lang.SuppressWarnings("all") class ParentBuilderImpl extends SuperBuilderAbstractToBuilder.Parent.ParentBuilder<SuperBuilderAbstractToBuilder.Parent, SuperBuilderAbstractToBuilder.Parent.ParentBuilderImpl> { + private ParentBuilderImpl() { + super(); + } + protected @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderAbstractToBuilder.Parent.ParentBuilderImpl self() { + return this; + } + public @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderAbstractToBuilder.Parent build() { + return new SuperBuilderAbstractToBuilder.Parent(this); + } + } + int parentField; + protected @java.lang.SuppressWarnings("all") Parent(final SuperBuilderAbstractToBuilder.Parent.ParentBuilder<?, ?> b) { + super(); + this.parentField = b.parentField; + } + public @java.lang.SuppressWarnings("all") SuperBuilderAbstractToBuilder.Parent.ParentBuilder<?, ?> toBuilder() { + return new SuperBuilderAbstractToBuilder.Parent.ParentBuilderImpl().$fillValuesFrom(this); + } + public static @java.lang.SuppressWarnings("all") SuperBuilderAbstractToBuilder.Parent.ParentBuilder<?, ?> builder() { + return new SuperBuilderAbstractToBuilder.Parent.ParentBuilderImpl(); + } + } + public static abstract @lombok.experimental.SuperBuilder(toBuilder = true) class Child extends Parent { + public static abstract @java.lang.SuppressWarnings("all") class ChildBuilder<C extends SuperBuilderAbstractToBuilder.Child, B extends SuperBuilderAbstractToBuilder.Child.ChildBuilder<C, B>> extends Parent.ParentBuilder<C, B> { + private @java.lang.SuppressWarnings("all") double childField; + public ChildBuilder() { + super(); + } + protected @java.lang.Override @java.lang.SuppressWarnings("all") B $fillValuesFrom(final C instance) { + super.$fillValuesFrom(instance); + SuperBuilderAbstractToBuilder.Child.ChildBuilder.$fillValuesFromInstanceIntoBuilder(instance, this); + return self(); + } + 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}. + */ + public @java.lang.SuppressWarnings("all") B childField(final double childField) { + this.childField = childField; + return self(); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (((("SuperBuilderAbstractToBuilder.Child.ChildBuilder(super=" + super.toString()) + ", childField=") + this.childField) + ")"); + } + } + double childField; + protected @java.lang.SuppressWarnings("all") Child(final SuperBuilderAbstractToBuilder.Child.ChildBuilder<?, ?> b) { + super(b); + this.childField = b.childField; + } + } + public static @lombok.experimental.SuperBuilder(toBuilder = true) class GrandChild extends Child { + public static abstract @java.lang.SuppressWarnings("all") class GrandChildBuilder<C extends SuperBuilderAbstractToBuilder.GrandChild, B extends SuperBuilderAbstractToBuilder.GrandChild.GrandChildBuilder<C, B>> extends Child.ChildBuilder<C, B> { + private @java.lang.SuppressWarnings("all") String grandChildField; + public GrandChildBuilder() { + super(); + } + protected @java.lang.Override @java.lang.SuppressWarnings("all") B $fillValuesFrom(final C instance) { + super.$fillValuesFrom(instance); + SuperBuilderAbstractToBuilder.GrandChild.GrandChildBuilder.$fillValuesFromInstanceIntoBuilder(instance, this); + return self(); + } + 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}. + */ + public @java.lang.SuppressWarnings("all") B grandChildField(final String grandChildField) { + this.grandChildField = grandChildField; + return self(); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (((("SuperBuilderAbstractToBuilder.GrandChild.GrandChildBuilder(super=" + super.toString()) + ", grandChildField=") + this.grandChildField) + ")"); + } + } + private static final @java.lang.SuppressWarnings("all") class GrandChildBuilderImpl extends SuperBuilderAbstractToBuilder.GrandChild.GrandChildBuilder<SuperBuilderAbstractToBuilder.GrandChild, SuperBuilderAbstractToBuilder.GrandChild.GrandChildBuilderImpl> { + private GrandChildBuilderImpl() { + super(); + } + protected @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderAbstractToBuilder.GrandChild.GrandChildBuilderImpl self() { + return this; + } + public @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderAbstractToBuilder.GrandChild build() { + return new SuperBuilderAbstractToBuilder.GrandChild(this); + } + } + String grandChildField; + protected @java.lang.SuppressWarnings("all") GrandChild(final SuperBuilderAbstractToBuilder.GrandChild.GrandChildBuilder<?, ?> b) { + super(b); + this.grandChildField = b.grandChildField; + } + public @java.lang.SuppressWarnings("all") SuperBuilderAbstractToBuilder.GrandChild.GrandChildBuilder<?, ?> toBuilder() { + return new SuperBuilderAbstractToBuilder.GrandChild.GrandChildBuilderImpl().$fillValuesFrom(this); + } + public static @java.lang.SuppressWarnings("all") SuperBuilderAbstractToBuilder.GrandChild.GrandChildBuilder<?, ?> builder() { + return new SuperBuilderAbstractToBuilder.GrandChild.GrandChildBuilderImpl(); + } + } + public SuperBuilderAbstractToBuilder() { + super(); + } + public static void test() { + GrandChild x = GrandChild.builder().grandChildField("").parentField(5).childField(2.5).build().toBuilder().build(); + } +} diff --git a/test/transform/resource/after-ecj/SuperBuilderBasic.java b/test/transform/resource/after-ecj/SuperBuilderBasic.java index 7902c95f..844206d0 100644 --- a/test/transform/resource/after-ecj/SuperBuilderBasic.java +++ b/test/transform/resource/after-ecj/SuperBuilderBasic.java @@ -1,116 +1,122 @@ -import java.util.List;
-public class SuperBuilderBasic {
- public static @lombok.experimental.SuperBuilder class Parent {
- public static abstract @java.lang.SuppressWarnings("all") class ParentBuilder<C extends SuperBuilderBasic.Parent, B extends SuperBuilderBasic.Parent.ParentBuilder<C, B>> {
- private @java.lang.SuppressWarnings("all") int field1;
- private @java.lang.SuppressWarnings("all") java.util.ArrayList<String> items;
- public ParentBuilder() {
- super();
- }
- protected abstract @java.lang.SuppressWarnings("all") B self();
- public abstract @java.lang.SuppressWarnings("all") C build();
- public @java.lang.SuppressWarnings("all") B field1(final int field1) {
- this.field1 = field1;
- return self();
- }
- public @java.lang.SuppressWarnings("all") B item(final String item) {
- if ((this.items == null))
- this.items = new java.util.ArrayList<String>();
- this.items.add(item);
- return self();
- }
- public @java.lang.SuppressWarnings("all") B items(final java.util.Collection<? extends String> items) {
- if ((items == null))
- {
- throw new java.lang.NullPointerException("items cannot be null");
- }
- if ((this.items == null))
- this.items = new java.util.ArrayList<String>();
- this.items.addAll(items);
- return self();
- }
- public @java.lang.SuppressWarnings("all") B clearItems() {
- if ((this.items != null))
- this.items.clear();
- return self();
- }
- public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() {
- return (((("SuperBuilderBasic.Parent.ParentBuilder(field1=" + this.field1) + ", items=") + this.items) + ")");
- }
- }
- private static final @java.lang.SuppressWarnings("all") class ParentBuilderImpl extends SuperBuilderBasic.Parent.ParentBuilder<SuperBuilderBasic.Parent, SuperBuilderBasic.Parent.ParentBuilderImpl> {
- private ParentBuilderImpl() {
- super();
- }
- protected @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderBasic.Parent.ParentBuilderImpl self() {
- return this;
- }
- public @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderBasic.Parent build() {
- return new SuperBuilderBasic.Parent(this);
- }
- }
- int field1;
- @lombok.Singular List<String> items;
- protected @java.lang.SuppressWarnings("all") Parent(final SuperBuilderBasic.Parent.ParentBuilder<?, ?> b) {
- super();
- this.field1 = b.field1;
- java.util.List<String> items;
- switch (((b.items == null) ? 0 : b.items.size())) {
- case 0 :
- items = java.util.Collections.emptyList();
- break;
- case 1 :
- items = java.util.Collections.singletonList(b.items.get(0));
- break;
- default :
- items = java.util.Collections.unmodifiableList(new java.util.ArrayList<String>(b.items));
- }
- this.items = items;
- }
- public static @java.lang.SuppressWarnings("all") SuperBuilderBasic.Parent.ParentBuilder<?, ?> builder() {
- return new SuperBuilderBasic.Parent.ParentBuilderImpl();
- }
- }
- public static @lombok.experimental.SuperBuilder class Child extends SuperBuilderBasic.Parent {
- public static abstract @java.lang.SuppressWarnings("all") class ChildBuilder<C extends SuperBuilderBasic.Child, B extends SuperBuilderBasic.Child.ChildBuilder<C, B>> extends SuperBuilderBasic.Parent.ParentBuilder<C, B> {
- private @java.lang.SuppressWarnings("all") double field3;
- 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();
- public @java.lang.SuppressWarnings("all") B field3(final double field3) {
- this.field3 = field3;
- return self();
- }
- public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() {
- return (((("SuperBuilderBasic.Child.ChildBuilder(super=" + super.toString()) + ", field3=") + this.field3) + ")");
- }
- }
- private static final @java.lang.SuppressWarnings("all") class ChildBuilderImpl extends SuperBuilderBasic.Child.ChildBuilder<SuperBuilderBasic.Child, SuperBuilderBasic.Child.ChildBuilderImpl> {
- private ChildBuilderImpl() {
- super();
- }
- protected @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderBasic.Child.ChildBuilderImpl self() {
- return this;
- }
- public @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderBasic.Child build() {
- return new SuperBuilderBasic.Child(this);
- }
- }
- double field3;
- protected @java.lang.SuppressWarnings("all") Child(final SuperBuilderBasic.Child.ChildBuilder<?, ?> b) {
- super(b);
- this.field3 = b.field3;
- }
- public static @java.lang.SuppressWarnings("all") SuperBuilderBasic.Child.ChildBuilder<?, ?> builder() {
- return new SuperBuilderBasic.Child.ChildBuilderImpl();
- }
- }
- public SuperBuilderBasic() {
- super();
- }
- public static void test() {
- Child x = Child.builder().field3(0.0).field1(5).item("").build();
- }
-}
+import java.util.List; +public class SuperBuilderBasic { + public static @lombok.experimental.SuperBuilder class Parent { + public static abstract @java.lang.SuppressWarnings("all") class ParentBuilder<C extends SuperBuilderBasic.Parent, B extends SuperBuilderBasic.Parent.ParentBuilder<C, B>> { + private @java.lang.SuppressWarnings("all") int field1; + private @java.lang.SuppressWarnings("all") java.util.ArrayList<String> items; + public ParentBuilder() { + super(); + } + protected abstract @java.lang.SuppressWarnings("all") B self(); + public abstract @java.lang.SuppressWarnings("all") C build(); + /** + * @return {@code this}. + */ + public @java.lang.SuppressWarnings("all") B field1(final int field1) { + this.field1 = field1; + return self(); + } + public @java.lang.SuppressWarnings("all") B item(final String item) { + if ((this.items == null)) + this.items = new java.util.ArrayList<String>(); + this.items.add(item); + return self(); + } + public @java.lang.SuppressWarnings("all") B items(final java.util.Collection<? extends String> items) { + if ((items == null)) + { + throw new java.lang.NullPointerException("items cannot be null"); + } + if ((this.items == null)) + this.items = new java.util.ArrayList<String>(); + this.items.addAll(items); + return self(); + } + public @java.lang.SuppressWarnings("all") B clearItems() { + if ((this.items != null)) + this.items.clear(); + return self(); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (((("SuperBuilderBasic.Parent.ParentBuilder(field1=" + this.field1) + ", items=") + this.items) + ")"); + } + } + private static final @java.lang.SuppressWarnings("all") class ParentBuilderImpl extends SuperBuilderBasic.Parent.ParentBuilder<SuperBuilderBasic.Parent, SuperBuilderBasic.Parent.ParentBuilderImpl> { + private ParentBuilderImpl() { + super(); + } + protected @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderBasic.Parent.ParentBuilderImpl self() { + return this; + } + public @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderBasic.Parent build() { + return new SuperBuilderBasic.Parent(this); + } + } + int field1; + @lombok.Singular List<String> items; + protected @java.lang.SuppressWarnings("all") Parent(final SuperBuilderBasic.Parent.ParentBuilder<?, ?> b) { + super(); + this.field1 = b.field1; + java.util.List<String> items; + switch (((b.items == null) ? 0 : b.items.size())) { + case 0 : + items = java.util.Collections.emptyList(); + break; + case 1 : + items = java.util.Collections.singletonList(b.items.get(0)); + break; + default : + items = java.util.Collections.unmodifiableList(new java.util.ArrayList<String>(b.items)); + } + this.items = items; + } + public static @java.lang.SuppressWarnings("all") SuperBuilderBasic.Parent.ParentBuilder<?, ?> builder() { + return new SuperBuilderBasic.Parent.ParentBuilderImpl(); + } + } + public static @lombok.experimental.SuperBuilder class Child extends SuperBuilderBasic.Parent { + public static abstract @java.lang.SuppressWarnings("all") class ChildBuilder<C extends SuperBuilderBasic.Child, B extends SuperBuilderBasic.Child.ChildBuilder<C, B>> extends SuperBuilderBasic.Parent.ParentBuilder<C, B> { + private @java.lang.SuppressWarnings("all") double field3; + 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}. + */ + public @java.lang.SuppressWarnings("all") B field3(final double field3) { + this.field3 = field3; + return self(); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (((("SuperBuilderBasic.Child.ChildBuilder(super=" + super.toString()) + ", field3=") + this.field3) + ")"); + } + } + private static final @java.lang.SuppressWarnings("all") class ChildBuilderImpl extends SuperBuilderBasic.Child.ChildBuilder<SuperBuilderBasic.Child, SuperBuilderBasic.Child.ChildBuilderImpl> { + private ChildBuilderImpl() { + super(); + } + protected @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderBasic.Child.ChildBuilderImpl self() { + return this; + } + public @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderBasic.Child build() { + return new SuperBuilderBasic.Child(this); + } + } + double field3; + protected @java.lang.SuppressWarnings("all") Child(final SuperBuilderBasic.Child.ChildBuilder<?, ?> b) { + super(b); + this.field3 = b.field3; + } + public static @java.lang.SuppressWarnings("all") SuperBuilderBasic.Child.ChildBuilder<?, ?> builder() { + return new SuperBuilderBasic.Child.ChildBuilderImpl(); + } + } + public SuperBuilderBasic() { + super(); + } + public static void test() { + Child x = Child.builder().field3(0.0).field1(5).item("").build(); + } +} diff --git a/test/transform/resource/after-ecj/SuperBuilderBasicToBuilder.java b/test/transform/resource/after-ecj/SuperBuilderBasicToBuilder.java index 56703396..67ee62f6 100644 --- a/test/transform/resource/after-ecj/SuperBuilderBasicToBuilder.java +++ b/test/transform/resource/after-ecj/SuperBuilderBasicToBuilder.java @@ -1,168 +1,183 @@ -import java.util.List;
-public class SuperBuilderBasicToBuilder {
- public static @lombok.experimental.SuperBuilder(toBuilder = true) class Parent {
- public static abstract @java.lang.SuppressWarnings("all") class ParentBuilder<C extends SuperBuilderBasicToBuilder.Parent, B extends SuperBuilderBasicToBuilder.Parent.ParentBuilder<C, B>> {
- private @java.lang.SuppressWarnings("all") int field1;
- private @java.lang.SuppressWarnings("all") int obtainViaField;
- private @java.lang.SuppressWarnings("all") int obtainViaMethod;
- private @java.lang.SuppressWarnings("all") String obtainViaStaticMethod;
- private @java.lang.SuppressWarnings("all") java.util.ArrayList<String> items;
- public ParentBuilder() {
- super();
- }
- protected @java.lang.SuppressWarnings("all") B $fillValuesFrom(final C instance) {
- SuperBuilderBasicToBuilder.Parent.ParentBuilder.$fillValuesFromInstanceIntoBuilder(instance, this);
- return self();
- }
- private static @java.lang.SuppressWarnings("all") void $fillValuesFromInstanceIntoBuilder(final SuperBuilderBasicToBuilder.Parent instance, final SuperBuilderBasicToBuilder.Parent.ParentBuilder<?, ?> b) {
- b.field1(instance.field1);
- b.obtainViaField(instance.field1);
- b.obtainViaMethod(instance.method());
- b.obtainViaStaticMethod(SuperBuilderBasicToBuilder.Parent.staticMethod(instance));
- b.items(((instance.items == null) ? java.util.Collections.emptyList() : instance.items));
- }
- protected abstract @java.lang.SuppressWarnings("all") B self();
- public abstract @java.lang.SuppressWarnings("all") C build();
- public @java.lang.SuppressWarnings("all") B field1(final int field1) {
- this.field1 = field1;
- return self();
- }
- public @java.lang.SuppressWarnings("all") B obtainViaField(final int obtainViaField) {
- this.obtainViaField = obtainViaField;
- return self();
- }
- public @java.lang.SuppressWarnings("all") B obtainViaMethod(final int obtainViaMethod) {
- this.obtainViaMethod = obtainViaMethod;
- return self();
- }
- public @java.lang.SuppressWarnings("all") B obtainViaStaticMethod(final String obtainViaStaticMethod) {
- this.obtainViaStaticMethod = obtainViaStaticMethod;
- return self();
- }
- public @java.lang.SuppressWarnings("all") B item(final String item) {
- if ((this.items == null))
- this.items = new java.util.ArrayList<String>();
- this.items.add(item);
- return self();
- }
- public @java.lang.SuppressWarnings("all") B items(final java.util.Collection<? extends String> items) {
- if ((items == null))
- {
- throw new java.lang.NullPointerException("items cannot be null");
- }
- if ((this.items == null))
- this.items = new java.util.ArrayList<String>();
- this.items.addAll(items);
- return self();
- }
- public @java.lang.SuppressWarnings("all") B clearItems() {
- if ((this.items != null))
- this.items.clear();
- return self();
- }
- 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) + ")");
- }
- }
- private static final @java.lang.SuppressWarnings("all") class ParentBuilderImpl extends SuperBuilderBasicToBuilder.Parent.ParentBuilder<SuperBuilderBasicToBuilder.Parent, SuperBuilderBasicToBuilder.Parent.ParentBuilderImpl> {
- private ParentBuilderImpl() {
- super();
- }
- protected @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderBasicToBuilder.Parent.ParentBuilderImpl self() {
- return this;
- }
- public @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderBasicToBuilder.Parent build() {
- return new SuperBuilderBasicToBuilder.Parent(this);
- }
- }
- private int field1;
- @lombok.Builder.ObtainVia(field = "field1") int obtainViaField;
- @lombok.Builder.ObtainVia(method = "method") int obtainViaMethod;
- @lombok.Builder.ObtainVia(method = "staticMethod",isStatic = true) String obtainViaStaticMethod;
- @lombok.Singular List<String> items;
- private int method() {
- return 2;
- }
- private static String staticMethod(Parent instance) {
- return "staticMethod";
- }
- protected @java.lang.SuppressWarnings("all") Parent(final SuperBuilderBasicToBuilder.Parent.ParentBuilder<?, ?> b) {
- super();
- this.field1 = b.field1;
- this.obtainViaField = b.obtainViaField;
- this.obtainViaMethod = b.obtainViaMethod;
- this.obtainViaStaticMethod = b.obtainViaStaticMethod;
- java.util.List<String> items;
- switch (((b.items == null) ? 0 : b.items.size())) {
- case 0 :
- items = java.util.Collections.emptyList();
- break;
- case 1 :
- items = java.util.Collections.singletonList(b.items.get(0));
- break;
- default :
- items = java.util.Collections.unmodifiableList(new java.util.ArrayList<String>(b.items));
- }
- this.items = items;
- }
- public @java.lang.SuppressWarnings("all") SuperBuilderBasicToBuilder.Parent.ParentBuilder<?, ?> toBuilder() {
- return new SuperBuilderBasicToBuilder.Parent.ParentBuilderImpl().$fillValuesFrom(this);
- }
- public static @java.lang.SuppressWarnings("all") SuperBuilderBasicToBuilder.Parent.ParentBuilder<?, ?> builder() {
- return new SuperBuilderBasicToBuilder.Parent.ParentBuilderImpl();
- }
- }
- public static @lombok.experimental.SuperBuilder(toBuilder = true) class Child extends Parent {
- public static abstract @java.lang.SuppressWarnings("all") class ChildBuilder<C extends SuperBuilderBasicToBuilder.Child, B extends SuperBuilderBasicToBuilder.Child.ChildBuilder<C, B>> extends Parent.ParentBuilder<C, B> {
- private @java.lang.SuppressWarnings("all") double field3;
- public ChildBuilder() {
- super();
- }
- protected @java.lang.Override @java.lang.SuppressWarnings("all") B $fillValuesFrom(final C instance) {
- super.$fillValuesFrom(instance);
- SuperBuilderBasicToBuilder.Child.ChildBuilder.$fillValuesFromInstanceIntoBuilder(instance, this);
- return self();
- }
- 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();
- public @java.lang.SuppressWarnings("all") B field3(final double field3) {
- this.field3 = field3;
- return self();
- }
- public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() {
- return (((("SuperBuilderBasicToBuilder.Child.ChildBuilder(super=" + super.toString()) + ", field3=") + this.field3) + ")");
- }
- }
- private static final @java.lang.SuppressWarnings("all") class ChildBuilderImpl extends SuperBuilderBasicToBuilder.Child.ChildBuilder<SuperBuilderBasicToBuilder.Child, SuperBuilderBasicToBuilder.Child.ChildBuilderImpl> {
- private ChildBuilderImpl() {
- super();
- }
- protected @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderBasicToBuilder.Child.ChildBuilderImpl self() {
- return this;
- }
- public @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderBasicToBuilder.Child build() {
- return new SuperBuilderBasicToBuilder.Child(this);
- }
- }
- private double field3;
- protected @java.lang.SuppressWarnings("all") Child(final SuperBuilderBasicToBuilder.Child.ChildBuilder<?, ?> b) {
- super(b);
- this.field3 = b.field3;
- }
- public @java.lang.SuppressWarnings("all") SuperBuilderBasicToBuilder.Child.ChildBuilder<?, ?> toBuilder() {
- return new SuperBuilderBasicToBuilder.Child.ChildBuilderImpl().$fillValuesFrom(this);
- }
- public static @java.lang.SuppressWarnings("all") SuperBuilderBasicToBuilder.Child.ChildBuilder<?, ?> builder() {
- return new SuperBuilderBasicToBuilder.Child.ChildBuilderImpl();
- }
- }
- public SuperBuilderBasicToBuilder() {
- super();
- }
- public static void test() {
- Child x = Child.builder().field3(0.0).field1(5).item("").build().toBuilder().build();
- }
-}
+import java.util.List; +public class SuperBuilderBasicToBuilder { + public static @lombok.experimental.SuperBuilder(toBuilder = true) class Parent { + public static abstract @java.lang.SuppressWarnings("all") class ParentBuilder<C extends SuperBuilderBasicToBuilder.Parent, B extends SuperBuilderBasicToBuilder.Parent.ParentBuilder<C, B>> { + private @java.lang.SuppressWarnings("all") int field1; + private @java.lang.SuppressWarnings("all") int obtainViaField; + private @java.lang.SuppressWarnings("all") int obtainViaMethod; + private @java.lang.SuppressWarnings("all") String obtainViaStaticMethod; + private @java.lang.SuppressWarnings("all") java.util.ArrayList<String> items; + public ParentBuilder() { + super(); + } + protected @java.lang.SuppressWarnings("all") B $fillValuesFrom(final C instance) { + SuperBuilderBasicToBuilder.Parent.ParentBuilder.$fillValuesFromInstanceIntoBuilder(instance, this); + return self(); + } + private static @java.lang.SuppressWarnings("all") void $fillValuesFromInstanceIntoBuilder(final SuperBuilderBasicToBuilder.Parent instance, final SuperBuilderBasicToBuilder.Parent.ParentBuilder<?, ?> b) { + b.field1(instance.field1); + b.obtainViaField(instance.field1); + b.obtainViaMethod(instance.method()); + 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}. + */ + public @java.lang.SuppressWarnings("all") B field1(final int field1) { + this.field1 = field1; + return self(); + } + /** + * @return {@code this}. + */ + public @java.lang.SuppressWarnings("all") B obtainViaField(final int obtainViaField) { + this.obtainViaField = obtainViaField; + return self(); + } + /** + * @return {@code this}. + */ + public @java.lang.SuppressWarnings("all") B obtainViaMethod(final int obtainViaMethod) { + this.obtainViaMethod = obtainViaMethod; + return self(); + } + /** + * @return {@code this}. + */ + public @java.lang.SuppressWarnings("all") B obtainViaStaticMethod(final String obtainViaStaticMethod) { + this.obtainViaStaticMethod = obtainViaStaticMethod; + return self(); + } + public @java.lang.SuppressWarnings("all") B item(final String item) { + if ((this.items == null)) + this.items = new java.util.ArrayList<String>(); + this.items.add(item); + return self(); + } + public @java.lang.SuppressWarnings("all") B items(final java.util.Collection<? extends String> items) { + if ((items == null)) + { + throw new java.lang.NullPointerException("items cannot be null"); + } + if ((this.items == null)) + this.items = new java.util.ArrayList<String>(); + this.items.addAll(items); + return self(); + } + public @java.lang.SuppressWarnings("all") B clearItems() { + if ((this.items != null)) + this.items.clear(); + return self(); + } + 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) + ")"); + } + } + private static final @java.lang.SuppressWarnings("all") class ParentBuilderImpl extends SuperBuilderBasicToBuilder.Parent.ParentBuilder<SuperBuilderBasicToBuilder.Parent, SuperBuilderBasicToBuilder.Parent.ParentBuilderImpl> { + private ParentBuilderImpl() { + super(); + } + protected @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderBasicToBuilder.Parent.ParentBuilderImpl self() { + return this; + } + public @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderBasicToBuilder.Parent build() { + return new SuperBuilderBasicToBuilder.Parent(this); + } + } + private int field1; + @lombok.Builder.ObtainVia(field = "field1") int obtainViaField; + @lombok.Builder.ObtainVia(method = "method") int obtainViaMethod; + @lombok.Builder.ObtainVia(method = "staticMethod",isStatic = true) String obtainViaStaticMethod; + @lombok.Singular List<String> items; + private int method() { + return 2; + } + private static String staticMethod(Parent instance) { + return "staticMethod"; + } + protected @java.lang.SuppressWarnings("all") Parent(final SuperBuilderBasicToBuilder.Parent.ParentBuilder<?, ?> b) { + super(); + this.field1 = b.field1; + this.obtainViaField = b.obtainViaField; + this.obtainViaMethod = b.obtainViaMethod; + this.obtainViaStaticMethod = b.obtainViaStaticMethod; + java.util.List<String> items; + switch (((b.items == null) ? 0 : b.items.size())) { + case 0 : + items = java.util.Collections.emptyList(); + break; + case 1 : + items = java.util.Collections.singletonList(b.items.get(0)); + break; + default : + items = java.util.Collections.unmodifiableList(new java.util.ArrayList<String>(b.items)); + } + this.items = items; + } + public @java.lang.SuppressWarnings("all") SuperBuilderBasicToBuilder.Parent.ParentBuilder<?, ?> toBuilder() { + return new SuperBuilderBasicToBuilder.Parent.ParentBuilderImpl().$fillValuesFrom(this); + } + public static @java.lang.SuppressWarnings("all") SuperBuilderBasicToBuilder.Parent.ParentBuilder<?, ?> builder() { + return new SuperBuilderBasicToBuilder.Parent.ParentBuilderImpl(); + } + } + public static @lombok.experimental.SuperBuilder(toBuilder = true) class Child extends Parent { + public static abstract @java.lang.SuppressWarnings("all") class ChildBuilder<C extends SuperBuilderBasicToBuilder.Child, B extends SuperBuilderBasicToBuilder.Child.ChildBuilder<C, B>> extends Parent.ParentBuilder<C, B> { + private @java.lang.SuppressWarnings("all") double field3; + public ChildBuilder() { + super(); + } + protected @java.lang.Override @java.lang.SuppressWarnings("all") B $fillValuesFrom(final C instance) { + super.$fillValuesFrom(instance); + SuperBuilderBasicToBuilder.Child.ChildBuilder.$fillValuesFromInstanceIntoBuilder(instance, this); + return self(); + } + 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}. + */ + public @java.lang.SuppressWarnings("all") B field3(final double field3) { + this.field3 = field3; + return self(); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (((("SuperBuilderBasicToBuilder.Child.ChildBuilder(super=" + super.toString()) + ", field3=") + this.field3) + ")"); + } + } + private static final @java.lang.SuppressWarnings("all") class ChildBuilderImpl extends SuperBuilderBasicToBuilder.Child.ChildBuilder<SuperBuilderBasicToBuilder.Child, SuperBuilderBasicToBuilder.Child.ChildBuilderImpl> { + private ChildBuilderImpl() { + super(); + } + protected @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderBasicToBuilder.Child.ChildBuilderImpl self() { + return this; + } + public @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderBasicToBuilder.Child build() { + return new SuperBuilderBasicToBuilder.Child(this); + } + } + private double field3; + protected @java.lang.SuppressWarnings("all") Child(final SuperBuilderBasicToBuilder.Child.ChildBuilder<?, ?> b) { + super(b); + this.field3 = b.field3; + } + public @java.lang.SuppressWarnings("all") SuperBuilderBasicToBuilder.Child.ChildBuilder<?, ?> toBuilder() { + return new SuperBuilderBasicToBuilder.Child.ChildBuilderImpl().$fillValuesFrom(this); + } + public static @java.lang.SuppressWarnings("all") SuperBuilderBasicToBuilder.Child.ChildBuilder<?, ?> builder() { + return new SuperBuilderBasicToBuilder.Child.ChildBuilderImpl(); + } + } + public SuperBuilderBasicToBuilder() { + super(); + } + public static void test() { + Child x = Child.builder().field3(0.0).field1(5).item("").build().toBuilder().build(); + } +} diff --git a/test/transform/resource/after-ecj/SuperBuilderCustomized.java b/test/transform/resource/after-ecj/SuperBuilderCustomized.java index fe0e1238..1fb41367 100644 --- a/test/transform/resource/after-ecj/SuperBuilderCustomized.java +++ b/test/transform/resource/after-ecj/SuperBuilderCustomized.java @@ -1,88 +1,91 @@ -import java.util.List;
-public class SuperBuilderCustomized {
- public static @lombok.experimental.SuperBuilder class Parent {
- public static abstract class ParentBuilder<C extends Parent, B extends ParentBuilder<C, B>> {
- private @java.lang.SuppressWarnings("all") int field1;
- public ParentBuilder() {
- super();
- }
- public B resetToDefault() {
- field1 = 0;
- return self();
- }
- public B field1(int field1) {
- this.field1 = (field1 + 1);
- 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 (("SuperBuilderCustomized.Parent.ParentBuilder(field1=" + this.field1) + ")");
- }
- }
- private static final @java.lang.SuppressWarnings("all") class ParentBuilderImpl extends SuperBuilderCustomized.Parent.ParentBuilder<SuperBuilderCustomized.Parent, SuperBuilderCustomized.Parent.ParentBuilderImpl> {
- private ParentBuilderImpl() {
- super();
- }
- protected @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderCustomized.Parent.ParentBuilderImpl self() {
- return this;
- }
- public @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderCustomized.Parent build() {
- return new SuperBuilderCustomized.Parent(this);
- }
- }
- int field1;
- protected Parent(ParentBuilder<?, ?> b) {
- super();
- if ((b.field1 == 0))
- throw new IllegalArgumentException("field1 must be != 0");
- this.field1 = b.field1;
- }
- public static SuperBuilderCustomized.Parent.ParentBuilder<?, ?> builder(int field1) {
- return new SuperBuilderCustomized.Parent.ParentBuilderImpl().field1(field1);
- }
- }
- public static @lombok.experimental.SuperBuilder class Child extends Parent {
- private static final class ChildBuilderImpl extends ChildBuilder<Child, ChildBuilderImpl> {
- private ChildBuilderImpl() {
- super();
- }
- public @Override Child build() {
- this.resetToDefault();
- return new Child(this);
- }
- protected @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderCustomized.Child.ChildBuilderImpl self() {
- return this;
- }
- }
- public static abstract @java.lang.SuppressWarnings("all") class ChildBuilder<C extends SuperBuilderCustomized.Child, B extends SuperBuilderCustomized.Child.ChildBuilder<C, B>> extends Parent.ParentBuilder<C, B> {
- private @java.lang.SuppressWarnings("all") double field2;
- 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();
- public @java.lang.SuppressWarnings("all") B field2(final double field2) {
- this.field2 = field2;
- return self();
- }
- public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() {
- return (((("SuperBuilderCustomized.Child.ChildBuilder(super=" + super.toString()) + ", field2=") + this.field2) + ")");
- }
- }
- double field2;
- public static ChildBuilder<?, ?> builder() {
- return new ChildBuilderImpl().field2(10.0);
- }
- protected @java.lang.SuppressWarnings("all") Child(final SuperBuilderCustomized.Child.ChildBuilder<?, ?> b) {
- super(b);
- this.field2 = b.field2;
- }
- }
- public SuperBuilderCustomized() {
- super();
- }
- public static void test() {
- Child x = Child.builder().field2(1.0).field1(5).resetToDefault().build();
- }
-}
+import java.util.List; +public class SuperBuilderCustomized { + public static @lombok.experimental.SuperBuilder class Parent { + public static abstract class ParentBuilder<C extends Parent, B extends ParentBuilder<C, B>> { + private @java.lang.SuppressWarnings("all") int field1; + public ParentBuilder() { + super(); + } + public B resetToDefault() { + field1 = 0; + return self(); + } + public B field1(int field1) { + this.field1 = (field1 + 1); + 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 (("SuperBuilderCustomized.Parent.ParentBuilder(field1=" + this.field1) + ")"); + } + } + private static final @java.lang.SuppressWarnings("all") class ParentBuilderImpl extends SuperBuilderCustomized.Parent.ParentBuilder<SuperBuilderCustomized.Parent, SuperBuilderCustomized.Parent.ParentBuilderImpl> { + private ParentBuilderImpl() { + super(); + } + protected @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderCustomized.Parent.ParentBuilderImpl self() { + return this; + } + public @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderCustomized.Parent build() { + return new SuperBuilderCustomized.Parent(this); + } + } + int field1; + protected Parent(ParentBuilder<?, ?> b) { + super(); + if ((b.field1 == 0)) + throw new IllegalArgumentException("field1 must be != 0"); + this.field1 = b.field1; + } + public static SuperBuilderCustomized.Parent.ParentBuilder<?, ?> builder(int field1) { + return new SuperBuilderCustomized.Parent.ParentBuilderImpl().field1(field1); + } + } + public static @lombok.experimental.SuperBuilder class Child extends Parent { + private static final class ChildBuilderImpl extends ChildBuilder<Child, ChildBuilderImpl> { + private ChildBuilderImpl() { + super(); + } + public @Override Child build() { + this.resetToDefault(); + return new Child(this); + } + protected @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderCustomized.Child.ChildBuilderImpl self() { + return this; + } + } + public static abstract @java.lang.SuppressWarnings("all") class ChildBuilder<C extends SuperBuilderCustomized.Child, B extends SuperBuilderCustomized.Child.ChildBuilder<C, B>> extends Parent.ParentBuilder<C, B> { + private @java.lang.SuppressWarnings("all") double field2; + 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}. + */ + public @java.lang.SuppressWarnings("all") B field2(final double field2) { + this.field2 = field2; + return self(); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (((("SuperBuilderCustomized.Child.ChildBuilder(super=" + super.toString()) + ", field2=") + this.field2) + ")"); + } + } + double field2; + public static ChildBuilder<?, ?> builder() { + return new ChildBuilderImpl().field2(10.0); + } + protected @java.lang.SuppressWarnings("all") Child(final SuperBuilderCustomized.Child.ChildBuilder<?, ?> b) { + super(b); + this.field2 = b.field2; + } + } + public SuperBuilderCustomized() { + super(); + } + public static void test() { + Child x = Child.builder().field2(1.0).field1(5).resetToDefault().build(); + } +} diff --git a/test/transform/resource/after-ecj/SuperBuilderCustomizedWithSetterPrefix.java b/test/transform/resource/after-ecj/SuperBuilderCustomizedWithSetterPrefix.java index 283bacd4..142181ec 100644 --- a/test/transform/resource/after-ecj/SuperBuilderCustomizedWithSetterPrefix.java +++ b/test/transform/resource/after-ecj/SuperBuilderCustomizedWithSetterPrefix.java @@ -1,45 +1,45 @@ -import java.util.List;
-public class SuperBuilderCustomizedWithSetterPrefix {
- public static @lombok.experimental.SuperBuilder(setterPrefix = "set") class Parent {
- public static abstract class ParentBuilder<C extends Parent, B extends ParentBuilder<C, B>> {
- private @java.lang.SuppressWarnings("all") int field1;
- public ParentBuilder() {
- super();
- }
- public B setField1(int field1) {
- this.field1 = (field1 + 1);
- 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 (("SuperBuilderCustomizedWithSetterPrefix.Parent.ParentBuilder(field1=" + this.field1) + ")");
- }
- }
- private static final @java.lang.SuppressWarnings("all") class ParentBuilderImpl extends SuperBuilderCustomizedWithSetterPrefix.Parent.ParentBuilder<SuperBuilderCustomizedWithSetterPrefix.Parent, SuperBuilderCustomizedWithSetterPrefix.Parent.ParentBuilderImpl> {
- private ParentBuilderImpl() {
- super();
- }
- protected @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderCustomizedWithSetterPrefix.Parent.ParentBuilderImpl self() {
- return this;
- }
- public @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderCustomizedWithSetterPrefix.Parent build() {
- return new SuperBuilderCustomizedWithSetterPrefix.Parent(this);
- }
- }
- int field1;
- protected @java.lang.SuppressWarnings("all") Parent(final SuperBuilderCustomizedWithSetterPrefix.Parent.ParentBuilder<?, ?> b) {
- super();
- this.field1 = b.field1;
- }
- public static @java.lang.SuppressWarnings("all") SuperBuilderCustomizedWithSetterPrefix.Parent.ParentBuilder<?, ?> builder() {
- return new SuperBuilderCustomizedWithSetterPrefix.Parent.ParentBuilderImpl();
- }
- }
- public SuperBuilderCustomizedWithSetterPrefix() {
- super();
- }
- public static void test() {
- Parent x = Parent.builder().setField1(5).build();
- }
-}
+import java.util.List; +public class SuperBuilderCustomizedWithSetterPrefix { + public static @lombok.experimental.SuperBuilder(setterPrefix = "set") class Parent { + public static abstract class ParentBuilder<C extends Parent, B extends ParentBuilder<C, B>> { + private @java.lang.SuppressWarnings("all") int field1; + public ParentBuilder() { + super(); + } + public B setField1(int field1) { + this.field1 = (field1 + 1); + 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 (("SuperBuilderCustomizedWithSetterPrefix.Parent.ParentBuilder(field1=" + this.field1) + ")"); + } + } + private static final @java.lang.SuppressWarnings("all") class ParentBuilderImpl extends SuperBuilderCustomizedWithSetterPrefix.Parent.ParentBuilder<SuperBuilderCustomizedWithSetterPrefix.Parent, SuperBuilderCustomizedWithSetterPrefix.Parent.ParentBuilderImpl> { + private ParentBuilderImpl() { + super(); + } + protected @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderCustomizedWithSetterPrefix.Parent.ParentBuilderImpl self() { + return this; + } + public @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderCustomizedWithSetterPrefix.Parent build() { + return new SuperBuilderCustomizedWithSetterPrefix.Parent(this); + } + } + int field1; + protected @java.lang.SuppressWarnings("all") Parent(final SuperBuilderCustomizedWithSetterPrefix.Parent.ParentBuilder<?, ?> b) { + super(); + this.field1 = b.field1; + } + public static @java.lang.SuppressWarnings("all") SuperBuilderCustomizedWithSetterPrefix.Parent.ParentBuilder<?, ?> builder() { + return new SuperBuilderCustomizedWithSetterPrefix.Parent.ParentBuilderImpl(); + } + } + public SuperBuilderCustomizedWithSetterPrefix() { + super(); + } + public static void test() { + Parent x = Parent.builder().setField1(5).build(); + } +} diff --git a/test/transform/resource/after-ecj/SuperBuilderInitializer.java b/test/transform/resource/after-ecj/SuperBuilderInitializer.java new file mode 100644 index 00000000..0425fb89 --- /dev/null +++ b/test/transform/resource/after-ecj/SuperBuilderInitializer.java @@ -0,0 +1,54 @@ +import lombok.experimental.SuperBuilder; +class SuperBuilderInitializer { + public static @SuperBuilder class One { + public static abstract @java.lang.SuppressWarnings("all") class OneBuilder<C extends SuperBuilderInitializer.One, B extends SuperBuilderInitializer.One.OneBuilder<C, B>> { + private @java.lang.SuppressWarnings("all") String world; + public OneBuilder() { + super(); + } + protected abstract @java.lang.SuppressWarnings("all") B self(); + public abstract @java.lang.SuppressWarnings("all") C build(); + /** + * @return {@code this}. + */ + public @java.lang.SuppressWarnings("all") B world(final String world) { + this.world = world; + return self(); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (("SuperBuilderInitializer.One.OneBuilder(world=" + this.world) + ")"); + } + } + private static final @java.lang.SuppressWarnings("all") class OneBuilderImpl extends SuperBuilderInitializer.One.OneBuilder<SuperBuilderInitializer.One, SuperBuilderInitializer.One.OneBuilderImpl> { + private OneBuilderImpl() { + super(); + } + protected @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderInitializer.One.OneBuilderImpl self() { + return this; + } + public @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderInitializer.One build() { + return new SuperBuilderInitializer.One(this); + } + } + private String world; + { + world = "Hello"; + } + private static final String world2; + static { + world2 = "Hello"; + } + <clinit>() { + } + protected @java.lang.SuppressWarnings("all") One(final SuperBuilderInitializer.One.OneBuilder<?, ?> b) { + super(); + this.world = b.world; + } + public static @java.lang.SuppressWarnings("all") SuperBuilderInitializer.One.OneBuilder<?, ?> builder() { + return new SuperBuilderInitializer.One.OneBuilderImpl(); + } + } + SuperBuilderInitializer() { + super(); + } +} diff --git a/test/transform/resource/after-ecj/SuperBuilderNameClashes.java b/test/transform/resource/after-ecj/SuperBuilderNameClashes.java index 89ce3824..44d3db92 100644 --- a/test/transform/resource/after-ecj/SuperBuilderNameClashes.java +++ b/test/transform/resource/after-ecj/SuperBuilderNameClashes.java @@ -70,6 +70,9 @@ public class SuperBuilderNameClashes { } protected abstract @java.lang.SuppressWarnings("all") B self(); public abstract @java.lang.SuppressWarnings("all") C3 build(); + /** + * @return {@code this}. + */ public @java.lang.SuppressWarnings("all") B c2(final C2 c2) { this.c2 = c2; return self(); diff --git a/test/transform/resource/after-ecj/SuperBuilderNestedGenericTypes.java b/test/transform/resource/after-ecj/SuperBuilderNestedGenericTypes.java index e511b276..0c51d4ee 100644 --- a/test/transform/resource/after-ecj/SuperBuilderNestedGenericTypes.java +++ b/test/transform/resource/after-ecj/SuperBuilderNestedGenericTypes.java @@ -1,37 +1,37 @@ -public class SuperBuilderNestedGenericTypes {
- public static abstract @lombok.experimental.SuperBuilder class Generic<T extends Generic<?>> {
- public static abstract @java.lang.SuppressWarnings("all") class GenericBuilder<T extends Generic<?>, C extends SuperBuilderNestedGenericTypes.Generic<T>, B extends SuperBuilderNestedGenericTypes.Generic.GenericBuilder<T, C, B>> {
- public GenericBuilder() {
- super();
- }
- 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 "SuperBuilderNestedGenericTypes.Generic.GenericBuilder()";
- }
- }
- protected @java.lang.SuppressWarnings("all") Generic(final SuperBuilderNestedGenericTypes.Generic.GenericBuilder<T, ?, ?> b) {
- super();
- }
- }
- public static abstract @lombok.experimental.SuperBuilder class NestedGeneric<T extends OtherGeneric<?>> extends Generic<NestedGeneric<? extends OtherGeneric<?>>> {
- public static abstract @java.lang.SuppressWarnings("all") class NestedGenericBuilder<T extends OtherGeneric<?>, C extends SuperBuilderNestedGenericTypes.NestedGeneric<T>, B extends SuperBuilderNestedGenericTypes.NestedGeneric.NestedGenericBuilder<T, C, B>> extends Generic.GenericBuilder<NestedGeneric<? extends OtherGeneric<?>>, C, B> {
- public NestedGenericBuilder() {
- super();
- }
- 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 (("SuperBuilderNestedGenericTypes.NestedGeneric.NestedGenericBuilder(super=" + super.toString()) + ")");
- }
- }
- protected @java.lang.SuppressWarnings("all") NestedGeneric(final SuperBuilderNestedGenericTypes.NestedGeneric.NestedGenericBuilder<T, ?, ?> b) {
- super(b);
- }
- }
- public interface OtherGeneric<T> {
- }
- public SuperBuilderNestedGenericTypes() {
- super();
- }
+public class SuperBuilderNestedGenericTypes { + public static abstract @lombok.experimental.SuperBuilder class Generic<T extends Generic<?>> { + public static abstract @java.lang.SuppressWarnings("all") class GenericBuilder<T extends Generic<?>, C extends SuperBuilderNestedGenericTypes.Generic<T>, B extends SuperBuilderNestedGenericTypes.Generic.GenericBuilder<T, C, B>> { + public GenericBuilder() { + super(); + } + 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 "SuperBuilderNestedGenericTypes.Generic.GenericBuilder()"; + } + } + protected @java.lang.SuppressWarnings("all") Generic(final SuperBuilderNestedGenericTypes.Generic.GenericBuilder<T, ?, ?> b) { + super(); + } + } + public static abstract @lombok.experimental.SuperBuilder class NestedGeneric<T extends OtherGeneric<?>> extends Generic<NestedGeneric<? extends OtherGeneric<?>>> { + public static abstract @java.lang.SuppressWarnings("all") class NestedGenericBuilder<T extends OtherGeneric<?>, C extends SuperBuilderNestedGenericTypes.NestedGeneric<T>, B extends SuperBuilderNestedGenericTypes.NestedGeneric.NestedGenericBuilder<T, C, B>> extends Generic.GenericBuilder<NestedGeneric<? extends OtherGeneric<?>>, C, B> { + public NestedGenericBuilder() { + super(); + } + 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 (("SuperBuilderNestedGenericTypes.NestedGeneric.NestedGenericBuilder(super=" + super.toString()) + ")"); + } + } + protected @java.lang.SuppressWarnings("all") NestedGeneric(final SuperBuilderNestedGenericTypes.NestedGeneric.NestedGenericBuilder<T, ?, ?> b) { + super(b); + } + } + public interface OtherGeneric<T> { + } + public SuperBuilderNestedGenericTypes() { + super(); + } }
\ No newline at end of file diff --git a/test/transform/resource/after-ecj/SuperBuilderSingularCustomized.java b/test/transform/resource/after-ecj/SuperBuilderSingularCustomized.java new file mode 100644 index 00000000..613edb03 --- /dev/null +++ b/test/transform/resource/after-ecj/SuperBuilderSingularCustomized.java @@ -0,0 +1,70 @@ +import java.util.Set; +@lombok.experimental.SuperBuilder class SuperBuilderSingularCustomized { + public static abstract class SuperBuilderSingularCustomizedBuilder<C extends SuperBuilderSingularCustomized, B extends SuperBuilderSingularCustomized.SuperBuilderSingularCustomizedBuilder<C, B>> { + private @java.lang.SuppressWarnings("all") java.util.ArrayList<String> foos; + public SuperBuilderSingularCustomizedBuilder() { + super(); + } + 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>(); + this.foos.add(foo); + return self(); + } + public @java.lang.SuppressWarnings("all") B foos(final java.util.Collection<? extends String> foos) { + if ((foos == null)) + { + throw new java.lang.NullPointerException("foos cannot be null"); + } + if ((this.foos == null)) + this.foos = new java.util.ArrayList<String>(); + this.foos.addAll(foos); + return self(); + } + public @java.lang.SuppressWarnings("all") B clearFoos() { + if ((this.foos != null)) + this.foos.clear(); + return self(); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (("SuperBuilderSingularCustomized.SuperBuilderSingularCustomizedBuilder(foos=" + this.foos) + ")"); + } + } + private static final @java.lang.SuppressWarnings("all") class SuperBuilderSingularCustomizedBuilderImpl extends SuperBuilderSingularCustomized.SuperBuilderSingularCustomizedBuilder<SuperBuilderSingularCustomized, SuperBuilderSingularCustomized.SuperBuilderSingularCustomizedBuilderImpl> { + private SuperBuilderSingularCustomizedBuilderImpl() { + super(); + } + protected @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderSingularCustomized.SuperBuilderSingularCustomizedBuilderImpl self() { + return this; + } + public @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderSingularCustomized build() { + return new SuperBuilderSingularCustomized(this); + } + } + private @lombok.Singular Set<String> foos; + protected @java.lang.SuppressWarnings("all") SuperBuilderSingularCustomized(final SuperBuilderSingularCustomized.SuperBuilderSingularCustomizedBuilder<?, ?> b) { + super(); + java.util.Set<String> foos; + switch (((b.foos == null) ? 0 : b.foos.size())) { + case 0 : + foos = java.util.Collections.emptySet(); + break; + case 1 : + foos = java.util.Collections.singleton(b.foos.get(0)); + break; + default : + foos = new java.util.LinkedHashSet<String>(((b.foos.size() < 0x40000000) ? ((1 + b.foos.size()) + ((b.foos.size() - 3) / 3)) : java.lang.Integer.MAX_VALUE)); + foos.addAll(b.foos); + foos = java.util.Collections.unmodifiableSet(foos); + } + this.foos = foos; + } + public static @java.lang.SuppressWarnings("all") SuperBuilderSingularCustomized.SuperBuilderSingularCustomizedBuilder<?, ?> builder() { + return new SuperBuilderSingularCustomized.SuperBuilderSingularCustomizedBuilderImpl(); + } +}
\ No newline at end of file diff --git a/test/transform/resource/after-ecj/SuperBuilderWithCustomBuilderMethod.java b/test/transform/resource/after-ecj/SuperBuilderWithCustomBuilderMethod.java index 25f6f876..93b78c3d 100644 --- a/test/transform/resource/after-ecj/SuperBuilderWithCustomBuilderMethod.java +++ b/test/transform/resource/after-ecj/SuperBuilderWithCustomBuilderMethod.java @@ -1,116 +1,122 @@ -import java.util.List;
-public class SuperBuilderWithCustomBuilderMethod {
- public static @lombok.experimental.SuperBuilder class Parent<A> {
- public static abstract @java.lang.SuppressWarnings("all") class ParentBuilder<A, C extends SuperBuilderWithCustomBuilderMethod.Parent<A>, B extends SuperBuilderWithCustomBuilderMethod.Parent.ParentBuilder<A, C, B>> {
- private @java.lang.SuppressWarnings("all") A field1;
- private @java.lang.SuppressWarnings("all") java.util.ArrayList<String> items;
- public ParentBuilder() {
- super();
- }
- protected abstract @java.lang.SuppressWarnings("all") B self();
- public abstract @java.lang.SuppressWarnings("all") C build();
- public @java.lang.SuppressWarnings("all") B field1(final A field1) {
- this.field1 = field1;
- return self();
- }
- public @java.lang.SuppressWarnings("all") B item(final String item) {
- if ((this.items == null))
- this.items = new java.util.ArrayList<String>();
- this.items.add(item);
- return self();
- }
- public @java.lang.SuppressWarnings("all") B items(final java.util.Collection<? extends String> items) {
- if ((items == null))
- {
- throw new java.lang.NullPointerException("items cannot be null");
- }
- if ((this.items == null))
- this.items = new java.util.ArrayList<String>();
- this.items.addAll(items);
- return self();
- }
- public @java.lang.SuppressWarnings("all") B clearItems() {
- if ((this.items != null))
- this.items.clear();
- return self();
- }
- public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() {
- return (((("SuperBuilderWithCustomBuilderMethod.Parent.ParentBuilder(field1=" + this.field1) + ", items=") + this.items) + ")");
- }
- }
- private static final @java.lang.SuppressWarnings("all") class ParentBuilderImpl<A> extends SuperBuilderWithCustomBuilderMethod.Parent.ParentBuilder<A, SuperBuilderWithCustomBuilderMethod.Parent<A>, SuperBuilderWithCustomBuilderMethod.Parent.ParentBuilderImpl<A>> {
- private ParentBuilderImpl() {
- super();
- }
- protected @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderWithCustomBuilderMethod.Parent.ParentBuilderImpl<A> self() {
- return this;
- }
- public @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderWithCustomBuilderMethod.Parent<A> build() {
- return new SuperBuilderWithCustomBuilderMethod.Parent<A>(this);
- }
- }
- A field1;
- @lombok.Singular List<String> items;
- protected @java.lang.SuppressWarnings("all") Parent(final SuperBuilderWithCustomBuilderMethod.Parent.ParentBuilder<A, ?, ?> b) {
- super();
- this.field1 = b.field1;
- java.util.List<String> items;
- switch (((b.items == null) ? 0 : b.items.size())) {
- case 0 :
- items = java.util.Collections.emptyList();
- break;
- case 1 :
- items = java.util.Collections.singletonList(b.items.get(0));
- break;
- default :
- items = java.util.Collections.unmodifiableList(new java.util.ArrayList<String>(b.items));
- }
- this.items = items;
- }
- public static @java.lang.SuppressWarnings("all") <A>SuperBuilderWithCustomBuilderMethod.Parent.ParentBuilder<A, ?, ?> builder() {
- return new SuperBuilderWithCustomBuilderMethod.Parent.ParentBuilderImpl<A>();
- }
- }
- public static @lombok.experimental.SuperBuilder class Child<A> extends Parent<A> {
- public static abstract @java.lang.SuppressWarnings("all") class ChildBuilder<A, C extends SuperBuilderWithCustomBuilderMethod.Child<A>, B extends SuperBuilderWithCustomBuilderMethod.Child.ChildBuilder<A, C, B>> extends Parent.ParentBuilder<A, C, B> {
- private @java.lang.SuppressWarnings("all") double field3;
- 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();
- public @java.lang.SuppressWarnings("all") B field3(final double field3) {
- this.field3 = field3;
- return self();
- }
- public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() {
- return (((("SuperBuilderWithCustomBuilderMethod.Child.ChildBuilder(super=" + super.toString()) + ", field3=") + this.field3) + ")");
- }
- }
- private static final @java.lang.SuppressWarnings("all") class ChildBuilderImpl<A> extends SuperBuilderWithCustomBuilderMethod.Child.ChildBuilder<A, SuperBuilderWithCustomBuilderMethod.Child<A>, SuperBuilderWithCustomBuilderMethod.Child.ChildBuilderImpl<A>> {
- private ChildBuilderImpl() {
- super();
- }
- protected @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderWithCustomBuilderMethod.Child.ChildBuilderImpl<A> self() {
- return this;
- }
- public @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderWithCustomBuilderMethod.Child<A> build() {
- return new SuperBuilderWithCustomBuilderMethod.Child<A>(this);
- }
- }
- double field3;
- public static <A>ChildBuilder<A, ?, ?> builder() {
- return new ChildBuilderImpl<A>().item("default item");
- }
- protected @java.lang.SuppressWarnings("all") Child(final SuperBuilderWithCustomBuilderMethod.Child.ChildBuilder<A, ?, ?> b) {
- super(b);
- this.field3 = b.field3;
- }
- }
- public SuperBuilderWithCustomBuilderMethod() {
- super();
- }
- public static void test() {
- Child<Integer> x = Child.<Integer>builder().field3(0.0).field1(5).item("").build();
- }
-}
+import java.util.List; +public class SuperBuilderWithCustomBuilderMethod { + public static @lombok.experimental.SuperBuilder class Parent<A> { + public static abstract @java.lang.SuppressWarnings("all") class ParentBuilder<A, C extends SuperBuilderWithCustomBuilderMethod.Parent<A>, B extends SuperBuilderWithCustomBuilderMethod.Parent.ParentBuilder<A, C, B>> { + private @java.lang.SuppressWarnings("all") A field1; + private @java.lang.SuppressWarnings("all") java.util.ArrayList<String> items; + public ParentBuilder() { + super(); + } + protected abstract @java.lang.SuppressWarnings("all") B self(); + public abstract @java.lang.SuppressWarnings("all") C build(); + /** + * @return {@code this}. + */ + public @java.lang.SuppressWarnings("all") B field1(final A field1) { + this.field1 = field1; + return self(); + } + public @java.lang.SuppressWarnings("all") B item(final String item) { + if ((this.items == null)) + this.items = new java.util.ArrayList<String>(); + this.items.add(item); + return self(); + } + public @java.lang.SuppressWarnings("all") B items(final java.util.Collection<? extends String> items) { + if ((items == null)) + { + throw new java.lang.NullPointerException("items cannot be null"); + } + if ((this.items == null)) + this.items = new java.util.ArrayList<String>(); + this.items.addAll(items); + return self(); + } + public @java.lang.SuppressWarnings("all") B clearItems() { + if ((this.items != null)) + this.items.clear(); + return self(); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (((("SuperBuilderWithCustomBuilderMethod.Parent.ParentBuilder(field1=" + this.field1) + ", items=") + this.items) + ")"); + } + } + private static final @java.lang.SuppressWarnings("all") class ParentBuilderImpl<A> extends SuperBuilderWithCustomBuilderMethod.Parent.ParentBuilder<A, SuperBuilderWithCustomBuilderMethod.Parent<A>, SuperBuilderWithCustomBuilderMethod.Parent.ParentBuilderImpl<A>> { + private ParentBuilderImpl() { + super(); + } + protected @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderWithCustomBuilderMethod.Parent.ParentBuilderImpl<A> self() { + return this; + } + public @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderWithCustomBuilderMethod.Parent<A> build() { + return new SuperBuilderWithCustomBuilderMethod.Parent<A>(this); + } + } + A field1; + @lombok.Singular List<String> items; + protected @java.lang.SuppressWarnings("all") Parent(final SuperBuilderWithCustomBuilderMethod.Parent.ParentBuilder<A, ?, ?> b) { + super(); + this.field1 = b.field1; + java.util.List<String> items; + switch (((b.items == null) ? 0 : b.items.size())) { + case 0 : + items = java.util.Collections.emptyList(); + break; + case 1 : + items = java.util.Collections.singletonList(b.items.get(0)); + break; + default : + items = java.util.Collections.unmodifiableList(new java.util.ArrayList<String>(b.items)); + } + this.items = items; + } + public static @java.lang.SuppressWarnings("all") <A>SuperBuilderWithCustomBuilderMethod.Parent.ParentBuilder<A, ?, ?> builder() { + return new SuperBuilderWithCustomBuilderMethod.Parent.ParentBuilderImpl<A>(); + } + } + public static @lombok.experimental.SuperBuilder class Child<A> extends Parent<A> { + public static abstract @java.lang.SuppressWarnings("all") class ChildBuilder<A, C extends SuperBuilderWithCustomBuilderMethod.Child<A>, B extends SuperBuilderWithCustomBuilderMethod.Child.ChildBuilder<A, C, B>> extends Parent.ParentBuilder<A, C, B> { + private @java.lang.SuppressWarnings("all") double field3; + 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}. + */ + public @java.lang.SuppressWarnings("all") B field3(final double field3) { + this.field3 = field3; + return self(); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (((("SuperBuilderWithCustomBuilderMethod.Child.ChildBuilder(super=" + super.toString()) + ", field3=") + this.field3) + ")"); + } + } + private static final @java.lang.SuppressWarnings("all") class ChildBuilderImpl<A> extends SuperBuilderWithCustomBuilderMethod.Child.ChildBuilder<A, SuperBuilderWithCustomBuilderMethod.Child<A>, SuperBuilderWithCustomBuilderMethod.Child.ChildBuilderImpl<A>> { + private ChildBuilderImpl() { + super(); + } + protected @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderWithCustomBuilderMethod.Child.ChildBuilderImpl<A> self() { + return this; + } + public @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderWithCustomBuilderMethod.Child<A> build() { + return new SuperBuilderWithCustomBuilderMethod.Child<A>(this); + } + } + double field3; + public static <A>ChildBuilder<A, ?, ?> builder() { + return new ChildBuilderImpl<A>().item("default item"); + } + protected @java.lang.SuppressWarnings("all") Child(final SuperBuilderWithCustomBuilderMethod.Child.ChildBuilder<A, ?, ?> b) { + super(b); + this.field3 = b.field3; + } + } + public SuperBuilderWithCustomBuilderMethod() { + super(); + } + public static void test() { + Child<Integer> x = Child.<Integer>builder().field3(0.0).field1(5).item("").build(); + } +} diff --git a/test/transform/resource/after-ecj/SuperBuilderWithDefaults.java b/test/transform/resource/after-ecj/SuperBuilderWithDefaults.java index 03bfd319..7c5a344a 100644 --- a/test/transform/resource/after-ecj/SuperBuilderWithDefaults.java +++ b/test/transform/resource/after-ecj/SuperBuilderWithDefaults.java @@ -1,112 +1,121 @@ -import java.util.List;
-public class SuperBuilderWithDefaults {
- public static @lombok.experimental.SuperBuilder class Parent<N extends Number> {
- public static abstract @java.lang.SuppressWarnings("all") class ParentBuilder<N extends Number, C extends SuperBuilderWithDefaults.Parent<N>, B extends SuperBuilderWithDefaults.Parent.ParentBuilder<N, C, B>> {
- private @java.lang.SuppressWarnings("all") long millis$value;
- private @java.lang.SuppressWarnings("all") boolean millis$set;
- private @java.lang.SuppressWarnings("all") N numberField$value;
- private @java.lang.SuppressWarnings("all") boolean numberField$set;
- public ParentBuilder() {
- super();
- }
- protected abstract @java.lang.SuppressWarnings("all") B self();
- public abstract @java.lang.SuppressWarnings("all") C build();
- public @java.lang.SuppressWarnings("all") B millis(final long millis) {
- this.millis$value = millis;
- millis$set = true;
- return self();
- }
- public @java.lang.SuppressWarnings("all") B numberField(final N numberField) {
- this.numberField$value = numberField;
- numberField$set = true;
- return self();
- }
- 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) + ")");
- }
- }
- private static final @java.lang.SuppressWarnings("all") class ParentBuilderImpl<N extends Number> extends SuperBuilderWithDefaults.Parent.ParentBuilder<N, SuperBuilderWithDefaults.Parent<N>, SuperBuilderWithDefaults.Parent.ParentBuilderImpl<N>> {
- private ParentBuilderImpl() {
- super();
- }
- protected @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderWithDefaults.Parent.ParentBuilderImpl<N> self() {
- return this;
- }
- public @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderWithDefaults.Parent<N> build() {
- return new SuperBuilderWithDefaults.Parent<N>(this);
- }
- }
- private @lombok.Builder.Default long millis;
- private @lombok.Builder.Default N numberField;
- private static @java.lang.SuppressWarnings("all") <N extends Number>long $default$millis() {
- return System.currentTimeMillis();
- }
- private static @java.lang.SuppressWarnings("all") <N extends Number>N $default$numberField() {
- return null;
- }
- protected @java.lang.SuppressWarnings("all") Parent(final SuperBuilderWithDefaults.Parent.ParentBuilder<N, ?, ?> b) {
- super();
- if (b.millis$set)
- this.millis = b.millis$value;
- else
- this.millis = SuperBuilderWithDefaults.Parent.<N>$default$millis();
- if (b.numberField$set)
- this.numberField = b.numberField$value;
- else
- this.numberField = SuperBuilderWithDefaults.Parent.<N>$default$numberField();
- }
- public static @java.lang.SuppressWarnings("all") <N extends Number>SuperBuilderWithDefaults.Parent.ParentBuilder<N, ?, ?> builder() {
- return new SuperBuilderWithDefaults.Parent.ParentBuilderImpl<N>();
- }
- }
- public static @lombok.experimental.SuperBuilder class Child extends Parent<Integer> {
- public static abstract @java.lang.SuppressWarnings("all") class ChildBuilder<C extends SuperBuilderWithDefaults.Child, B extends SuperBuilderWithDefaults.Child.ChildBuilder<C, B>> extends Parent.ParentBuilder<Integer, C, B> {
- private @java.lang.SuppressWarnings("all") double doubleField$value;
- private @java.lang.SuppressWarnings("all") boolean doubleField$set;
- 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();
- public @java.lang.SuppressWarnings("all") B doubleField(final double doubleField) {
- this.doubleField$value = doubleField;
- doubleField$set = true;
- return self();
- }
- public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() {
- return (((("SuperBuilderWithDefaults.Child.ChildBuilder(super=" + super.toString()) + ", doubleField$value=") + this.doubleField$value) + ")");
- }
- }
- private static final @java.lang.SuppressWarnings("all") class ChildBuilderImpl extends SuperBuilderWithDefaults.Child.ChildBuilder<SuperBuilderWithDefaults.Child, SuperBuilderWithDefaults.Child.ChildBuilderImpl> {
- private ChildBuilderImpl() {
- super();
- }
- protected @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderWithDefaults.Child.ChildBuilderImpl self() {
- return this;
- }
- public @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderWithDefaults.Child build() {
- return new SuperBuilderWithDefaults.Child(this);
- }
- }
- private @lombok.Builder.Default double doubleField;
- private static @java.lang.SuppressWarnings("all") double $default$doubleField() {
- return Math.PI;
- }
- protected @java.lang.SuppressWarnings("all") Child(final SuperBuilderWithDefaults.Child.ChildBuilder<?, ?> b) {
- super(b);
- if (b.doubleField$set)
- this.doubleField = b.doubleField$value;
- else
- this.doubleField = SuperBuilderWithDefaults.Child.$default$doubleField();
- }
- public static @java.lang.SuppressWarnings("all") SuperBuilderWithDefaults.Child.ChildBuilder<?, ?> builder() {
- return new SuperBuilderWithDefaults.Child.ChildBuilderImpl();
- }
- }
- public SuperBuilderWithDefaults() {
- super();
- }
- public static void test() {
- Child x = Child.builder().doubleField(0.1).numberField(5).millis(1234567890L).build();
- }
-}
+import java.util.List; +public class SuperBuilderWithDefaults { + public static @lombok.experimental.SuperBuilder class Parent<N extends Number> { + public static abstract @java.lang.SuppressWarnings("all") class ParentBuilder<N extends Number, C extends SuperBuilderWithDefaults.Parent<N>, B extends SuperBuilderWithDefaults.Parent.ParentBuilder<N, C, B>> { + private @java.lang.SuppressWarnings("all") long millis$value; + private @java.lang.SuppressWarnings("all") boolean millis$set; + private @java.lang.SuppressWarnings("all") N numberField$value; + private @java.lang.SuppressWarnings("all") boolean numberField$set; + public ParentBuilder() { + super(); + } + protected abstract @java.lang.SuppressWarnings("all") B self(); + public abstract @java.lang.SuppressWarnings("all") C build(); + /** + * @return {@code this}. + */ + public @java.lang.SuppressWarnings("all") B millis(final long millis) { + this.millis$value = millis; + millis$set = true; + return self(); + } + /** + * @return {@code this}. + */ + public @java.lang.SuppressWarnings("all") B numberField(final N numberField) { + this.numberField$value = numberField; + numberField$set = true; + return self(); + } + 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) + ")"); + } + } + private static final @java.lang.SuppressWarnings("all") class ParentBuilderImpl<N extends Number> extends SuperBuilderWithDefaults.Parent.ParentBuilder<N, SuperBuilderWithDefaults.Parent<N>, SuperBuilderWithDefaults.Parent.ParentBuilderImpl<N>> { + private ParentBuilderImpl() { + super(); + } + protected @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderWithDefaults.Parent.ParentBuilderImpl<N> self() { + return this; + } + public @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderWithDefaults.Parent<N> build() { + return new SuperBuilderWithDefaults.Parent<N>(this); + } + } + private @lombok.Builder.Default long millis; + private @lombok.Builder.Default N numberField; + private static @java.lang.SuppressWarnings("all") <N extends Number>long $default$millis() { + return System.currentTimeMillis(); + } + private static @java.lang.SuppressWarnings("all") <N extends Number>N $default$numberField() { + return null; + } + protected @java.lang.SuppressWarnings("all") Parent(final SuperBuilderWithDefaults.Parent.ParentBuilder<N, ?, ?> b) { + super(); + if (b.millis$set) + this.millis = b.millis$value; + else + this.millis = SuperBuilderWithDefaults.Parent.<N>$default$millis(); + if (b.numberField$set) + this.numberField = b.numberField$value; + else + this.numberField = SuperBuilderWithDefaults.Parent.<N>$default$numberField(); + } + public static @java.lang.SuppressWarnings("all") <N extends Number>SuperBuilderWithDefaults.Parent.ParentBuilder<N, ?, ?> builder() { + return new SuperBuilderWithDefaults.Parent.ParentBuilderImpl<N>(); + } + } + public static @lombok.experimental.SuperBuilder class Child extends Parent<Integer> { + public static abstract @java.lang.SuppressWarnings("all") class ChildBuilder<C extends SuperBuilderWithDefaults.Child, B extends SuperBuilderWithDefaults.Child.ChildBuilder<C, B>> extends Parent.ParentBuilder<Integer, C, B> { + private @java.lang.SuppressWarnings("all") double doubleField$value; + private @java.lang.SuppressWarnings("all") boolean doubleField$set; + 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}. + */ + public @java.lang.SuppressWarnings("all") B doubleField(final double doubleField) { + this.doubleField$value = doubleField; + doubleField$set = true; + return self(); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (((("SuperBuilderWithDefaults.Child.ChildBuilder(super=" + super.toString()) + ", doubleField$value=") + this.doubleField$value) + ")"); + } + } + private static final @java.lang.SuppressWarnings("all") class ChildBuilderImpl extends SuperBuilderWithDefaults.Child.ChildBuilder<SuperBuilderWithDefaults.Child, SuperBuilderWithDefaults.Child.ChildBuilderImpl> { + private ChildBuilderImpl() { + super(); + } + protected @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderWithDefaults.Child.ChildBuilderImpl self() { + return this; + } + public @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderWithDefaults.Child build() { + return new SuperBuilderWithDefaults.Child(this); + } + } + private @lombok.Builder.Default double doubleField; + private static @java.lang.SuppressWarnings("all") double $default$doubleField() { + return Math.PI; + } + protected @java.lang.SuppressWarnings("all") Child(final SuperBuilderWithDefaults.Child.ChildBuilder<?, ?> b) { + super(b); + if (b.doubleField$set) + this.doubleField = b.doubleField$value; + else + this.doubleField = SuperBuilderWithDefaults.Child.$default$doubleField(); + } + public static @java.lang.SuppressWarnings("all") SuperBuilderWithDefaults.Child.ChildBuilder<?, ?> builder() { + return new SuperBuilderWithDefaults.Child.ChildBuilderImpl(); + } + } + public SuperBuilderWithDefaults() { + super(); + } + public static void test() { + Child x = Child.builder().doubleField(0.1).numberField(5).millis(1234567890L).build(); + } +} diff --git a/test/transform/resource/after-ecj/SuperBuilderWithExistingConstructor.java b/test/transform/resource/after-ecj/SuperBuilderWithExistingConstructor.java new file mode 100644 index 00000000..d42c3ca7 --- /dev/null +++ b/test/transform/resource/after-ecj/SuperBuilderWithExistingConstructor.java @@ -0,0 +1,32 @@ +public @lombok.experimental.SuperBuilder class SuperBuilderWithExistingConstructor { + public static abstract @java.lang.SuppressWarnings("all") class SuperBuilderWithExistingConstructorBuilder<C extends SuperBuilderWithExistingConstructor, B extends SuperBuilderWithExistingConstructor.SuperBuilderWithExistingConstructorBuilder<C, B>> { + public SuperBuilderWithExistingConstructorBuilder() { + super(); + } + 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 "SuperBuilderWithExistingConstructor.SuperBuilderWithExistingConstructorBuilder()"; + } + } + private static final @java.lang.SuppressWarnings("all") class SuperBuilderWithExistingConstructorBuilderImpl extends SuperBuilderWithExistingConstructor.SuperBuilderWithExistingConstructorBuilder<SuperBuilderWithExistingConstructor, SuperBuilderWithExistingConstructor.SuperBuilderWithExistingConstructorBuilderImpl> { + private SuperBuilderWithExistingConstructorBuilderImpl() { + super(); + } + protected @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderWithExistingConstructor.SuperBuilderWithExistingConstructorBuilderImpl self() { + return this; + } + public @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderWithExistingConstructor build() { + return new SuperBuilderWithExistingConstructor(this); + } + } + public SuperBuilderWithExistingConstructor() { + super(); + } + protected @java.lang.SuppressWarnings("all") SuperBuilderWithExistingConstructor(final SuperBuilderWithExistingConstructor.SuperBuilderWithExistingConstructorBuilder<?, ?> b) { + super(); + } + public static @java.lang.SuppressWarnings("all") SuperBuilderWithExistingConstructor.SuperBuilderWithExistingConstructorBuilder<?, ?> builder() { + return new SuperBuilderWithExistingConstructor.SuperBuilderWithExistingConstructorBuilderImpl(); + } +}
\ No newline at end of file diff --git a/test/transform/resource/after-ecj/SuperBuilderWithGenerics.java b/test/transform/resource/after-ecj/SuperBuilderWithGenerics.java index 6bda526e..db989687 100644 --- a/test/transform/resource/after-ecj/SuperBuilderWithGenerics.java +++ b/test/transform/resource/after-ecj/SuperBuilderWithGenerics.java @@ -1,116 +1,122 @@ -import java.util.List;
-public class SuperBuilderWithGenerics {
- public static @lombok.experimental.SuperBuilder class Parent<A> {
- public static abstract @java.lang.SuppressWarnings("all") class ParentBuilder<A, C extends SuperBuilderWithGenerics.Parent<A>, B extends SuperBuilderWithGenerics.Parent.ParentBuilder<A, C, B>> {
- private @java.lang.SuppressWarnings("all") A field1;
- private @java.lang.SuppressWarnings("all") java.util.ArrayList<String> items;
- public ParentBuilder() {
- super();
- }
- protected abstract @java.lang.SuppressWarnings("all") B self();
- public abstract @java.lang.SuppressWarnings("all") C build();
- public @java.lang.SuppressWarnings("all") B field1(final A field1) {
- this.field1 = field1;
- return self();
- }
- public @java.lang.SuppressWarnings("all") B item(final String item) {
- if ((this.items == null))
- this.items = new java.util.ArrayList<String>();
- this.items.add(item);
- return self();
- }
- public @java.lang.SuppressWarnings("all") B items(final java.util.Collection<? extends String> items) {
- if ((items == null))
- {
- throw new java.lang.NullPointerException("items cannot be null");
- }
- if ((this.items == null))
- this.items = new java.util.ArrayList<String>();
- this.items.addAll(items);
- return self();
- }
- public @java.lang.SuppressWarnings("all") B clearItems() {
- if ((this.items != null))
- this.items.clear();
- return self();
- }
- public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() {
- return (((("SuperBuilderWithGenerics.Parent.ParentBuilder(field1=" + this.field1) + ", items=") + this.items) + ")");
- }
- }
- private static final @java.lang.SuppressWarnings("all") class ParentBuilderImpl<A> extends SuperBuilderWithGenerics.Parent.ParentBuilder<A, SuperBuilderWithGenerics.Parent<A>, SuperBuilderWithGenerics.Parent.ParentBuilderImpl<A>> {
- private ParentBuilderImpl() {
- super();
- }
- protected @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderWithGenerics.Parent.ParentBuilderImpl<A> self() {
- return this;
- }
- public @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderWithGenerics.Parent<A> build() {
- return new SuperBuilderWithGenerics.Parent<A>(this);
- }
- }
- A field1;
- @lombok.Singular List<String> items;
- protected @java.lang.SuppressWarnings("all") Parent(final SuperBuilderWithGenerics.Parent.ParentBuilder<A, ?, ?> b) {
- super();
- this.field1 = b.field1;
- java.util.List<String> items;
- switch (((b.items == null) ? 0 : b.items.size())) {
- case 0 :
- items = java.util.Collections.emptyList();
- break;
- case 1 :
- items = java.util.Collections.singletonList(b.items.get(0));
- break;
- default :
- items = java.util.Collections.unmodifiableList(new java.util.ArrayList<String>(b.items));
- }
- this.items = items;
- }
- public static @java.lang.SuppressWarnings("all") <A>SuperBuilderWithGenerics.Parent.ParentBuilder<A, ?, ?> builder() {
- return new SuperBuilderWithGenerics.Parent.ParentBuilderImpl<A>();
- }
- }
- public static @lombok.experimental.SuperBuilder class Child<A> extends Parent<A> {
- public static abstract @java.lang.SuppressWarnings("all") class ChildBuilder<A, C extends SuperBuilderWithGenerics.Child<A>, B extends SuperBuilderWithGenerics.Child.ChildBuilder<A, C, B>> extends Parent.ParentBuilder<A, C, B> {
- private @java.lang.SuppressWarnings("all") double field3;
- 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();
- public @java.lang.SuppressWarnings("all") B field3(final double field3) {
- this.field3 = field3;
- return self();
- }
- public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() {
- return (((("SuperBuilderWithGenerics.Child.ChildBuilder(super=" + super.toString()) + ", field3=") + this.field3) + ")");
- }
- }
- private static final @java.lang.SuppressWarnings("all") class ChildBuilderImpl<A> extends SuperBuilderWithGenerics.Child.ChildBuilder<A, SuperBuilderWithGenerics.Child<A>, SuperBuilderWithGenerics.Child.ChildBuilderImpl<A>> {
- private ChildBuilderImpl() {
- super();
- }
- protected @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderWithGenerics.Child.ChildBuilderImpl<A> self() {
- return this;
- }
- public @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderWithGenerics.Child<A> build() {
- return new SuperBuilderWithGenerics.Child<A>(this);
- }
- }
- double field3;
- protected @java.lang.SuppressWarnings("all") Child(final SuperBuilderWithGenerics.Child.ChildBuilder<A, ?, ?> b) {
- super(b);
- this.field3 = b.field3;
- }
- public static @java.lang.SuppressWarnings("all") <A>SuperBuilderWithGenerics.Child.ChildBuilder<A, ?, ?> builder() {
- return new SuperBuilderWithGenerics.Child.ChildBuilderImpl<A>();
- }
- }
- public SuperBuilderWithGenerics() {
- super();
- }
- public static void test() {
- Child<Integer> x = Child.<Integer>builder().field3(0.0).field1(5).item("").build();
- }
-}
+import java.util.List; +public class SuperBuilderWithGenerics { + public static @lombok.experimental.SuperBuilder class Parent<A> { + public static abstract @java.lang.SuppressWarnings("all") class ParentBuilder<A, C extends SuperBuilderWithGenerics.Parent<A>, B extends SuperBuilderWithGenerics.Parent.ParentBuilder<A, C, B>> { + private @java.lang.SuppressWarnings("all") A field1; + private @java.lang.SuppressWarnings("all") java.util.ArrayList<String> items; + public ParentBuilder() { + super(); + } + protected abstract @java.lang.SuppressWarnings("all") B self(); + public abstract @java.lang.SuppressWarnings("all") C build(); + /** + * @return {@code this}. + */ + public @java.lang.SuppressWarnings("all") B field1(final A field1) { + this.field1 = field1; + return self(); + } + public @java.lang.SuppressWarnings("all") B item(final String item) { + if ((this.items == null)) + this.items = new java.util.ArrayList<String>(); + this.items.add(item); + return self(); + } + public @java.lang.SuppressWarnings("all") B items(final java.util.Collection<? extends String> items) { + if ((items == null)) + { + throw new java.lang.NullPointerException("items cannot be null"); + } + if ((this.items == null)) + this.items = new java.util.ArrayList<String>(); + this.items.addAll(items); + return self(); + } + public @java.lang.SuppressWarnings("all") B clearItems() { + if ((this.items != null)) + this.items.clear(); + return self(); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (((("SuperBuilderWithGenerics.Parent.ParentBuilder(field1=" + this.field1) + ", items=") + this.items) + ")"); + } + } + private static final @java.lang.SuppressWarnings("all") class ParentBuilderImpl<A> extends SuperBuilderWithGenerics.Parent.ParentBuilder<A, SuperBuilderWithGenerics.Parent<A>, SuperBuilderWithGenerics.Parent.ParentBuilderImpl<A>> { + private ParentBuilderImpl() { + super(); + } + protected @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderWithGenerics.Parent.ParentBuilderImpl<A> self() { + return this; + } + public @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderWithGenerics.Parent<A> build() { + return new SuperBuilderWithGenerics.Parent<A>(this); + } + } + A field1; + @lombok.Singular List<String> items; + protected @java.lang.SuppressWarnings("all") Parent(final SuperBuilderWithGenerics.Parent.ParentBuilder<A, ?, ?> b) { + super(); + this.field1 = b.field1; + java.util.List<String> items; + switch (((b.items == null) ? 0 : b.items.size())) { + case 0 : + items = java.util.Collections.emptyList(); + break; + case 1 : + items = java.util.Collections.singletonList(b.items.get(0)); + break; + default : + items = java.util.Collections.unmodifiableList(new java.util.ArrayList<String>(b.items)); + } + this.items = items; + } + public static @java.lang.SuppressWarnings("all") <A>SuperBuilderWithGenerics.Parent.ParentBuilder<A, ?, ?> builder() { + return new SuperBuilderWithGenerics.Parent.ParentBuilderImpl<A>(); + } + } + public static @lombok.experimental.SuperBuilder class Child<A> extends Parent<A> { + public static abstract @java.lang.SuppressWarnings("all") class ChildBuilder<A, C extends SuperBuilderWithGenerics.Child<A>, B extends SuperBuilderWithGenerics.Child.ChildBuilder<A, C, B>> extends Parent.ParentBuilder<A, C, B> { + private @java.lang.SuppressWarnings("all") double field3; + 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}. + */ + public @java.lang.SuppressWarnings("all") B field3(final double field3) { + this.field3 = field3; + return self(); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (((("SuperBuilderWithGenerics.Child.ChildBuilder(super=" + super.toString()) + ", field3=") + this.field3) + ")"); + } + } + private static final @java.lang.SuppressWarnings("all") class ChildBuilderImpl<A> extends SuperBuilderWithGenerics.Child.ChildBuilder<A, SuperBuilderWithGenerics.Child<A>, SuperBuilderWithGenerics.Child.ChildBuilderImpl<A>> { + private ChildBuilderImpl() { + super(); + } + protected @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderWithGenerics.Child.ChildBuilderImpl<A> self() { + return this; + } + public @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderWithGenerics.Child<A> build() { + return new SuperBuilderWithGenerics.Child<A>(this); + } + } + double field3; + protected @java.lang.SuppressWarnings("all") Child(final SuperBuilderWithGenerics.Child.ChildBuilder<A, ?, ?> b) { + super(b); + this.field3 = b.field3; + } + public static @java.lang.SuppressWarnings("all") <A>SuperBuilderWithGenerics.Child.ChildBuilder<A, ?, ?> builder() { + return new SuperBuilderWithGenerics.Child.ChildBuilderImpl<A>(); + } + } + public SuperBuilderWithGenerics() { + super(); + } + public static void test() { + Child<Integer> x = Child.<Integer>builder().field3(0.0).field1(5).item("").build(); + } +} diff --git a/test/transform/resource/after-ecj/SuperBuilderWithGenerics2.java b/test/transform/resource/after-ecj/SuperBuilderWithGenerics2.java index 4fac5de9..96e681f4 100644 --- a/test/transform/resource/after-ecj/SuperBuilderWithGenerics2.java +++ b/test/transform/resource/after-ecj/SuperBuilderWithGenerics2.java @@ -1,116 +1,122 @@ -import java.util.List;
-public class SuperBuilderWithGenerics2 {
- public static @lombok.experimental.SuperBuilder class Parent<A> {
- public static abstract @java.lang.SuppressWarnings("all") class ParentBuilder<A, C extends SuperBuilderWithGenerics2.Parent<A>, B extends SuperBuilderWithGenerics2.Parent.ParentBuilder<A, C, B>> {
- private @java.lang.SuppressWarnings("all") A field1;
- private @java.lang.SuppressWarnings("all") java.util.ArrayList<String> items;
- public ParentBuilder() {
- super();
- }
- protected abstract @java.lang.SuppressWarnings("all") B self();
- public abstract @java.lang.SuppressWarnings("all") C build();
- public @java.lang.SuppressWarnings("all") B field1(final A field1) {
- this.field1 = field1;
- return self();
- }
- public @java.lang.SuppressWarnings("all") B item(final String item) {
- if ((this.items == null))
- this.items = new java.util.ArrayList<String>();
- this.items.add(item);
- return self();
- }
- public @java.lang.SuppressWarnings("all") B items(final java.util.Collection<? extends String> items) {
- if ((items == null))
- {
- throw new java.lang.NullPointerException("items cannot be null");
- }
- if ((this.items == null))
- this.items = new java.util.ArrayList<String>();
- this.items.addAll(items);
- return self();
- }
- public @java.lang.SuppressWarnings("all") B clearItems() {
- if ((this.items != null))
- this.items.clear();
- return self();
- }
- public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() {
- return (((("SuperBuilderWithGenerics2.Parent.ParentBuilder(field1=" + this.field1) + ", items=") + this.items) + ")");
- }
- }
- private static final @java.lang.SuppressWarnings("all") class ParentBuilderImpl<A> extends SuperBuilderWithGenerics2.Parent.ParentBuilder<A, SuperBuilderWithGenerics2.Parent<A>, SuperBuilderWithGenerics2.Parent.ParentBuilderImpl<A>> {
- private ParentBuilderImpl() {
- super();
- }
- protected @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderWithGenerics2.Parent.ParentBuilderImpl<A> self() {
- return this;
- }
- public @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderWithGenerics2.Parent<A> build() {
- return new SuperBuilderWithGenerics2.Parent<A>(this);
- }
- }
- A field1;
- @lombok.Singular List<String> items;
- protected @java.lang.SuppressWarnings("all") Parent(final SuperBuilderWithGenerics2.Parent.ParentBuilder<A, ?, ?> b) {
- super();
- this.field1 = b.field1;
- java.util.List<String> items;
- switch (((b.items == null) ? 0 : b.items.size())) {
- case 0 :
- items = java.util.Collections.emptyList();
- break;
- case 1 :
- items = java.util.Collections.singletonList(b.items.get(0));
- break;
- default :
- items = java.util.Collections.unmodifiableList(new java.util.ArrayList<String>(b.items));
- }
- this.items = items;
- }
- public static @java.lang.SuppressWarnings("all") <A>SuperBuilderWithGenerics2.Parent.ParentBuilder<A, ?, ?> builder() {
- return new SuperBuilderWithGenerics2.Parent.ParentBuilderImpl<A>();
- }
- }
- public static @lombok.experimental.SuperBuilder(builderMethodName = "builder2") class Child<A> extends Parent<String> {
- public static abstract @java.lang.SuppressWarnings("all") class ChildBuilder<A, C extends SuperBuilderWithGenerics2.Child<A>, B extends SuperBuilderWithGenerics2.Child.ChildBuilder<A, C, B>> extends Parent.ParentBuilder<String, C, B> {
- private @java.lang.SuppressWarnings("all") A field3;
- 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();
- public @java.lang.SuppressWarnings("all") B field3(final A field3) {
- this.field3 = field3;
- return self();
- }
- public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() {
- return (((("SuperBuilderWithGenerics2.Child.ChildBuilder(super=" + super.toString()) + ", field3=") + this.field3) + ")");
- }
- }
- private static final @java.lang.SuppressWarnings("all") class ChildBuilderImpl<A> extends SuperBuilderWithGenerics2.Child.ChildBuilder<A, SuperBuilderWithGenerics2.Child<A>, SuperBuilderWithGenerics2.Child.ChildBuilderImpl<A>> {
- private ChildBuilderImpl() {
- super();
- }
- protected @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderWithGenerics2.Child.ChildBuilderImpl<A> self() {
- return this;
- }
- public @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderWithGenerics2.Child<A> build() {
- return new SuperBuilderWithGenerics2.Child<A>(this);
- }
- }
- A field3;
- protected @java.lang.SuppressWarnings("all") Child(final SuperBuilderWithGenerics2.Child.ChildBuilder<A, ?, ?> b) {
- super(b);
- this.field3 = b.field3;
- }
- public static @java.lang.SuppressWarnings("all") <A>SuperBuilderWithGenerics2.Child.ChildBuilder<A, ?, ?> builder2() {
- return new SuperBuilderWithGenerics2.Child.ChildBuilderImpl<A>();
- }
- }
- public SuperBuilderWithGenerics2() {
- super();
- }
- public static void test() {
- Child<Integer> x = Child.<Integer>builder2().field3(1).field1("value").item("").build();
- }
-}
+import java.util.List; +public class SuperBuilderWithGenerics2 { + public static @lombok.experimental.SuperBuilder class Parent<A> { + public static abstract @java.lang.SuppressWarnings("all") class ParentBuilder<A, C extends SuperBuilderWithGenerics2.Parent<A>, B extends SuperBuilderWithGenerics2.Parent.ParentBuilder<A, C, B>> { + private @java.lang.SuppressWarnings("all") A field1; + private @java.lang.SuppressWarnings("all") java.util.ArrayList<String> items; + public ParentBuilder() { + super(); + } + protected abstract @java.lang.SuppressWarnings("all") B self(); + public abstract @java.lang.SuppressWarnings("all") C build(); + /** + * @return {@code this}. + */ + public @java.lang.SuppressWarnings("all") B field1(final A field1) { + this.field1 = field1; + return self(); + } + public @java.lang.SuppressWarnings("all") B item(final String item) { + if ((this.items == null)) + this.items = new java.util.ArrayList<String>(); + this.items.add(item); + return self(); + } + public @java.lang.SuppressWarnings("all") B items(final java.util.Collection<? extends String> items) { + if ((items == null)) + { + throw new java.lang.NullPointerException("items cannot be null"); + } + if ((this.items == null)) + this.items = new java.util.ArrayList<String>(); + this.items.addAll(items); + return self(); + } + public @java.lang.SuppressWarnings("all") B clearItems() { + if ((this.items != null)) + this.items.clear(); + return self(); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (((("SuperBuilderWithGenerics2.Parent.ParentBuilder(field1=" + this.field1) + ", items=") + this.items) + ")"); + } + } + private static final @java.lang.SuppressWarnings("all") class ParentBuilderImpl<A> extends SuperBuilderWithGenerics2.Parent.ParentBuilder<A, SuperBuilderWithGenerics2.Parent<A>, SuperBuilderWithGenerics2.Parent.ParentBuilderImpl<A>> { + private ParentBuilderImpl() { + super(); + } + protected @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderWithGenerics2.Parent.ParentBuilderImpl<A> self() { + return this; + } + public @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderWithGenerics2.Parent<A> build() { + return new SuperBuilderWithGenerics2.Parent<A>(this); + } + } + A field1; + @lombok.Singular List<String> items; + protected @java.lang.SuppressWarnings("all") Parent(final SuperBuilderWithGenerics2.Parent.ParentBuilder<A, ?, ?> b) { + super(); + this.field1 = b.field1; + java.util.List<String> items; + switch (((b.items == null) ? 0 : b.items.size())) { + case 0 : + items = java.util.Collections.emptyList(); + break; + case 1 : + items = java.util.Collections.singletonList(b.items.get(0)); + break; + default : + items = java.util.Collections.unmodifiableList(new java.util.ArrayList<String>(b.items)); + } + this.items = items; + } + public static @java.lang.SuppressWarnings("all") <A>SuperBuilderWithGenerics2.Parent.ParentBuilder<A, ?, ?> builder() { + return new SuperBuilderWithGenerics2.Parent.ParentBuilderImpl<A>(); + } + } + public static @lombok.experimental.SuperBuilder(builderMethodName = "builder2") class Child<A> extends Parent<String> { + public static abstract @java.lang.SuppressWarnings("all") class ChildBuilder<A, C extends SuperBuilderWithGenerics2.Child<A>, B extends SuperBuilderWithGenerics2.Child.ChildBuilder<A, C, B>> extends Parent.ParentBuilder<String, C, B> { + private @java.lang.SuppressWarnings("all") A field3; + 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}. + */ + public @java.lang.SuppressWarnings("all") B field3(final A field3) { + this.field3 = field3; + return self(); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (((("SuperBuilderWithGenerics2.Child.ChildBuilder(super=" + super.toString()) + ", field3=") + this.field3) + ")"); + } + } + private static final @java.lang.SuppressWarnings("all") class ChildBuilderImpl<A> extends SuperBuilderWithGenerics2.Child.ChildBuilder<A, SuperBuilderWithGenerics2.Child<A>, SuperBuilderWithGenerics2.Child.ChildBuilderImpl<A>> { + private ChildBuilderImpl() { + super(); + } + protected @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderWithGenerics2.Child.ChildBuilderImpl<A> self() { + return this; + } + public @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderWithGenerics2.Child<A> build() { + return new SuperBuilderWithGenerics2.Child<A>(this); + } + } + A field3; + protected @java.lang.SuppressWarnings("all") Child(final SuperBuilderWithGenerics2.Child.ChildBuilder<A, ?, ?> b) { + super(b); + this.field3 = b.field3; + } + public static @java.lang.SuppressWarnings("all") <A>SuperBuilderWithGenerics2.Child.ChildBuilder<A, ?, ?> builder2() { + return new SuperBuilderWithGenerics2.Child.ChildBuilderImpl<A>(); + } + } + public SuperBuilderWithGenerics2() { + super(); + } + public static void test() { + Child<Integer> x = Child.<Integer>builder2().field3(1).field1("value").item("").build(); + } +} diff --git a/test/transform/resource/after-ecj/SuperBuilderWithGenerics3.java b/test/transform/resource/after-ecj/SuperBuilderWithGenerics3.java index 760c4439..8184bb05 100644 --- a/test/transform/resource/after-ecj/SuperBuilderWithGenerics3.java +++ b/test/transform/resource/after-ecj/SuperBuilderWithGenerics3.java @@ -8,6 +8,9 @@ public class SuperBuilderWithGenerics3 { } protected abstract @java.lang.SuppressWarnings("all") B self(); public abstract @java.lang.SuppressWarnings("all") C build(); + /** + * @return {@code this}. + */ public @java.lang.SuppressWarnings("all") B str(final String str) { this.str = str; return self(); @@ -49,6 +52,9 @@ public class SuperBuilderWithGenerics3 { } 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}. + */ public @java.lang.SuppressWarnings("all") B field3(final double field3) { this.field3 = field3; return self(); diff --git a/test/transform/resource/after-ecj/SuperBuilderWithGenericsAndToBuilder.java b/test/transform/resource/after-ecj/SuperBuilderWithGenericsAndToBuilder.java index 4e55ae38..829b50b9 100644 --- a/test/transform/resource/after-ecj/SuperBuilderWithGenericsAndToBuilder.java +++ b/test/transform/resource/after-ecj/SuperBuilderWithGenericsAndToBuilder.java @@ -1,156 +1,162 @@ -import java.util.Map;
-public class SuperBuilderWithGenericsAndToBuilder {
- public static @lombok.experimental.SuperBuilder(toBuilder = true) class Parent<A> {
- public static abstract @java.lang.SuppressWarnings("all") class ParentBuilder<A, C extends SuperBuilderWithGenericsAndToBuilder.Parent<A>, B extends SuperBuilderWithGenericsAndToBuilder.Parent.ParentBuilder<A, C, B>> {
- private @java.lang.SuppressWarnings("all") A field1;
- private @java.lang.SuppressWarnings("all") java.util.ArrayList<Integer> items$key;
- private @java.lang.SuppressWarnings("all") java.util.ArrayList<String> items$value;
- public ParentBuilder() {
- super();
- }
- protected @java.lang.SuppressWarnings("all") B $fillValuesFrom(final C instance) {
- SuperBuilderWithGenericsAndToBuilder.Parent.ParentBuilder.$fillValuesFromInstanceIntoBuilder(instance, this);
- return self();
- }
- private static @java.lang.SuppressWarnings("all") <A>void $fillValuesFromInstanceIntoBuilder(final SuperBuilderWithGenericsAndToBuilder.Parent<A> instance, final SuperBuilderWithGenericsAndToBuilder.Parent.ParentBuilder<A, ?, ?> b) {
- b.field1(instance.field1);
- b.items(((instance.items == null) ? java.util.Collections.emptyMap() : instance.items));
- }
- protected abstract @java.lang.SuppressWarnings("all") B self();
- public abstract @java.lang.SuppressWarnings("all") C build();
- public @java.lang.SuppressWarnings("all") B field1(final A field1) {
- this.field1 = field1;
- return self();
- }
- public @java.lang.SuppressWarnings("all") B item(final Integer itemKey, final String itemValue) {
- if ((this.items$key == null))
- {
- this.items$key = new java.util.ArrayList<Integer>();
- this.items$value = new java.util.ArrayList<String>();
- }
- this.items$key.add(itemKey);
- this.items$value.add(itemValue);
- return self();
- }
- public @java.lang.SuppressWarnings("all") B items(final java.util.Map<? extends Integer, ? extends String> items) {
- if ((items == null))
- {
- throw new java.lang.NullPointerException("items cannot be null");
- }
- if ((this.items$key == null))
- {
- this.items$key = new java.util.ArrayList<Integer>();
- this.items$value = new java.util.ArrayList<String>();
- }
- for (java.util.Map.Entry<? extends Integer, ? extends String> $lombokEntry : items.entrySet())
- {
- this.items$key.add($lombokEntry.getKey());
- this.items$value.add($lombokEntry.getValue());
- }
- return self();
- }
- public @java.lang.SuppressWarnings("all") B clearItems() {
- if ((this.items$key != null))
- {
- this.items$key.clear();
- this.items$value.clear();
- }
- return self();
- }
- 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) + ")");
- }
- }
- private static final @java.lang.SuppressWarnings("all") class ParentBuilderImpl<A> extends SuperBuilderWithGenericsAndToBuilder.Parent.ParentBuilder<A, SuperBuilderWithGenericsAndToBuilder.Parent<A>, SuperBuilderWithGenericsAndToBuilder.Parent.ParentBuilderImpl<A>> {
- private ParentBuilderImpl() {
- super();
- }
- protected @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderWithGenericsAndToBuilder.Parent.ParentBuilderImpl<A> self() {
- return this;
- }
- public @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderWithGenericsAndToBuilder.Parent<A> build() {
- return new SuperBuilderWithGenericsAndToBuilder.Parent<A>(this);
- }
- }
- A field1;
- @lombok.Singular Map<Integer, String> items;
- protected @java.lang.SuppressWarnings("all") Parent(final SuperBuilderWithGenericsAndToBuilder.Parent.ParentBuilder<A, ?, ?> b) {
- super();
- this.field1 = b.field1;
- java.util.Map<Integer, String> items;
- switch (((b.items$key == null) ? 0 : b.items$key.size())) {
- case 0 :
- items = java.util.Collections.emptyMap();
- break;
- case 1 :
- items = java.util.Collections.singletonMap(b.items$key.get(0), b.items$value.get(0));
- break;
- default :
- items = new java.util.LinkedHashMap<Integer, String>(((b.items$key.size() < 0x40000000) ? ((1 + b.items$key.size()) + ((b.items$key.size() - 3) / 3)) : java.lang.Integer.MAX_VALUE));
- for (int $i = 0;; ($i < b.items$key.size()); $i ++)
- items.put(b.items$key.get($i), b.items$value.get($i));
- items = java.util.Collections.unmodifiableMap(items);
- }
- this.items = items;
- }
- public @java.lang.SuppressWarnings("all") SuperBuilderWithGenericsAndToBuilder.Parent.ParentBuilder<A, ?, ?> toBuilder() {
- return new SuperBuilderWithGenericsAndToBuilder.Parent.ParentBuilderImpl<A>().$fillValuesFrom(this);
- }
- public static @java.lang.SuppressWarnings("all") <A>SuperBuilderWithGenericsAndToBuilder.Parent.ParentBuilder<A, ?, ?> builder() {
- return new SuperBuilderWithGenericsAndToBuilder.Parent.ParentBuilderImpl<A>();
- }
- }
- public static @lombok.experimental.SuperBuilder(toBuilder = true) class Child<A> extends Parent<A> {
- public static abstract @java.lang.SuppressWarnings("all") class ChildBuilder<A, C extends SuperBuilderWithGenericsAndToBuilder.Child<A>, B extends SuperBuilderWithGenericsAndToBuilder.Child.ChildBuilder<A, C, B>> extends Parent.ParentBuilder<A, C, B> {
- private @java.lang.SuppressWarnings("all") double field3;
- public ChildBuilder() {
- super();
- }
- protected @java.lang.Override @java.lang.SuppressWarnings("all") B $fillValuesFrom(final C instance) {
- super.$fillValuesFrom(instance);
- SuperBuilderWithGenericsAndToBuilder.Child.ChildBuilder.$fillValuesFromInstanceIntoBuilder(instance, this);
- return self();
- }
- 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();
- public @java.lang.SuppressWarnings("all") B field3(final double field3) {
- this.field3 = field3;
- return self();
- }
- public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() {
- return (((("SuperBuilderWithGenericsAndToBuilder.Child.ChildBuilder(super=" + super.toString()) + ", field3=") + this.field3) + ")");
- }
- }
- private static final @java.lang.SuppressWarnings("all") class ChildBuilderImpl<A> extends SuperBuilderWithGenericsAndToBuilder.Child.ChildBuilder<A, SuperBuilderWithGenericsAndToBuilder.Child<A>, SuperBuilderWithGenericsAndToBuilder.Child.ChildBuilderImpl<A>> {
- private ChildBuilderImpl() {
- super();
- }
- protected @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderWithGenericsAndToBuilder.Child.ChildBuilderImpl<A> self() {
- return this;
- }
- public @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderWithGenericsAndToBuilder.Child<A> build() {
- return new SuperBuilderWithGenericsAndToBuilder.Child<A>(this);
- }
- }
- double field3;
- protected @java.lang.SuppressWarnings("all") Child(final SuperBuilderWithGenericsAndToBuilder.Child.ChildBuilder<A, ?, ?> b) {
- super(b);
- this.field3 = b.field3;
- }
- public @java.lang.SuppressWarnings("all") SuperBuilderWithGenericsAndToBuilder.Child.ChildBuilder<A, ?, ?> toBuilder() {
- return new SuperBuilderWithGenericsAndToBuilder.Child.ChildBuilderImpl<A>().$fillValuesFrom(this);
- }
- public static @java.lang.SuppressWarnings("all") <A>SuperBuilderWithGenericsAndToBuilder.Child.ChildBuilder<A, ?, ?> builder() {
- return new SuperBuilderWithGenericsAndToBuilder.Child.ChildBuilderImpl<A>();
- }
- }
- public SuperBuilderWithGenericsAndToBuilder() {
- super();
- }
- public static void test() {
- Child<Integer> x = Child.<Integer>builder().field3(0.0).field1(5).item(5, "").build().toBuilder().build();
- }
-}
+import java.util.Map; +public class SuperBuilderWithGenericsAndToBuilder { + public static @lombok.experimental.SuperBuilder(toBuilder = true) class Parent<A> { + public static abstract @java.lang.SuppressWarnings("all") class ParentBuilder<A, C extends SuperBuilderWithGenericsAndToBuilder.Parent<A>, B extends SuperBuilderWithGenericsAndToBuilder.Parent.ParentBuilder<A, C, B>> { + private @java.lang.SuppressWarnings("all") A field1; + private @java.lang.SuppressWarnings("all") java.util.ArrayList<Integer> items$key; + private @java.lang.SuppressWarnings("all") java.util.ArrayList<String> items$value; + public ParentBuilder() { + super(); + } + protected @java.lang.SuppressWarnings("all") B $fillValuesFrom(final C instance) { + SuperBuilderWithGenericsAndToBuilder.Parent.ParentBuilder.$fillValuesFromInstanceIntoBuilder(instance, this); + return self(); + } + private static @java.lang.SuppressWarnings("all") <A>void $fillValuesFromInstanceIntoBuilder(final SuperBuilderWithGenericsAndToBuilder.Parent<A> instance, final SuperBuilderWithGenericsAndToBuilder.Parent.ParentBuilder<A, ?, ?> b) { + 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}. + */ + public @java.lang.SuppressWarnings("all") B field1(final A field1) { + this.field1 = field1; + return self(); + } + public @java.lang.SuppressWarnings("all") B item(final Integer itemKey, final String itemValue) { + if ((this.items$key == null)) + { + this.items$key = new java.util.ArrayList<Integer>(); + this.items$value = new java.util.ArrayList<String>(); + } + this.items$key.add(itemKey); + this.items$value.add(itemValue); + return self(); + } + public @java.lang.SuppressWarnings("all") B items(final java.util.Map<? extends Integer, ? extends String> items) { + if ((items == null)) + { + throw new java.lang.NullPointerException("items cannot be null"); + } + if ((this.items$key == null)) + { + this.items$key = new java.util.ArrayList<Integer>(); + this.items$value = new java.util.ArrayList<String>(); + } + for (java.util.Map.Entry<? extends Integer, ? extends String> $lombokEntry : items.entrySet()) + { + this.items$key.add($lombokEntry.getKey()); + this.items$value.add($lombokEntry.getValue()); + } + return self(); + } + public @java.lang.SuppressWarnings("all") B clearItems() { + if ((this.items$key != null)) + { + this.items$key.clear(); + this.items$value.clear(); + } + return self(); + } + 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) + ")"); + } + } + private static final @java.lang.SuppressWarnings("all") class ParentBuilderImpl<A> extends SuperBuilderWithGenericsAndToBuilder.Parent.ParentBuilder<A, SuperBuilderWithGenericsAndToBuilder.Parent<A>, SuperBuilderWithGenericsAndToBuilder.Parent.ParentBuilderImpl<A>> { + private ParentBuilderImpl() { + super(); + } + protected @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderWithGenericsAndToBuilder.Parent.ParentBuilderImpl<A> self() { + return this; + } + public @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderWithGenericsAndToBuilder.Parent<A> build() { + return new SuperBuilderWithGenericsAndToBuilder.Parent<A>(this); + } + } + A field1; + @lombok.Singular Map<Integer, String> items; + protected @java.lang.SuppressWarnings("all") Parent(final SuperBuilderWithGenericsAndToBuilder.Parent.ParentBuilder<A, ?, ?> b) { + super(); + this.field1 = b.field1; + java.util.Map<Integer, String> items; + switch (((b.items$key == null) ? 0 : b.items$key.size())) { + case 0 : + items = java.util.Collections.emptyMap(); + break; + case 1 : + items = java.util.Collections.singletonMap(b.items$key.get(0), b.items$value.get(0)); + break; + default : + items = new java.util.LinkedHashMap<Integer, String>(((b.items$key.size() < 0x40000000) ? ((1 + b.items$key.size()) + ((b.items$key.size() - 3) / 3)) : java.lang.Integer.MAX_VALUE)); + for (int $i = 0;; ($i < b.items$key.size()); $i ++) + items.put(b.items$key.get($i), b.items$value.get($i)); + items = java.util.Collections.unmodifiableMap(items); + } + this.items = items; + } + public @java.lang.SuppressWarnings("all") SuperBuilderWithGenericsAndToBuilder.Parent.ParentBuilder<A, ?, ?> toBuilder() { + return new SuperBuilderWithGenericsAndToBuilder.Parent.ParentBuilderImpl<A>().$fillValuesFrom(this); + } + public static @java.lang.SuppressWarnings("all") <A>SuperBuilderWithGenericsAndToBuilder.Parent.ParentBuilder<A, ?, ?> builder() { + return new SuperBuilderWithGenericsAndToBuilder.Parent.ParentBuilderImpl<A>(); + } + } + public static @lombok.experimental.SuperBuilder(toBuilder = true) class Child<A> extends Parent<A> { + public static abstract @java.lang.SuppressWarnings("all") class ChildBuilder<A, C extends SuperBuilderWithGenericsAndToBuilder.Child<A>, B extends SuperBuilderWithGenericsAndToBuilder.Child.ChildBuilder<A, C, B>> extends Parent.ParentBuilder<A, C, B> { + private @java.lang.SuppressWarnings("all") double field3; + public ChildBuilder() { + super(); + } + protected @java.lang.Override @java.lang.SuppressWarnings("all") B $fillValuesFrom(final C instance) { + super.$fillValuesFrom(instance); + SuperBuilderWithGenericsAndToBuilder.Child.ChildBuilder.$fillValuesFromInstanceIntoBuilder(instance, this); + return self(); + } + 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}. + */ + public @java.lang.SuppressWarnings("all") B field3(final double field3) { + this.field3 = field3; + return self(); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (((("SuperBuilderWithGenericsAndToBuilder.Child.ChildBuilder(super=" + super.toString()) + ", field3=") + this.field3) + ")"); + } + } + private static final @java.lang.SuppressWarnings("all") class ChildBuilderImpl<A> extends SuperBuilderWithGenericsAndToBuilder.Child.ChildBuilder<A, SuperBuilderWithGenericsAndToBuilder.Child<A>, SuperBuilderWithGenericsAndToBuilder.Child.ChildBuilderImpl<A>> { + private ChildBuilderImpl() { + super(); + } + protected @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderWithGenericsAndToBuilder.Child.ChildBuilderImpl<A> self() { + return this; + } + public @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderWithGenericsAndToBuilder.Child<A> build() { + return new SuperBuilderWithGenericsAndToBuilder.Child<A>(this); + } + } + double field3; + protected @java.lang.SuppressWarnings("all") Child(final SuperBuilderWithGenericsAndToBuilder.Child.ChildBuilder<A, ?, ?> b) { + super(b); + this.field3 = b.field3; + } + public @java.lang.SuppressWarnings("all") SuperBuilderWithGenericsAndToBuilder.Child.ChildBuilder<A, ?, ?> toBuilder() { + return new SuperBuilderWithGenericsAndToBuilder.Child.ChildBuilderImpl<A>().$fillValuesFrom(this); + } + public static @java.lang.SuppressWarnings("all") <A>SuperBuilderWithGenericsAndToBuilder.Child.ChildBuilder<A, ?, ?> builder() { + return new SuperBuilderWithGenericsAndToBuilder.Child.ChildBuilderImpl<A>(); + } + } + public SuperBuilderWithGenericsAndToBuilder() { + super(); + } + public static void test() { + Child<Integer> x = Child.<Integer>builder().field3(0.0).field1(5).item(5, "").build().toBuilder().build(); + } +} diff --git a/test/transform/resource/after-ecj/SuperBuilderWithNonNull.java b/test/transform/resource/after-ecj/SuperBuilderWithNonNull.java index f0a2bc00..28504f29 100644 --- a/test/transform/resource/after-ecj/SuperBuilderWithNonNull.java +++ b/test/transform/resource/after-ecj/SuperBuilderWithNonNull.java @@ -1,105 +1,111 @@ -import java.util.List;
-public class SuperBuilderWithNonNull {
- public static @lombok.experimental.SuperBuilder class Parent {
- public static abstract @java.lang.SuppressWarnings("all") class ParentBuilder<C extends SuperBuilderWithNonNull.Parent, B extends SuperBuilderWithNonNull.Parent.ParentBuilder<C, B>> {
- private @java.lang.SuppressWarnings("all") String nonNullParentField$value;
- private @java.lang.SuppressWarnings("all") boolean nonNullParentField$set;
- public ParentBuilder() {
- super();
- }
- protected abstract @java.lang.SuppressWarnings("all") B self();
- public abstract @java.lang.SuppressWarnings("all") C build();
- public @java.lang.SuppressWarnings("all") B nonNullParentField(final @lombok.NonNull String nonNullParentField) {
- if ((nonNullParentField == null))
- {
- throw new java.lang.NullPointerException("nonNullParentField is marked non-null but is null");
- }
- this.nonNullParentField$value = nonNullParentField;
- nonNullParentField$set = true;
- return self();
- }
- public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() {
- return (("SuperBuilderWithNonNull.Parent.ParentBuilder(nonNullParentField$value=" + this.nonNullParentField$value) + ")");
- }
- }
- private static final @java.lang.SuppressWarnings("all") class ParentBuilderImpl extends SuperBuilderWithNonNull.Parent.ParentBuilder<SuperBuilderWithNonNull.Parent, SuperBuilderWithNonNull.Parent.ParentBuilderImpl> {
- private ParentBuilderImpl() {
- super();
- }
- protected @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderWithNonNull.Parent.ParentBuilderImpl self() {
- return this;
- }
- public @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderWithNonNull.Parent build() {
- return new SuperBuilderWithNonNull.Parent(this);
- }
- }
- final @lombok.NonNull @lombok.Builder.Default String nonNullParentField;
- private static @java.lang.SuppressWarnings("all") String $default$nonNullParentField() {
- return "default";
- }
- protected @java.lang.SuppressWarnings("all") Parent(final SuperBuilderWithNonNull.Parent.ParentBuilder<?, ?> b) {
- super();
- if (b.nonNullParentField$set)
- this.nonNullParentField = b.nonNullParentField$value;
- else
- this.nonNullParentField = SuperBuilderWithNonNull.Parent.$default$nonNullParentField();
- if ((nonNullParentField == null))
- {
- throw new java.lang.NullPointerException("nonNullParentField is marked non-null but is null");
- }
- }
- public static @java.lang.SuppressWarnings("all") SuperBuilderWithNonNull.Parent.ParentBuilder<?, ?> builder() {
- return new SuperBuilderWithNonNull.Parent.ParentBuilderImpl();
- }
- }
- public static @lombok.experimental.SuperBuilder class Child extends Parent {
- public static abstract @java.lang.SuppressWarnings("all") class ChildBuilder<C extends SuperBuilderWithNonNull.Child, B extends SuperBuilderWithNonNull.Child.ChildBuilder<C, B>> extends Parent.ParentBuilder<C, B> {
- private @java.lang.SuppressWarnings("all") String nonNullChildField;
- 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();
- public @java.lang.SuppressWarnings("all") B nonNullChildField(final @lombok.NonNull String nonNullChildField) {
- if ((nonNullChildField == null))
- {
- throw new java.lang.NullPointerException("nonNullChildField is marked non-null but is null");
- }
- this.nonNullChildField = nonNullChildField;
- return self();
- }
- public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() {
- return (((("SuperBuilderWithNonNull.Child.ChildBuilder(super=" + super.toString()) + ", nonNullChildField=") + this.nonNullChildField) + ")");
- }
- }
- private static final @java.lang.SuppressWarnings("all") class ChildBuilderImpl extends SuperBuilderWithNonNull.Child.ChildBuilder<SuperBuilderWithNonNull.Child, SuperBuilderWithNonNull.Child.ChildBuilderImpl> {
- private ChildBuilderImpl() {
- super();
- }
- protected @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderWithNonNull.Child.ChildBuilderImpl self() {
- return this;
- }
- public @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderWithNonNull.Child build() {
- return new SuperBuilderWithNonNull.Child(this);
- }
- }
- @lombok.NonNull String nonNullChildField;
- protected @java.lang.SuppressWarnings("all") Child(final SuperBuilderWithNonNull.Child.ChildBuilder<?, ?> b) {
- super(b);
- this.nonNullChildField = b.nonNullChildField;
- if ((nonNullChildField == null))
- {
- throw new java.lang.NullPointerException("nonNullChildField is marked non-null but is null");
- }
- }
- public static @java.lang.SuppressWarnings("all") SuperBuilderWithNonNull.Child.ChildBuilder<?, ?> builder() {
- return new SuperBuilderWithNonNull.Child.ChildBuilderImpl();
- }
- }
- public SuperBuilderWithNonNull() {
- super();
- }
- public static void test() {
- Child x = Child.builder().nonNullChildField("child").nonNullParentField("parent").build();
- }
-}
+import java.util.List; +public class SuperBuilderWithNonNull { + public static @lombok.experimental.SuperBuilder class Parent { + public static abstract @java.lang.SuppressWarnings("all") class ParentBuilder<C extends SuperBuilderWithNonNull.Parent, B extends SuperBuilderWithNonNull.Parent.ParentBuilder<C, B>> { + private @java.lang.SuppressWarnings("all") String nonNullParentField$value; + private @java.lang.SuppressWarnings("all") boolean nonNullParentField$set; + public ParentBuilder() { + super(); + } + protected abstract @java.lang.SuppressWarnings("all") B self(); + public abstract @java.lang.SuppressWarnings("all") C build(); + /** + * @return {@code this}. + */ + public @java.lang.SuppressWarnings("all") B nonNullParentField(final @lombok.NonNull String nonNullParentField) { + if ((nonNullParentField == null)) + { + throw new java.lang.NullPointerException("nonNullParentField is marked non-null but is null"); + } + this.nonNullParentField$value = nonNullParentField; + nonNullParentField$set = true; + return self(); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (("SuperBuilderWithNonNull.Parent.ParentBuilder(nonNullParentField$value=" + this.nonNullParentField$value) + ")"); + } + } + private static final @java.lang.SuppressWarnings("all") class ParentBuilderImpl extends SuperBuilderWithNonNull.Parent.ParentBuilder<SuperBuilderWithNonNull.Parent, SuperBuilderWithNonNull.Parent.ParentBuilderImpl> { + private ParentBuilderImpl() { + super(); + } + protected @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderWithNonNull.Parent.ParentBuilderImpl self() { + return this; + } + public @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderWithNonNull.Parent build() { + return new SuperBuilderWithNonNull.Parent(this); + } + } + final @lombok.NonNull @lombok.Builder.Default String nonNullParentField; + private static @java.lang.SuppressWarnings("all") String $default$nonNullParentField() { + return "default"; + } + protected @java.lang.SuppressWarnings("all") Parent(final SuperBuilderWithNonNull.Parent.ParentBuilder<?, ?> b) { + super(); + if (b.nonNullParentField$set) + this.nonNullParentField = b.nonNullParentField$value; + else + this.nonNullParentField = SuperBuilderWithNonNull.Parent.$default$nonNullParentField(); + if ((nonNullParentField == null)) + { + throw new java.lang.NullPointerException("nonNullParentField is marked non-null but is null"); + } + } + public static @java.lang.SuppressWarnings("all") SuperBuilderWithNonNull.Parent.ParentBuilder<?, ?> builder() { + return new SuperBuilderWithNonNull.Parent.ParentBuilderImpl(); + } + } + public static @lombok.experimental.SuperBuilder class Child extends Parent { + public static abstract @java.lang.SuppressWarnings("all") class ChildBuilder<C extends SuperBuilderWithNonNull.Child, B extends SuperBuilderWithNonNull.Child.ChildBuilder<C, B>> extends Parent.ParentBuilder<C, B> { + private @java.lang.SuppressWarnings("all") String nonNullChildField; + 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}. + */ + public @java.lang.SuppressWarnings("all") B nonNullChildField(final @lombok.NonNull String nonNullChildField) { + if ((nonNullChildField == null)) + { + throw new java.lang.NullPointerException("nonNullChildField is marked non-null but is null"); + } + this.nonNullChildField = nonNullChildField; + return self(); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (((("SuperBuilderWithNonNull.Child.ChildBuilder(super=" + super.toString()) + ", nonNullChildField=") + this.nonNullChildField) + ")"); + } + } + private static final @java.lang.SuppressWarnings("all") class ChildBuilderImpl extends SuperBuilderWithNonNull.Child.ChildBuilder<SuperBuilderWithNonNull.Child, SuperBuilderWithNonNull.Child.ChildBuilderImpl> { + private ChildBuilderImpl() { + super(); + } + protected @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderWithNonNull.Child.ChildBuilderImpl self() { + return this; + } + public @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderWithNonNull.Child build() { + return new SuperBuilderWithNonNull.Child(this); + } + } + @lombok.NonNull String nonNullChildField; + protected @java.lang.SuppressWarnings("all") Child(final SuperBuilderWithNonNull.Child.ChildBuilder<?, ?> b) { + super(b); + this.nonNullChildField = b.nonNullChildField; + if ((nonNullChildField == null)) + { + throw new java.lang.NullPointerException("nonNullChildField is marked non-null but is null"); + } + } + public static @java.lang.SuppressWarnings("all") SuperBuilderWithNonNull.Child.ChildBuilder<?, ?> builder() { + return new SuperBuilderWithNonNull.Child.ChildBuilderImpl(); + } + } + public SuperBuilderWithNonNull() { + super(); + } + public static void test() { + Child x = Child.builder().nonNullChildField("child").nonNullParentField("parent").build(); + } +} diff --git a/test/transform/resource/after-ecj/SuperBuilderWithPrefixes.java b/test/transform/resource/after-ecj/SuperBuilderWithPrefixes.java index 1f972899..303d53f6 100644 --- a/test/transform/resource/after-ecj/SuperBuilderWithPrefixes.java +++ b/test/transform/resource/after-ecj/SuperBuilderWithPrefixes.java @@ -8,10 +8,16 @@ } protected abstract @java.lang.SuppressWarnings("all") B self(); public abstract @java.lang.SuppressWarnings("all") C build(); + /** + * @return {@code this}. + */ public @java.lang.SuppressWarnings("all") B field(final int field) { this.field = field; return self(); } + /** + * @return {@code this}. + */ public @java.lang.SuppressWarnings("all") B otherField(final int otherField) { this.otherField = otherField; return self(); diff --git a/test/transform/resource/after-ecj/SuperBuilderWithSetterPrefix.java b/test/transform/resource/after-ecj/SuperBuilderWithSetterPrefix.java index 6d24f613..3a1278c1 100644 --- a/test/transform/resource/after-ecj/SuperBuilderWithSetterPrefix.java +++ b/test/transform/resource/after-ecj/SuperBuilderWithSetterPrefix.java @@ -1,168 +1,183 @@ -import java.util.List;
-public class SuperBuilderWithSetterPrefix {
- public static @lombok.experimental.SuperBuilder(toBuilder = true,setterPrefix = "with") class Parent {
- public static abstract @java.lang.SuppressWarnings("all") class ParentBuilder<C extends SuperBuilderWithSetterPrefix.Parent, B extends SuperBuilderWithSetterPrefix.Parent.ParentBuilder<C, B>> {
- private @java.lang.SuppressWarnings("all") int field1;
- private @java.lang.SuppressWarnings("all") int obtainViaField;
- private @java.lang.SuppressWarnings("all") int obtainViaMethod;
- private @java.lang.SuppressWarnings("all") String obtainViaStaticMethod;
- private @java.lang.SuppressWarnings("all") java.util.ArrayList<String> items;
- public ParentBuilder() {
- super();
- }
- protected @java.lang.SuppressWarnings("all") B $fillValuesFrom(final C instance) {
- SuperBuilderWithSetterPrefix.Parent.ParentBuilder.$fillValuesFromInstanceIntoBuilder(instance, this);
- return self();
- }
- private static @java.lang.SuppressWarnings("all") void $fillValuesFromInstanceIntoBuilder(final SuperBuilderWithSetterPrefix.Parent instance, final SuperBuilderWithSetterPrefix.Parent.ParentBuilder<?, ?> b) {
- b.withField1(instance.field1);
- b.withObtainViaField(instance.field1);
- b.withObtainViaMethod(instance.method());
- b.withObtainViaStaticMethod(SuperBuilderWithSetterPrefix.Parent.staticMethod(instance));
- b.withItems(((instance.items == null) ? java.util.Collections.emptyList() : instance.items));
- }
- protected abstract @java.lang.SuppressWarnings("all") B self();
- public abstract @java.lang.SuppressWarnings("all") C build();
- public @java.lang.SuppressWarnings("all") B withField1(final int field1) {
- this.field1 = field1;
- return self();
- }
- public @java.lang.SuppressWarnings("all") B withObtainViaField(final int obtainViaField) {
- this.obtainViaField = obtainViaField;
- return self();
- }
- public @java.lang.SuppressWarnings("all") B withObtainViaMethod(final int obtainViaMethod) {
- this.obtainViaMethod = obtainViaMethod;
- return self();
- }
- public @java.lang.SuppressWarnings("all") B withObtainViaStaticMethod(final String obtainViaStaticMethod) {
- this.obtainViaStaticMethod = obtainViaStaticMethod;
- return self();
- }
- public @java.lang.SuppressWarnings("all") B withItem(final String item) {
- if ((this.items == null))
- this.items = new java.util.ArrayList<String>();
- this.items.add(item);
- return self();
- }
- public @java.lang.SuppressWarnings("all") B withItems(final java.util.Collection<? extends String> items) {
- if ((items == null))
- {
- throw new java.lang.NullPointerException("items cannot be null");
- }
- if ((this.items == null))
- this.items = new java.util.ArrayList<String>();
- this.items.addAll(items);
- return self();
- }
- public @java.lang.SuppressWarnings("all") B clearItems() {
- if ((this.items != null))
- this.items.clear();
- return self();
- }
- 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) + ")");
- }
- }
- private static final @java.lang.SuppressWarnings("all") class ParentBuilderImpl extends SuperBuilderWithSetterPrefix.Parent.ParentBuilder<SuperBuilderWithSetterPrefix.Parent, SuperBuilderWithSetterPrefix.Parent.ParentBuilderImpl> {
- private ParentBuilderImpl() {
- super();
- }
- protected @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderWithSetterPrefix.Parent.ParentBuilderImpl self() {
- return this;
- }
- public @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderWithSetterPrefix.Parent build() {
- return new SuperBuilderWithSetterPrefix.Parent(this);
- }
- }
- private int field1;
- @lombok.Builder.ObtainVia(field = "field1") int obtainViaField;
- @lombok.Builder.ObtainVia(method = "method") int obtainViaMethod;
- @lombok.Builder.ObtainVia(method = "staticMethod",isStatic = true) String obtainViaStaticMethod;
- @lombok.Singular List<String> items;
- private int method() {
- return 2;
- }
- private static String staticMethod(Parent instance) {
- return "staticMethod";
- }
- protected @java.lang.SuppressWarnings("all") Parent(final SuperBuilderWithSetterPrefix.Parent.ParentBuilder<?, ?> b) {
- super();
- this.field1 = b.field1;
- this.obtainViaField = b.obtainViaField;
- this.obtainViaMethod = b.obtainViaMethod;
- this.obtainViaStaticMethod = b.obtainViaStaticMethod;
- java.util.List<String> items;
- switch (((b.items == null) ? 0 : b.items.size())) {
- case 0 :
- items = java.util.Collections.emptyList();
- break;
- case 1 :
- items = java.util.Collections.singletonList(b.items.get(0));
- break;
- default :
- items = java.util.Collections.unmodifiableList(new java.util.ArrayList<String>(b.items));
- }
- this.items = items;
- }
- public @java.lang.SuppressWarnings("all") SuperBuilderWithSetterPrefix.Parent.ParentBuilder<?, ?> toBuilder() {
- return new SuperBuilderWithSetterPrefix.Parent.ParentBuilderImpl().$fillValuesFrom(this);
- }
- public static @java.lang.SuppressWarnings("all") SuperBuilderWithSetterPrefix.Parent.ParentBuilder<?, ?> builder() {
- return new SuperBuilderWithSetterPrefix.Parent.ParentBuilderImpl();
- }
- }
- public static @lombok.experimental.SuperBuilder(toBuilder = true,setterPrefix = "set") class Child extends Parent {
- public static abstract @java.lang.SuppressWarnings("all") class ChildBuilder<C extends SuperBuilderWithSetterPrefix.Child, B extends SuperBuilderWithSetterPrefix.Child.ChildBuilder<C, B>> extends Parent.ParentBuilder<C, B> {
- private @java.lang.SuppressWarnings("all") double field3;
- public ChildBuilder() {
- super();
- }
- protected @java.lang.Override @java.lang.SuppressWarnings("all") B $fillValuesFrom(final C instance) {
- super.$fillValuesFrom(instance);
- SuperBuilderWithSetterPrefix.Child.ChildBuilder.$fillValuesFromInstanceIntoBuilder(instance, this);
- return self();
- }
- 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();
- public @java.lang.SuppressWarnings("all") B setField3(final double field3) {
- this.field3 = field3;
- return self();
- }
- public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() {
- return (((("SuperBuilderWithSetterPrefix.Child.ChildBuilder(super=" + super.toString()) + ", field3=") + this.field3) + ")");
- }
- }
- private static final @java.lang.SuppressWarnings("all") class ChildBuilderImpl extends SuperBuilderWithSetterPrefix.Child.ChildBuilder<SuperBuilderWithSetterPrefix.Child, SuperBuilderWithSetterPrefix.Child.ChildBuilderImpl> {
- private ChildBuilderImpl() {
- super();
- }
- protected @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderWithSetterPrefix.Child.ChildBuilderImpl self() {
- return this;
- }
- public @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderWithSetterPrefix.Child build() {
- return new SuperBuilderWithSetterPrefix.Child(this);
- }
- }
- private double field3;
- protected @java.lang.SuppressWarnings("all") Child(final SuperBuilderWithSetterPrefix.Child.ChildBuilder<?, ?> b) {
- super(b);
- this.field3 = b.field3;
- }
- public @java.lang.SuppressWarnings("all") SuperBuilderWithSetterPrefix.Child.ChildBuilder<?, ?> toBuilder() {
- return new SuperBuilderWithSetterPrefix.Child.ChildBuilderImpl().$fillValuesFrom(this);
- }
- public static @java.lang.SuppressWarnings("all") SuperBuilderWithSetterPrefix.Child.ChildBuilder<?, ?> builder() {
- return new SuperBuilderWithSetterPrefix.Child.ChildBuilderImpl();
- }
- }
- public SuperBuilderWithSetterPrefix() {
- super();
- }
- public static void test() {
- Child x = Child.builder().setField3(0.0).withField1(5).withItem("").build().toBuilder().build();
- }
-}
+import java.util.List; +public class SuperBuilderWithSetterPrefix { + public static @lombok.experimental.SuperBuilder(toBuilder = true,setterPrefix = "with") class Parent { + public static abstract @java.lang.SuppressWarnings("all") class ParentBuilder<C extends SuperBuilderWithSetterPrefix.Parent, B extends SuperBuilderWithSetterPrefix.Parent.ParentBuilder<C, B>> { + private @java.lang.SuppressWarnings("all") int field1; + private @java.lang.SuppressWarnings("all") int obtainViaField; + private @java.lang.SuppressWarnings("all") int obtainViaMethod; + private @java.lang.SuppressWarnings("all") String obtainViaStaticMethod; + private @java.lang.SuppressWarnings("all") java.util.ArrayList<String> items; + public ParentBuilder() { + super(); + } + protected @java.lang.SuppressWarnings("all") B $fillValuesFrom(final C instance) { + SuperBuilderWithSetterPrefix.Parent.ParentBuilder.$fillValuesFromInstanceIntoBuilder(instance, this); + return self(); + } + private static @java.lang.SuppressWarnings("all") void $fillValuesFromInstanceIntoBuilder(final SuperBuilderWithSetterPrefix.Parent instance, final SuperBuilderWithSetterPrefix.Parent.ParentBuilder<?, ?> b) { + b.withField1(instance.field1); + b.withObtainViaField(instance.field1); + b.withObtainViaMethod(instance.method()); + 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}. + */ + public @java.lang.SuppressWarnings("all") B withField1(final int field1) { + this.field1 = field1; + return self(); + } + /** + * @return {@code this}. + */ + public @java.lang.SuppressWarnings("all") B withObtainViaField(final int obtainViaField) { + this.obtainViaField = obtainViaField; + return self(); + } + /** + * @return {@code this}. + */ + public @java.lang.SuppressWarnings("all") B withObtainViaMethod(final int obtainViaMethod) { + this.obtainViaMethod = obtainViaMethod; + return self(); + } + /** + * @return {@code this}. + */ + public @java.lang.SuppressWarnings("all") B withObtainViaStaticMethod(final String obtainViaStaticMethod) { + this.obtainViaStaticMethod = obtainViaStaticMethod; + return self(); + } + public @java.lang.SuppressWarnings("all") B withItem(final String item) { + if ((this.items == null)) + this.items = new java.util.ArrayList<String>(); + this.items.add(item); + return self(); + } + public @java.lang.SuppressWarnings("all") B withItems(final java.util.Collection<? extends String> items) { + if ((items == null)) + { + throw new java.lang.NullPointerException("items cannot be null"); + } + if ((this.items == null)) + this.items = new java.util.ArrayList<String>(); + this.items.addAll(items); + return self(); + } + public @java.lang.SuppressWarnings("all") B clearItems() { + if ((this.items != null)) + this.items.clear(); + return self(); + } + 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) + ")"); + } + } + private static final @java.lang.SuppressWarnings("all") class ParentBuilderImpl extends SuperBuilderWithSetterPrefix.Parent.ParentBuilder<SuperBuilderWithSetterPrefix.Parent, SuperBuilderWithSetterPrefix.Parent.ParentBuilderImpl> { + private ParentBuilderImpl() { + super(); + } + protected @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderWithSetterPrefix.Parent.ParentBuilderImpl self() { + return this; + } + public @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderWithSetterPrefix.Parent build() { + return new SuperBuilderWithSetterPrefix.Parent(this); + } + } + private int field1; + @lombok.Builder.ObtainVia(field = "field1") int obtainViaField; + @lombok.Builder.ObtainVia(method = "method") int obtainViaMethod; + @lombok.Builder.ObtainVia(method = "staticMethod",isStatic = true) String obtainViaStaticMethod; + @lombok.Singular List<String> items; + private int method() { + return 2; + } + private static String staticMethod(Parent instance) { + return "staticMethod"; + } + protected @java.lang.SuppressWarnings("all") Parent(final SuperBuilderWithSetterPrefix.Parent.ParentBuilder<?, ?> b) { + super(); + this.field1 = b.field1; + this.obtainViaField = b.obtainViaField; + this.obtainViaMethod = b.obtainViaMethod; + this.obtainViaStaticMethod = b.obtainViaStaticMethod; + java.util.List<String> items; + switch (((b.items == null) ? 0 : b.items.size())) { + case 0 : + items = java.util.Collections.emptyList(); + break; + case 1 : + items = java.util.Collections.singletonList(b.items.get(0)); + break; + default : + items = java.util.Collections.unmodifiableList(new java.util.ArrayList<String>(b.items)); + } + this.items = items; + } + public @java.lang.SuppressWarnings("all") SuperBuilderWithSetterPrefix.Parent.ParentBuilder<?, ?> toBuilder() { + return new SuperBuilderWithSetterPrefix.Parent.ParentBuilderImpl().$fillValuesFrom(this); + } + public static @java.lang.SuppressWarnings("all") SuperBuilderWithSetterPrefix.Parent.ParentBuilder<?, ?> builder() { + return new SuperBuilderWithSetterPrefix.Parent.ParentBuilderImpl(); + } + } + public static @lombok.experimental.SuperBuilder(toBuilder = true,setterPrefix = "set") class Child extends Parent { + public static abstract @java.lang.SuppressWarnings("all") class ChildBuilder<C extends SuperBuilderWithSetterPrefix.Child, B extends SuperBuilderWithSetterPrefix.Child.ChildBuilder<C, B>> extends Parent.ParentBuilder<C, B> { + private @java.lang.SuppressWarnings("all") double field3; + public ChildBuilder() { + super(); + } + protected @java.lang.Override @java.lang.SuppressWarnings("all") B $fillValuesFrom(final C instance) { + super.$fillValuesFrom(instance); + SuperBuilderWithSetterPrefix.Child.ChildBuilder.$fillValuesFromInstanceIntoBuilder(instance, this); + return self(); + } + 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}. + */ + public @java.lang.SuppressWarnings("all") B setField3(final double field3) { + this.field3 = field3; + return self(); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (((("SuperBuilderWithSetterPrefix.Child.ChildBuilder(super=" + super.toString()) + ", field3=") + this.field3) + ")"); + } + } + private static final @java.lang.SuppressWarnings("all") class ChildBuilderImpl extends SuperBuilderWithSetterPrefix.Child.ChildBuilder<SuperBuilderWithSetterPrefix.Child, SuperBuilderWithSetterPrefix.Child.ChildBuilderImpl> { + private ChildBuilderImpl() { + super(); + } + protected @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderWithSetterPrefix.Child.ChildBuilderImpl self() { + return this; + } + public @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderWithSetterPrefix.Child build() { + return new SuperBuilderWithSetterPrefix.Child(this); + } + } + private double field3; + protected @java.lang.SuppressWarnings("all") Child(final SuperBuilderWithSetterPrefix.Child.ChildBuilder<?, ?> b) { + super(b); + this.field3 = b.field3; + } + public @java.lang.SuppressWarnings("all") SuperBuilderWithSetterPrefix.Child.ChildBuilder<?, ?> toBuilder() { + return new SuperBuilderWithSetterPrefix.Child.ChildBuilderImpl().$fillValuesFrom(this); + } + public static @java.lang.SuppressWarnings("all") SuperBuilderWithSetterPrefix.Child.ChildBuilder<?, ?> builder() { + return new SuperBuilderWithSetterPrefix.Child.ChildBuilderImpl(); + } + } + public SuperBuilderWithSetterPrefix() { + super(); + } + public static void test() { + Child x = Child.builder().setField3(0.0).withField1(5).withItem("").build().toBuilder().build(); + } +} diff --git a/test/transform/resource/after-ecj/Tolerate.java b/test/transform/resource/after-ecj/Tolerate.java index 1fe5fe4c..fa3f8624 100644 --- a/test/transform/resource/after-ecj/Tolerate.java +++ b/test/transform/resource/after-ecj/Tolerate.java @@ -25,6 +25,9 @@ import java.util.regex.Pattern; public @java.lang.SuppressWarnings("all") Pattern getPattern() { return this.pattern; } + /** + * @return a clone of this object, except with this updated property (returns {@code this} if an identical value is passed). + */ public @java.lang.SuppressWarnings("all") Tolerate2 withPattern(final Pattern pattern) { return ((this.pattern == pattern) ? this : new Tolerate2(pattern)); } diff --git a/test/transform/resource/after-ecj/ValueCallSuper.java b/test/transform/resource/after-ecj/ValueCallSuper.java index 2fef08ab..72422a4a 100644 --- a/test/transform/resource/after-ecj/ValueCallSuper.java +++ b/test/transform/resource/after-ecj/ValueCallSuper.java @@ -1,32 +1,32 @@ -class ValueParent {
- ValueParent() {
- super();
- }
-}
-final @lombok.Value class ValueCallSuper extends ValueParent {
- public @java.lang.Override @java.lang.SuppressWarnings("all") boolean equals(final java.lang.Object o) {
- if ((o == this))
- return true;
- if ((! (o instanceof ValueCallSuper)))
- return false;
- final ValueCallSuper other = (ValueCallSuper) o;
- if ((! other.canEqual((java.lang.Object) this)))
- return false;
- if ((! super.equals(o)))
- return false;
- return true;
- }
- protected @java.lang.SuppressWarnings("all") boolean canEqual(final java.lang.Object other) {
- return (other instanceof ValueCallSuper);
- }
- public @java.lang.Override @java.lang.SuppressWarnings("all") int hashCode() {
- final int result = super.hashCode();
- return result;
- }
- public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() {
- return "ValueCallSuper()";
- }
- public @java.lang.SuppressWarnings("all") ValueCallSuper() {
- super();
- }
-}
+class ValueParent { + ValueParent() { + super(); + } +} +final @lombok.Value class ValueCallSuper extends ValueParent { + public @java.lang.Override @java.lang.SuppressWarnings("all") boolean equals(final java.lang.Object o) { + if ((o == this)) + return true; + if ((! (o instanceof ValueCallSuper))) + return false; + final ValueCallSuper other = (ValueCallSuper) o; + if ((! other.canEqual((java.lang.Object) this))) + return false; + if ((! super.equals(o))) + return false; + return true; + } + protected @java.lang.SuppressWarnings("all") boolean canEqual(final java.lang.Object other) { + return (other instanceof ValueCallSuper); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") int hashCode() { + final int result = super.hashCode(); + return result; + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return "ValueCallSuper()"; + } + public @java.lang.SuppressWarnings("all") ValueCallSuper() { + super(); + } +} diff --git a/test/transform/resource/after-ecj/WithAlreadyExists.java b/test/transform/resource/after-ecj/WithAlreadyExists.java index a868cde5..9dbd6d8a 100644 --- a/test/transform/resource/after-ecj/WithAlreadyExists.java +++ b/test/transform/resource/after-ecj/WithAlreadyExists.java @@ -37,6 +37,9 @@ class With5 { With5(String foo) { super(); } + /** + * @return a clone of this object, except with this updated property (returns {@code this} if an identical value is passed). + */ public @java.lang.SuppressWarnings("all") With5 withFoo(final String foo) { return ((this.foo == foo) ? this : new With5(foo)); } @@ -48,6 +51,9 @@ class With6 { With6(String foo) { super(); } + /** + * @return a clone of this object, except with this updated property (returns {@code this} if an identical value is passed). + */ public @java.lang.SuppressWarnings("all") With6 withFoo(final String foo) { return ((this.foo == foo) ? this : new With6(foo)); } diff --git a/test/transform/resource/after-ecj/WithAndAllArgsConstructor.java b/test/transform/resource/after-ecj/WithAndAllArgsConstructor.java index d3fcded2..52a7f3a3 100644 --- a/test/transform/resource/after-ecj/WithAndAllArgsConstructor.java +++ b/test/transform/resource/after-ecj/WithAndAllArgsConstructor.java @@ -4,9 +4,15 @@ final int x = 10; int y = 20; final int z; + /** + * @return a clone of this object, except with this updated property (returns {@code this} if an identical value is passed). + */ public @java.lang.SuppressWarnings("all") WithAndAllArgsConstructor<T, J, L> withTest(final J test) { return ((this.test == test) ? this : new WithAndAllArgsConstructor<T, J, L>(test, this.test2, this.y, this.z)); } + /** + * @return a clone of this object, except with this updated property (returns {@code this} if an identical value is passed). + */ public @java.lang.SuppressWarnings("all") WithAndAllArgsConstructor<T, J, L> withTest2(final java.util.List<L> test2) { return ((this.test2 == test2) ? this : new WithAndAllArgsConstructor<T, J, L>(this.test, test2, this.y, this.z)); } diff --git a/test/transform/resource/after-ecj/WithMethodAbstract.java b/test/transform/resource/after-ecj/WithMethodAbstract.java index cb71357a..e0b14fc2 100644 --- a/test/transform/resource/after-ecj/WithMethodAbstract.java +++ b/test/transform/resource/after-ecj/WithMethodAbstract.java @@ -3,5 +3,8 @@ abstract class WithMethodAbstract { WithMethodAbstract() { super(); } + /** + * @return a clone of this object, except with this updated property (returns {@code this} if an identical value is passed). + */ public abstract @java.lang.SuppressWarnings("all") WithMethodAbstract withFoo(final String foo); } diff --git a/test/transform/resource/after-ecj/WithMethodMarkedDeprecated.java b/test/transform/resource/after-ecj/WithMethodMarkedDeprecated.java index cd123fe8..d5f2bbcc 100644 --- a/test/transform/resource/after-ecj/WithMethodMarkedDeprecated.java +++ b/test/transform/resource/after-ecj/WithMethodMarkedDeprecated.java @@ -5,9 +5,16 @@ class WithMethodMarkedDeprecated { WithMethodMarkedDeprecated(int annotation, int javadoc) { super(); } + /** + * @return a clone of this object, except with this updated property (returns {@code this} if an identical value is passed). + */ public @java.lang.Deprecated @java.lang.SuppressWarnings("all") WithMethodMarkedDeprecated withAnnotation(final int annotation) { return ((this.annotation == annotation) ? this : new WithMethodMarkedDeprecated(annotation, this.javadoc)); } + /** + * @deprecated + * @return a clone of this object, except with this updated property (returns {@code this} if an identical value is passed). + */ public @java.lang.Deprecated @java.lang.SuppressWarnings("all") WithMethodMarkedDeprecated withJavadoc(final int javadoc) { return ((this.javadoc == javadoc) ? this : new WithMethodMarkedDeprecated(this.annotation, javadoc)); } diff --git a/test/transform/resource/after-ecj/WithMethodMarkedDeprecatedAnnOnly.java b/test/transform/resource/after-ecj/WithMethodMarkedDeprecatedAnnOnly.java new file mode 100644 index 00000000..d4604af5 --- /dev/null +++ b/test/transform/resource/after-ecj/WithMethodMarkedDeprecatedAnnOnly.java @@ -0,0 +1,14 @@ +import lombok.With; +class WithMethodMarkedDeprecatedAnnOnly { + @Deprecated @With int annotation; + WithMethodMarkedDeprecatedAnnOnly(int annotation) { + super(); + } + /** + * @return a clone of this object, except with this updated property (returns {@code this} if an identical value is passed). + */ + public @java.lang.Deprecated @java.lang.SuppressWarnings("all") WithMethodMarkedDeprecatedAnnOnly withAnnotation(final int annotation) { + return ((this.annotation == annotation) ? this : new WithMethodMarkedDeprecatedAnnOnly(annotation)); + } +} + diff --git a/test/transform/resource/after-ecj/WithNested.java b/test/transform/resource/after-ecj/WithNested.java index 55f6edb2..25a8bced 100644 --- a/test/transform/resource/after-ecj/WithNested.java +++ b/test/transform/resource/after-ecj/WithNested.java @@ -1,6 +1,9 @@ public interface WithNested<Z> { @lombok.RequiredArgsConstructor class IAmStaticReally { final @lombok.With String x; + /** + * @return a clone of this object, except with this updated property (returns {@code this} if an identical value is passed). + */ public @java.lang.SuppressWarnings("all") WithNested.IAmStaticReally withX(final String x) { return ((this.x == x) ? this : new WithNested.IAmStaticReally(x)); } diff --git a/test/transform/resource/after-ecj/WithOnClass.java b/test/transform/resource/after-ecj/WithOnClass.java index ca3e8c6b..1c635fce 100644 --- a/test/transform/resource/after-ecj/WithOnClass.java +++ b/test/transform/resource/after-ecj/WithOnClass.java @@ -4,6 +4,9 @@ WithOnClass1(boolean isNone, boolean isPublic) { super(); } + /** + * @return a clone of this object, except with this updated property (returns {@code this} if an identical value is passed). + */ public @java.lang.SuppressWarnings("all") WithOnClass1 withPublic(final boolean isPublic) { return ((this.isPublic == isPublic) ? this : new WithOnClass1(this.isNone, isPublic)); } @@ -15,9 +18,15 @@ WithOnClass2(boolean isNone, boolean isProtected, boolean isPackage) { super(); } + /** + * @return a clone of this object, except with this updated property (returns {@code this} if an identical value is passed). + */ @java.lang.SuppressWarnings("all") WithOnClass2 withPackage(final boolean isPackage) { return ((this.isPackage == isPackage) ? this : new WithOnClass2(this.isNone, this.isProtected, isPackage)); } + /** + * @return a clone of this object, except with this updated property (returns {@code this} if an identical value is passed). + */ protected @java.lang.SuppressWarnings("all") WithOnClass2 withProtected(final boolean isProtected) { return ((this.isProtected == isProtected) ? this : new WithOnClass2(this.isNone, isProtected, this.isPackage)); } @@ -28,9 +37,15 @@ WithOnClass3(String couldBeNull, String nonNull) { super(); } + /** + * @return a clone of this object, except with this updated property (returns {@code this} if an identical value is passed). + */ public @java.lang.SuppressWarnings("all") WithOnClass3 withCouldBeNull(final String couldBeNull) { return ((this.couldBeNull == couldBeNull) ? this : new WithOnClass3(couldBeNull, this.nonNull)); } + /** + * @return a clone of this object, except with this updated property (returns {@code this} if an identical value is passed). + */ public @java.lang.SuppressWarnings("all") WithOnClass3 withNonNull(final @lombok.NonNull String nonNull) { if ((nonNull == null)) { @@ -46,6 +61,9 @@ super(); this.fY = y; } + /** + * @return a clone of this object, except with this updated property (returns {@code this} if an identical value is passed). + */ public @java.lang.SuppressWarnings("all") WithOnClass4 withY(final int fY) { return ((this.fY == fY) ? this : new WithOnClass4(fY)); } diff --git a/test/transform/resource/after-ecj/WithPlain.java b/test/transform/resource/after-ecj/WithPlain.java index 66a1455b..9f888abe 100644 --- a/test/transform/resource/after-ecj/WithPlain.java +++ b/test/transform/resource/after-ecj/WithPlain.java @@ -7,9 +7,15 @@ class WithPlain { this.i = i; this.foo = foo; } + /** + * @return a clone of this object, except with this updated property (returns {@code this} if an identical value is passed). + */ public @org.springframework.lang.NonNull @java.lang.SuppressWarnings("all") WithPlain withI(final int i) { return ((this.i == i) ? this : new WithPlain(i, this.foo)); } + /** + * @return a clone of this object, except with this updated property (returns {@code this} if an identical value is passed). + */ public @org.springframework.lang.NonNull @java.lang.SuppressWarnings("all") WithPlain withFoo(final int foo) { return ((this.foo == foo) ? this : new WithPlain(this.i, foo)); } diff --git a/test/transform/resource/after-ecj/WithWithGenerics.java b/test/transform/resource/after-ecj/WithWithGenerics.java index b6985b99..98b18092 100644 --- a/test/transform/resource/after-ecj/WithWithGenerics.java +++ b/test/transform/resource/after-ecj/WithWithGenerics.java @@ -6,12 +6,21 @@ class WithWithGenerics<T, J extends T, L extends java.lang.Number> { public WithWithGenerics(J test, java.util.List<L> test2, java.util.List<? extends L> test3) { super(); } + /** + * @return a clone of this object, except with this updated property (returns {@code this} if an identical value is passed). + */ public @java.lang.SuppressWarnings("all") WithWithGenerics<T, J, L> withTest(final J test) { return ((this.test == test) ? this : new WithWithGenerics<T, J, L>(test, this.test2, this.test3)); } + /** + * @return a clone of this object, except with this updated property (returns {@code this} if an identical value is passed). + */ public @java.lang.SuppressWarnings("all") WithWithGenerics<T, J, L> withTest2(final java.util.List<L> test2) { return ((this.test2 == test2) ? this : new WithWithGenerics<T, J, L>(this.test, test2, this.test3)); } + /** + * @return a clone of this object, except with this updated property (returns {@code this} if an identical value is passed). + */ public @java.lang.SuppressWarnings("all") WithWithGenerics<T, J, L> withTest3(final java.util.List<? extends L> test3) { return ((this.test3 == test3) ? this : new WithWithGenerics<T, J, L>(this.test, this.test2, test3)); } diff --git a/test/transform/resource/after-ecj/WithWithTypeAnnos.java b/test/transform/resource/after-ecj/WithWithTypeAnnos.java index ff73869b..8f1b3f69 100644 --- a/test/transform/resource/after-ecj/WithWithTypeAnnos.java +++ b/test/transform/resource/after-ecj/WithWithTypeAnnos.java @@ -12,6 +12,9 @@ class WithWithTypeAnnos { super(); this.foo = foo; } + /** + * @return a clone of this object, except with this updated property (returns {@code this} if an identical value is passed). + */ public @java.lang.SuppressWarnings("all") WithWithTypeAnnos withFoo(final @TA List<String> foo) { return ((this.foo == foo) ? this : new WithWithTypeAnnos(foo)); } diff --git a/test/transform/resource/after-ecj/WitherAccessLevel.java b/test/transform/resource/after-ecj/WitherAccessLevel.java index 09a2e514..b6457534 100644 --- a/test/transform/resource/after-ecj/WitherAccessLevel.java +++ b/test/transform/resource/after-ecj/WitherAccessLevel.java @@ -9,18 +9,33 @@ class WitherAccessLevel { WitherAccessLevel(boolean isNone, boolean isPrivate, boolean isPackage, boolean isProtected, boolean isPublic, boolean value) { super(); } + /** + * @return a clone of this object, except with this updated property (returns {@code this} if an identical value is passed). + */ private @java.lang.SuppressWarnings("all") WitherAccessLevel withPrivate(final boolean isPrivate) { return ((this.isPrivate == isPrivate) ? this : new WitherAccessLevel(this.isNone, isPrivate, this.isPackage, this.isProtected, this.isPublic, this.value)); } + /** + * @return a clone of this object, except with this updated property (returns {@code this} if an identical value is passed). + */ @java.lang.SuppressWarnings("all") WitherAccessLevel withPackage(final boolean isPackage) { return ((this.isPackage == isPackage) ? this : new WitherAccessLevel(this.isNone, this.isPrivate, isPackage, this.isProtected, this.isPublic, this.value)); } + /** + * @return a clone of this object, except with this updated property (returns {@code this} if an identical value is passed). + */ protected @java.lang.SuppressWarnings("all") WitherAccessLevel withProtected(final boolean isProtected) { return ((this.isProtected == isProtected) ? this : new WitherAccessLevel(this.isNone, this.isPrivate, this.isPackage, isProtected, this.isPublic, this.value)); } + /** + * @return a clone of this object, except with this updated property (returns {@code this} if an identical value is passed). + */ public @java.lang.SuppressWarnings("all") WitherAccessLevel withPublic(final boolean isPublic) { return ((this.isPublic == isPublic) ? this : new WitherAccessLevel(this.isNone, this.isPrivate, this.isPackage, this.isProtected, isPublic, this.value)); } + /** + * @return a clone of this object, except with this updated property (returns {@code this} if an identical value is passed). + */ public @java.lang.SuppressWarnings("all") WitherAccessLevel withValue(final boolean value) { return ((this.value == value) ? this : new WitherAccessLevel(this.isNone, this.isPrivate, this.isPackage, this.isProtected, this.isPublic, value)); } diff --git a/test/transform/resource/after-ecj/WitherLegacyStar.java b/test/transform/resource/after-ecj/WitherLegacyStar.java index 7aeaa969..2b9ebe79 100644 --- a/test/transform/resource/after-ecj/WitherLegacyStar.java +++ b/test/transform/resource/after-ecj/WitherLegacyStar.java @@ -5,6 +5,9 @@ class WitherLegacyStar { super(); this.i = i; } + /** + * @return a clone of this object, except with this updated property (returns {@code this} if an identical value is passed). + */ public @java.lang.SuppressWarnings("all") WitherLegacyStar withI(final int i) { return ((this.i == i) ? this : new WitherLegacyStar(i)); } diff --git a/test/transform/resource/before/BuilderAccessWithGetter.java b/test/transform/resource/before/BuilderAccessWithGetter.java new file mode 100644 index 00000000..38212ecf --- /dev/null +++ b/test/transform/resource/before/BuilderAccessWithGetter.java @@ -0,0 +1,10 @@ +import lombok.AccessLevel; +import lombok.Builder; +import lombok.Getter; + +@Builder(access = AccessLevel.PRIVATE) +public final class BuilderAccessWithGetter { + + @Getter + private final String string; +} diff --git a/test/transform/resource/before/BuilderSingularNullBehavior1.java b/test/transform/resource/before/BuilderSingularNullBehavior1.java index bcf473a4..add00ea7 100644 --- a/test/transform/resource/before/BuilderSingularNullBehavior1.java +++ b/test/transform/resource/before/BuilderSingularNullBehavior1.java @@ -1,3 +1,4 @@ +//version 8: //CONF: lombok.addNullAnnotations = checkerframework //CONF: lombok.nonNull.exceptionType = assertion import java.util.List; diff --git a/test/transform/resource/before/BuilderSingularNullBehavior2.java b/test/transform/resource/before/BuilderSingularNullBehavior2.java index 7d1d0e57..dde4eea9 100644 --- a/test/transform/resource/before/BuilderSingularNullBehavior2.java +++ b/test/transform/resource/before/BuilderSingularNullBehavior2.java @@ -1,3 +1,4 @@ +//version 8: springframework dep is too new to run on j6 //CONF: lombok.addNullAnnotations = spring //CONF: lombok.nonNull.exceptionType = JDK import java.util.List; diff --git a/test/transform/resource/before/BuilderWithDeprecatedAnnOnly.java b/test/transform/resource/before/BuilderWithDeprecatedAnnOnly.java new file mode 100644 index 00000000..1d2d199c --- /dev/null +++ b/test/transform/resource/before/BuilderWithDeprecatedAnnOnly.java @@ -0,0 +1,10 @@ +import com.google.common.collect.ImmutableList; +import lombok.Builder; +import lombok.Singular; + +@Builder +public class BuilderWithDeprecatedAnnOnly { + @Deprecated int dep1; + @Singular @Deprecated java.util.List<String> strings; + @Singular @Deprecated ImmutableList<Integer> numbers; +} diff --git a/test/transform/resource/before/BuilderWithNonNull.java b/test/transform/resource/before/BuilderWithNonNull.java index 03a54326..b0c1d36a 100644 --- a/test/transform/resource/before/BuilderWithNonNull.java +++ b/test/transform/resource/before/BuilderWithNonNull.java @@ -1,3 +1,4 @@ +//version 8: @lombok.Builder class BuilderWithNonNull { @lombok.NonNull diff --git a/test/transform/resource/before/BuilderWithNonNullWithSetterPrefix.java b/test/transform/resource/before/BuilderWithNonNullWithSetterPrefix.java index 8ef1f70e..7c1aa983 100644 --- a/test/transform/resource/before/BuilderWithNonNullWithSetterPrefix.java +++ b/test/transform/resource/before/BuilderWithNonNullWithSetterPrefix.java @@ -1,3 +1,4 @@ +//version 8: @lombok.Builder(setterPrefix = "with") class BuilderWithNonNullWithSetterPrefix { @lombok.NonNull diff --git a/test/transform/resource/before/BuilderWithToBuilder.java b/test/transform/resource/before/BuilderWithToBuilder.java index 50938ab2..5b87a18f 100644 --- a/test/transform/resource/before/BuilderWithToBuilder.java +++ b/test/transform/resource/before/BuilderWithToBuilder.java @@ -18,3 +18,16 @@ class ConstructorWithToBuilder<T> { public ConstructorWithToBuilder(String mOne, @Builder.ObtainVia(field = "foo") T baz, com.google.common.collect.ImmutableList<T> bars) { } } + +class StaticMethodWithToBuilder<T> { + private T foo; + + public StaticMethodWithToBuilder(T foo) { + this.foo = foo; + } + + @Builder(toBuilder = true) + public static <T> StaticMethodWithToBuilder<T> of(T foo) { + return new StaticMethodWithToBuilder<T>(foo); + } +}
\ No newline at end of file diff --git a/test/transform/resource/before/CheckerFrameworkBasic.java b/test/transform/resource/before/CheckerFrameworkBasic.java index 8a0bd118..4bf1ac73 100644 --- a/test/transform/resource/before/CheckerFrameworkBasic.java +++ b/test/transform/resource/before/CheckerFrameworkBasic.java @@ -1,9 +1,11 @@ +//version 8: //CONF: checkerframework = 4.0 +import lombok.AllArgsConstructor; import lombok.Data; import lombok.experimental.Accessors; import lombok.With; -@Data @Accessors(chain = true) +@Data @AllArgsConstructor @Accessors(chain = true) class CheckerFrameworkBasic { @With private final int x; private final int y; diff --git a/test/transform/resource/before/CheckerFrameworkBuilder.java b/test/transform/resource/before/CheckerFrameworkBuilder.java index 440b80e9..0f24e1b7 100644 --- a/test/transform/resource/before/CheckerFrameworkBuilder.java +++ b/test/transform/resource/before/CheckerFrameworkBuilder.java @@ -1,3 +1,4 @@ +//version 8: //CONF: checkerframework = 4.0 import java.util.List; import lombok.Builder; diff --git a/test/transform/resource/before/CheckerFrameworkSuperBuilder.java b/test/transform/resource/before/CheckerFrameworkSuperBuilder.java index ed9e14cb..fefff676 100644 --- a/test/transform/resource/before/CheckerFrameworkSuperBuilder.java +++ b/test/transform/resource/before/CheckerFrameworkSuperBuilder.java @@ -1,3 +1,4 @@ +//version 8: //CONF: checkerframework = 4.0 import java.util.List; import lombok.Singular; diff --git a/test/transform/resource/before/ConstructorsWithAccessors.java b/test/transform/resource/before/ConstructorsWithAccessors.java index e67a47ce..fc72be55 100644 --- a/test/transform/resource/before/ConstructorsWithAccessors.java +++ b/test/transform/resource/before/ConstructorsWithAccessors.java @@ -1,3 +1,4 @@ +//version 8: @lombok.AllArgsConstructor @lombok.experimental.Accessors(prefix={"p", "_"}) class ConstructorsWithAccessors { int plower; int pUpper; @@ -11,4 +12,3 @@ @lombok.NonNull Integer _huh; @lombok.NonNull final Integer __huh2; } - diff --git a/test/transform/resource/before/DataOnLocalClass.java b/test/transform/resource/before/DataOnLocalClass.java index b1272b7e..e4fa4cd5 100644 --- a/test/transform/resource/before/DataOnLocalClass.java +++ b/test/transform/resource/before/DataOnLocalClass.java @@ -1,3 +1,4 @@ +//version 8: import lombok.Data; class DataOnLocalClass1 { public static void main(String[] args) { diff --git a/test/transform/resource/before/DataWithOverrideEqualsAndHashCode.java b/test/transform/resource/before/DataWithOverrideEqualsAndHashCode.java new file mode 100644 index 00000000..78138bbf --- /dev/null +++ b/test/transform/resource/before/DataWithOverrideEqualsAndHashCode.java @@ -0,0 +1,18 @@ +import lombok.Data; + +class DataWithOverrideEqualsAndHashCode { + class Data1 { + + } + + @Data + class Data2 extends Data1 { + public int hashCode() { + return 42; + } + + public boolean equals(Object other) { + return false; + } + } +}
\ No newline at end of file diff --git a/test/transform/resource/before/DelegateAlreadyImplemented.java b/test/transform/resource/before/DelegateAlreadyImplemented.java index c43c1949..feaf3c4b 100644 --- a/test/transform/resource/before/DelegateAlreadyImplemented.java +++ b/test/transform/resource/before/DelegateAlreadyImplemented.java @@ -1,3 +1,4 @@ +//platform !eclipse: Requires a 'full' eclipse with intialized workspace, and we don't (yet) have that set up properly in the test run. public class DelegateAlreadyImplemented<T> { @lombok.experimental.Delegate diff --git a/test/transform/resource/before/DelegateFlagUsage.java b/test/transform/resource/before/DelegateFlagUsage.java index 1f274e24..0b52c764 100644 --- a/test/transform/resource/before/DelegateFlagUsage.java +++ b/test/transform/resource/before/DelegateFlagUsage.java @@ -1,3 +1,4 @@ +//platform !eclipse: Requires a 'full' eclipse with intialized workspace, and we don't (yet) have that set up properly in the test run. //conf: lombok.delegate.flagUsage = warning //skip compare content: We're just checking if the flagUsage key works. public class DelegateFlagUsage { diff --git a/test/transform/resource/before/DelegateGenerics.java b/test/transform/resource/before/DelegateGenerics.java index e89158a9..f00c90aa 100644 --- a/test/transform/resource/before/DelegateGenerics.java +++ b/test/transform/resource/before/DelegateGenerics.java @@ -1,3 +1,4 @@ +//platform !eclipse: Requires a 'full' eclipse with intialized workspace, and we don't (yet) have that set up properly in the test run. public class DelegateGenerics<T> { @lombok.experimental.Delegate I1<T> target; diff --git a/test/transform/resource/before/DelegateOnGetter.java b/test/transform/resource/before/DelegateOnGetter.java index afe09ff4..ad9d1cfb 100644 --- a/test/transform/resource/before/DelegateOnGetter.java +++ b/test/transform/resource/before/DelegateOnGetter.java @@ -1,3 +1,4 @@ +//platform !eclipse: Requires a 'full' eclipse with intialized workspace, and we don't (yet) have that set up properly in the test run. import lombok.Delegate; import lombok.Getter; diff --git a/test/transform/resource/before/DelegateOnGetterNone.java b/test/transform/resource/before/DelegateOnGetterNone.java index f9a97e6a..cd471369 100644 --- a/test/transform/resource/before/DelegateOnGetterNone.java +++ b/test/transform/resource/before/DelegateOnGetterNone.java @@ -1,3 +1,4 @@ +//platform !eclipse: Requires a 'full' eclipse with intialized workspace, and we don't (yet) have that set up properly in the test run. import lombok.AccessLevel; import lombok.experimental.Delegate; import lombok.Getter; diff --git a/test/transform/resource/before/DelegateOnLocalClass.java b/test/transform/resource/before/DelegateOnLocalClass.java new file mode 100644 index 00000000..7376c087 --- /dev/null +++ b/test/transform/resource/before/DelegateOnLocalClass.java @@ -0,0 +1,19 @@ +//platform !eclipse: Requires a 'full' eclipse with intialized workspace, and we don't (yet) have that set up properly in the test run. +//skip compare content +//ignore: crashed javac with NPE, should be enabled when that bug is fixed +import lombok.experimental.Delegate; +import lombok.Getter; + +interface DelegateOnLocalClass { + void test1() { + class DelegateOnStatic { + @Delegate private final java.lang.Runnable field = null; + } + } + + void test2() { + Runnable r = new Runnable() { + @Delegate private final java.lang.Runnable field = null; + } + } +} diff --git a/test/transform/resource/before/DelegateOnMethods.java b/test/transform/resource/before/DelegateOnMethods.java index 79189cc1..4ea70d74 100644 --- a/test/transform/resource/before/DelegateOnMethods.java +++ b/test/transform/resource/before/DelegateOnMethods.java @@ -1,3 +1,4 @@ +//platform !eclipse: Requires a 'full' eclipse with intialized workspace, and we don't (yet) have that set up properly in the test run. import lombok.experimental.Delegate; abstract class DelegateOnMethods { diff --git a/test/transform/resource/before/DelegateOnStatic.java b/test/transform/resource/before/DelegateOnStatic.java index 7a420b20..b9b728bc 100644 --- a/test/transform/resource/before/DelegateOnStatic.java +++ b/test/transform/resource/before/DelegateOnStatic.java @@ -1,3 +1,4 @@ +//platform !eclipse: Requires a 'full' eclipse with intialized workspace, and we don't (yet) have that set up properly in the test run. //skip compare content import lombok.experimental.Delegate; import lombok.Getter; diff --git a/test/transform/resource/before/DelegateRecursion.java b/test/transform/resource/before/DelegateRecursion.java index d74107e2..c6428d06 100644 --- a/test/transform/resource/before/DelegateRecursion.java +++ b/test/transform/resource/before/DelegateRecursion.java @@ -1,3 +1,4 @@ +//platform !eclipse: Requires a 'full' eclipse with intialized workspace, and we don't (yet) have that set up properly in the test run. //skip compare content: This test is to see if the 'delegate recursion is not supported' error pops up. import lombok.experimental.Delegate; class DelegateRecursionOuterMost { diff --git a/test/transform/resource/before/DelegateTypesAndExcludes.java b/test/transform/resource/before/DelegateTypesAndExcludes.java index 164261d8..2c0f8770 100644 --- a/test/transform/resource/before/DelegateTypesAndExcludes.java +++ b/test/transform/resource/before/DelegateTypesAndExcludes.java @@ -1,3 +1,4 @@ +//platform !eclipse: Requires a 'full' eclipse with intialized workspace, and we don't (yet) have that set up properly in the test run. import lombok.experimental.Delegate; class DelegatePlain { @Delegate(types = Bar.class) diff --git a/test/transform/resource/before/DelegateWithDeprecated.java b/test/transform/resource/before/DelegateWithDeprecated.java index a0deb788..bf3519b3 100644 --- a/test/transform/resource/before/DelegateWithDeprecated.java +++ b/test/transform/resource/before/DelegateWithDeprecated.java @@ -1,3 +1,4 @@ +//platform !eclipse: Requires a 'full' eclipse with intialized workspace, and we don't (yet) have that set up properly in the test run. import lombok.experimental.Delegate; class DelegateWithDeprecated { diff --git a/test/transform/resource/before/DelegateWithVarargs.java b/test/transform/resource/before/DelegateWithVarargs.java index 0c266620..91519884 100644 --- a/test/transform/resource/before/DelegateWithVarargs.java +++ b/test/transform/resource/before/DelegateWithVarargs.java @@ -1,3 +1,4 @@ +//platform !eclipse: Requires a 'full' eclipse with intialized workspace, and we don't (yet) have that set up properly in the test run. import lombok.experimental.Delegate; class DelegateWithVarargs { diff --git a/test/transform/resource/before/DelegateWithVarargs2.java b/test/transform/resource/before/DelegateWithVarargs2.java index 8a3dbf14..bc3fdf09 100644 --- a/test/transform/resource/before/DelegateWithVarargs2.java +++ b/test/transform/resource/before/DelegateWithVarargs2.java @@ -1,3 +1,4 @@ +//platform !eclipse: Requires a 'full' eclipse with intialized workspace, and we don't (yet) have that set up properly in the test run. import lombok.experimental.Delegate; class DelegateWithVarargs2 { diff --git a/test/transform/resource/before/EqualsAndHashCodeAnnotated.java b/test/transform/resource/before/EqualsAndHashCodeAnnotated.java index d672b982..f65d7b5b 100644 --- a/test/transform/resource/before/EqualsAndHashCodeAnnotated.java +++ b/test/transform/resource/before/EqualsAndHashCodeAnnotated.java @@ -1,4 +1,4 @@ -//version 8 +//version 8: import java.lang.annotation.*; @lombok.EqualsAndHashCode diff --git a/test/transform/resource/before/EqualsAndHashCodeCache.java b/test/transform/resource/before/EqualsAndHashCodeCache.java new file mode 100644 index 00000000..3c84ee59 --- /dev/null +++ b/test/transform/resource/before/EqualsAndHashCodeCache.java @@ -0,0 +1,29 @@ +@lombok.EqualsAndHashCode(cacheStrategy = lombok.EqualsAndHashCode.CacheStrategy.LAZY) +class EqualsAndHashCode { + int x; + boolean[] y; + Object[] z; + String a; + String b; +} + +@lombok.EqualsAndHashCode(cacheStrategy = lombok.EqualsAndHashCode.CacheStrategy.LAZY) +final class EqualsAndHashCode2 { + int x; + long y; + float f; + double d; + boolean b; +} + +@lombok.EqualsAndHashCode(callSuper=false, cacheStrategy = lombok.EqualsAndHashCode.CacheStrategy.LAZY) +final class EqualsAndHashCode3 extends EqualsAndHashCode { +} + +@lombok.EqualsAndHashCode(callSuper=true, cacheStrategy = lombok.EqualsAndHashCode.CacheStrategy.LAZY) +class EqualsAndHashCode4 extends EqualsAndHashCode { +} + +@lombok.EqualsAndHashCode(callSuper=true, cacheStrategy = lombok.EqualsAndHashCode.CacheStrategy.LAZY) +final class EqualsAndHashCode5 extends EqualsAndHashCode { +}
\ No newline at end of file diff --git a/test/transform/resource/before/ExtensionMethodAutoboxing.java b/test/transform/resource/before/ExtensionMethodAutoboxing.java new file mode 100644 index 00000000..5e07a6b3 --- /dev/null +++ b/test/transform/resource/before/ExtensionMethodAutoboxing.java @@ -0,0 +1,23 @@ +import lombok.experimental.ExtensionMethod; + +@ExtensionMethod({ExtensionMethodAutoboxing.Extensions.class}) +class ExtensionMethodAutoboxing { + public void test() { + Long l1 = 1l; + long l2 = 1l; + Integer i1 = 1; + int i2 = 1; + + String string = "test"; + string.boxing(l1, i1); + string.boxing(l1, i2); + string.boxing(l2, i1); + string.boxing(l2, i2); + } + + static class Extensions { + public static String boxing(String string, Long a, int b) { + return string + " " + a + " " + b; + } + } +} diff --git a/test/transform/resource/before/ExtensionMethodChain.java b/test/transform/resource/before/ExtensionMethodChain.java new file mode 100644 index 00000000..f7960ed4 --- /dev/null +++ b/test/transform/resource/before/ExtensionMethodChain.java @@ -0,0 +1,17 @@ +import java.util.Arrays; +import java.util.List; +import lombok.experimental.ExtensionMethod; + +@ExtensionMethod(ExtensionMethodChain.Extensions.class) +class ExtensionMethodChain { + + public void test() { + "1".intValue().intValue(); + } + + static class Extensions { + public static Integer intValue(String s) { + return Integer.valueOf(s); + } + } +} diff --git a/test/transform/resource/before/ExtensionMethodFunctional.java b/test/transform/resource/before/ExtensionMethodFunctional.java new file mode 100644 index 00000000..8586dd7a --- /dev/null +++ b/test/transform/resource/before/ExtensionMethodFunctional.java @@ -0,0 +1,47 @@ +// version 8: +import java.util.function.Consumer; +import java.util.function.Function; +import java.util.List; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +import lombok.experimental.ExtensionMethod; + +@ExtensionMethod(value = ExtensionMethodFunctional.Extensions.class, suppressBaseMethods = false) +class ExtensionMethodFunctional { + public void test() { + String test = "test"; + test = test.map(s -> s.reverse()); + + test.consume(s -> System.out.println("1: " + s), s -> System.out.println("2: " + s)); + test.consume(System.out::println, System.out::println); + + Stream.of("a", "b", "c").map(String::toUpperCase).toList1(); + List<Integer> i2 = Stream.of("a", "b", "c").map(String::toUpperCase).toList2(); + } + + static class Extensions { + public static <T, R> R map(T value, Function<T, R> mapper) { + return mapper.apply(value); + } + + public static String reverse(String string) { + return new StringBuilder(string).reverse().toString(); + } + + @SafeVarargs + public static <T> void consume(T o, Consumer<T>... consumer) { + for (int i = 0; i < consumer.length; i++) { + consumer[i].accept(o); + } + } + + public static <T> List<T> toList1(Stream<T> stream) { + return (List<T>) stream.collect(Collectors.toList()); + } + + public static <T, U> List<U> toList2(Stream<T> stream) { + return null; + } + } +} diff --git a/test/transform/resource/before/ExtensionMethodGeneric.java b/test/transform/resource/before/ExtensionMethodGeneric.java new file mode 100644 index 00000000..d44c663b --- /dev/null +++ b/test/transform/resource/before/ExtensionMethodGeneric.java @@ -0,0 +1,34 @@ +import java.util.List; +import java.util.Map; + +import lombok.experimental.ExtensionMethod; + +@ExtensionMethod(ExtensionMethodGeneric.Extensions.class) +class ExtensionMethodGeneric { + public void test() { + List<String> stringList = null; + List<Number> numberList = null; + stringList.test(); + stringList.test(numberList); + stringList.test(stringList).test(numberList); + Integer i = stringList.test2(); + + Map<String, Integer> map = null; + List<String> l = map.test(stringList, numberList); + } + + static class Extensions { + public static <T> List<T> test(List<String> obj, List<T> list) { + return null; + } + public static <K,V> K test(Map<String, Integer> obj, K k, V v) { + return k; + } + public static <T> T test(List<T> list) { + return null; + } + public static <T,U> U test2(List<T> list) { + return null; + } + } +} diff --git a/test/transform/resource/before/ExtensionMethodNames.java b/test/transform/resource/before/ExtensionMethodNames.java new file mode 100644 index 00000000..4ca63a63 --- /dev/null +++ b/test/transform/resource/before/ExtensionMethodNames.java @@ -0,0 +1,33 @@ +package a; + +import lombok.experimental.ExtensionMethod; + +@ExtensionMethod(Extensions.class) +class ExtensionMethodNames { + + public void instanceCalls() { + (new Test()).ext(); + + Test t = new Test(); + t.ext(); + + Test Test = new Test(); + Test.ext(); + } + + public void staticCalls() { + Test.ext(); + a.Test.ext(); + } +} + +class Extensions { + public static void ext(Test t) { + } +} + +class Test { + public static void ext() { + + } +}
\ No newline at end of file diff --git a/test/transform/resource/before/ExtensionMethodNonStaticAccess.java b/test/transform/resource/before/ExtensionMethodNonStaticAccess.java new file mode 100644 index 00000000..0d317c35 --- /dev/null +++ b/test/transform/resource/before/ExtensionMethodNonStaticAccess.java @@ -0,0 +1,18 @@ +//issue #2752: this test triggers an indirect static access and a non static access warning for the same method call +//platform ecj,eclipse +class ExtensionMethodNonStaticAccess { + public void method(){ + Derived derived = new Derived(); + derived.staticMethod(); + } +} + +class Base { + static String staticMethod() { + return ""; + } +} + +class Derived extends Base { + +}
\ No newline at end of file diff --git a/test/transform/resource/before/ExtensionMethodSuppress.java b/test/transform/resource/before/ExtensionMethodSuppress.java new file mode 100644 index 00000000..d30652d3 --- /dev/null +++ b/test/transform/resource/before/ExtensionMethodSuppress.java @@ -0,0 +1,43 @@ +import lombok.experimental.ExtensionMethod; + +@ExtensionMethod(Extensions.class) +class ExtensionMethodSuppress { + public void test() { + Test.staticMethod(); + + Test test = new Test(); + test.instanceMethod(); + test.staticMethod(); + } +} + +@ExtensionMethod(value = Extensions.class, suppressBaseMethods = false) +class ExtensionMethodKeep { + public void test() { + Test.staticMethod(); + + Test test = new Test(); + test.instanceMethod(); + test.staticMethod(); + } +} + +class Test { + public static void staticMethod() { + + } + + public void instanceMethod() { + + } +} + +class Extensions { + public static void staticMethod(Test test) { + + } + + public static void instanceMethod(Test test) { + + } +}
\ No newline at end of file diff --git a/test/transform/resource/before/ExtensionMethodVarargs.java b/test/transform/resource/before/ExtensionMethodVarargs.java new file mode 100644 index 00000000..a976f9e6 --- /dev/null +++ b/test/transform/resource/before/ExtensionMethodVarargs.java @@ -0,0 +1,23 @@ +// version 8: +import lombok.experimental.ExtensionMethod; + +@ExtensionMethod(ExtensionMethodVarargs.Extensions.class) +class ExtensionMethodVarargs { + public void test() { + Long l1 = 1l; + long l2 = 1l; + Integer i1 = 1; + int i2 = 1; + + "%d %d %d %d".format(l1, l2, i1, i2); + "%d".format(l1); + "".format(new Integer[]{1,2}); + "".format(new Integer[]{1,2}, new Integer[]{1,2}); + } + + static class Extensions { + public static String format(String string, Object... params) { + return String.format(string, params); + } + } +} diff --git a/test/transform/resource/before/GetterDeprecated.java b/test/transform/resource/before/GetterDeprecated.java index 01b66bca..16d66a85 100644 --- a/test/transform/resource/before/GetterDeprecated.java +++ b/test/transform/resource/before/GetterDeprecated.java @@ -8,4 +8,4 @@ class GetterDeprecated { * @deprecated */ @Getter int javadoc; -}
\ No newline at end of file +} diff --git a/test/transform/resource/before/GetterOnClass.java b/test/transform/resource/before/GetterOnClass.java index 0a38b386..f44d2556 100644 --- a/test/transform/resource/before/GetterOnClass.java +++ b/test/transform/resource/before/GetterOnClass.java @@ -1,3 +1,4 @@ +//version 8: @lombok.Getter class GetterOnClass1 { @lombok.Getter(lombok.AccessLevel.NONE) diff --git a/test/transform/resource/before/JacksonBuilderSingular.java b/test/transform/resource/before/JacksonBuilderSingular.java index c179c760..20d6979a 100644 --- a/test/transform/resource/before/JacksonBuilderSingular.java +++ b/test/transform/resource/before/JacksonBuilderSingular.java @@ -1,3 +1,4 @@ +//version 8: Jackson deps are at least Java7+. import java.util.List; import java.util.Map; diff --git a/test/transform/resource/before/JacksonJsonProperty.java b/test/transform/resource/before/JacksonJsonProperty.java index f0b7b2f2..c0bccfae 100644 --- a/test/transform/resource/before/JacksonJsonProperty.java +++ b/test/transform/resource/before/JacksonJsonProperty.java @@ -1,3 +1,4 @@ +//version 8: Jackson deps are at least Java7+. import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonSetter; import com.fasterxml.jackson.annotation.Nulls; diff --git a/test/transform/resource/before/JacksonizedBuilderComplex.java b/test/transform/resource/before/JacksonizedBuilderComplex.java index dec1cd3b..5942926d 100644 --- a/test/transform/resource/before/JacksonizedBuilderComplex.java +++ b/test/transform/resource/before/JacksonizedBuilderComplex.java @@ -1,10 +1,11 @@ -//CONF: lombok.builder.className = Test*Name
-import java.util.List;
-import lombok.Builder;
-import lombok.extern.jackson.Jacksonized;
-
-class JacksonizedBuilderComplex {
- @Jacksonized
- @Builder(buildMethodName = "execute", setterPrefix = "with")
- private static <T extends Number> void testVoidWithGenerics(T number, int arg2, String arg3, JacksonizedBuilderComplex selfRef) {}
-}
+//version 8: Jackson deps are at least Java7+. +//CONF: lombok.builder.className = Test*Name +import java.util.List; +import lombok.Builder; +import lombok.extern.jackson.Jacksonized; + +class JacksonizedBuilderComplex { + @Jacksonized + @Builder(buildMethodName = "execute", setterPrefix = "with") + private static <T extends Number> void testVoidWithGenerics(T number, int arg2, String arg3, JacksonizedBuilderComplex selfRef) {} +} diff --git a/test/transform/resource/before/JacksonizedBuilderSimple.java b/test/transform/resource/before/JacksonizedBuilderSimple.java index 6da015ec..b81a0f5d 100644 --- a/test/transform/resource/before/JacksonizedBuilderSimple.java +++ b/test/transform/resource/before/JacksonizedBuilderSimple.java @@ -1,3 +1,4 @@ +//version 8: Jackson deps are at least Java7+. import java.util.List; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; diff --git a/test/transform/resource/before/JacksonizedSuperBuilderSimple.java b/test/transform/resource/before/JacksonizedSuperBuilderSimple.java index 1e3bd0fc..23e52c97 100644 --- a/test/transform/resource/before/JacksonizedSuperBuilderSimple.java +++ b/test/transform/resource/before/JacksonizedSuperBuilderSimple.java @@ -1,3 +1,4 @@ +//version 8: Jackson deps are at least Java7+. public class JacksonizedSuperBuilderSimple { @lombok.extern.jackson.Jacksonized @lombok.experimental.SuperBuilder diff --git a/test/transform/resource/before/JacksonizedSuperBuilderWithJsonDeserialize.java b/test/transform/resource/before/JacksonizedSuperBuilderWithJsonDeserialize.java index 0c80d1a6..ac0dba07 100644 --- a/test/transform/resource/before/JacksonizedSuperBuilderWithJsonDeserialize.java +++ b/test/transform/resource/before/JacksonizedSuperBuilderWithJsonDeserialize.java @@ -1,3 +1,4 @@ +//version 8: Jackson deps are at least Java7+. @lombok.extern.jackson.Jacksonized @lombok.experimental.SuperBuilder @com.fasterxml.jackson.databind.annotation.JsonDeserialize diff --git a/test/transform/resource/before/JavadocMultiline.java b/test/transform/resource/before/JavadocMultiline.java new file mode 100644 index 00000000..8557dba8 --- /dev/null +++ b/test/transform/resource/before/JavadocMultiline.java @@ -0,0 +1,22 @@ +@lombok.Getter +@lombok.Setter +class JavadocMultiline { + /** + * This is a list of booleans. + * + * @param booleans A list of booleans to set for this object. This is a Javadoc param that is + * long enough to wrap to multiple lines. + * @return A list of booleans to set for this object. This is a Javadoc return that is long + * enough to wrap to multiple lines. + */ + private java.util.List<Boolean> booleans; + + + /** + * This is a list of booleans. + * + * @param booleans A list of booleans to set for this object. This is a Javadoc param that is + * long enough to wrap to multiple lines. + */ + private java.util.List<Boolean> booleans2; +} diff --git a/test/transform/resource/before/LoggerLog4j2.java b/test/transform/resource/before/LoggerLog4j2.java index 10b3aae5..1dd48d7a 100644 --- a/test/transform/resource/before/LoggerLog4j2.java +++ b/test/transform/resource/before/LoggerLog4j2.java @@ -1,3 +1,4 @@ +//version 8: import lombok.extern.log4j.Log4j2; @lombok.extern.log4j.Log4j2 diff --git a/test/transform/resource/before/LoggerSlf4j.java b/test/transform/resource/before/LoggerSlf4j.java index 3f8284e8..c59db4ee 100644 --- a/test/transform/resource/before/LoggerSlf4j.java +++ b/test/transform/resource/before/LoggerSlf4j.java @@ -28,7 +28,3 @@ class LoggerSlf4jWithStaticField { class LoggerSlf4jWithTwoStaticFields { static final String TOPIC = "StaticField"; } - -@Slf4j(topic="A"+"B") -class LoggerSlf4jWithTwoLiterals { -}
\ No newline at end of file diff --git a/test/transform/resource/before/LoggerSlf4jInvalidTopic.java b/test/transform/resource/before/LoggerSlf4jInvalidTopic.java deleted file mode 100644 index eed02f01..00000000 --- a/test/transform/resource/before/LoggerSlf4jInvalidTopic.java +++ /dev/null @@ -1,5 +0,0 @@ -import lombok.extern.slf4j.Slf4j; - -@Slf4j(topic=42) -class LoggerSlf4jWithIntegerTopic { -}
\ No newline at end of file diff --git a/test/transform/resource/before/NonNullOnParameter.java b/test/transform/resource/before/NonNullOnParameter.java index 22aceac7..43175832 100644 --- a/test/transform/resource/before/NonNullOnParameter.java +++ b/test/transform/resource/before/NonNullOnParameter.java @@ -1,3 +1,4 @@ +//version 8: class NonNullOnParameter extends Thread { NonNullOnParameter(@lombok.NonNull String arg) { this(arg, ""); diff --git a/test/transform/resource/before/NonNullOnParameterAbstract.java b/test/transform/resource/before/NonNullOnParameterAbstract.java index 16691184..0508be42 100644 --- a/test/transform/resource/before/NonNullOnParameterAbstract.java +++ b/test/transform/resource/before/NonNullOnParameterAbstract.java @@ -1,3 +1,4 @@ +//version 8: abstract class NonNullOnParameterAbstract { public void test(@lombok.NonNull String arg) { System.out.println("Hey"); diff --git a/test/transform/resource/before/NonNullPlain.java b/test/transform/resource/before/NonNullPlain.java index a438d1d4..1a016fb4 100644 --- a/test/transform/resource/before/NonNullPlain.java +++ b/test/transform/resource/before/NonNullPlain.java @@ -1,3 +1,4 @@ +//version 8: import java.lang.annotation.*; @lombok.RequiredArgsConstructor diff --git a/test/transform/resource/before/NonNullWithAlternateException.java b/test/transform/resource/before/NonNullWithAlternateException.java index c47f5727..28b7be6d 100644 --- a/test/transform/resource/before/NonNullWithAlternateException.java +++ b/test/transform/resource/before/NonNullWithAlternateException.java @@ -1,3 +1,4 @@ +//version 8: //CONF: lombok.nonNull.exceptionType = IllegalArgumentException public class NonNullWithAlternateException { diff --git a/test/transform/resource/before/NonNullWithAssertion.java b/test/transform/resource/before/NonNullWithAssertion.java index c3d271a6..1e282ffa 100644 --- a/test/transform/resource/before/NonNullWithAssertion.java +++ b/test/transform/resource/before/NonNullWithAssertion.java @@ -1,3 +1,4 @@ +//version 8: //CONF: lombok.nonNull.exceptionType = Assertion public class NonNullWithAssertion { diff --git a/test/transform/resource/before/NonNullWithGuava.java b/test/transform/resource/before/NonNullWithGuava.java index dc877daa..e592ee14 100644 --- a/test/transform/resource/before/NonNullWithGuava.java +++ b/test/transform/resource/before/NonNullWithGuava.java @@ -1,3 +1,4 @@ +//version 8: //CONF: lombok.nonNull.exceptionType = Guava import static com.google.common.base.Preconditions.*; public class NonNullWithGuava { diff --git a/test/transform/resource/before/NonNullWithJdk.java b/test/transform/resource/before/NonNullWithJdk.java index c8cbf2ee..5c3d03a5 100644 --- a/test/transform/resource/before/NonNullWithJdk.java +++ b/test/transform/resource/before/NonNullWithJdk.java @@ -1,4 +1,4 @@ -//version 7: +//version 8: //CONF: lombok.nonNull.exceptionType = Jdk import static java.util.Objects.*; public class NonNullWithJdk { diff --git a/test/transform/resource/before/NonNullWithSneakyThrows.java b/test/transform/resource/before/NonNullWithSneakyThrows.java index 35f78a7f..00c03f04 100644 --- a/test/transform/resource/before/NonNullWithSneakyThrows.java +++ b/test/transform/resource/before/NonNullWithSneakyThrows.java @@ -1,3 +1,4 @@ +//version 8: class NonNullWithSneakyThrows { @lombok.SneakyThrows void test(@lombok.NonNull String in) { System.out.println(in); diff --git a/test/transform/resource/before/NullAnnotatedCheckerFrameworkSuperBuilder.java b/test/transform/resource/before/NullAnnotatedCheckerFrameworkSuperBuilder.java new file mode 100644 index 00000000..eea118cb --- /dev/null +++ b/test/transform/resource/before/NullAnnotatedCheckerFrameworkSuperBuilder.java @@ -0,0 +1,20 @@ +//version 8: +//CONF: lombok.addNullAnnotations = checkerframework +import java.util.List; +import lombok.Singular; + +class NullAnnotatedCheckerFrameworkSuperBuilder { + @lombok.experimental.SuperBuilder + public static class Parent { + @lombok.Builder.Default int x = 5; + int y; + int z; + @Singular List<String> names; + } + + @lombok.experimental.SuperBuilder + public static class ZChild extends Parent { + @lombok.Builder.Default int a = 1; + int b; + } +} diff --git a/test/transform/resource/before/NullLibrary1.java b/test/transform/resource/before/NullLibrary1.java index 95433270..d57d3d09 100644 --- a/test/transform/resource/before/NullLibrary1.java +++ b/test/transform/resource/before/NullLibrary1.java @@ -1,3 +1,4 @@ +//version 8: //CONF: lombok.addNullAnnotations = eclipse @lombok.EqualsAndHashCode @lombok.ToString diff --git a/test/transform/resource/before/NullLibrary2.java b/test/transform/resource/before/NullLibrary2.java index 17b1e6e0..6b0ce4b0 100644 --- a/test/transform/resource/before/NullLibrary2.java +++ b/test/transform/resource/before/NullLibrary2.java @@ -1,3 +1,4 @@ +//version 8: springframework dep is too new to run on j6 //CONF: lombok.addNullAnnotations = spring @lombok.EqualsAndHashCode @lombok.ToString diff --git a/test/transform/resource/before/OnXJava7StyleOn8.java b/test/transform/resource/before/OnXJava7StyleOn8.java index 582fe6ce..94865c97 100644 --- a/test/transform/resource/before/OnXJava7StyleOn8.java +++ b/test/transform/resource/before/OnXJava7StyleOn8.java @@ -1,4 +1,4 @@ -//platform ecj +//platform ecj,eclipse //version 8: public class OnXJava7StyleOn8 { diff --git a/test/transform/resource/before/OnXJava8StyleOn7.java b/test/transform/resource/before/OnXJava8StyleOn7.java index c006e468..98f76451 100644 --- a/test/transform/resource/before/OnXJava8StyleOn7.java +++ b/test/transform/resource/before/OnXJava8StyleOn7.java @@ -1,4 +1,4 @@ -//platform ecj +//platform ecj,eclipse //version :7 public class OnXJava8StyleOn7 { diff --git a/test/transform/resource/before/SetterDeprecated.java b/test/transform/resource/before/SetterDeprecated.java index e655622f..585cade1 100644 --- a/test/transform/resource/before/SetterDeprecated.java +++ b/test/transform/resource/before/SetterDeprecated.java @@ -8,4 +8,4 @@ class SetterDeprecated { * @deprecated */ @Setter int javadoc; -}
\ No newline at end of file +} diff --git a/test/transform/resource/before/SetterOnClass.java b/test/transform/resource/before/SetterOnClass.java index a7629ff0..b7ab4177 100644 --- a/test/transform/resource/before/SetterOnClass.java +++ b/test/transform/resource/before/SetterOnClass.java @@ -1,3 +1,4 @@ +//version 8: @lombok.Setter class SetterOnClass1 { @lombok.Setter(lombok.AccessLevel.NONE) diff --git a/test/transform/resource/before/StaticConstructor.java b/test/transform/resource/before/StaticConstructor.java index eff1fa9b..7b720c6f 100644 --- a/test/transform/resource/before/StaticConstructor.java +++ b/test/transform/resource/before/StaticConstructor.java @@ -1,3 +1,4 @@ +//version 8: //CONF: lombok.addNullAnnotations = checkerframework import lombok.AllArgsConstructor; @AllArgsConstructor(staticName = "of") diff --git a/test/transform/resource/before/SuperBuilderBasicToBuilder.java b/test/transform/resource/before/SuperBuilderBasicToBuilder.java index 93161443..bd97876e 100644 --- a/test/transform/resource/before/SuperBuilderBasicToBuilder.java +++ b/test/transform/resource/before/SuperBuilderBasicToBuilder.java @@ -15,7 +15,7 @@ public class SuperBuilderBasicToBuilder { private int method() { return 2; } - + private static String staticMethod(Parent instance) { return "staticMethod"; } diff --git a/test/transform/resource/before/SuperBuilderCustomized.java b/test/transform/resource/before/SuperBuilderCustomized.java index 8e641d90..652d0865 100644 --- a/test/transform/resource/before/SuperBuilderCustomized.java +++ b/test/transform/resource/before/SuperBuilderCustomized.java @@ -1,3 +1,4 @@ +//version 8: Javac 6 will error out due to `ChildBuilder` not existing before properly running lombok. Giving j6 support status, not worth fixing. import java.util.List; public class SuperBuilderCustomized { diff --git a/test/transform/resource/before/SuperBuilderInitializer.java b/test/transform/resource/before/SuperBuilderInitializer.java new file mode 100644 index 00000000..966a4daf --- /dev/null +++ b/test/transform/resource/before/SuperBuilderInitializer.java @@ -0,0 +1,16 @@ +import lombok.experimental.SuperBuilder; + +class SuperBuilderInitializer { + @SuperBuilder + public static class One { + private String world; + { + world = "Hello"; + } + + private static final String world2; + static { + world2 = "Hello"; + } + } +} diff --git a/test/transform/resource/before/SuperBuilderSingularAnnotatedTypes.java b/test/transform/resource/before/SuperBuilderSingularAnnotatedTypes.java index d26352d2..097f4e60 100644 --- a/test/transform/resource/before/SuperBuilderSingularAnnotatedTypes.java +++ b/test/transform/resource/before/SuperBuilderSingularAnnotatedTypes.java @@ -1,4 +1,4 @@ -//VERSION 8: +//version 8: import java.lang.annotation.ElementType; import java.lang.annotation.Target; import java.util.Set; diff --git a/test/transform/resource/before/SuperBuilderSingularCustomized.java b/test/transform/resource/before/SuperBuilderSingularCustomized.java new file mode 100644 index 00000000..86b6022a --- /dev/null +++ b/test/transform/resource/before/SuperBuilderSingularCustomized.java @@ -0,0 +1,9 @@ +import java.util.Set; +@lombok.experimental.SuperBuilder +class SuperBuilderSingularCustomized { + @lombok.Singular private Set<String> foos; + public static abstract class SuperBuilderSingularCustomizedBuilder<C extends SuperBuilderSingularCustomized, B extends SuperBuilderSingularCustomized.SuperBuilderSingularCustomizedBuilder<C, B>> { + public B custom(final String value) { + return self(); + } + }} diff --git a/test/transform/resource/before/SuperBuilderWithCustomBuilderMethod.java b/test/transform/resource/before/SuperBuilderWithCustomBuilderMethod.java index d52cbded..b828eafe 100644 --- a/test/transform/resource/before/SuperBuilderWithCustomBuilderMethod.java +++ b/test/transform/resource/before/SuperBuilderWithCustomBuilderMethod.java @@ -1,3 +1,4 @@ +//version 8: Javac 6 will error out due to `ChildBuilder` not existing before properly running lombok. Giving j6 support status, not worth fixing. import java.util.List; public class SuperBuilderWithCustomBuilderMethod { diff --git a/test/transform/resource/before/SuperBuilderWithExistingConstructor.java b/test/transform/resource/before/SuperBuilderWithExistingConstructor.java new file mode 100644 index 00000000..d6bfe2ec --- /dev/null +++ b/test/transform/resource/before/SuperBuilderWithExistingConstructor.java @@ -0,0 +1,5 @@ +@lombok.experimental.SuperBuilder +public class SuperBuilderWithExistingConstructor { + public SuperBuilderWithExistingConstructor() { + } +} diff --git a/test/transform/resource/before/SuperBuilderWithNonNull.java b/test/transform/resource/before/SuperBuilderWithNonNull.java index 34668bbc..7287c688 100644 --- a/test/transform/resource/before/SuperBuilderWithNonNull.java +++ b/test/transform/resource/before/SuperBuilderWithNonNull.java @@ -1,3 +1,4 @@ +//version 8: import java.util.List; public class SuperBuilderWithNonNull { diff --git a/test/transform/resource/before/ValDelegateMethodReference.java b/test/transform/resource/before/ValDelegateMethodReference.java index 7adc402a..3d1f082c 100644 --- a/test/transform/resource/before/ValDelegateMethodReference.java +++ b/test/transform/resource/before/ValDelegateMethodReference.java @@ -1,4 +1,5 @@ - +//version 8: +//platform !eclipse: Requires a 'full' eclipse with intialized workspace, and we don't (yet) have that set up properly in the test run. import lombok.Getter; import lombok.Setter; import lombok.experimental.Delegate; diff --git a/test/transform/resource/before/ValWeirdTypes.java b/test/transform/resource/before/ValWeirdTypes.java index 8dd63e86..f62feca6 100644 --- a/test/transform/resource/before/ValWeirdTypes.java +++ b/test/transform/resource/before/ValWeirdTypes.java @@ -1,3 +1,4 @@ +// version 8: In java6/7, lub types worked differently, so, the `arraysAsList` method has a slightly different inferred type there. import java.math.BigDecimal; import java.util.*; import lombok.val; diff --git a/test/transform/resource/before/ValueCallSuper.java b/test/transform/resource/before/ValueCallSuper.java index e236b404..bf561998 100644 --- a/test/transform/resource/before/ValueCallSuper.java +++ b/test/transform/resource/before/ValueCallSuper.java @@ -1,7 +1,7 @@ -//CONF: lombok.equalsAndHashCode.callSuper = call
-
-class ValueParent {
-}
-@lombok.Value
-class ValueCallSuper extends ValueParent {
-}
+//CONF: lombok.equalsAndHashCode.callSuper = call + +class ValueParent { +} +@lombok.Value +class ValueCallSuper extends ValueParent { +} diff --git a/test/transform/resource/before/WithByNullAnnos.java b/test/transform/resource/before/WithByNullAnnos.java index 3fd8087f..a3ef6ac3 100644 --- a/test/transform/resource/before/WithByNullAnnos.java +++ b/test/transform/resource/before/WithByNullAnnos.java @@ -1,3 +1,4 @@ +//version 8: //CONF: lombok.addNullAnnotations=checkerframework import java.util.List; @lombok.RequiredArgsConstructor diff --git a/test/transform/resource/before/WithByTypes.java b/test/transform/resource/before/WithByTypes.java index 9d2fe358..e33b0dd6 100644 --- a/test/transform/resource/before/WithByTypes.java +++ b/test/transform/resource/before/WithByTypes.java @@ -1,3 +1,4 @@ +//version 8: @lombok.RequiredArgsConstructor @lombok.experimental.FieldDefaults(level = lombok.AccessLevel.PRIVATE, makeFinal = true) @lombok.experimental.WithBy diff --git a/test/transform/resource/before/WithMethodMarkedDeprecatedAnnOnly.java b/test/transform/resource/before/WithMethodMarkedDeprecatedAnnOnly.java new file mode 100644 index 00000000..50509545 --- /dev/null +++ b/test/transform/resource/before/WithMethodMarkedDeprecatedAnnOnly.java @@ -0,0 +1,10 @@ +import lombok.With; + +class WithMethodMarkedDeprecatedAnnOnly { + + @Deprecated + @With int annotation; + + WithMethodMarkedDeprecatedAnnOnly(int annotation) { + } +}
\ No newline at end of file diff --git a/test/transform/resource/before/WithOnClass.java b/test/transform/resource/before/WithOnClass.java index a6215b54..fb6350e7 100644 --- a/test/transform/resource/before/WithOnClass.java +++ b/test/transform/resource/before/WithOnClass.java @@ -1,3 +1,5 @@ +//version 8: + @lombok.With class WithOnClass1 { @lombok.With(lombok.AccessLevel.NONE) diff --git a/test/transform/resource/before/WithPlain.java b/test/transform/resource/before/WithPlain.java index 4f048242..9be8d4d5 100644 --- a/test/transform/resource/before/WithPlain.java +++ b/test/transform/resource/before/WithPlain.java @@ -1,3 +1,4 @@ +//version 8: springframework dep is too new to run on j6 //CONF: lombok.addNullAnnotations = spring import lombok.With; class WithPlain { diff --git a/test/transform/resource/messages-delombok/CheckerFrameworkBasic.java.messages b/test/transform/resource/messages-delombok/CheckerFrameworkBasic.java.messages deleted file mode 100644 index 9ee959a4..00000000 --- a/test/transform/resource/messages-delombok/CheckerFrameworkBasic.java.messages +++ /dev/null @@ -1,4 +0,0 @@ -6 package org.checkerframework.common.aliasing.qual does not exist -8 package org.checkerframework.dataflow.qual does not exist -9 package org.checkerframework.dataflow.qual does not exist -10 package org.checkerframework.dataflow.qual does not exist diff --git a/test/transform/resource/messages-delombok/CheckerFrameworkBuilder.java.messages b/test/transform/resource/messages-delombok/CheckerFrameworkBuilder.java.messages deleted file mode 100644 index 8c736705..00000000 --- a/test/transform/resource/messages-delombok/CheckerFrameworkBuilder.java.messages +++ /dev/null @@ -1 +0,0 @@ -6 package org.checkerframework.common.aliasing.qual does not exist diff --git a/test/transform/resource/messages-delombok/CheckerFrameworkSuperBuilder.java.messages b/test/transform/resource/messages-delombok/CheckerFrameworkSuperBuilder.java.messages deleted file mode 100644 index 5dd6251a..00000000 --- a/test/transform/resource/messages-delombok/CheckerFrameworkSuperBuilder.java.messages +++ /dev/null @@ -1,3 +0,0 @@ -6 package org.checkerframework.dataflow.qual does not exist --1 package org.checkerframework.checker.builder.qual does not exist -14 package org.checkerframework.dataflow.qual does not exist diff --git a/test/transform/resource/messages-delombok/ExtensionMethodVarargs.java.messages b/test/transform/resource/messages-delombok/ExtensionMethodVarargs.java.messages new file mode 100644 index 00000000..587d0767 --- /dev/null +++ b/test/transform/resource/messages-delombok/ExtensionMethodVarargs.java.messages @@ -0,0 +1 @@ +14 non-varargs call of varargs method with inexact argument type for last parameter
\ No newline at end of file diff --git a/test/transform/resource/messages-delombok/LoggerSlf4jInvalidTopic.java.messages b/test/transform/resource/messages-delombok/LoggerSlf4jInvalidTopic.java.messages deleted file mode 100644 index 8de0a120..00000000 --- a/test/transform/resource/messages-delombok/LoggerSlf4jInvalidTopic.java.messages +++ /dev/null @@ -1,2 +0,0 @@ -3 incompatible types: int cannot be converted to java.lang.String --1 not flagged modified
\ No newline at end of file diff --git a/test/transform/resource/messages-delombok/UtilityClassErrors.java.messages b/test/transform/resource/messages-delombok/UtilityClassErrors.java.messages index 0ff5b231..21e23ed5 100644 --- a/test/transform/resource/messages-delombok/UtilityClassErrors.java.messages +++ b/test/transform/resource/messages-delombok/UtilityClassErrors.java.messages @@ -1,4 +1,4 @@ 4 @UtilityClasses cannot have declared constructors. 7 @UtilityClass cannot be placed on a method local or anonymous inner class, or any class nested in such a class. -12 @UtilityClass is only supported on a class (can't be an interface, enum, annotation, or record). +12 @UtilityClass is only supported on a class. 17 @UtilityClass automatically makes the class static, however, this class cannot be made static.
\ No newline at end of file diff --git a/test/transform/resource/messages-ecj/CheckerFrameworkBasic.java.messages b/test/transform/resource/messages-ecj/CheckerFrameworkBasic.java.messages deleted file mode 100644 index 8cc7fb58..00000000 --- a/test/transform/resource/messages-ecj/CheckerFrameworkBasic.java.messages +++ /dev/null @@ -1 +0,0 @@ -6 org.checkerframework.common cannot be resolved to a type diff --git a/test/transform/resource/messages-ecj/CheckerFrameworkBuilder.java.messages b/test/transform/resource/messages-ecj/CheckerFrameworkBuilder.java.messages deleted file mode 100644 index d385a95c..00000000 --- a/test/transform/resource/messages-ecj/CheckerFrameworkBuilder.java.messages +++ /dev/null @@ -1 +0,0 @@ -6 org.checkerframework cannot be resolved to a type diff --git a/test/transform/resource/messages-ecj/CheckerFrameworkSuperBuilder.java.messages b/test/transform/resource/messages-ecj/CheckerFrameworkSuperBuilder.java.messages deleted file mode 100644 index 8cc7fb58..00000000 --- a/test/transform/resource/messages-ecj/CheckerFrameworkSuperBuilder.java.messages +++ /dev/null @@ -1 +0,0 @@ -6 org.checkerframework.common cannot be resolved to a type diff --git a/test/transform/resource/messages-ecj/ExtensionMethodNonStaticAccess.java.messages b/test/transform/resource/messages-ecj/ExtensionMethodNonStaticAccess.java.messages new file mode 100644 index 00000000..3f5f3988 --- /dev/null +++ b/test/transform/resource/messages-ecj/ExtensionMethodNonStaticAccess.java.messages @@ -0,0 +1,2 @@ +6 The static method staticMethod() from the type Base should be accessed directly +6 The static method staticMethod() from the type Base should be accessed in a static way
\ No newline at end of file diff --git a/test/transform/resource/messages-ecj/ExtensionMethodSuppress.java.messages b/test/transform/resource/messages-ecj/ExtensionMethodSuppress.java.messages new file mode 100644 index 00000000..dfa778a4 --- /dev/null +++ b/test/transform/resource/messages-ecj/ExtensionMethodSuppress.java.messages @@ -0,0 +1 @@ +21 The static method staticMethod() from the type Test should be accessed in a static way
\ No newline at end of file diff --git a/test/transform/resource/messages-ecj/LoggerSlf4jInvalidTopic.java.messages b/test/transform/resource/messages-ecj/LoggerSlf4jInvalidTopic.java.messages deleted file mode 100644 index 9bc2a82b..00000000 --- a/test/transform/resource/messages-ecj/LoggerSlf4jInvalidTopic.java.messages +++ /dev/null @@ -1 +0,0 @@ -3 Type mismatch: cannot convert from int to String
\ No newline at end of file diff --git a/test/transform/resource/messages-ecj/UtilityClassErrors.java.messages b/test/transform/resource/messages-ecj/UtilityClassErrors.java.messages index 6995eb65..21e23ed5 100644 --- a/test/transform/resource/messages-ecj/UtilityClassErrors.java.messages +++ b/test/transform/resource/messages-ecj/UtilityClassErrors.java.messages @@ -1,4 +1,4 @@ 4 @UtilityClasses cannot have declared constructors. 7 @UtilityClass cannot be placed on a method local or anonymous inner class, or any class nested in such a class. -12 @UtilityClass is only supported on a class (can't be an interface, enum, annotation, or record) +12 @UtilityClass is only supported on a class. 17 @UtilityClass automatically makes the class static, however, this class cannot be made static.
\ No newline at end of file diff --git a/test/transform/resource/messages-idempotent/CheckerFrameworkBasic.java.messages b/test/transform/resource/messages-idempotent/CheckerFrameworkBasic.java.messages deleted file mode 100644 index 80694a06..00000000 --- a/test/transform/resource/messages-idempotent/CheckerFrameworkBasic.java.messages +++ /dev/null @@ -1,10 +0,0 @@ -5 package org.checkerframework.common.aliasing.qual does not exist -11 package org.checkerframework.dataflow.qual does not exist -16 package org.checkerframework.dataflow.qual does not exist -21 package org.checkerframework.dataflow.qual does not exist -26 package org.checkerframework.checker.builder.qual does not exist -32 package org.checkerframework.dataflow.qual does not exist -45 package org.checkerframework.dataflow.qual does not exist -50 package org.checkerframework.dataflow.qual does not exist -61 package org.checkerframework.dataflow.qual does not exist -67 package org.checkerframework.dataflow.qual does not exist diff --git a/test/transform/resource/messages-idempotent/ExtensionMethodVarargs.java.messages b/test/transform/resource/messages-idempotent/ExtensionMethodVarargs.java.messages new file mode 100644 index 00000000..5a1016ca --- /dev/null +++ b/test/transform/resource/messages-idempotent/ExtensionMethodVarargs.java.messages @@ -0,0 +1 @@ +9 non-varargs call of varargs method with inexact argument type for last parameter
\ No newline at end of file diff --git a/test/transform/resource/messages-idempotent/LoggerSlf4jInvalidTopic.java.messages b/test/transform/resource/messages-idempotent/LoggerSlf4jInvalidTopic.java.messages deleted file mode 100644 index d894fad1..00000000 --- a/test/transform/resource/messages-idempotent/LoggerSlf4jInvalidTopic.java.messages +++ /dev/null @@ -1 +0,0 @@ -3 incompatible types: int cannot be converted to java.lang.String
\ No newline at end of file |