diff options
Diffstat (limited to 'test/transform')
11 files changed, 182 insertions, 30 deletions
diff --git a/test/transform/resource/after-delombok/BuilderComplex.java b/test/transform/resource/after-delombok/BuilderComplex.java index a89d7114..c63d7b59 100644 --- a/test/transform/resource/after-delombok/BuilderComplex.java +++ b/test/transform/resource/after-delombok/BuilderComplex.java @@ -3,7 +3,7 @@ class BuilderComplex { private static <T extends Number> void testVoidWithGenerics(T number, int arg2, String arg3, BuilderComplex selfRef) { } @java.lang.SuppressWarnings("all") - public static class VoidBuilder<T extends Number> { + public static class TestVoidName<T extends Number> { @java.lang.SuppressWarnings("all") private T number; @java.lang.SuppressWarnings("all") @@ -13,25 +13,25 @@ class BuilderComplex { @java.lang.SuppressWarnings("all") private BuilderComplex selfRef; @java.lang.SuppressWarnings("all") - VoidBuilder() { + TestVoidName() { } @java.lang.SuppressWarnings("all") - public VoidBuilder<T> number(final T number) { + public TestVoidName<T> number(final T number) { this.number = number; return this; } @java.lang.SuppressWarnings("all") - public VoidBuilder<T> arg2(final int arg2) { + public TestVoidName<T> arg2(final int arg2) { this.arg2 = arg2; return this; } @java.lang.SuppressWarnings("all") - public VoidBuilder<T> arg3(final String arg3) { + public TestVoidName<T> arg3(final String arg3) { this.arg3 = arg3; return this; } @java.lang.SuppressWarnings("all") - public VoidBuilder<T> selfRef(final BuilderComplex selfRef) { + public TestVoidName<T> selfRef(final BuilderComplex selfRef) { this.selfRef = selfRef; return this; } @@ -42,11 +42,11 @@ class BuilderComplex { @java.lang.Override @java.lang.SuppressWarnings("all") public java.lang.String toString() { - return "BuilderComplex.VoidBuilder(number=" + this.number + ", arg2=" + this.arg2 + ", arg3=" + this.arg3 + ", selfRef=" + this.selfRef + ")"; + return "BuilderComplex.TestVoidName(number=" + this.number + ", arg2=" + this.arg2 + ", arg3=" + this.arg3 + ", selfRef=" + this.selfRef + ")"; } } @java.lang.SuppressWarnings("all") - public static <T extends Number> VoidBuilder<T> builder() { - return new VoidBuilder<T>(); + public static <T extends Number> TestVoidName<T> builder() { + return new TestVoidName<T>(); } } diff --git a/test/transform/resource/after-delombok/BuilderCustomName.java b/test/transform/resource/after-delombok/BuilderCustomName.java new file mode 100644 index 00000000..4db08220 --- /dev/null +++ b/test/transform/resource/after-delombok/BuilderCustomName.java @@ -0,0 +1,47 @@ +import java.util.List; +class BuilderCustomName<T> { + private final int field; + @java.lang.SuppressWarnings("all") + public static abstract class SimpleTestBuilder<T, C extends BuilderCustomName<T>, B extends SimpleTestBuilder<T, C, B>> { + @java.lang.SuppressWarnings("all") + private int field; + @java.lang.SuppressWarnings("all") + protected abstract B self(); + @java.lang.SuppressWarnings("all") + public abstract C build(); + @java.lang.SuppressWarnings("all") + public B field(final int field) { + this.field = field; + return self(); + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public java.lang.String toString() { + return "BuilderCustomName.SimpleTestBuilder(field=" + this.field + ")"; + } + } + @java.lang.SuppressWarnings("all") + private static final class SimpleTestBuilderImpl<T> extends SimpleTestBuilder<T, BuilderCustomName<T>, SimpleTestBuilderImpl<T>> { + @java.lang.SuppressWarnings("all") + private SimpleTestBuilderImpl() { + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + protected SimpleTestBuilderImpl<T> self() { + return this; + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public BuilderCustomName<T> build() { + return new BuilderCustomName<T>(this); + } + } + @java.lang.SuppressWarnings("all") + protected BuilderCustomName(final SimpleTestBuilder<T, ?, ?> b) { + this.field = b.field; + } + @java.lang.SuppressWarnings("all") + public static <T> SimpleTestBuilder<T, ?, ?> builder() { + return new SimpleTestBuilderImpl<T>(); + } +}
\ No newline at end of file diff --git a/test/transform/resource/after-delombok/EqualsAndHashCodeAnnotated.java b/test/transform/resource/after-delombok/EqualsAndHashCodeAnnotated.java new file mode 100644 index 00000000..64b6f4d3 --- /dev/null +++ b/test/transform/resource/after-delombok/EqualsAndHashCodeAnnotated.java @@ -0,0 +1,51 @@ +import java.lang.annotation.*; + +class EqualsAndHashCodeAnnotated { + @Annotated + int primitive; + @Annotated + Object object; + int @Annotated [] primitiveValues; + int @Annotated [] @Annotated [] morePrimitiveValues; + Integer @Annotated [] objectValues; + Integer @Annotated [] @Annotated [] moreObjectValues; + @Target(ElementType.TYPE_USE) + @Retention(RetentionPolicy.SOURCE) + @interface Annotated { + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public boolean equals(final java.lang.Object o) { + if (o == this) return true; + if (!(o instanceof EqualsAndHashCodeAnnotated)) return false; + final EqualsAndHashCodeAnnotated other = (EqualsAndHashCodeAnnotated) o; + if (!other.canEqual((java.lang.Object) this)) return false; + if (this.primitive != other.primitive) return false; + final java.lang.Object this$object = this.object; + final java.lang.Object other$object = other.object; + if (this$object == null ? other$object != null : !this$object.equals(other$object)) return false; + if (!java.util.Arrays.equals(this.primitiveValues, other.primitiveValues)) return false; + if (!java.util.Arrays.deepEquals(this.morePrimitiveValues, other.morePrimitiveValues)) return false; + if (!java.util.Arrays.deepEquals(this.objectValues, other.objectValues)) return false; + if (!java.util.Arrays.deepEquals(this.moreObjectValues, other.moreObjectValues)) return false; + return true; + } + @java.lang.SuppressWarnings("all") + protected boolean canEqual(final java.lang.Object other) { + return other instanceof EqualsAndHashCodeAnnotated; + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public int hashCode() { + final int PRIME = 59; + int result = 1; + result = result * PRIME + this.primitive; + final java.lang.Object $object = this.object; + result = result * PRIME + ($object == null ? 43 : $object.hashCode()); + result = result * PRIME + java.util.Arrays.hashCode(this.primitiveValues); + result = result * PRIME + java.util.Arrays.deepHashCode(this.morePrimitiveValues); + result = result * PRIME + java.util.Arrays.deepHashCode(this.objectValues); + result = result * PRIME + java.util.Arrays.deepHashCode(this.moreObjectValues); + return result; + } +}
\ No newline at end of file diff --git a/test/transform/resource/after-delombok/ValLambda.java b/test/transform/resource/after-delombok/ValLambda.java index 82b8ecc5..24ae3b5f 100644 --- a/test/transform/resource/after-delombok/ValLambda.java +++ b/test/transform/resource/after-delombok/ValLambda.java @@ -30,8 +30,4 @@ class ValLambda { java.util.function.Function foo3 = (System.currentTimeMillis() < 0) ? (java.util.function.Function) r -> "" : r -> System.currentTimeMillis(); final java.util.function.Function<java.lang.String, java.lang.String> foo4 = (System.currentTimeMillis() < 0) ? (java.util.function.Function<String, String>) r -> "" : r -> String.valueOf(System.currentTimeMillis()); } -// public void castLubLambda() { -// Runnable foo = (Runnable) ((System.currentTimeMillis() > 0) ? () -> {} : System.out::println); -// lombok.val foo = (Runnable) ((System.currentTimeMillis() > 0) ? () -> {} : System.out::println); -// } }
\ No newline at end of file diff --git a/test/transform/resource/after-ecj/BuilderComplex.java b/test/transform/resource/after-ecj/BuilderComplex.java index 93d70fe9..23dbf058 100644 --- a/test/transform/resource/after-ecj/BuilderComplex.java +++ b/test/transform/resource/after-ecj/BuilderComplex.java @@ -1,27 +1,27 @@ import java.util.List; import lombok.Builder; class BuilderComplex { - public static @java.lang.SuppressWarnings("all") class VoidBuilder<T extends Number> { + public static @java.lang.SuppressWarnings("all") class TestVoidName<T extends Number> { private @java.lang.SuppressWarnings("all") T number; private @java.lang.SuppressWarnings("all") int arg2; private @java.lang.SuppressWarnings("all") String arg3; private @java.lang.SuppressWarnings("all") BuilderComplex selfRef; - @java.lang.SuppressWarnings("all") VoidBuilder() { + @java.lang.SuppressWarnings("all") TestVoidName() { super(); } - public @java.lang.SuppressWarnings("all") VoidBuilder<T> number(final T number) { + public @java.lang.SuppressWarnings("all") TestVoidName<T> number(final T number) { this.number = number; return this; } - public @java.lang.SuppressWarnings("all") VoidBuilder<T> arg2(final int arg2) { + public @java.lang.SuppressWarnings("all") TestVoidName<T> arg2(final int arg2) { this.arg2 = arg2; return this; } - public @java.lang.SuppressWarnings("all") VoidBuilder<T> arg3(final String arg3) { + public @java.lang.SuppressWarnings("all") TestVoidName<T> arg3(final String arg3) { this.arg3 = arg3; return this; } - public @java.lang.SuppressWarnings("all") VoidBuilder<T> selfRef(final BuilderComplex selfRef) { + public @java.lang.SuppressWarnings("all") TestVoidName<T> selfRef(final BuilderComplex selfRef) { this.selfRef = selfRef; return this; } @@ -29,7 +29,7 @@ class BuilderComplex { BuilderComplex.<T>testVoidWithGenerics(number, arg2, arg3, selfRef); } public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { - return (((((((("BuilderComplex.VoidBuilder(number=" + this.number) + ", arg2=") + this.arg2) + ", arg3=") + this.arg3) + ", selfRef=") + this.selfRef) + ")"); + return (((((((("BuilderComplex.TestVoidName(number=" + this.number) + ", arg2=") + this.arg2) + ", arg3=") + this.arg3) + ", selfRef=") + this.selfRef) + ")"); } } BuilderComplex() { @@ -37,7 +37,7 @@ class BuilderComplex { } private static @Builder(buildMethodName = "execute") <T extends Number>void testVoidWithGenerics(T number, int arg2, String arg3, BuilderComplex selfRef) { } - public static @java.lang.SuppressWarnings("all") <T extends Number>VoidBuilder<T> builder() { - return new VoidBuilder<T>(); + public static @java.lang.SuppressWarnings("all") <T extends Number>TestVoidName<T> builder() { + return new TestVoidName<T>(); } } diff --git a/test/transform/resource/after-ecj/BuilderCustomName.java b/test/transform/resource/after-ecj/BuilderCustomName.java new file mode 100644 index 00000000..1067a9d1 --- /dev/null +++ b/test/transform/resource/after-ecj/BuilderCustomName.java @@ -0,0 +1,37 @@ +import java.util.List; +@lombok.experimental.SuperBuilder class BuilderCustomName<T> { + public static abstract @java.lang.SuppressWarnings("all") class SimpleTestBuilder<T, C extends BuilderCustomName<T>, B extends SimpleTestBuilder<T, C, B>> { + private @java.lang.SuppressWarnings("all") int field; + public SimpleTestBuilder() { + super(); + } + protected abstract @java.lang.SuppressWarnings("all") B self(); + public abstract @java.lang.SuppressWarnings("all") C build(); + public @java.lang.SuppressWarnings("all") B field(final int field) { + this.field = field; + return self(); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (("BuilderCustomName.SimpleTestBuilder(field=" + this.field) + ")"); + } + } + private static final @java.lang.SuppressWarnings("all") class SimpleTestBuilderImpl<T> extends SimpleTestBuilder<T, BuilderCustomName<T>, SimpleTestBuilderImpl<T>> { + private SimpleTestBuilderImpl() { + super(); + } + protected @java.lang.Override @java.lang.SuppressWarnings("all") SimpleTestBuilderImpl<T> self() { + return this; + } + public @java.lang.Override @java.lang.SuppressWarnings("all") BuilderCustomName<T> build() { + return new BuilderCustomName<T>(this); + } + } + private final int field; + protected @java.lang.SuppressWarnings("all") BuilderCustomName(final SimpleTestBuilder<T, ?, ?> b) { + super(); + this.field = b.field; + } + public static @java.lang.SuppressWarnings("all") <T>SimpleTestBuilder<T, ?, ?> builder() { + return new SimpleTestBuilderImpl<T>(); + } +} diff --git a/test/transform/resource/before/BuilderComplex.java b/test/transform/resource/before/BuilderComplex.java index c13f5877..46f62721 100644 --- a/test/transform/resource/before/BuilderComplex.java +++ b/test/transform/resource/before/BuilderComplex.java @@ -1,3 +1,4 @@ +//CONF: lombok.builder.className = Test*Name import java.util.List; import lombok.Builder; diff --git a/test/transform/resource/before/BuilderCustomName.java b/test/transform/resource/before/BuilderCustomName.java new file mode 100644 index 00000000..d5709e63 --- /dev/null +++ b/test/transform/resource/before/BuilderCustomName.java @@ -0,0 +1,7 @@ +//CONF: lombok.builder.className = SimpleTestBuilder +import java.util.List; + +@lombok.experimental.SuperBuilder +class BuilderCustomName<T> { + private final int field; +} diff --git a/test/transform/resource/before/BuilderJavadoc.java b/test/transform/resource/before/BuilderJavadoc.java index c2e0a6e0..390e2096 100644 --- a/test/transform/resource/before/BuilderJavadoc.java +++ b/test/transform/resource/before/BuilderJavadoc.java @@ -4,7 +4,7 @@ import java.util.List; class BuilderJavadoc<T> { /** * basic gets only a builder setter. - * @see #getsetwith + * @see #getsetwith * @param tag is moved to the setter. * @return tag is removed from the setter. */ @@ -49,6 +49,5 @@ class BuilderJavadoc<T> { this.predefWithJavadoc = x * 100; return this; } - } - + } } diff --git a/test/transform/resource/before/EqualsAndHashCodeAnnotated.java b/test/transform/resource/before/EqualsAndHashCodeAnnotated.java new file mode 100644 index 00000000..d672b982 --- /dev/null +++ b/test/transform/resource/before/EqualsAndHashCodeAnnotated.java @@ -0,0 +1,19 @@ +//version 8 +import java.lang.annotation.*; + +@lombok.EqualsAndHashCode +class EqualsAndHashCodeAnnotated { + @Annotated int primitive; + @Annotated Object object; + + int @Annotated [] primitiveValues; + int @Annotated [] @Annotated [] morePrimitiveValues; + + Integer @Annotated [] objectValues; + Integer @Annotated [] @Annotated [] moreObjectValues; + + @Target(ElementType.TYPE_USE) + @Retention(RetentionPolicy.SOURCE) + @interface Annotated { + } +} diff --git a/test/transform/resource/before/ValLambda.java b/test/transform/resource/before/ValLambda.java index 64b9cbe8..5c9c4a43 100644 --- a/test/transform/resource/before/ValLambda.java +++ b/test/transform/resource/before/ValLambda.java @@ -24,9 +24,4 @@ class ValLambda { java.util.function.Function foo3 = (System.currentTimeMillis() < 0) ? (java.util.function.Function) r -> "" : r -> System.currentTimeMillis(); lombok.val foo4 = (System.currentTimeMillis() < 0) ? (java.util.function.Function<String, String>) r -> "" : r -> String.valueOf(System.currentTimeMillis()); } - -// public void castLubLambda() { -// Runnable foo = (Runnable) ((System.currentTimeMillis() > 0) ? () -> {} : System.out::println); -// lombok.val foo = (Runnable) ((System.currentTimeMillis() > 0) ? () -> {} : System.out::println); -// } } |