diff options
Diffstat (limited to 'test')
14 files changed, 599 insertions, 0 deletions
diff --git a/test/transform/resource/after-delombok/GetterLazy.java b/test/transform/resource/after-delombok/GetterLazy.java new file mode 100644 index 00000000..d7f97f0d --- /dev/null +++ b/test/transform/resource/after-delombok/GetterLazy.java @@ -0,0 +1,19 @@ +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>>(); + @java.lang.SuppressWarnings("all") + public ValueType getFieldName() { + java.util.concurrent.atomic.AtomicReference<ValueType> value = this.fieldName.get(); + if (value == null) { + synchronized (this.fieldName) { + value = this.fieldName.get(); + if (value == null) { + value = new java.util.concurrent.atomic.AtomicReference<ValueType>(new ValueType()); + this.fieldName.set(value); + } + } + } + return value.get(); + } +} diff --git a/test/transform/resource/after-delombok/GetterLazyEahcToString.java b/test/transform/resource/after-delombok/GetterLazyEahcToString.java new file mode 100644 index 00000000..f085722d --- /dev/null +++ b/test/transform/resource/after-delombok/GetterLazyEahcToString.java @@ -0,0 +1,58 @@ +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 String value2 = ""; + + @java.lang.Override + @java.lang.SuppressWarnings("all") + public boolean equals(final java.lang.Object o) { + if (o == this) return true; + if (!(o instanceof GetterLazyEahcToString)) return false; + final GetterLazyEahcToString other = (GetterLazyEahcToString)o; + if (!other.canEqual(this)) return false; + if (this.getValue() == null ? other.getValue() != null : !this.getValue().equals(other.getValue())) return false; + if (this.value2 == null ? other.value2 != null : !this.value2.equals(other.value2)) return false; + return true; + } + + @java.lang.SuppressWarnings("all") + public boolean canEqual(final java.lang.Object other) { + return other instanceof GetterLazyEahcToString; + } + + @java.lang.Override + @java.lang.SuppressWarnings("all") + public int hashCode() { + final int PRIME = 31; + int result = 1; + result = result * PRIME + (this.getValue() == null ? 0 : this.getValue().hashCode()); + result = result * PRIME + (this.value2 == null ? 0 : this.value2.hashCode()); + return result; + } + + @java.lang.Override + @java.lang.SuppressWarnings("all") + public java.lang.String toString() { + return "GetterLazyEahcToString(value=" + this.getValue() + ", value2=" + this.value2 + ")"; + } + + @java.lang.SuppressWarnings("all") + public String getValue() { + java.util.concurrent.atomic.AtomicReference<String> value = this.value.get(); + if (value == null) { + synchronized (this.value) { + value = this.value.get(); + if (value == null) { + value = new java.util.concurrent.atomic.AtomicReference<String>(""); + this.value.set(value); + } + } + } + return value.get(); + } + + @java.lang.SuppressWarnings("all") + public String getValue2() { + return this.value2; + } +}
\ No newline at end of file diff --git a/test/transform/resource/after-delombok/GetterLazyInvalid.java b/test/transform/resource/after-delombok/GetterLazyInvalid.java new file mode 100644 index 00000000..25963921 --- /dev/null +++ b/test/transform/resource/after-delombok/GetterLazyInvalid.java @@ -0,0 +1,25 @@ +class GetterLazyInvalidNotFinal { + private String fieldName = ""; +} +class GetterLazyInvalidNotPrivate { + final String fieldName = ""; +} +class GetterLazyInvalidNotPrivateFinal { + String fieldName = ""; +} +class GetterLazyInvalidNone { + private final String fieldName = ""; +} +class GetterLazyInvalidClass { + private final String fieldName = ""; + @java.lang.SuppressWarnings("all") + public String getFieldName() { + return this.fieldName; + } +} +class GetterLazyInvalidNoInit { + private final String fieldName; + GetterLazyInvalidNoInit() { + this.fieldName = "foo"; + } +}
\ No newline at end of file diff --git a/test/transform/resource/after-delombok/GetterLazyNative.java b/test/transform/resource/after-delombok/GetterLazyNative.java new file mode 100644 index 00000000..650d0496 --- /dev/null +++ b/test/transform/resource/after-delombok/GetterLazyNative.java @@ -0,0 +1,137 @@ +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[]>>(); + @java.lang.SuppressWarnings("all") + public boolean getBooleanField() { + java.util.concurrent.atomic.AtomicReference<java.lang.Boolean> value = this.booleanField.get(); + if (value == null) { + synchronized (this.booleanField) { + value = this.booleanField.get(); + if (value == null) { + value = new java.util.concurrent.atomic.AtomicReference<java.lang.Boolean>(true); + this.booleanField.set(value); + } + } + } + return value.get(); + } + @java.lang.SuppressWarnings("all") + public byte getByteField() { + java.util.concurrent.atomic.AtomicReference<java.lang.Byte> value = this.byteField.get(); + if (value == null) { + synchronized (this.byteField) { + value = this.byteField.get(); + if (value == null) { + value = new java.util.concurrent.atomic.AtomicReference<java.lang.Byte>(1); + this.byteField.set(value); + } + } + } + return value.get(); + } + @java.lang.SuppressWarnings("all") + public short getShortField() { + java.util.concurrent.atomic.AtomicReference<java.lang.Short> value = this.shortField.get(); + if (value == null) { + synchronized (this.shortField) { + value = this.shortField.get(); + if (value == null) { + value = new java.util.concurrent.atomic.AtomicReference<java.lang.Short>(1); + this.shortField.set(value); + } + } + } + return value.get(); + } + @java.lang.SuppressWarnings("all") + public int getIntField() { + java.util.concurrent.atomic.AtomicReference<java.lang.Integer> value = this.intField.get(); + if (value == null) { + synchronized (this.intField) { + value = this.intField.get(); + if (value == null) { + value = new java.util.concurrent.atomic.AtomicReference<java.lang.Integer>(1); + this.intField.set(value); + } + } + } + return value.get(); + } + @java.lang.SuppressWarnings("all") + public long getLongField() { + java.util.concurrent.atomic.AtomicReference<java.lang.Long> value = this.longField.get(); + if (value == null) { + synchronized (this.longField) { + value = this.longField.get(); + if (value == null) { + value = new java.util.concurrent.atomic.AtomicReference<java.lang.Long>(1); + this.longField.set(value); + } + } + } + return value.get(); + } + @java.lang.SuppressWarnings("all") + public float getFloatField() { + java.util.concurrent.atomic.AtomicReference<java.lang.Float> value = this.floatField.get(); + if (value == null) { + synchronized (this.floatField) { + value = this.floatField.get(); + if (value == null) { + value = new java.util.concurrent.atomic.AtomicReference<java.lang.Float>(1.0F); + this.floatField.set(value); + } + } + } + return value.get(); + } + @java.lang.SuppressWarnings("all") + public double getDoubleField() { + java.util.concurrent.atomic.AtomicReference<java.lang.Double> value = this.doubleField.get(); + if (value == null) { + synchronized (this.doubleField) { + value = this.doubleField.get(); + if (value == null) { + value = new java.util.concurrent.atomic.AtomicReference<java.lang.Double>(1.0); + this.doubleField.set(value); + } + } + } + return value.get(); + } + @java.lang.SuppressWarnings("all") + public char getCharField() { + java.util.concurrent.atomic.AtomicReference<java.lang.Character> value = this.charField.get(); + if (value == null) { + synchronized (this.charField) { + value = this.charField.get(); + if (value == null) { + value = new java.util.concurrent.atomic.AtomicReference<java.lang.Character>('1'); + this.charField.set(value); + } + } + } + return value.get(); + } + @java.lang.SuppressWarnings("all") + public int[] getIntArrayField() { + java.util.concurrent.atomic.AtomicReference<int[]> value = this.intArrayField.get(); + if (value == null) { + synchronized (this.intArrayField) { + value = this.intArrayField.get(); + if (value == null) { + value = new java.util.concurrent.atomic.AtomicReference<int[]>(new int[]{1}); + this.intArrayField.set(value); + } + } + } + return value.get(); + } +}
\ No newline at end of file diff --git a/test/transform/resource/after-ecj/GetterLazy.java b/test/transform/resource/after-ecj/GetterLazy.java new file mode 100644 index 00000000..669a9a81 --- /dev/null +++ b/test/transform/resource/after-ecj/GetterLazy.java @@ -0,0 +1,27 @@ +class GetterLazy { + static class ValueType { + ValueType() { + super(); + } + } + private final @lombok.Getter(lazy = true) java.util.concurrent.atomic.AtomicReference<java.util.concurrent.atomic.AtomicReference<ValueType>> fieldName = new java.util.concurrent.atomic.AtomicReference<java.util.concurrent.atomic.AtomicReference<ValueType>>(); + public @java.lang.SuppressWarnings("all") ValueType getFieldName() { + java.util.concurrent.atomic.AtomicReference<ValueType> value = this.fieldName.get(); + if ((value == null)) + { + synchronized (this.fieldName) + { + value = this.fieldName.get(); + if ((value == null)) + { + value = new java.util.concurrent.atomic.AtomicReference<ValueType>(new ValueType()); + this.fieldName.set(value); + } + } + } + return value.get(); + } + GetterLazy() { + super(); + } +} diff --git a/test/transform/resource/after-ecj/GetterLazyEahcToString.java b/test/transform/resource/after-ecj/GetterLazyEahcToString.java new file mode 100644 index 00000000..6261ce38 --- /dev/null +++ b/test/transform/resource/after-ecj/GetterLazyEahcToString.java @@ -0,0 +1,53 @@ +@lombok.EqualsAndHashCode(doNotUseGetters = true) @lombok.ToString(doNotUseGetters = true) class GetterLazyEahcToString { + private final @lombok.Getter(lazy = true) 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 @lombok.Getter String value2 = ""; + public @java.lang.SuppressWarnings("all") String getValue() { + java.util.concurrent.atomic.AtomicReference<String> value = this.value.get(); + if ((value == null)) + { + synchronized (this.value) + { + value = this.value.get(); + if ((value == null)) + { + value = new java.util.concurrent.atomic.AtomicReference<String>(""); + this.value.set(value); + } + } + } + return value.get(); + } + public @java.lang.SuppressWarnings("all") String getValue2() { + return this.value2; + } + public @java.lang.Override @java.lang.SuppressWarnings("all") boolean equals(final java.lang.Object o) { + if ((o == this)) + return true; + if ((! (o instanceof GetterLazyEahcToString))) + return false; + final GetterLazyEahcToString other = (GetterLazyEahcToString) o; + if ((! other.canEqual(this))) + return false; + if (((this.getValue() == null) ? (other.getValue() != null) : (! this.getValue().equals(other.getValue())))) + return false; + if (((this.value2 == null) ? (other.value2 != null) : (! this.value2.equals(other.value2)))) + return false; + return true; + } + public @java.lang.SuppressWarnings("all") boolean canEqual(final java.lang.Object other) { + return (other instanceof GetterLazyEahcToString); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") int hashCode() { + final int PRIME = 31; + int result = 1; + result = ((result * PRIME) + ((this.getValue() == null) ? 0 : this.getValue().hashCode())); + result = ((result * PRIME) + ((this.value2 == null) ? 0 : this.value2.hashCode())); + return result; + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (((("GetterLazyEahcToString(value=" + this.getValue()) + ", value2=") + this.value2) + ")"); + } + GetterLazyEahcToString() { + super(); + } +}
\ No newline at end of file diff --git a/test/transform/resource/after-ecj/GetterLazyInvalid.java b/test/transform/resource/after-ecj/GetterLazyInvalid.java new file mode 100644 index 00000000..eaa22d71 --- /dev/null +++ b/test/transform/resource/after-ecj/GetterLazyInvalid.java @@ -0,0 +1,40 @@ +class GetterLazyInvalidNotFinal { + private @lombok.Getter(lazy = true) String fieldName = ""; + GetterLazyInvalidNotFinal() { + super(); + } +} +class GetterLazyInvalidNotPrivate { + final @lombok.Getter(lazy = true) String fieldName = ""; + GetterLazyInvalidNotPrivate() { + super(); + } +} +class GetterLazyInvalidNotPrivateFinal { + @lombok.Getter(lazy = true) String fieldName = ""; + GetterLazyInvalidNotPrivateFinal() { + super(); + } +} +class GetterLazyInvalidNone { + private final @lombok.Getter(lazy = true,value = lombok.AccessLevel.NONE) String fieldName = ""; + GetterLazyInvalidNone() { + super(); + } +} +@lombok.Getter(lazy = true) class GetterLazyInvalidClass { + private final String fieldName = ""; + public @java.lang.SuppressWarnings("all") String getFieldName() { + return this.fieldName; + } + GetterLazyInvalidClass() { + super(); + } +} +class GetterLazyInvalidNoInit { + private final @lombok.Getter(lazy = true) String fieldName; + GetterLazyInvalidNoInit() { + super(); + this.fieldName = "foo"; + } +}
\ No newline at end of file diff --git a/test/transform/resource/after-ecj/GetterLazyNative.java b/test/transform/resource/after-ecj/GetterLazyNative.java new file mode 100644 index 00000000..6c90a101 --- /dev/null +++ b/test/transform/resource/after-ecj/GetterLazyNative.java @@ -0,0 +1,158 @@ +class GetterLazyNative { + private final @lombok.Getter(lazy = true) 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 @lombok.Getter(lazy = true) 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 @lombok.Getter(lazy = true) 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 @lombok.Getter(lazy = true) 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 @lombok.Getter(lazy = true) 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 @lombok.Getter(lazy = true) 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 @lombok.Getter(lazy = true) 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 @lombok.Getter(lazy = true) 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 @lombok.Getter(lazy = true) java.util.concurrent.atomic.AtomicReference<java.util.concurrent.atomic.AtomicReference<int[]>> intArrayField = new java.util.concurrent.atomic.AtomicReference<java.util.concurrent.atomic.AtomicReference<int[]>>(); + public @java.lang.SuppressWarnings("all") boolean isBooleanField() { + java.util.concurrent.atomic.AtomicReference<java.lang.Boolean> value = this.booleanField.get(); + if ((value == null)) + { + synchronized (this.booleanField) + { + value = this.booleanField.get(); + if ((value == null)) + { + value = new java.util.concurrent.atomic.AtomicReference<java.lang.Boolean>(true); + this.booleanField.set(value); + } + } + } + return value.get(); + } + public @java.lang.SuppressWarnings("all") byte getByteField() { + java.util.concurrent.atomic.AtomicReference<java.lang.Byte> value = this.byteField.get(); + if ((value == null)) + { + synchronized (this.byteField) + { + value = this.byteField.get(); + if ((value == null)) + { + value = new java.util.concurrent.atomic.AtomicReference<java.lang.Byte>(1); + this.byteField.set(value); + } + } + } + return value.get(); + } + public @java.lang.SuppressWarnings("all") short getShortField() { + java.util.concurrent.atomic.AtomicReference<java.lang.Short> value = this.shortField.get(); + if ((value == null)) + { + synchronized (this.shortField) + { + value = this.shortField.get(); + if ((value == null)) + { + value = new java.util.concurrent.atomic.AtomicReference<java.lang.Short>(1); + this.shortField.set(value); + } + } + } + return value.get(); + } + public @java.lang.SuppressWarnings("all") int getIntField() { + java.util.concurrent.atomic.AtomicReference<java.lang.Integer> value = this.intField.get(); + if ((value == null)) + { + synchronized (this.intField) + { + value = this.intField.get(); + if ((value == null)) + { + value = new java.util.concurrent.atomic.AtomicReference<java.lang.Integer>(1); + this.intField.set(value); + } + } + } + return value.get(); + } + public @java.lang.SuppressWarnings("all") long getLongField() { + java.util.concurrent.atomic.AtomicReference<java.lang.Long> value = this.longField.get(); + if ((value == null)) + { + synchronized (this.longField) + { + value = this.longField.get(); + if ((value == null)) + { + value = new java.util.concurrent.atomic.AtomicReference<java.lang.Long>(1); + this.longField.set(value); + } + } + } + return value.get(); + } + public @java.lang.SuppressWarnings("all") float getFloatField() { + java.util.concurrent.atomic.AtomicReference<java.lang.Float> value = this.floatField.get(); + if ((value == null)) + { + synchronized (this.floatField) + { + value = this.floatField.get(); + if ((value == null)) + { + value = new java.util.concurrent.atomic.AtomicReference<java.lang.Float>(1.0f); + this.floatField.set(value); + } + } + } + return value.get(); + } + public @java.lang.SuppressWarnings("all") double getDoubleField() { + java.util.concurrent.atomic.AtomicReference<java.lang.Double> value = this.doubleField.get(); + if ((value == null)) + { + synchronized (this.doubleField) + { + value = this.doubleField.get(); + if ((value == null)) + { + value = new java.util.concurrent.atomic.AtomicReference<java.lang.Double>(1.0); + this.doubleField.set(value); + } + } + } + return value.get(); + } + public @java.lang.SuppressWarnings("all") char getCharField() { + java.util.concurrent.atomic.AtomicReference<java.lang.Character> value = this.charField.get(); + if ((value == null)) + { + synchronized (this.charField) + { + value = this.charField.get(); + if ((value == null)) + { + value = new java.util.concurrent.atomic.AtomicReference<java.lang.Character>('1'); + this.charField.set(value); + } + } + } + return value.get(); + } + public @java.lang.SuppressWarnings("all") int[] getIntArrayField() { + java.util.concurrent.atomic.AtomicReference<int[]> value = this.intArrayField.get(); + if ((value == null)) + { + synchronized (this.intArrayField) + { + value = this.intArrayField.get(); + if ((value == null)) + { + value = new java.util.concurrent.atomic.AtomicReference<int[]>(new int[]{1}); + this.intArrayField.set(value); + } + } + } + return value.get(); + } + GetterLazyNative() { + super(); + } +}
\ No newline at end of file diff --git a/test/transform/resource/before/GetterLazy.java b/test/transform/resource/before/GetterLazy.java new file mode 100644 index 00000000..51c7a921 --- /dev/null +++ b/test/transform/resource/before/GetterLazy.java @@ -0,0 +1,7 @@ +class GetterLazy { + static class ValueType { + } + + @lombok.Getter(lazy=true) + private final ValueType fieldName = new ValueType(); +} diff --git a/test/transform/resource/before/GetterLazyEahcToString.java b/test/transform/resource/before/GetterLazyEahcToString.java new file mode 100644 index 00000000..642f8deb --- /dev/null +++ b/test/transform/resource/before/GetterLazyEahcToString.java @@ -0,0 +1,8 @@ +@lombok.EqualsAndHashCode(doNotUseGetters = true) +@lombok.ToString(doNotUseGetters = true) +class GetterLazyEahcToString { + @lombok.Getter(lazy=true) + private final String value = ""; + @lombok.Getter + private final String value2 = ""; +} diff --git a/test/transform/resource/before/GetterLazyInvalid.java b/test/transform/resource/before/GetterLazyInvalid.java new file mode 100644 index 00000000..cc9f9501 --- /dev/null +++ b/test/transform/resource/before/GetterLazyInvalid.java @@ -0,0 +1,27 @@ +class GetterLazyInvalidNotFinal { + @lombok.Getter(lazy=true) + private String fieldName = ""; +} +class GetterLazyInvalidNotPrivate { + @lombok.Getter(lazy=true) + final String fieldName = ""; +} +class GetterLazyInvalidNotPrivateFinal { + @lombok.Getter(lazy=true) + String fieldName = ""; +} +class GetterLazyInvalidNone { + @lombok.Getter(lazy=true, value=lombok.AccessLevel.NONE) + private final String fieldName = ""; +} +@lombok.Getter(lazy = true) +class GetterLazyInvalidClass { + private final String fieldName = ""; +} +class GetterLazyInvalidNoInit { + @lombok.Getter(lazy = true) + private final String fieldName; + GetterLazyInvalidNoInit() { + this.fieldName = "foo"; + } +}
\ No newline at end of file diff --git a/test/transform/resource/before/GetterLazyNative.java b/test/transform/resource/before/GetterLazyNative.java new file mode 100644 index 00000000..9b290bc7 --- /dev/null +++ b/test/transform/resource/before/GetterLazyNative.java @@ -0,0 +1,28 @@ +class GetterLazyNative { + @lombok.Getter(lazy=true) + private final boolean booleanField = true; + + @lombok.Getter(lazy=true) + private final byte byteField = 1; + + @lombok.Getter(lazy=true) + private final short shortField = 1; + + @lombok.Getter(lazy=true) + private final int intField = 1; + + @lombok.Getter(lazy=true) + private final long longField = 1; + + @lombok.Getter(lazy=true) + private final float floatField = 1.0f; + + @lombok.Getter(lazy=true) + private final double doubleField = 1.0; + + @lombok.Getter(lazy=true) + private final char charField = '1'; + + @lombok.Getter(lazy=true) + private final int[] intArrayField = new int[] {1}; +} diff --git a/test/transform/resource/messages-delombok/GetterLazyInvalid.java.messages b/test/transform/resource/messages-delombok/GetterLazyInvalid.java.messages new file mode 100644 index 00000000..4f7e3df8 --- /dev/null +++ b/test/transform/resource/messages-delombok/GetterLazyInvalid.java.messages @@ -0,0 +1,6 @@ +2:9 ERROR 'lazy' requires the field to be private and final. +6:9 ERROR 'lazy' requires the field to be private and final. +10:9 ERROR 'lazy' requires the field to be private and final. +14:9 WARNING 'lazy' does not work with AccessLevel.NONE. +17:1 ERROR 'lazy' is not supported for @Getter on a type. +22:9 ERROR 'lazy' requires field initialization.
\ No newline at end of file diff --git a/test/transform/resource/messages-ecj/GetterLazyInvalid.java.messages b/test/transform/resource/messages-ecj/GetterLazyInvalid.java.messages new file mode 100644 index 00000000..25641930 --- /dev/null +++ b/test/transform/resource/messages-ecj/GetterLazyInvalid.java.messages @@ -0,0 +1,6 @@ +2 error 'lazy' requires the field to be private and final. +6 error 'lazy' requires the field to be private and final. +10 error 'lazy' requires the field to be private and final. +14 warning 'lazy' does not work with AccessLevel.NONE. +17 error 'lazy' is not supported for @Getter on a type. +22 error 'lazy' requires field initialization. |