diff options
Diffstat (limited to 'test/transform/resource')
15 files changed, 122 insertions, 32 deletions
diff --git a/test/transform/resource/after-delombok/DelegateOnGetter.java b/test/transform/resource/after-delombok/DelegateOnGetter.java index f41259df..edf1641b 100644 --- a/test/transform/resource/after-delombok/DelegateOnGetter.java +++ b/test/transform/resource/after-delombok/DelegateOnGetter.java @@ -4,7 +4,7 @@ class DelegateOnGetter { void setList(java.util.ArrayList<java.lang.String> list); int getInt(); } - @java.lang.SuppressWarnings("all") + @java.lang.SuppressWarnings({"all", "unchecked"}) public Bar getBar() { java.lang.Object value = this.bar.get(); if (value == null) { diff --git a/test/transform/resource/after-delombok/GetterLazy.java b/test/transform/resource/after-delombok/GetterLazy.java index 25a71848..1e30f94b 100644 --- a/test/transform/resource/after-delombok/GetterLazy.java +++ b/test/transform/resource/after-delombok/GetterLazy.java @@ -2,7 +2,7 @@ class GetterLazy { static class 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") + @java.lang.SuppressWarnings({"all", "unchecked"}) public ValueType getFieldName() { java.lang.Object value = this.fieldName.get(); if (value == null) { diff --git a/test/transform/resource/after-delombok/GetterLazyBoolean.java b/test/transform/resource/after-delombok/GetterLazyBoolean.java index 3ca127e3..5b1f19dc 100644 --- a/test/transform/resource/after-delombok/GetterLazyBoolean.java +++ b/test/transform/resource/after-delombok/GetterLazyBoolean.java @@ -31,7 +31,7 @@ class GetterLazyBoolean { public java.lang.String toString() { return "GetterLazyBoolean(booleanValue=" + this.isBooleanValue() + ")"; } - @java.lang.SuppressWarnings("all") + @java.lang.SuppressWarnings({"all", "unchecked"}) public boolean isBooleanValue() { java.lang.Object value = this.booleanValue.get(); if (value == null) { @@ -46,7 +46,7 @@ class GetterLazyBoolean { } return (java.lang.Boolean) value; } - @java.lang.SuppressWarnings("all") + @java.lang.SuppressWarnings({"all", "unchecked"}) public boolean isOtherBooleanValue() { java.lang.Object value = this.otherBooleanValue.get(); if (value == null) { diff --git a/test/transform/resource/after-delombok/GetterLazyEahcToString.java b/test/transform/resource/after-delombok/GetterLazyEahcToString.java index e0a0f6b2..bec89818 100644 --- a/test/transform/resource/after-delombok/GetterLazyEahcToString.java +++ b/test/transform/resource/after-delombok/GetterLazyEahcToString.java @@ -44,9 +44,7 @@ class GetterLazyEahcToString { return "GetterLazyEahcToString(value=" + this.getValue() + ", value2=" + this.value2 + ")"; } - @java.lang.SuppressWarnings("all") - - + @java.lang.SuppressWarnings({"all", "unchecked"}) public String getValue() { java.lang.Object value = this.value.get(); if (value == null) { diff --git a/test/transform/resource/after-delombok/GetterLazyGenerics.java b/test/transform/resource/after-delombok/GetterLazyGenerics.java new file mode 100644 index 00000000..5e92cda7 --- /dev/null +++ b/test/transform/resource/after-delombok/GetterLazyGenerics.java @@ -0,0 +1,37 @@ +class GetterLazyGenerics<E> { + private final java.util.concurrent.atomic.AtomicReference<java.lang.Object> field = new java.util.concurrent.atomic.AtomicReference<java.lang.Object>(); + private final java.util.concurrent.atomic.AtomicReference<java.lang.Object> field2 = new java.util.concurrent.atomic.AtomicReference<java.lang.Object>(); + public static <E> E getAny() { + return null; + } + @java.lang.SuppressWarnings({"all", "unchecked"}) + public E getField() { + java.lang.Object value = this.field.get(); + if (value == null) { + synchronized (this.field) { + value = this.field.get(); + if (value == null) { + final E actualValue = getAny(); + value = actualValue == null ? this.field : actualValue; + this.field.set(value); + } + } + } + return (E) (value == this.field ? null : value); + } + @java.lang.SuppressWarnings({"all", "unchecked"}) + public long getField2() { + java.lang.Object value = this.field2.get(); + if (value == null) { + synchronized (this.field2) { + value = this.field2.get(); + if (value == null) { + final long actualValue = System.currentTimeMillis(); + value = actualValue; + this.field2.set(value); + } + } + } + return (java.lang.Long) value; + } +}
\ No newline at end of file diff --git a/test/transform/resource/after-delombok/GetterLazyNative.java b/test/transform/resource/after-delombok/GetterLazyNative.java index b9d471ff..f43d5490 100644 --- a/test/transform/resource/after-delombok/GetterLazyNative.java +++ b/test/transform/resource/after-delombok/GetterLazyNative.java @@ -8,7 +8,7 @@ class GetterLazyNative { 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") + @java.lang.SuppressWarnings({"all", "unchecked"}) public boolean isBooleanField() { java.lang.Object value = this.booleanField.get(); if (value == null) { @@ -23,7 +23,7 @@ class GetterLazyNative { } return (java.lang.Boolean) value; } - @java.lang.SuppressWarnings("all") + @java.lang.SuppressWarnings({"all", "unchecked"}) public byte getByteField() { java.lang.Object value = this.byteField.get(); if (value == null) { @@ -38,7 +38,7 @@ class GetterLazyNative { } return (java.lang.Byte) value; } - @java.lang.SuppressWarnings("all") + @java.lang.SuppressWarnings({"all", "unchecked"}) public short getShortField() { java.lang.Object value = this.shortField.get(); if (value == null) { @@ -53,7 +53,7 @@ class GetterLazyNative { } return (java.lang.Short) value; } - @java.lang.SuppressWarnings("all") + @java.lang.SuppressWarnings({"all", "unchecked"}) public int getIntField() { java.lang.Object value = this.intField.get(); if (value == null) { @@ -68,7 +68,7 @@ class GetterLazyNative { } return (java.lang.Integer) value; } - @java.lang.SuppressWarnings("all") + @java.lang.SuppressWarnings({"all", "unchecked"}) public long getLongField() { java.lang.Object value = this.longField.get(); if (value == null) { @@ -83,7 +83,7 @@ class GetterLazyNative { } return (java.lang.Long) value; } - @java.lang.SuppressWarnings("all") + @java.lang.SuppressWarnings({"all", "unchecked"}) public float getFloatField() { java.lang.Object value = this.floatField.get(); if (value == null) { @@ -98,7 +98,7 @@ class GetterLazyNative { } return (java.lang.Float) value; } - @java.lang.SuppressWarnings("all") + @java.lang.SuppressWarnings({"all", "unchecked"}) public double getDoubleField() { java.lang.Object value = this.doubleField.get(); if (value == null) { @@ -113,7 +113,7 @@ class GetterLazyNative { } return (java.lang.Double) value; } - @java.lang.SuppressWarnings("all") + @java.lang.SuppressWarnings({"all", "unchecked"}) public char getCharField() { java.lang.Object value = this.charField.get(); if (value == null) { @@ -128,7 +128,7 @@ class GetterLazyNative { } return (java.lang.Character) value; } - @java.lang.SuppressWarnings("all") + @java.lang.SuppressWarnings({"all", "unchecked"}) public int[] getIntArrayField() { java.lang.Object value = this.intArrayField.get(); if (value == null) { diff --git a/test/transform/resource/after-delombok/GetterLazyTransient.java b/test/transform/resource/after-delombok/GetterLazyTransient.java index 49093ed1..0fd85621 100644 --- a/test/transform/resource/after-delombok/GetterLazyTransient.java +++ b/test/transform/resource/after-delombok/GetterLazyTransient.java @@ -2,7 +2,7 @@ class GetterLazyTransient { private final java.util.concurrent.atomic.AtomicReference<java.lang.Object> nonTransientField = new java.util.concurrent.atomic.AtomicReference<java.lang.Object>(); private final transient int transientField = 2; private final transient int nonLazyTransientField = 3; - @java.lang.SuppressWarnings("all") + @java.lang.SuppressWarnings({"all", "unchecked"}) public int getNonTransientField() { java.lang.Object value = this.nonTransientField.get(); if (value == null) { diff --git a/test/transform/resource/after-ecj/DelegateOnGetter.java b/test/transform/resource/after-ecj/DelegateOnGetter.java index 59f6a3b8..f2b9a6cd 100644 --- a/test/transform/resource/after-ecj/DelegateOnGetter.java +++ b/test/transform/resource/after-ecj/DelegateOnGetter.java @@ -9,7 +9,7 @@ class DelegateOnGetter { DelegateOnGetter() { super(); } - public @Delegate @java.lang.SuppressWarnings("all") Bar getBar() { + public @Delegate @java.lang.SuppressWarnings({"all", "unchecked"}) Bar getBar() { java.lang.Object value = this.bar.get(); if ((value == null)) { diff --git a/test/transform/resource/after-ecj/GetterLazy.java b/test/transform/resource/after-ecj/GetterLazy.java index 8394f58d..b4567f04 100644 --- a/test/transform/resource/after-ecj/GetterLazy.java +++ b/test/transform/resource/after-ecj/GetterLazy.java @@ -8,7 +8,7 @@ class GetterLazy { GetterLazy() { super(); } - public @java.lang.SuppressWarnings("all") ValueType getFieldName() { + public @java.lang.SuppressWarnings({"all", "unchecked"}) ValueType getFieldName() { java.lang.Object value = this.fieldName.get(); if ((value == null)) { diff --git a/test/transform/resource/after-ecj/GetterLazyBoolean.java b/test/transform/resource/after-ecj/GetterLazyBoolean.java index 174389e8..ad319755 100644 --- a/test/transform/resource/after-ecj/GetterLazyBoolean.java +++ b/test/transform/resource/after-ecj/GetterLazyBoolean.java @@ -7,7 +7,7 @@ private static boolean calculateBoolean() { return true; } - public @java.lang.SuppressWarnings("all") boolean isBooleanValue() { + public @java.lang.SuppressWarnings({"all", "unchecked"}) boolean isBooleanValue() { java.lang.Object value = this.booleanValue.get(); if ((value == null)) { @@ -24,7 +24,7 @@ } return (java.lang.Boolean) value; } - public @java.lang.SuppressWarnings("all") boolean isOtherBooleanValue() { + public @java.lang.SuppressWarnings({"all", "unchecked"}) boolean isOtherBooleanValue() { java.lang.Object value = this.otherBooleanValue.get(); if ((value == null)) { diff --git a/test/transform/resource/after-ecj/GetterLazyEahcToString.java b/test/transform/resource/after-ecj/GetterLazyEahcToString.java index e66a9c2e..5197f4e1 100644 --- a/test/transform/resource/after-ecj/GetterLazyEahcToString.java +++ b/test/transform/resource/after-ecj/GetterLazyEahcToString.java @@ -4,7 +4,7 @@ GetterLazyEahcToString() { super(); } - public @java.lang.SuppressWarnings("all") String getValue() { + public @java.lang.SuppressWarnings({"all", "unchecked"}) String getValue() { java.lang.Object value = this.value.get(); if ((value == null)) { diff --git a/test/transform/resource/after-ecj/GetterLazyGenerics.java b/test/transform/resource/after-ecj/GetterLazyGenerics.java new file mode 100644 index 00000000..67ef5543 --- /dev/null +++ b/test/transform/resource/after-ecj/GetterLazyGenerics.java @@ -0,0 +1,44 @@ +class GetterLazyGenerics<E> { + private final @lombok.Getter(lazy = true) java.util.concurrent.atomic.AtomicReference<java.lang.Object> field = new java.util.concurrent.atomic.AtomicReference<java.lang.Object>(); + private final @lombok.Getter(lazy = true) java.util.concurrent.atomic.AtomicReference<java.lang.Object> field2 = new java.util.concurrent.atomic.AtomicReference<java.lang.Object>(); + GetterLazyGenerics() { + super(); + } + public static <E>E getAny() { + return null; + } + public @java.lang.SuppressWarnings({"all", "unchecked"}) E getField() { + java.lang.Object value = this.field.get(); + if ((value == null)) + { + synchronized (this.field) + { + value = this.field.get(); + if ((value == null)) + { + final E actualValue = getAny(); + value = ((actualValue == null) ? this.field : actualValue); + this.field.set(value); + } + } + } + return (E) ((value == this.field) ? null : value); + } + public @java.lang.SuppressWarnings({"all", "unchecked"}) long getField2() { + java.lang.Object value = this.field2.get(); + if ((value == null)) + { + synchronized (this.field2) + { + value = this.field2.get(); + if ((value == null)) + { + final long actualValue = System.currentTimeMillis(); + value = actualValue; + this.field2.set(value); + } + } + } + return (java.lang.Long) value; + } +}
\ No newline at end of file diff --git a/test/transform/resource/after-ecj/GetterLazyNative.java b/test/transform/resource/after-ecj/GetterLazyNative.java index db70f2f4..7808068e 100644 --- a/test/transform/resource/after-ecj/GetterLazyNative.java +++ b/test/transform/resource/after-ecj/GetterLazyNative.java @@ -11,7 +11,7 @@ class GetterLazyNative { GetterLazyNative() { super(); } - public @java.lang.SuppressWarnings("all") boolean isBooleanField() { + public @java.lang.SuppressWarnings({"all", "unchecked"}) boolean isBooleanField() { java.lang.Object value = this.booleanField.get(); if ((value == null)) { @@ -28,7 +28,7 @@ class GetterLazyNative { } return (java.lang.Boolean) value; } - public @java.lang.SuppressWarnings("all") byte getByteField() { + public @java.lang.SuppressWarnings({"all", "unchecked"}) byte getByteField() { java.lang.Object value = this.byteField.get(); if ((value == null)) { @@ -45,7 +45,7 @@ class GetterLazyNative { } return (java.lang.Byte) value; } - public @java.lang.SuppressWarnings("all") short getShortField() { + public @java.lang.SuppressWarnings({"all", "unchecked"}) short getShortField() { java.lang.Object value = this.shortField.get(); if ((value == null)) { @@ -62,7 +62,7 @@ class GetterLazyNative { } return (java.lang.Short) value; } - public @java.lang.SuppressWarnings("all") int getIntField() { + public @java.lang.SuppressWarnings({"all", "unchecked"}) int getIntField() { java.lang.Object value = this.intField.get(); if ((value == null)) { @@ -79,7 +79,7 @@ class GetterLazyNative { } return (java.lang.Integer) value; } - public @java.lang.SuppressWarnings("all") long getLongField() { + public @java.lang.SuppressWarnings({"all", "unchecked"}) long getLongField() { java.lang.Object value = this.longField.get(); if ((value == null)) { @@ -96,7 +96,7 @@ class GetterLazyNative { } return (java.lang.Long) value; } - public @java.lang.SuppressWarnings("all") float getFloatField() { + public @java.lang.SuppressWarnings({"all", "unchecked"}) float getFloatField() { java.lang.Object value = this.floatField.get(); if ((value == null)) { @@ -113,7 +113,7 @@ class GetterLazyNative { } return (java.lang.Float) value; } - public @java.lang.SuppressWarnings("all") double getDoubleField() { + public @java.lang.SuppressWarnings({"all", "unchecked"}) double getDoubleField() { java.lang.Object value = this.doubleField.get(); if ((value == null)) { @@ -130,7 +130,7 @@ class GetterLazyNative { } return (java.lang.Double) value; } - public @java.lang.SuppressWarnings("all") char getCharField() { + public @java.lang.SuppressWarnings({"all", "unchecked"}) char getCharField() { java.lang.Object value = this.charField.get(); if ((value == null)) { @@ -147,7 +147,7 @@ class GetterLazyNative { } return (java.lang.Character) value; } - public @java.lang.SuppressWarnings("all") int[] getIntArrayField() { + public @java.lang.SuppressWarnings({"all", "unchecked"}) int[] getIntArrayField() { java.lang.Object value = this.intArrayField.get(); if ((value == null)) { diff --git a/test/transform/resource/after-ecj/GetterLazyTransient.java b/test/transform/resource/after-ecj/GetterLazyTransient.java index 3ffd9b69..7e5f4a41 100644 --- a/test/transform/resource/after-ecj/GetterLazyTransient.java +++ b/test/transform/resource/after-ecj/GetterLazyTransient.java @@ -5,7 +5,7 @@ class GetterLazyTransient { GetterLazyTransient() { super(); } - public @java.lang.SuppressWarnings("all") int getNonTransientField() { + public @java.lang.SuppressWarnings({"all", "unchecked"}) int getNonTransientField() { java.lang.Object value = this.nonTransientField.get(); if ((value == null)) { diff --git a/test/transform/resource/before/GetterLazyGenerics.java b/test/transform/resource/before/GetterLazyGenerics.java new file mode 100644 index 00000000..50ca1c33 --- /dev/null +++ b/test/transform/resource/before/GetterLazyGenerics.java @@ -0,0 +1,11 @@ +class GetterLazyGenerics<E> { + @lombok.Getter(lazy=true) + private final E field = getAny(); + + @lombok.Getter(lazy=true) + private final long field2 = System.currentTimeMillis(); + + public static <E> E getAny() { + return null; + } +}
\ No newline at end of file |