diff options
Diffstat (limited to 'test')
18 files changed, 256 insertions, 27 deletions
diff --git a/test/pretty/resource/after/ArrayAndVarargs.java b/test/pretty/resource/after/ArrayAndVarargs.java new file mode 100644 index 00000000..9727bff6 --- /dev/null +++ b/test/pretty/resource/after/ArrayAndVarargs.java @@ -0,0 +1,7 @@ +import java.util.List; +class ArrayAndVarargs { + void test(List<String[]>... foo) { + } + void test2(byte[]... foo) { + } +} diff --git a/test/pretty/resource/before/ArrayAndVarargs.java b/test/pretty/resource/before/ArrayAndVarargs.java new file mode 100644 index 00000000..38c9b276 --- /dev/null +++ b/test/pretty/resource/before/ArrayAndVarargs.java @@ -0,0 +1,9 @@ +import java.util.List; + +class ArrayAndVarargs { + void test(List<String[]>... foo) { + } + + void test2(byte[]... foo) { + } +}
\ No newline at end of file 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/ValInLambda.java b/test/transform/resource/after-delombok/ValInLambda.java index 7ce1e1b4..861fb9da 100644 --- a/test/transform/resource/after-delombok/ValInLambda.java +++ b/test/transform/resource/after-delombok/ValInLambda.java @@ -2,17 +2,26 @@ class ValInLambda { Runnable foo = (Runnable) () -> { final int i = 1; + final java.lang.Runnable foo = (System.currentTimeMillis() > 0) ? (Runnable) () -> { + } : System.out::println; }; - + public void easyLambda() { Runnable foo = (Runnable) () -> { final int i = 1; }; } - + public void easyIntersectionLambda() { Runnable foo = (Runnable) () -> { final int i = 1; }; } + + public void easyLubLambda() { + Runnable foo = (Runnable) () -> { + final java.lang.Runnable fooInner = (System.currentTimeMillis() > 0) ? (Runnable) () -> { + } : System.out::println; + }; + } } diff --git a/test/transform/resource/after-delombok/ValLambda.java b/test/transform/resource/after-delombok/ValLambda.java index 00ff27ad..24ae3b5f 100644 --- a/test/transform/resource/after-delombok/ValLambda.java +++ b/test/transform/resource/after-delombok/ValLambda.java @@ -1,15 +1,27 @@ // version 8: class ValLambda { + static { + final java.lang.Runnable foo = (System.currentTimeMillis() > 0) ? (Runnable) () -> { + } : System.out::println; + } + + { + final java.lang.Runnable foo = (System.currentTimeMillis() > 0) ? (Runnable) () -> { + } : System.out::println; + } + public void easyLambda() { final java.lang.Runnable foo = (Runnable) () -> { }; } + public void easyIntersectionLambda() { final java.lang.Runnable foo = (Runnable & java.io.Serializable) () -> { }; final java.io.Serializable bar = (java.io.Serializable & Runnable) () -> { }; } + public void easyLubLambda() { final java.lang.Runnable foo = (System.currentTimeMillis() > 0) ? (Runnable) () -> { } : System.out::println; 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/after-ecj/ValInLambda.java b/test/transform/resource/after-ecj/ValInLambda.java index 7669789b..0fac61e9 100644 --- a/test/transform/resource/after-ecj/ValInLambda.java +++ b/test/transform/resource/after-ecj/ValInLambda.java @@ -1,9 +1,9 @@ -// version 8: - import lombok.val; class ValInLambda { Runnable foo = (Runnable) () -> { final @val int i = 1; + final @lombok.val java.lang.Runnable foo = ((System.currentTimeMillis() > 0) ? (Runnable) () -> { +} : System.out::println); }; ValInLambda() { super(); @@ -18,4 +18,10 @@ class ValInLambda { final @val int i = 1; }; } + public void easyLubLambda() { + Runnable foo = (Runnable) () -> { + final @lombok.val java.lang.Runnable fooInner = ((System.currentTimeMillis() > 0) ? (Runnable) () -> { +} : System.out::println); +}; + } } diff --git a/test/transform/resource/after-ecj/ValLambda.java b/test/transform/resource/after-ecj/ValLambda.java index fcb855b3..5b52869f 100644 --- a/test/transform/resource/after-ecj/ValLambda.java +++ b/test/transform/resource/after-ecj/ValLambda.java @@ -1,4 +1,14 @@ class ValLambda { + static { + final @lombok.val java.lang.Runnable foo = ((System.currentTimeMillis() > 0) ? (Runnable) () -> { +} : System.out::println); + } + { + final @lombok.val java.lang.Runnable foo = ((System.currentTimeMillis() > 0) ? (Runnable) () -> { +} : System.out::println); + } + <clinit>() { + } ValLambda() { super(); } 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/ValInLambda.java b/test/transform/resource/before/ValInLambda.java index 2c2a5942..a5364f8e 100644 --- a/test/transform/resource/before/ValInLambda.java +++ b/test/transform/resource/before/ValInLambda.java @@ -5,6 +5,7 @@ import lombok.val; class ValInLambda { Runnable foo = (Runnable) () -> { val i = 1; + lombok.val foo = (System.currentTimeMillis() > 0) ? (Runnable)()-> {} : System.out::println; }; public void easyLambda() { @@ -18,4 +19,10 @@ class ValInLambda { val i = 1; }; } + + public void easyLubLambda() { + Runnable foo = (Runnable) () -> { + lombok.val fooInner = (System.currentTimeMillis() > 0) ? (Runnable)()-> {} : System.out::println; + }; + } } diff --git a/test/transform/resource/before/ValLambda.java b/test/transform/resource/before/ValLambda.java index 35f83c3c..5c9c4a43 100644 --- a/test/transform/resource/before/ValLambda.java +++ b/test/transform/resource/before/ValLambda.java @@ -1,5 +1,13 @@ // version 8: class ValLambda { + + static { + lombok.val foo = (System.currentTimeMillis() > 0) ? (Runnable)()-> {} : System.out::println; + } + { + lombok.val foo = (System.currentTimeMillis() > 0) ? (Runnable)()-> {} : System.out::println; + } + public void easyLambda() { lombok.val foo = (Runnable)()-> {}; } diff --git a/test/transform/resource/messages-ecj/ValLambda.java.messages b/test/transform/resource/messages-ecj/ValLambda.java.messages index 21c831c3..e6940434 100644 --- a/test/transform/resource/messages-ecj/ValLambda.java.messages +++ b/test/transform/resource/messages-ecj/ValLambda.java.messages @@ -1,2 +1,2 @@ -14 Function is a raw type. References to generic type Function<T,R> should be parameterized -15 Function is a raw type. References to generic type Function<T,R> should be parameterized
\ No newline at end of file +23 Function is a raw type. References to generic type Function<T,R> should be parameterized +24 Function is a raw type. References to generic type Function<T,R> should be parameterized
\ No newline at end of file |