diff options
Diffstat (limited to 'test/transform/resource/after-delombok')
31 files changed, 594 insertions, 72 deletions
diff --git a/test/transform/resource/after-delombok/BuilderChainAndFluent.java b/test/transform/resource/after-delombok/BuilderChainAndFluent.java new file mode 100644 index 00000000..d4975bff --- /dev/null +++ b/test/transform/resource/after-delombok/BuilderChainAndFluent.java @@ -0,0 +1,31 @@ +class BuilderChainAndFluent { + private final int yes; + @java.lang.SuppressWarnings("all") + BuilderChainAndFluent(final int yes) { + this.yes = yes; + } + @java.lang.SuppressWarnings("all") + public static class BuilderChainAndFluentBuilder { + private int yes; + @java.lang.SuppressWarnings("all") + BuilderChainAndFluentBuilder() { + } + @java.lang.SuppressWarnings("all") + public void setYes(final int yes) { + this.yes = yes; + } + @java.lang.SuppressWarnings("all") + public BuilderChainAndFluent build() { + return new BuilderChainAndFluent(yes); + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public java.lang.String toString() { + return "BuilderChainAndFluent.BuilderChainAndFluentBuilder(yes=" + this.yes + ")"; + } + } + @java.lang.SuppressWarnings("all") + public static BuilderChainAndFluentBuilder builder() { + return new BuilderChainAndFluentBuilder(); + } +}
\ No newline at end of file diff --git a/test/transform/resource/after-delombok/BuilderComplex.java b/test/transform/resource/after-delombok/BuilderComplex.java new file mode 100644 index 00000000..3c97f92a --- /dev/null +++ b/test/transform/resource/after-delombok/BuilderComplex.java @@ -0,0 +1,48 @@ +import java.util.List; +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> { + private T number; + private int arg2; + private String arg3; + private BuilderComplex selfRef; + @java.lang.SuppressWarnings("all") + VoidBuilder() { + } + @java.lang.SuppressWarnings("all") + public VoidBuilder<T> number(final T number) { + this.number = number; + return this; + } + @java.lang.SuppressWarnings("all") + public VoidBuilder<T> arg2(final int arg2) { + this.arg2 = arg2; + return this; + } + @java.lang.SuppressWarnings("all") + public VoidBuilder<T> arg3(final String arg3) { + this.arg3 = arg3; + return this; + } + @java.lang.SuppressWarnings("all") + public VoidBuilder<T> selfRef(final BuilderComplex selfRef) { + this.selfRef = selfRef; + return this; + } + @java.lang.SuppressWarnings("all") + public void execute() { + BuilderComplex.<T>testVoidWithGenerics(number, arg2, arg3, selfRef); + } + @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 + ")"; + } + } + @java.lang.SuppressWarnings("all") + public static <T extends Number> VoidBuilder<T> builder() { + return new VoidBuilder<T>(); + } +}
\ No newline at end of file diff --git a/test/transform/resource/after-delombok/BuilderSimple.java b/test/transform/resource/after-delombok/BuilderSimple.java new file mode 100644 index 00000000..11c0e58c --- /dev/null +++ b/test/transform/resource/after-delombok/BuilderSimple.java @@ -0,0 +1,43 @@ +import java.util.List; +class BuilderSimple<T> { + private final int noshow = 0; + private final int yes; + private List<T> also; + private int $butNotMe; + @java.lang.SuppressWarnings("all") + BuilderSimple(final int yes, final List<T> also) { + this.yes = yes; + this.also = also; + } + @java.lang.SuppressWarnings("all") + public static class BuilderSimpleBuilder<T> { + private int yes; + private List<T> also; + @java.lang.SuppressWarnings("all") + BuilderSimpleBuilder() { + } + @java.lang.SuppressWarnings("all") + public BuilderSimpleBuilder<T> yes(final int yes) { + this.yes = yes; + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSimpleBuilder<T> also(final List<T> also) { + this.also = also; + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSimple<T> build() { + return new BuilderSimple<T>(yes, also); + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public java.lang.String toString() { + return "BuilderSimple.BuilderSimpleBuilder(yes=" + this.yes + ", also=" + this.also + ")"; + } + } + @java.lang.SuppressWarnings("all") + public static <T> BuilderSimpleBuilder<T> builder() { + return new BuilderSimpleBuilder<T>(); + } +} diff --git a/test/transform/resource/after-delombok/BuilderWithExistingBuilderClass.java b/test/transform/resource/after-delombok/BuilderWithExistingBuilderClass.java new file mode 100644 index 00000000..1d40dbfa --- /dev/null +++ b/test/transform/resource/after-delombok/BuilderWithExistingBuilderClass.java @@ -0,0 +1,38 @@ +class BuilderWithExistingBuilderClass<T, K extends Number> { + public static <Z extends Number> BuilderWithExistingBuilderClass<String, Z> staticMethod(Z arg1, boolean arg2, String arg3) { + return null; + } + public static class BuilderWithExistingBuilderClassBuilder<Z extends Number> { + private boolean arg2; + private String arg3; + private Z arg1; + public void arg2(boolean arg) { + } + @java.lang.SuppressWarnings("all") + BuilderWithExistingBuilderClassBuilder() { + } + @java.lang.SuppressWarnings("all") + public BuilderWithExistingBuilderClassBuilder<Z> arg1(final Z arg1) { + this.arg1 = arg1; + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderWithExistingBuilderClassBuilder<Z> arg3(final String arg3) { + this.arg3 = arg3; + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderWithExistingBuilderClass build() { + return BuilderWithExistingBuilderClass.<Z>staticMethod(arg1, arg2, arg3); + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public java.lang.String toString() { + return "BuilderWithExistingBuilderClass.BuilderWithExistingBuilderClassBuilder(arg1=" + this.arg1 + ", arg2=" + this.arg2 + ", arg3=" + this.arg3 + ")"; + } + } + @java.lang.SuppressWarnings("all") + public static <Z extends Number> BuilderWithExistingBuilderClassBuilder<Z> builder() { + return new BuilderWithExistingBuilderClassBuilder<Z>(); + } +}
\ No newline at end of file diff --git a/test/transform/resource/after-delombok/CommentsInterspersed.java b/test/transform/resource/after-delombok/CommentsInterspersed.java index 5aaafe42..833f2ce0 100644 --- a/test/transform/resource/after-delombok/CommentsInterspersed.java +++ b/test/transform/resource/after-delombok/CommentsInterspersed.java @@ -1,9 +1,13 @@ /* cmt *//* cmt2 */ /* cmt3 */ /*bla */ public class CommentsInterspersed { - /** javadoc for field */ + /** + * javadoc for field + */ private int x; /* bla2 */ private String test = "foo"; //$NON-NLS-1$ - /** Javadoc on method */ + /** + * Javadoc on method + */ public native void gwtTest(); /*-{ javascript; }-*/ diff --git a/test/transform/resource/after-delombok/DataOnLocalClass.java b/test/transform/resource/after-delombok/DataOnLocalClass.java index ed4d30ca..abe2757b 100644 --- a/test/transform/resource/after-delombok/DataOnLocalClass.java +++ b/test/transform/resource/after-delombok/DataOnLocalClass.java @@ -63,7 +63,9 @@ class DataOnLocalClass2 { String name; @java.lang.SuppressWarnings("all") public InnerLocal(@lombok.NonNull final String name) { - if (name == null) throw new java.lang.NullPointerException("name"); + if (name == null) { + throw new java.lang.NullPointerException("name"); + } this.name = name; } @lombok.NonNull @@ -73,7 +75,9 @@ class DataOnLocalClass2 { } @java.lang.SuppressWarnings("all") public void setName(@lombok.NonNull final String name) { - if (name == null) throw new java.lang.NullPointerException("name"); + if (name == null) { + throw new java.lang.NullPointerException("name"); + } this.name = name; } @java.lang.Override diff --git a/test/transform/resource/after-delombok/DelegateOnGetter.java b/test/transform/resource/after-delombok/DelegateOnGetter.java index 08d682a2..e8d01a49 100644 --- a/test/transform/resource/after-delombok/DelegateOnGetter.java +++ b/test/transform/resource/after-delombok/DelegateOnGetter.java @@ -1,12 +1,12 @@ class DelegateOnGetter { - private final java.util.concurrent.atomic.AtomicReference<java.util.concurrent.atomic.AtomicReference<Bar>> bar = new java.util.concurrent.atomic.AtomicReference<java.util.concurrent.atomic.AtomicReference<Bar>>(); + private final java.util.concurrent.atomic.AtomicReference<java.lang.Object> bar = new java.util.concurrent.atomic.AtomicReference<java.lang.Object>(); private interface Bar { void setList(java.util.ArrayList<java.lang.String> list); int getInt(); } @java.lang.SuppressWarnings("all") public Bar getBar() { - java.util.concurrent.atomic.AtomicReference<Bar> value = this.bar.get(); + java.lang.Object value = this.bar.get(); if (value == null) { synchronized (this.bar) { value = this.bar.get(); @@ -18,12 +18,12 @@ class DelegateOnGetter { return 42; } }; - value = new java.util.concurrent.atomic.AtomicReference<Bar>(actualValue); + value = actualValue == null ? this.bar : actualValue; this.bar.set(value); } } } - return value.get(); + return (Bar)(value == this.bar ? null : value); } @java.lang.SuppressWarnings("all") public void setList(final java.util.ArrayList<java.lang.String> list) { diff --git a/test/transform/resource/after-delombok/DelegateWithDeprecated.java b/test/transform/resource/after-delombok/DelegateWithDeprecated.java index 04e12160..f7bd1e6d 100644 --- a/test/transform/resource/after-delombok/DelegateWithDeprecated.java +++ b/test/transform/resource/after-delombok/DelegateWithDeprecated.java @@ -3,7 +3,9 @@ class DelegateWithDeprecated { private interface Bar { @Deprecated void deprecatedAnnotation(); - /** @deprecated */ + /** + * @deprecated + */ void deprecatedComment(); void notDeprecated(); } diff --git a/test/transform/resource/after-delombok/EqualsAndHashCodeWithSomeExistingMethods.java b/test/transform/resource/after-delombok/EqualsAndHashCodeWithSomeExistingMethods.java new file mode 100644 index 00000000..0a6b1e7f --- /dev/null +++ b/test/transform/resource/after-delombok/EqualsAndHashCodeWithSomeExistingMethods.java @@ -0,0 +1,82 @@ +import lombok.*; +import static lombok.AccessLevel.NONE; +class EqualsAndHashCodeWithSomeExistingMethods { + int x; + public int hashCode() { + return 42; + } + @java.lang.SuppressWarnings("all") + public EqualsAndHashCodeWithSomeExistingMethods() { + + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public java.lang.String toString() { + return "EqualsAndHashCodeWithSomeExistingMethods(x=" + this.x + ")"; + } +} +class EqualsAndHashCodeWithSomeExistingMethods2 { + int x; + public boolean canEqual(Object other) { + return false; + } + @java.lang.SuppressWarnings("all") + public EqualsAndHashCodeWithSomeExistingMethods2() { + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public java.lang.String toString() { + return "EqualsAndHashCodeWithSomeExistingMethods2(x=" + this.x + ")"; + } +} +class EqualsAndHashCodeWithAllExistingMethods { + int x; + public int hashCode() { + return 42; + } + public boolean equals(Object other) { + return false; + } + @java.lang.SuppressWarnings("all") + public EqualsAndHashCodeWithAllExistingMethods() { + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public java.lang.String toString() { + return "EqualsAndHashCodeWithAllExistingMethods(x=" + this.x + ")"; + } +} +class EqualsAndHashCodeWithNoExistingMethods { + int x; + @java.lang.SuppressWarnings("all") + public EqualsAndHashCodeWithNoExistingMethods() { + + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public boolean equals(final java.lang.Object o) { + if (o == this) return true; + if (!(o instanceof EqualsAndHashCodeWithNoExistingMethods)) return false; + final EqualsAndHashCodeWithNoExistingMethods other = (EqualsAndHashCodeWithNoExistingMethods)o; + if (!other.canEqual((java.lang.Object)this)) return false; + if (this.x != other.x) return false; + return true; + } + @java.lang.SuppressWarnings("all") + public boolean canEqual(final java.lang.Object other) { + return other instanceof EqualsAndHashCodeWithNoExistingMethods; + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public int hashCode() { + final int PRIME = 31; + int result = 1; + result = result * PRIME + this.x; + return result; + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public java.lang.String toString() { + return "EqualsAndHashCodeWithNoExistingMethods(x=" + this.x + ")"; + } +} diff --git a/test/transform/resource/after-delombok/GetterDeprecated.java b/test/transform/resource/after-delombok/GetterDeprecated.java index 3387540f..09ea9929 100644 --- a/test/transform/resource/after-delombok/GetterDeprecated.java +++ b/test/transform/resource/after-delombok/GetterDeprecated.java @@ -10,6 +10,9 @@ class GetterDeprecated { public int getAnnotation() { return this.annotation; } + /** + * @deprecated + */ @java.lang.Deprecated @java.lang.SuppressWarnings("all") public int getJavadoc() { diff --git a/test/transform/resource/after-delombok/GetterLazy.java b/test/transform/resource/after-delombok/GetterLazy.java index 95be39e3..4f6f2c03 100644 --- a/test/transform/resource/after-delombok/GetterLazy.java +++ b/test/transform/resource/after-delombok/GetterLazy.java @@ -1,20 +1,20 @@ class GetterLazy { static class ValueType { } - private final java.util.concurrent.atomic.AtomicReference<java.util.concurrent.atomic.AtomicReference<ValueType>> fieldName = new java.util.concurrent.atomic.AtomicReference<java.util.concurrent.atomic.AtomicReference<ValueType>>(); + private final java.util.concurrent.atomic.AtomicReference<java.lang.Object> fieldName = new java.util.concurrent.atomic.AtomicReference<java.lang.Object>(); @java.lang.SuppressWarnings("all") public ValueType getFieldName() { - java.util.concurrent.atomic.AtomicReference<ValueType> value = this.fieldName.get(); + java.lang.Object value = this.fieldName.get(); if (value == null) { synchronized (this.fieldName) { value = this.fieldName.get(); if (value == null) { final ValueType actualValue = new ValueType(); - value = new java.util.concurrent.atomic.AtomicReference<ValueType>(actualValue); + value = actualValue == null ? this.fieldName : actualValue; this.fieldName.set(value); } } } - return value.get(); + return (ValueType)(value == this.fieldName ? null : value); } } diff --git a/test/transform/resource/after-delombok/GetterLazyBoolean.java b/test/transform/resource/after-delombok/GetterLazyBoolean.java index caab2803..08d32013 100644 --- a/test/transform/resource/after-delombok/GetterLazyBoolean.java +++ b/test/transform/resource/after-delombok/GetterLazyBoolean.java @@ -1,6 +1,6 @@ class GetterLazyBoolean { - private final java.util.concurrent.atomic.AtomicReference<java.util.concurrent.atomic.AtomicReference<java.lang.Boolean>> booleanValue = new java.util.concurrent.atomic.AtomicReference<java.util.concurrent.atomic.AtomicReference<java.lang.Boolean>>(); - private final java.util.concurrent.atomic.AtomicReference<java.util.concurrent.atomic.AtomicReference<java.lang.Boolean>> otherBooleanValue = new java.util.concurrent.atomic.AtomicReference<java.util.concurrent.atomic.AtomicReference<java.lang.Boolean>>(); + private final java.util.concurrent.atomic.AtomicReference<java.lang.Object> booleanValue = new java.util.concurrent.atomic.AtomicReference<java.lang.Object>(); + private final java.util.concurrent.atomic.AtomicReference<java.lang.Object> otherBooleanValue = new java.util.concurrent.atomic.AtomicReference<java.lang.Object>(); private static boolean calculateBoolean() { return true; } @@ -33,32 +33,32 @@ class GetterLazyBoolean { } @java.lang.SuppressWarnings("all") public boolean isBooleanValue() { - java.util.concurrent.atomic.AtomicReference<java.lang.Boolean> value = this.booleanValue.get(); + java.lang.Object value = this.booleanValue.get(); if (value == null) { synchronized (this.booleanValue) { value = this.booleanValue.get(); if (value == null) { final boolean actualValue = calculateBoolean(); - value = new java.util.concurrent.atomic.AtomicReference<java.lang.Boolean>(actualValue); + value = actualValue; this.booleanValue.set(value); } } } - return value.get(); + return (java.lang.Boolean)value; } @java.lang.SuppressWarnings("all") public boolean isOtherBooleanValue() { - java.util.concurrent.atomic.AtomicReference<java.lang.Boolean> value = this.otherBooleanValue.get(); + java.lang.Object value = this.otherBooleanValue.get(); if (value == null) { synchronized (this.otherBooleanValue) { value = this.otherBooleanValue.get(); if (value == null) { final boolean actualValue = !calculateBoolean(); - value = new java.util.concurrent.atomic.AtomicReference<java.lang.Boolean>(actualValue); + value = actualValue; this.otherBooleanValue.set(value); } } } - return value.get(); + return (java.lang.Boolean)value; } } diff --git a/test/transform/resource/after-delombok/GetterLazyEahcToString.java b/test/transform/resource/after-delombok/GetterLazyEahcToString.java index ce3555fe..1358e536 100644 --- a/test/transform/resource/after-delombok/GetterLazyEahcToString.java +++ b/test/transform/resource/after-delombok/GetterLazyEahcToString.java @@ -1,6 +1,6 @@ class GetterLazyEahcToString { - private final java.util.concurrent.atomic.AtomicReference<java.util.concurrent.atomic.AtomicReference<String>> value = new java.util.concurrent.atomic.AtomicReference<java.util.concurrent.atomic.AtomicReference<String>>(); + private final java.util.concurrent.atomic.AtomicReference<java.lang.Object> value = new java.util.concurrent.atomic.AtomicReference<java.lang.Object>(); private final String value2 = ""; @java.lang.Override @@ -44,18 +44,18 @@ class GetterLazyEahcToString { @java.lang.SuppressWarnings("all") public String getValue() { - java.util.concurrent.atomic.AtomicReference<String> value = this.value.get(); + java.lang.Object value = this.value.get(); if (value == null) { synchronized (this.value) { value = this.value.get(); if (value == null) { final String actualValue = ""; - value = new java.util.concurrent.atomic.AtomicReference<String>(actualValue); + value = actualValue == null ? this.value : actualValue; this.value.set(value); } } } - return value.get(); + return (String)(value == this.value ? null : value); } @java.lang.SuppressWarnings("all") diff --git a/test/transform/resource/after-delombok/GetterLazyNative.java b/test/transform/resource/after-delombok/GetterLazyNative.java index a10075ba..eb31991a 100644 --- a/test/transform/resource/after-delombok/GetterLazyNative.java +++ b/test/transform/resource/after-delombok/GetterLazyNative.java @@ -1,146 +1,146 @@ class GetterLazyNative { - private final java.util.concurrent.atomic.AtomicReference<java.util.concurrent.atomic.AtomicReference<java.lang.Boolean>> booleanField = new java.util.concurrent.atomic.AtomicReference<java.util.concurrent.atomic.AtomicReference<java.lang.Boolean>>(); - private final java.util.concurrent.atomic.AtomicReference<java.util.concurrent.atomic.AtomicReference<java.lang.Byte>> byteField = new java.util.concurrent.atomic.AtomicReference<java.util.concurrent.atomic.AtomicReference<java.lang.Byte>>(); - private final java.util.concurrent.atomic.AtomicReference<java.util.concurrent.atomic.AtomicReference<java.lang.Short>> shortField = new java.util.concurrent.atomic.AtomicReference<java.util.concurrent.atomic.AtomicReference<java.lang.Short>>(); - private final java.util.concurrent.atomic.AtomicReference<java.util.concurrent.atomic.AtomicReference<java.lang.Integer>> intField = new java.util.concurrent.atomic.AtomicReference<java.util.concurrent.atomic.AtomicReference<java.lang.Integer>>(); - private final java.util.concurrent.atomic.AtomicReference<java.util.concurrent.atomic.AtomicReference<java.lang.Long>> longField = new java.util.concurrent.atomic.AtomicReference<java.util.concurrent.atomic.AtomicReference<java.lang.Long>>(); - private final java.util.concurrent.atomic.AtomicReference<java.util.concurrent.atomic.AtomicReference<java.lang.Float>> floatField = new java.util.concurrent.atomic.AtomicReference<java.util.concurrent.atomic.AtomicReference<java.lang.Float>>(); - private final java.util.concurrent.atomic.AtomicReference<java.util.concurrent.atomic.AtomicReference<java.lang.Double>> doubleField = new java.util.concurrent.atomic.AtomicReference<java.util.concurrent.atomic.AtomicReference<java.lang.Double>>(); - private final java.util.concurrent.atomic.AtomicReference<java.util.concurrent.atomic.AtomicReference<java.lang.Character>> charField = new java.util.concurrent.atomic.AtomicReference<java.util.concurrent.atomic.AtomicReference<java.lang.Character>>(); - private final java.util.concurrent.atomic.AtomicReference<java.util.concurrent.atomic.AtomicReference<int[]>> intArrayField = new java.util.concurrent.atomic.AtomicReference<java.util.concurrent.atomic.AtomicReference<int[]>>(); + private final java.util.concurrent.atomic.AtomicReference<java.lang.Object> booleanField = new java.util.concurrent.atomic.AtomicReference<java.lang.Object>(); + private final java.util.concurrent.atomic.AtomicReference<java.lang.Object> byteField = new java.util.concurrent.atomic.AtomicReference<java.lang.Object>(); + private final java.util.concurrent.atomic.AtomicReference<java.lang.Object> shortField = new java.util.concurrent.atomic.AtomicReference<java.lang.Object>(); + private final java.util.concurrent.atomic.AtomicReference<java.lang.Object> intField = new java.util.concurrent.atomic.AtomicReference<java.lang.Object>(); + private final java.util.concurrent.atomic.AtomicReference<java.lang.Object> longField = new java.util.concurrent.atomic.AtomicReference<java.lang.Object>(); + private final java.util.concurrent.atomic.AtomicReference<java.lang.Object> floatField = new java.util.concurrent.atomic.AtomicReference<java.lang.Object>(); + private final java.util.concurrent.atomic.AtomicReference<java.lang.Object> doubleField = new java.util.concurrent.atomic.AtomicReference<java.lang.Object>(); + private final java.util.concurrent.atomic.AtomicReference<java.lang.Object> charField = new java.util.concurrent.atomic.AtomicReference<java.lang.Object>(); + private final java.util.concurrent.atomic.AtomicReference<java.lang.Object> intArrayField = new java.util.concurrent.atomic.AtomicReference<java.lang.Object>(); @java.lang.SuppressWarnings("all") public boolean isBooleanField() { - java.util.concurrent.atomic.AtomicReference<java.lang.Boolean> value = this.booleanField.get(); + java.lang.Object value = this.booleanField.get(); if (value == null) { synchronized (this.booleanField) { value = this.booleanField.get(); if (value == null) { final boolean actualValue = true; - value = new java.util.concurrent.atomic.AtomicReference<java.lang.Boolean>(actualValue); + value = actualValue; this.booleanField.set(value); } } } - return value.get(); + return (java.lang.Boolean)value; } @java.lang.SuppressWarnings("all") public byte getByteField() { - java.util.concurrent.atomic.AtomicReference<java.lang.Byte> value = this.byteField.get(); + java.lang.Object value = this.byteField.get(); if (value == null) { synchronized (this.byteField) { value = this.byteField.get(); if (value == null) { final byte actualValue = 1; - value = new java.util.concurrent.atomic.AtomicReference<java.lang.Byte>(actualValue); + value = actualValue; this.byteField.set(value); } } } - return value.get(); + return (java.lang.Byte)value; } @java.lang.SuppressWarnings("all") public short getShortField() { - java.util.concurrent.atomic.AtomicReference<java.lang.Short> value = this.shortField.get(); + java.lang.Object value = this.shortField.get(); if (value == null) { synchronized (this.shortField) { value = this.shortField.get(); if (value == null) { final short actualValue = 1; - value = new java.util.concurrent.atomic.AtomicReference<java.lang.Short>(actualValue); + value = actualValue; this.shortField.set(value); } } } - return value.get(); + return (java.lang.Short)value; } @java.lang.SuppressWarnings("all") public int getIntField() { - java.util.concurrent.atomic.AtomicReference<java.lang.Integer> value = this.intField.get(); + java.lang.Object value = this.intField.get(); if (value == null) { synchronized (this.intField) { value = this.intField.get(); if (value == null) { final int actualValue = 1; - value = new java.util.concurrent.atomic.AtomicReference<java.lang.Integer>(actualValue); + value = actualValue; this.intField.set(value); } } } - return value.get(); + return (java.lang.Integer)value; } @java.lang.SuppressWarnings("all") public long getLongField() { - java.util.concurrent.atomic.AtomicReference<java.lang.Long> value = this.longField.get(); + java.lang.Object value = this.longField.get(); if (value == null) { synchronized (this.longField) { value = this.longField.get(); if (value == null) { final long actualValue = 1; - value = new java.util.concurrent.atomic.AtomicReference<java.lang.Long>(actualValue); + value = actualValue; this.longField.set(value); } } } - return value.get(); + return (java.lang.Long)value; } @java.lang.SuppressWarnings("all") public float getFloatField() { - java.util.concurrent.atomic.AtomicReference<java.lang.Float> value = this.floatField.get(); + java.lang.Object value = this.floatField.get(); if (value == null) { synchronized (this.floatField) { value = this.floatField.get(); if (value == null) { final float actualValue = 1.0F; - value = new java.util.concurrent.atomic.AtomicReference<java.lang.Float>(actualValue); + value = actualValue; this.floatField.set(value); } } } - return value.get(); + return (java.lang.Float)value; } @java.lang.SuppressWarnings("all") public double getDoubleField() { - java.util.concurrent.atomic.AtomicReference<java.lang.Double> value = this.doubleField.get(); + java.lang.Object value = this.doubleField.get(); if (value == null) { synchronized (this.doubleField) { value = this.doubleField.get(); if (value == null) { final double actualValue = 1.0; - value = new java.util.concurrent.atomic.AtomicReference<java.lang.Double>(actualValue); + value = actualValue; this.doubleField.set(value); } } } - return value.get(); + return (java.lang.Double)value; } @java.lang.SuppressWarnings("all") public char getCharField() { - java.util.concurrent.atomic.AtomicReference<java.lang.Character> value = this.charField.get(); + java.lang.Object value = this.charField.get(); if (value == null) { synchronized (this.charField) { value = this.charField.get(); if (value == null) { final char actualValue = '1'; - value = new java.util.concurrent.atomic.AtomicReference<java.lang.Character>(actualValue); + value = actualValue; this.charField.set(value); } } } - return value.get(); + return (java.lang.Character)value; } @java.lang.SuppressWarnings("all") public int[] getIntArrayField() { - java.util.concurrent.atomic.AtomicReference<int[]> value = this.intArrayField.get(); + java.lang.Object value = this.intArrayField.get(); if (value == null) { synchronized (this.intArrayField) { value = this.intArrayField.get(); if (value == null) { final int[] actualValue = new int[]{1}; - value = new java.util.concurrent.atomic.AtomicReference<int[]>(actualValue); + value = actualValue == null ? this.intArrayField : actualValue; this.intArrayField.set(value); } } } - return value.get(); + return (int[])(value == this.intArrayField ? null : value); } -}
\ No newline at end of file +} diff --git a/test/transform/resource/after-delombok/GetterSetterJavadoc.java b/test/transform/resource/after-delombok/GetterSetterJavadoc.java new file mode 100644 index 00000000..7bf92d1f --- /dev/null +++ b/test/transform/resource/after-delombok/GetterSetterJavadoc.java @@ -0,0 +1,100 @@ +class GetterSetterJavadoc1 { + /** + * Some text + */ + private int fieldName; + @java.lang.SuppressWarnings("all") + public GetterSetterJavadoc1() { + } + /** + * Getter section + * + * @return Sky is blue + */ + @java.lang.SuppressWarnings("all") + public int getFieldName() { + return this.fieldName; + } + /** + * Some text + * + * @param fieldName Hello, World + */ + @java.lang.SuppressWarnings("all") + public void setFieldName(final int fieldName) { + this.fieldName = fieldName; + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public boolean equals(final java.lang.Object o) { + if (o == this) return true; + if (!(o instanceof GetterSetterJavadoc1)) return false; + final GetterSetterJavadoc1 other = (GetterSetterJavadoc1)o; + if (!other.canEqual((java.lang.Object)this)) return false; + if (this.getFieldName() != other.getFieldName()) return false; + return true; + } + @java.lang.SuppressWarnings("all") + public boolean canEqual(final java.lang.Object other) { + return other instanceof GetterSetterJavadoc1; + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public int hashCode() { + final int PRIME = 31; + int result = 1; + result = result * PRIME + this.getFieldName(); + return result; + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public java.lang.String toString() { + return "GetterSetterJavadoc1(fieldName=" + this.getFieldName() + ")"; + } +} +class GetterSetterJavadoc2 { + /** + * Some text + */ + private int fieldName; + /** + * Some text + * + * @return Sky is blue + */ + @java.lang.SuppressWarnings("all") + public int getFieldName() { + return this.fieldName; + } + /** + * Some text + * + * @param fieldName Hello, World + */ + @java.lang.SuppressWarnings("all") + public void setFieldName(final int fieldName) { + this.fieldName = fieldName; + } +} +class GetterSetterJavadoc3 { + /** + * Some text + */ + private int fieldName; + /** + * Getter section + * @return Sky is blue + */ + @java.lang.SuppressWarnings("all") + public int getFieldName() { + return this.fieldName; + } + /** + * Setter section + * @param fieldName Hello, World + */ + @java.lang.SuppressWarnings("all") + public void setFieldName(final int fieldName) { + this.fieldName = fieldName; + } +}
\ No newline at end of file diff --git a/test/transform/resource/after-delombok/JavadocGenerally.java b/test/transform/resource/after-delombok/JavadocGenerally.java new file mode 100644 index 00000000..729cdce3 --- /dev/null +++ b/test/transform/resource/after-delombok/JavadocGenerally.java @@ -0,0 +1,24 @@ +/** + * Doc on package + */ +package testPackage; +/** Weird doc */ +/** + * Doc on class + */ +class JavadocGenerally { + /** + * Doc on field + */ + private int someField; + /** + * Doc on method + */ + public void test() { + } + /** + * Doc on inner + */ + public interface TestingInner { + } +} diff --git a/test/transform/resource/after-delombok/LoggerCommons.java b/test/transform/resource/after-delombok/LoggerCommons.java index c2a03815..dfe3e88d 100644 --- a/test/transform/resource/after-delombok/LoggerCommons.java +++ b/test/transform/resource/after-delombok/LoggerCommons.java @@ -1,7 +1,6 @@ class LoggerCommons { private static final org.apache.commons.logging.Log log = org.apache.commons.logging.LogFactory.getLog(LoggerCommons.class); } - class LoggerCommonsWithImport { private static final org.apache.commons.logging.Log log = org.apache.commons.logging.LogFactory.getLog(LoggerCommonsWithImport.class); }
\ No newline at end of file diff --git a/test/transform/resource/after-delombok/LoggerJul.java b/test/transform/resource/after-delombok/LoggerJul.java index 39cb2aac..b020c540 100644 --- a/test/transform/resource/after-delombok/LoggerJul.java +++ b/test/transform/resource/after-delombok/LoggerJul.java @@ -1,7 +1,6 @@ class LoggerJul { private static final java.util.logging.Logger log = java.util.logging.Logger.getLogger(LoggerJul.class.getName()); } - class LoggerJulWithImport { private static final java.util.logging.Logger log = java.util.logging.Logger.getLogger(LoggerJulWithImport.class.getName()); }
\ No newline at end of file diff --git a/test/transform/resource/after-delombok/LoggerLog4j.java b/test/transform/resource/after-delombok/LoggerLog4j.java index 6892a7d8..dfbad89a 100644 --- a/test/transform/resource/after-delombok/LoggerLog4j.java +++ b/test/transform/resource/after-delombok/LoggerLog4j.java @@ -1,7 +1,6 @@ class LoggerLog4j { private static final org.apache.log4j.Logger log = org.apache.log4j.Logger.getLogger(LoggerLog4j.class); } - class LoggerLog4jWithImport { private static final org.apache.log4j.Logger log = org.apache.log4j.Logger.getLogger(LoggerLog4jWithImport.class); }
\ No newline at end of file diff --git a/test/transform/resource/after-delombok/LoggerLog4j2.java b/test/transform/resource/after-delombok/LoggerLog4j2.java new file mode 100644 index 00000000..3447a9a5 --- /dev/null +++ b/test/transform/resource/after-delombok/LoggerLog4j2.java @@ -0,0 +1,6 @@ +class LoggerLog4j2 { + private static final org.apache.logging.log4j.Logger log = org.apache.logging.log4j.LogManager.getLogger(LoggerLog4j2.class); +} +class LoggerLog4j2WithImport { + private static final org.apache.logging.log4j.Logger log = org.apache.logging.log4j.LogManager.getLogger(LoggerLog4j2WithImport.class); +}
\ No newline at end of file diff --git a/test/transform/resource/after-delombok/LoggerSlf4j.java b/test/transform/resource/after-delombok/LoggerSlf4j.java index cb1486ba..4cc7c107 100644 --- a/test/transform/resource/after-delombok/LoggerSlf4j.java +++ b/test/transform/resource/after-delombok/LoggerSlf4j.java @@ -1,11 +1,9 @@ class LoggerSlf4j { private static final org.slf4j.Logger log = org.slf4j.LoggerFactory.getLogger(LoggerSlf4j.class); } - class LoggerSlf4jWithImport { private static final org.slf4j.Logger log = org.slf4j.LoggerFactory.getLogger(LoggerSlf4jWithImport.class); } - class LoggerSlf4jOuter { static class Inner { private static final org.slf4j.Logger log = org.slf4j.LoggerFactory.getLogger(Inner.class); diff --git a/test/transform/resource/after-delombok/LoggerXSlf4j.java b/test/transform/resource/after-delombok/LoggerXSlf4j.java index 0239c60b..7d8f3236 100644 --- a/test/transform/resource/after-delombok/LoggerXSlf4j.java +++ b/test/transform/resource/after-delombok/LoggerXSlf4j.java @@ -1,7 +1,6 @@ class LoggerXSlf4j { private static final org.slf4j.ext.XLogger log = org.slf4j.ext.XLoggerFactory.getXLogger(LoggerXSlf4j.class); } - class LoggerXSlf4jWithImport { private static final org.slf4j.ext.XLogger log = org.slf4j.ext.XLoggerFactory.getXLogger(LoggerXSlf4jWithImport.class); }
\ No newline at end of file diff --git a/test/transform/resource/after-delombok/NonNullOnParameter.java b/test/transform/resource/after-delombok/NonNullOnParameter.java new file mode 100644 index 00000000..a27d19c9 --- /dev/null +++ b/test/transform/resource/after-delombok/NonNullOnParameter.java @@ -0,0 +1,48 @@ +class NonNullOnParameter extends Thread { + NonNullOnParameter(@lombok.NonNull String arg) { + this(arg, ""); + if (arg == null) { + throw new java.lang.NullPointerException("arg"); + } + } + NonNullOnParameter(@lombok.NonNull String arg, @lombok.NonNull String arg2) { + super(arg); + if (arg2 == null) { + throw new java.lang.NullPointerException("arg2"); + } + if (arg == null) throw new NullPointerException(); + } + public void test2(@lombok.NonNull String arg, @lombok.NonNull String arg2, @lombok.NonNull String arg3) { + if (arg == null) { + throw new java.lang.NullPointerException("arg"); + } + if (arg3 == null) { + throw new java.lang.NullPointerException("arg3"); + } + if (arg2 == null) { + throw new NullPointerException("arg2"); + } + if (arg == null) System.out.println("Hello"); + } + public void test3(@lombok.NonNull String arg) { + if (arg == null) { + throw new java.lang.NullPointerException("arg"); + } + if (arg != null) throw new IllegalStateException(); + } + public void test(@lombok.NonNull String stringArg, @lombok.NonNull String arg2, @lombok.NonNull int primitiveArg) { + if (stringArg == null) { + throw new java.lang.NullPointerException("stringArg"); + } + if (arg2 == null) { + throw new java.lang.NullPointerException("arg2"); + } + } + public void test(@lombok.NonNull String arg) { + if (arg == null) { + throw new java.lang.NullPointerException("arg"); + } + System.out.println("Hey"); + if (arg == null) throw new NullPointerException(); + } +} diff --git a/test/transform/resource/after-delombok/NonNullPlain.java b/test/transform/resource/after-delombok/NonNullPlain.java index 064e00b9..6b85cbf7 100644 --- a/test/transform/resource/after-delombok/NonNullPlain.java +++ b/test/transform/resource/after-delombok/NonNullPlain.java @@ -16,7 +16,9 @@ class NonNullPlain { @java.beans.ConstructorProperties({"i", "s"}) @java.lang.SuppressWarnings("all") public NonNullPlain(@lombok.NonNull final int i, @lombok.NonNull final String s) { - if (s == null) throw new java.lang.NullPointerException("s"); + if (s == null) { + throw new java.lang.NullPointerException("s"); + } this.i = i; this.s = s; } @@ -45,7 +47,9 @@ class NonNullPlain { @java.lang.SuppressWarnings("all") public void setS(@lombok.NonNull final String s) { - if (s == null) throw new java.lang.NullPointerException("s"); + if (s == null) { + throw new java.lang.NullPointerException("s"); + } this.s = s; } diff --git a/test/transform/resource/after-delombok/SetterDeprecated.java b/test/transform/resource/after-delombok/SetterDeprecated.java index 5a6cf9f3..72a609ad 100644 --- a/test/transform/resource/after-delombok/SetterDeprecated.java +++ b/test/transform/resource/after-delombok/SetterDeprecated.java @@ -10,6 +10,9 @@ class SetterDeprecated { public void setAnnotation(final int annotation) { this.annotation = annotation; } + /** + * @deprecated + */ @java.lang.Deprecated @java.lang.SuppressWarnings("all") public void setJavadoc(final int javadoc) { diff --git a/test/transform/resource/after-delombok/SetterOnClass.java b/test/transform/resource/after-delombok/SetterOnClass.java index 151bc179..7077c492 100644 --- a/test/transform/resource/after-delombok/SetterOnClass.java +++ b/test/transform/resource/after-delombok/SetterOnClass.java @@ -53,7 +53,9 @@ class SetterOnClass6 { } @java.lang.SuppressWarnings("all") public void setNonNull(@lombok.NonNull final String nonNull) { - if (nonNull == null) throw new java.lang.NullPointerException("nonNull"); + if (nonNull == null) { + throw new java.lang.NullPointerException("nonNull"); + } this.nonNull = nonNull; } }
\ No newline at end of file diff --git a/test/transform/resource/after-delombok/ValInTryWithResources.java b/test/transform/resource/after-delombok/ValInTryWithResources.java new file mode 100644 index 00000000..73f8d1a2 --- /dev/null +++ b/test/transform/resource/after-delombok/ValInTryWithResources.java @@ -0,0 +1,10 @@ +//version 7 +import java.io.IOException; +public class ValInTryWithResources { + public void whyTryInsteadOfCleanup() throws IOException { + try (final java.io.InputStream in = getClass().getResourceAsStream("ValInTryWithResources.class");) { + final java.io.InputStream i = in; + final int j = in.read(); + } + } +} diff --git a/test/transform/resource/after-delombok/ValueExperimental.java b/test/transform/resource/after-delombok/ValueExperimental.java new file mode 100644 index 00000000..77a48ec9 --- /dev/null +++ b/test/transform/resource/after-delombok/ValueExperimental.java @@ -0,0 +1,46 @@ +final class ValueExperimental1 { + @java.lang.SuppressWarnings("all") + public ValueExperimental1() { + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public boolean equals(final java.lang.Object o) { + if (o == this) return true; + if (!(o instanceof ValueExperimental1)) return false; + return true; + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public int hashCode() { + int result = 1; + return result; + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public java.lang.String toString() { + return "ValueExperimental1()"; + } +} +final class ValueExperimental2 { + @java.lang.SuppressWarnings("all") + public ValueExperimental2() { + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public boolean equals(final java.lang.Object o) { + if (o == this) return true; + if (!(o instanceof ValueExperimental2)) return false; + return true; + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public int hashCode() { + int result = 1; + return result; + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public java.lang.String toString() { + return "ValueExperimental2()"; + } +}
\ No newline at end of file diff --git a/test/transform/resource/after-delombok/ValueExperimentalStarImport.java b/test/transform/resource/after-delombok/ValueExperimentalStarImport.java new file mode 100644 index 00000000..6911f260 --- /dev/null +++ b/test/transform/resource/after-delombok/ValueExperimentalStarImport.java @@ -0,0 +1,25 @@ +import lombok.experimental.*; +final class ValueExperimentalStarImport { + @java.lang.SuppressWarnings("all") + public ValueExperimentalStarImport() { + + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public boolean equals(final java.lang.Object o) { + if (o == this) return true; + if (!(o instanceof ValueExperimentalStarImport)) return false; + return true; + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public int hashCode() { + int result = 1; + return result; + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public java.lang.String toString() { + return "ValueExperimentalStarImport()"; + } +}
\ No newline at end of file diff --git a/test/transform/resource/after-delombok/WitherDeprecated.java b/test/transform/resource/after-delombok/WitherDeprecated.java index f076d90e..29192012 100644 --- a/test/transform/resource/after-delombok/WitherDeprecated.java +++ b/test/transform/resource/after-delombok/WitherDeprecated.java @@ -12,6 +12,9 @@ class WitherDeprecated { public WitherDeprecated withAnnotation(final int annotation) { return this.annotation == annotation ? this : new WitherDeprecated(annotation, this.javadoc); } + /** + * @deprecated + */ @java.lang.Deprecated @java.lang.SuppressWarnings("all") public WitherDeprecated withJavadoc(final int javadoc) { diff --git a/test/transform/resource/after-delombok/WitherOnClass.java b/test/transform/resource/after-delombok/WitherOnClass.java index 783fede1..45d0c4b5 100644 --- a/test/transform/resource/after-delombok/WitherOnClass.java +++ b/test/transform/resource/after-delombok/WitherOnClass.java @@ -35,7 +35,9 @@ class WitherOnClass3 { } @java.lang.SuppressWarnings("all") public WitherOnClass3 withNonNull(@lombok.NonNull final String nonNull) { - if (nonNull == null) throw new java.lang.NullPointerException("nonNull"); + if (nonNull == null) { + throw new java.lang.NullPointerException("nonNull"); + } return this.nonNull == nonNull ? this : new WitherOnClass3(this.couldBeNull, nonNull); } } |