diff options
Diffstat (limited to 'test/transform/resource/after-delombok')
8 files changed, 242 insertions, 29 deletions
diff --git a/test/transform/resource/after-delombok/BuilderJavadoc.java b/test/transform/resource/after-delombok/BuilderJavadoc.java new file mode 100644 index 00000000..196ced3b --- /dev/null +++ b/test/transform/resource/after-delombok/BuilderJavadoc.java @@ -0,0 +1,116 @@ +import java.util.List; +class BuilderJavadoc<T> { + /** + * basic gets only a builder setter. + * @see #getsetwith + * + * @return tag is removed from the setter. + */ + private final int basic; + /** + * getsetwith gets a builder setter, an instance getter and setter, and a wither. + */ + private int getsetwith; + /** + * Predef has a predefined builder setter with no javadoc, and the builder setter does not get this one. + * @param tag remains on the field. + * @return tag remains on the field. + */ + private final int predef; + /** + * predefWithJavadoc has a predefined builder setter with javadoc, so it keeps that one untouched. + * @param tag is removed from the field. + * @return tag remains on the field. + */ + private final int predefWithJavadoc; + public static class BuilderJavadocBuilder<T> { + @java.lang.SuppressWarnings("all") + private int basic; + @java.lang.SuppressWarnings("all") + private int getsetwith; + @java.lang.SuppressWarnings("all") + private int predef; + @java.lang.SuppressWarnings("all") + private int predefWithJavadoc; + public BuilderJavadocBuilder<T> predef(final int x) { + this.predef = x * 10; + return this; + } + /** + * This javadoc remains untouched. + * @param x 1/100 of the thing + * @return the updated builder + */ + public BuilderJavadocBuilder<T> predefWithJavadoc(final int x) { + this.predefWithJavadoc = x * 100; + return this; + } + @java.lang.SuppressWarnings("all") + BuilderJavadocBuilder() { + } + /** + * basic gets only a builder setter. + * @see #getsetwith + * @param tag is moved to the setter. + */ + @java.lang.SuppressWarnings("all") + public 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. + */ + @java.lang.SuppressWarnings("all") + public BuilderJavadocBuilder<T> getsetwith(final int getsetwith) { + this.getsetwith = getsetwith; + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderJavadoc<T> build() { + return new BuilderJavadoc<T>(basic, getsetwith, predef, predefWithJavadoc); + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public java.lang.String toString() { + return "BuilderJavadoc.BuilderJavadocBuilder(basic=" + this.basic + ", getsetwith=" + this.getsetwith + ", predef=" + this.predef + ", predefWithJavadoc=" + this.predefWithJavadoc + ")"; + } + } + @java.lang.SuppressWarnings("all") + BuilderJavadoc(final int basic, final int getsetwith, final int predef, final int predefWithJavadoc) { + this.basic = basic; + this.getsetwith = getsetwith; + this.predef = predef; + this.predefWithJavadoc = predefWithJavadoc; + } + @java.lang.SuppressWarnings("all") + public static <T> BuilderJavadocBuilder<T> builder() { + return new BuilderJavadocBuilder<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") + public 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. + */ + @java.lang.SuppressWarnings("all") + public 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. + */ + @java.lang.SuppressWarnings("all") + public 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-delombok/BuilderWithBadNames.java b/test/transform/resource/after-delombok/BuilderWithBadNames.java new file mode 100644 index 00000000..f413be23 --- /dev/null +++ b/test/transform/resource/after-delombok/BuilderWithBadNames.java @@ -0,0 +1,42 @@ +public class BuilderWithBadNames { + String build; + String toString; + @java.lang.SuppressWarnings("all") + BuilderWithBadNames(final String build, final String toString) { + this.build = build; + this.toString = toString; + } + @java.lang.SuppressWarnings("all") + public static class BuilderWithBadNamesBuilder { + @java.lang.SuppressWarnings("all") + private String build; + @java.lang.SuppressWarnings("all") + private String toString; + @java.lang.SuppressWarnings("all") + BuilderWithBadNamesBuilder() { + } + @java.lang.SuppressWarnings("all") + public BuilderWithBadNamesBuilder build(final String build) { + this.build = build; + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderWithBadNamesBuilder toString(final String toString) { + this.toString = toString; + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderWithBadNames build() { + return new BuilderWithBadNames(build, toString); + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public java.lang.String toString() { + return "BuilderWithBadNames.BuilderWithBadNamesBuilder(build=" + this.build + ", toString=" + this.toString + ")"; + } + } + @java.lang.SuppressWarnings("all") + public static BuilderWithBadNamesBuilder builder() { + return new BuilderWithBadNamesBuilder(); + } +} diff --git a/test/transform/resource/after-delombok/BuilderWithDeprecated.java b/test/transform/resource/after-delombok/BuilderWithDeprecated.java index cd887529..f06a11f2 100644 --- a/test/transform/resource/after-delombok/BuilderWithDeprecated.java +++ b/test/transform/resource/after-delombok/BuilderWithDeprecated.java @@ -1,7 +1,7 @@ import com.google.common.collect.ImmutableList; public class BuilderWithDeprecated { /** - * @deprecated + * @deprecated since always */ String dep1; @Deprecated @@ -30,6 +30,9 @@ public class BuilderWithDeprecated { @java.lang.SuppressWarnings("all") BuilderWithDeprecatedBuilder() { } + /** + * @deprecated since always + */ @java.lang.Deprecated @java.lang.SuppressWarnings("all") public BuilderWithDeprecatedBuilder dep1(final String dep1) { diff --git a/test/transform/resource/after-delombok/DataPlain.java b/test/transform/resource/after-delombok/DataPlain.java index e7d452b6..15b834d9 100644 --- a/test/transform/resource/after-delombok/DataPlain.java +++ b/test/transform/resource/after-delombok/DataPlain.java @@ -152,6 +152,7 @@ final class Data3 { final class Data4 extends java.util.Timer { int x; Data4() { + super(); } @java.lang.SuppressWarnings("all") public int getX() { diff --git a/test/transform/resource/after-delombok/NonNullTypeUse.java b/test/transform/resource/after-delombok/NonNullTypeUse.java new file mode 100644 index 00000000..27719480 --- /dev/null +++ b/test/transform/resource/after-delombok/NonNullTypeUse.java @@ -0,0 +1,32 @@ +import lombok.NonNull; +class NonNullTypeUse { + void test1(@NonNull String[][][] args) { + if (args == null) { + throw new java.lang.NullPointerException("args is marked @NonNull but is null"); + } + } + void test2(String @NonNull [][][] args) { + if (args == null) { + throw new java.lang.NullPointerException("args is marked @NonNull but is null"); + } + } + void test3(String[] @NonNull [][] args) { + } + void test4(String[][] @NonNull [] args) { + } + void test5(@NonNull String simple) { + if (simple == null) { + throw new java.lang.NullPointerException("simple is marked @NonNull but is null"); + } + } + void test6(java.lang.@NonNull String weird) { + if (weird == null) { + throw new java.lang.NullPointerException("weird is marked @NonNull but is null"); + } + } + void test7(java.lang.String @NonNull [][] weird) { + if (weird == null) { + throw new java.lang.NullPointerException("weird is marked @NonNull but is null"); + } + } +} diff --git a/test/transform/resource/after-delombok/SetterAndWitherJavadoc.java b/test/transform/resource/after-delombok/SetterAndWitherJavadoc.java new file mode 100644 index 00000000..8c0505e7 --- /dev/null +++ b/test/transform/resource/after-delombok/SetterAndWitherJavadoc.java @@ -0,0 +1,46 @@ +class SetterAndWitherJavadoc { + /** + * Some value. + */ + int i; + /** + * Some other value. + */ + int j; + SetterAndWitherJavadoc(int i, int j) { + this.i = i; + this.j = j; + } + /** + * Some value. + * @param the new value + */ + @java.lang.SuppressWarnings("all") + public void setI(final int i) { + this.i = i; + } + /** + * Some value. + * @param the new value + */ + @java.lang.SuppressWarnings("all") + public SetterAndWitherJavadoc withI(final int i) { + return this.i == i ? this : new SetterAndWitherJavadoc(i, this.j); + } + /** + * Set some other value. + * @param the new other value + */ + @java.lang.SuppressWarnings("all") + public void setJ(final int j) { + this.j = j; + } + /** + * Reinstantiate with some other value. + * @param the other new other value + */ + @java.lang.SuppressWarnings("all") + public SetterAndWitherJavadoc withJ(final int j) { + return this.j == j ? this : new SetterAndWitherJavadoc(this.i, j); + } +} diff --git a/test/transform/resource/after-delombok/SetterWitherJavadocParamCopy.java b/test/transform/resource/after-delombok/SetterWitherJavadocParamCopy.java deleted file mode 100644 index e6f5ab75..00000000 --- a/test/transform/resource/after-delombok/SetterWitherJavadocParamCopy.java +++ /dev/null @@ -1,28 +0,0 @@ -class SetterWitherJavadocParamCopy { - /** - * Some text - */ - private int fieldName; - - public SetterWitherJavadocParamCopy(int f) { - this.fieldName = f; - } - /** - * Some text - * - * @param fieldName Hello, World1 - */ - @java.lang.SuppressWarnings("all") - public void setFieldName(final int fieldName) { - this.fieldName = fieldName; - } - /** - * Some text - * - * @param fieldName Hello, World1 - */ - @java.lang.SuppressWarnings("all") - public SetterWitherJavadocParamCopy withFieldName(final int fieldName) { - return this.fieldName == fieldName ? this : new SetterWitherJavadocParamCopy(fieldName); - } -}
\ No newline at end of file diff --git a/test/transform/resource/after-delombok/SneakyThrowsPlain.java b/test/transform/resource/after-delombok/SneakyThrowsPlain.java index 86f7790c..32ab8054 100644 --- a/test/transform/resource/after-delombok/SneakyThrowsPlain.java +++ b/test/transform/resource/after-delombok/SneakyThrowsPlain.java @@ -1,5 +1,6 @@ class SneakyThrowsPlain { SneakyThrowsPlain() { + super(); try { System.out.println("constructor"); } catch (final java.lang.Throwable $ex) { |