diff options
Diffstat (limited to 'test/transform/resource/after-delombok')
4 files changed, 184 insertions, 30 deletions
diff --git a/test/transform/resource/after-delombok/BuilderSingularNullBehavior2.java b/test/transform/resource/after-delombok/BuilderSingularNullBehavior2.java new file mode 100644 index 00000000..f62ebd10 --- /dev/null +++ b/test/transform/resource/after-delombok/BuilderSingularNullBehavior2.java @@ -0,0 +1,99 @@ +import java.util.List; +import lombok.Singular.NullCollectionBehavior; +class BuilderSingularNullBehavior2 { + private List<String> locations; + private List<String> doohickeys; + @java.lang.SuppressWarnings("all") + BuilderSingularNullBehavior2(final List<String> locations, final List<String> doohickeys) { + this.locations = locations; + this.doohickeys = doohickeys; + } + @java.lang.SuppressWarnings("all") + public static class BuilderSingularNullBehavior2Builder { + @java.lang.SuppressWarnings("all") + private java.util.ArrayList<String> locations; + @java.lang.SuppressWarnings("all") + private java.util.ArrayList<String> doohickeys; + @java.lang.SuppressWarnings("all") + BuilderSingularNullBehavior2Builder() { + } + @java.lang.SuppressWarnings("all") + public BuilderSingularNullBehavior2.BuilderSingularNullBehavior2Builder location(final String location) { + if (this.locations == null) this.locations = new java.util.ArrayList<String>(); + this.locations.add(location); + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularNullBehavior2.BuilderSingularNullBehavior2Builder locations(final java.util.@org.checkerframework.checker.nullness.qual.NonNull Collection<? extends String> locations) { + java.util.Objects.requireNonNull(locations, "locations cannot be null"); + if (this.locations == null) this.locations = new java.util.ArrayList<String>(); + this.locations.addAll(locations); + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularNullBehavior2.BuilderSingularNullBehavior2Builder clearLocations() { + if (this.locations != null) this.locations.clear(); + return this; + } + + @java.lang.SuppressWarnings("all") + public BuilderSingularNullBehavior2.BuilderSingularNullBehavior2Builder doohickey(final String doohickey) { + if (this.doohickeys == null) this.doohickeys = new java.util.ArrayList<String>(); + this.doohickeys.add(doohickey); + return this; + } + + @java.lang.SuppressWarnings("all") + public BuilderSingularNullBehavior2.BuilderSingularNullBehavior2Builder doohickeys(final java.util.@org.checkerframework.checker.nullness.qual.Nullable Collection<? extends String> doohickeys) { + if (doohickeys != null) { + if (this.doohickeys == null) this.doohickeys = new java.util.ArrayList<String>(); + this.doohickeys.addAll(doohickeys); + } + return this; + } + + @java.lang.SuppressWarnings("all") + public BuilderSingularNullBehavior2.BuilderSingularNullBehavior2Builder clearDoohickeys() { + if (this.doohickeys != null) this.doohickeys.clear(); + return this; + } + + @java.lang.SuppressWarnings("all") + public BuilderSingularNullBehavior2 build() { + java.util.List<String> locations; + switch (this.locations == null ? 0 : this.locations.size()) { + case 0: + locations = java.util.Collections.emptyList(); + break; + case 1: + locations = java.util.Collections.singletonList(this.locations.get(0)); + break; + default: + locations = java.util.Collections.unmodifiableList(new java.util.ArrayList<String>(this.locations)); + } + java.util.List<String> doohickeys; + switch (this.doohickeys == null ? 0 : this.doohickeys.size()) { + case 0: + doohickeys = java.util.Collections.emptyList(); + break; + case 1: + doohickeys = java.util.Collections.singletonList(this.doohickeys.get(0)); + break; + default: + doohickeys = java.util.Collections.unmodifiableList(new java.util.ArrayList<String>(this.doohickeys)); + } + return new BuilderSingularNullBehavior2(locations, doohickeys); + } + + @java.lang.Override + @java.lang.SuppressWarnings("all") + public java.lang.@org.checkerframework.checker.nullness.qual.NonNull String toString() { + return "BuilderSingularNullBehavior2.BuilderSingularNullBehavior2Builder(locations=" + this.locations + ", doohickeys=" + this.doohickeys + ")"; + } + } + + @java.lang.SuppressWarnings("all") + public static BuilderSingularNullBehavior2.BuilderSingularNullBehavior2Builder builder() { + return new BuilderSingularNullBehavior2.BuilderSingularNullBehavior2Builder(); + } +}
\ No newline at end of file diff --git a/test/transform/resource/after-delombok/EqualsAndHashCodeWithNNBD.java b/test/transform/resource/after-delombok/EqualsAndHashCodeWithNNBD.java deleted file mode 100644 index 6eaf9f36..00000000 --- a/test/transform/resource/after-delombok/EqualsAndHashCodeWithNNBD.java +++ /dev/null @@ -1,30 +0,0 @@ -import javax.annotation.ParametersAreNonnullByDefault; - -@ParametersAreNonnullByDefault -class EqualsAndHashCodeWithNNBD { - - @org.eclipse.jdt.annotation.NonNullByDefault - static class Inner { - @java.lang.Override - @java.lang.SuppressWarnings("all") - public boolean equals(final java.lang.@javax.annotation.Nullable @org.eclipse.jdt.annotation.Nullable Object o) { - if (o == this) return true; - if (!(o instanceof EqualsAndHashCodeWithNNBD.Inner)) return false; - final EqualsAndHashCodeWithNNBD.Inner other = (EqualsAndHashCodeWithNNBD.Inner) 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 EqualsAndHashCodeWithNNBD.Inner; - } - - @java.lang.Override - @java.lang.SuppressWarnings("all") - public int hashCode() { - final int result = 1; - return result; - } - } -}
\ No newline at end of file diff --git a/test/transform/resource/after-delombok/NullLibrary1.java b/test/transform/resource/after-delombok/NullLibrary1.java new file mode 100644 index 00000000..e426e3d3 --- /dev/null +++ b/test/transform/resource/after-delombok/NullLibrary1.java @@ -0,0 +1,42 @@ +public class NullLibrary1 { + String foo; + @java.lang.Override + @java.lang.SuppressWarnings("all") + public boolean equals(final java.lang.@org.eclipse.jdt.annotation.Nullable Object o) { + if (o == this) return true; + if (!(o instanceof NullLibrary1)) return false; + final NullLibrary1 other = (NullLibrary1) o; + if (!other.canEqual((java.lang.Object) this)) return false; + final java.lang.Object this$foo = this.foo; + final java.lang.Object other$foo = other.foo; + if (this$foo == null ? other$foo != null : !this$foo.equals(other$foo)) return false; + return true; + } + @java.lang.SuppressWarnings("all") + protected boolean canEqual(final java.lang.@org.eclipse.jdt.annotation.Nullable Object other) { + return other instanceof NullLibrary1; + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public int hashCode() { + final int PRIME = 59; + int result = 1; + final java.lang.Object $foo = this.foo; + result = result * PRIME + ($foo == null ? 43 : $foo.hashCode()); + return result; + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public java.lang.@org.eclipse.jdt.annotation.NonNull String toString() { + return "NullLibrary1(foo=" + this.foo + ")"; + } + @java.lang.SuppressWarnings("all") + public NullLibrary1(final String foo) { + this.foo = foo; + } + @org.eclipse.jdt.annotation.NonNull + @java.lang.SuppressWarnings("all") + public NullLibrary1 withFoo(final String foo) { + return this.foo == foo ? this : new NullLibrary1(foo); + } +} diff --git a/test/transform/resource/after-delombok/NullLibrary2.java b/test/transform/resource/after-delombok/NullLibrary2.java new file mode 100644 index 00000000..8f48c8a5 --- /dev/null +++ b/test/transform/resource/after-delombok/NullLibrary2.java @@ -0,0 +1,43 @@ +public class NullLibrary2 { + String foo; + @java.lang.Override + @java.lang.SuppressWarnings("all") + public boolean equals(@org.springframework.lang.Nullable final java.lang.Object o) { + if (o == this) return true; + if (!(o instanceof NullLibrary2)) return false; + final NullLibrary2 other = (NullLibrary2) o; + if (!other.canEqual((java.lang.Object) this)) return false; + final java.lang.Object this$foo = this.foo; + final java.lang.Object other$foo = other.foo; + if (this$foo == null ? other$foo != null : !this$foo.equals(other$foo)) return false; + return true; + } + @java.lang.SuppressWarnings("all") + protected boolean canEqual(@org.springframework.lang.Nullable final java.lang.Object other) { + return other instanceof NullLibrary2; + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public int hashCode() { + final int PRIME = 59; + int result = 1; + final java.lang.Object $foo = this.foo; + result = result * PRIME + ($foo == null ? 43 : $foo.hashCode()); + return result; + } + @org.springframework.lang.NonNull + @java.lang.Override + @java.lang.SuppressWarnings("all") + public java.lang.String toString() { + return "NullLibrary2(foo=" + this.foo + ")"; + } + @java.lang.SuppressWarnings("all") + public NullLibrary2(final String foo) { + this.foo = foo; + } + @org.springframework.lang.NonNull + @java.lang.SuppressWarnings("all") + public NullLibrary2 withFoo(final String foo) { + return this.foo == foo ? this : new NullLibrary2(foo); + } +} |