diff options
author | Rawi01 <Rawi01@users.noreply.github.com> | 2021-05-29 18:49:05 +0200 |
---|---|---|
committer | Rawi01 <Rawi01@users.noreply.github.com> | 2021-06-03 19:23:19 +0200 |
commit | 60f575496b3184c2279e9dba470097ed164d5adf (patch) | |
tree | 61493259ec561b5d01a7a6e5361b4a7b16b5b106 /test | |
parent | 6758714ed564d72236564889157c4812eacb96fb (diff) | |
download | lombok-60f575496b3184c2279e9dba470097ed164d5adf.tar.gz lombok-60f575496b3184c2279e9dba470097ed164d5adf.tar.bz2 lombok-60f575496b3184c2279e9dba470097ed164d5adf.zip |
[fixes #2838] Handle anonymous classes properly
Generated qualified names (e.g. Outer.Inner) now stop at anonymous
classes instead of adding an empty part. All handlers that add static
fields/methods/types now add error messages instead of generating
invalid code.
Diffstat (limited to 'test')
61 files changed, 1004 insertions, 0 deletions
diff --git a/test/transform/resource/after-delombok/AccessorsInAnonymousClass.java b/test/transform/resource/after-delombok/AccessorsInAnonymousClass.java new file mode 100644 index 00000000..27fab509 --- /dev/null +++ b/test/transform/resource/after-delombok/AccessorsInAnonymousClass.java @@ -0,0 +1,22 @@ +public class AccessorsInAnonymousClass { + Object annonymous = new Object() { + + class Inner { + private String string; + + @java.lang.SuppressWarnings("all") + public String string() { + return this.string; + } + + /** + * @return {@code this}. + */ + @java.lang.SuppressWarnings("all") + public Inner string(final String string) { + this.string = string; + return this; + } + } + }; +} diff --git a/test/transform/resource/after-delombok/BuilderInAnonymousClass.java b/test/transform/resource/after-delombok/BuilderInAnonymousClass.java new file mode 100644 index 00000000..4810a0a8 --- /dev/null +++ b/test/transform/resource/after-delombok/BuilderInAnonymousClass.java @@ -0,0 +1,8 @@ +public class BuilderInAnonymousClass { + Object annonymous = new Object() { + + class Inner { + private String string; + } + }; +} diff --git a/test/transform/resource/after-delombok/ConstructorsInAnonymousClass.java b/test/transform/resource/after-delombok/ConstructorsInAnonymousClass.java new file mode 100644 index 00000000..56e96ae3 --- /dev/null +++ b/test/transform/resource/after-delombok/ConstructorsInAnonymousClass.java @@ -0,0 +1,33 @@ +import lombok.NonNull; + +public class ConstructorsInAnonymousClass { + Object annonymous = new Object() { + + class Inner { + private String string; + @NonNull + private String string2; + + @java.lang.SuppressWarnings("all") + public Inner(final String string, @NonNull final String string2) { + if (string2 == null) { + throw new java.lang.NullPointerException("string2 is marked non-null but is null"); + } + this.string = string; + this.string2 = string2; + } + + @java.lang.SuppressWarnings("all") + public Inner(@NonNull final String string2) { + if (string2 == null) { + throw new java.lang.NullPointerException("string2 is marked non-null but is null"); + } + this.string2 = string2; + } + + @java.lang.SuppressWarnings("all") + public Inner() { + } + } + }; +} diff --git a/test/transform/resource/after-delombok/DataInAnonymousClass.java b/test/transform/resource/after-delombok/DataInAnonymousClass.java new file mode 100644 index 00000000..788d7be5 --- /dev/null +++ b/test/transform/resource/after-delombok/DataInAnonymousClass.java @@ -0,0 +1,56 @@ +public class DataInAnonymousClass { + Object annonymous = new Object() { + + class Inner { + private String string; + + @java.lang.SuppressWarnings("all") + public Inner() { + } + + @java.lang.SuppressWarnings("all") + public String getString() { + return this.string; + } + + @java.lang.SuppressWarnings("all") + public void setString(final String string) { + this.string = string; + } + + @java.lang.Override + @java.lang.SuppressWarnings("all") + public boolean equals(final java.lang.Object o) { + if (o == this) return true; + if (!(o instanceof Inner)) return false; + final Inner other = (Inner) o; + if (!other.canEqual((java.lang.Object) this)) return false; + final java.lang.Object this$string = this.getString(); + final java.lang.Object other$string = other.getString(); + if (this$string == null ? other$string != null : !this$string.equals(other$string)) return false; + return true; + } + + @java.lang.SuppressWarnings("all") + protected boolean canEqual(final java.lang.Object other) { + return other instanceof Inner; + } + + @java.lang.Override + @java.lang.SuppressWarnings("all") + public int hashCode() { + final int PRIME = 59; + int result = 1; + final java.lang.Object $string = this.getString(); + result = result * PRIME + ($string == null ? 43 : $string.hashCode()); + return result; + } + + @java.lang.Override + @java.lang.SuppressWarnings("all") + public java.lang.String toString() { + return "Inner(string=" + this.getString() + ")"; + } + } + }; +} diff --git a/test/transform/resource/after-delombok/EqualsAndHashCodeInAnonymousClass.java b/test/transform/resource/after-delombok/EqualsAndHashCodeInAnonymousClass.java new file mode 100644 index 00000000..6f0b5738 --- /dev/null +++ b/test/transform/resource/after-delombok/EqualsAndHashCodeInAnonymousClass.java @@ -0,0 +1,36 @@ +public class EqualsAndHashCodeInAnonymousClass { + Object annonymous = new Object() { + + class Inner { + private String string; + + @java.lang.Override + @java.lang.SuppressWarnings("all") + public boolean equals(final java.lang.Object o) { + if (o == this) return true; + if (!(o instanceof Inner)) return false; + final Inner other = (Inner) o; + if (!other.canEqual((java.lang.Object) this)) return false; + final java.lang.Object this$string = this.string; + final java.lang.Object other$string = other.string; + if (this$string == null ? other$string != null : !this$string.equals(other$string)) return false; + return true; + } + + @java.lang.SuppressWarnings("all") + protected boolean canEqual(final java.lang.Object other) { + return other instanceof Inner; + } + + @java.lang.Override + @java.lang.SuppressWarnings("all") + public int hashCode() { + final int PRIME = 59; + int result = 1; + final java.lang.Object $string = this.string; + result = result * PRIME + ($string == null ? 43 : $string.hashCode()); + return result; + } + } + }; +} diff --git a/test/transform/resource/after-delombok/FieldNameConstantsInAnonymousClass.java b/test/transform/resource/after-delombok/FieldNameConstantsInAnonymousClass.java new file mode 100644 index 00000000..1f7e7d7a --- /dev/null +++ b/test/transform/resource/after-delombok/FieldNameConstantsInAnonymousClass.java @@ -0,0 +1,8 @@ +public class FieldNameConstantsInAnonymousClass { + Object annonymous = new Object() { + + class Inner { + private String string; + } + }; +} diff --git a/test/transform/resource/after-delombok/GetterInAnonymousClass.java b/test/transform/resource/after-delombok/GetterInAnonymousClass.java new file mode 100644 index 00000000..3c990545 --- /dev/null +++ b/test/transform/resource/after-delombok/GetterInAnonymousClass.java @@ -0,0 +1,13 @@ +public class GetterInAnonymousClass { + Object annonymous = new Object() { + + class Inner { + private String string; + + @java.lang.SuppressWarnings("all") + public String getString() { + return this.string; + } + } + }; +} diff --git a/test/transform/resource/after-delombok/GetterLazyInAnonymousClass.java b/test/transform/resource/after-delombok/GetterLazyInAnonymousClass.java new file mode 100644 index 00000000..4476e463 --- /dev/null +++ b/test/transform/resource/after-delombok/GetterLazyInAnonymousClass.java @@ -0,0 +1,24 @@ +public class GetterLazyInAnonymousClass { + Object annonymous = new Object() { + + class Inner { + private final java.util.concurrent.atomic.AtomicReference<java.lang.Object> string = new java.util.concurrent.atomic.AtomicReference<java.lang.Object>(); + + @java.lang.SuppressWarnings({"all", "unchecked"}) + public String getString() { + java.lang.Object value = this.string.get(); + if (value == null) { + synchronized (this.string) { + value = this.string.get(); + if (value == null) { + final String actualValue = "test"; + value = actualValue == null ? this.string : actualValue; + this.string.set(value); + } + } + } + return (String) (value == this.string ? null : value); + } + } + }; +} diff --git a/test/transform/resource/after-delombok/LoggerSlf4jInAnonymousClass.java b/test/transform/resource/after-delombok/LoggerSlf4jInAnonymousClass.java new file mode 100644 index 00000000..1ec25d92 --- /dev/null +++ b/test/transform/resource/after-delombok/LoggerSlf4jInAnonymousClass.java @@ -0,0 +1,7 @@ +public class LoggerSlf4jInAnonymousClass { + Object annonymous = new Object() { + + class Inner { + } + }; +} diff --git a/test/transform/resource/after-delombok/SetterInAnonymousClass.java b/test/transform/resource/after-delombok/SetterInAnonymousClass.java new file mode 100644 index 00000000..ced2be52 --- /dev/null +++ b/test/transform/resource/after-delombok/SetterInAnonymousClass.java @@ -0,0 +1,13 @@ +public class SetterInAnonymousClass { + Object annonymous = new Object() { + + class Inner { + private String string; + + @java.lang.SuppressWarnings("all") + public void setString(final String string) { + this.string = string; + } + } + }; +} diff --git a/test/transform/resource/after-delombok/SuperBuilderInAnonymousClass.java b/test/transform/resource/after-delombok/SuperBuilderInAnonymousClass.java new file mode 100644 index 00000000..cc654919 --- /dev/null +++ b/test/transform/resource/after-delombok/SuperBuilderInAnonymousClass.java @@ -0,0 +1,12 @@ +public class SuperBuilderInAnonymousClass { + Object annonymous = new Object() { + + class InnerParent { + private String string; + } + + class InnerChild { + private String string; + } + }; +} diff --git a/test/transform/resource/after-delombok/SynchronizedInAnonymousClass.java b/test/transform/resource/after-delombok/SynchronizedInAnonymousClass.java new file mode 100644 index 00000000..904487a3 --- /dev/null +++ b/test/transform/resource/after-delombok/SynchronizedInAnonymousClass.java @@ -0,0 +1,15 @@ +public class SynchronizedInAnonymousClass { + Object annonymous = new Object() { + + class Inner { + @java.lang.SuppressWarnings("all") + private final java.lang.Object $lock = new java.lang.Object[0]; + + public void foo() { + synchronized (this.$lock) { + String foo = "bar"; + } + } + } + }; +} diff --git a/test/transform/resource/after-delombok/ToStringInAnonymousClass.java b/test/transform/resource/after-delombok/ToStringInAnonymousClass.java new file mode 100644 index 00000000..aa3651bb --- /dev/null +++ b/test/transform/resource/after-delombok/ToStringInAnonymousClass.java @@ -0,0 +1,14 @@ +public class ToStringInAnonymousClass { + Object annonymous = new Object() { + + class Inner { + private String string; + + @java.lang.Override + @java.lang.SuppressWarnings("all") + public java.lang.String toString() { + return "Inner(string=" + this.string + ")"; + } + } + }; +} diff --git a/test/transform/resource/after-delombok/UtilityClassInAnonymousClass.java b/test/transform/resource/after-delombok/UtilityClassInAnonymousClass.java new file mode 100644 index 00000000..3df9b559 --- /dev/null +++ b/test/transform/resource/after-delombok/UtilityClassInAnonymousClass.java @@ -0,0 +1,8 @@ +public class UtilityClassInAnonymousClass { + Object annonymous = new Object() { + + class Inner { + private String string; + } + }; +} diff --git a/test/transform/resource/after-delombok/ValueInAnonymousClass.java b/test/transform/resource/after-delombok/ValueInAnonymousClass.java new file mode 100644 index 00000000..5bab4093 --- /dev/null +++ b/test/transform/resource/after-delombok/ValueInAnonymousClass.java @@ -0,0 +1,46 @@ +public class ValueInAnonymousClass { + Object annonymous = new Object() { + + final class Inner { + private final String string; + + @java.lang.SuppressWarnings("all") + public Inner(final String string) { + this.string = string; + } + + @java.lang.SuppressWarnings("all") + public String getString() { + return this.string; + } + + @java.lang.Override + @java.lang.SuppressWarnings("all") + public boolean equals(final java.lang.Object o) { + if (o == this) return true; + if (!(o instanceof Inner)) return false; + final Inner other = (Inner) o; + final java.lang.Object this$string = this.getString(); + final java.lang.Object other$string = other.getString(); + if (this$string == null ? other$string != null : !this$string.equals(other$string)) return false; + return true; + } + + @java.lang.Override + @java.lang.SuppressWarnings("all") + public int hashCode() { + final int PRIME = 59; + int result = 1; + final java.lang.Object $string = this.getString(); + result = result * PRIME + ($string == null ? 43 : $string.hashCode()); + return result; + } + + @java.lang.Override + @java.lang.SuppressWarnings("all") + public java.lang.String toString() { + return "Inner(string=" + this.getString() + ")"; + } + } + }; +} diff --git a/test/transform/resource/after-delombok/WithByInAnonymousClass.java b/test/transform/resource/after-delombok/WithByInAnonymousClass.java new file mode 100644 index 00000000..e3c70763 --- /dev/null +++ b/test/transform/resource/after-delombok/WithByInAnonymousClass.java @@ -0,0 +1,16 @@ +public class WithByInAnonymousClass { + Object annonymous = new Object() { + + class Inner { + private Inner(String string) { + } + + private String string; + + @java.lang.SuppressWarnings("all") + public Inner withStringBy(final java.util.function.Function<? super String, ? extends String> transformer) { + return new Inner(transformer.apply(this.string)); + } + } + }; +} diff --git a/test/transform/resource/after-delombok/WithInAnonymousClass.java b/test/transform/resource/after-delombok/WithInAnonymousClass.java new file mode 100644 index 00000000..02490533 --- /dev/null +++ b/test/transform/resource/after-delombok/WithInAnonymousClass.java @@ -0,0 +1,19 @@ +public class WithInAnonymousClass { + Object annonymous = new Object() { + + class Inner { + private Inner(String string) { + } + + private String string; + + /** + * @return a clone of this object, except with this updated property (returns {@code this} if an identical value is passed). + */ + @java.lang.SuppressWarnings("all") + public Inner withString(final String string) { + return this.string == string ? this : new Inner(string); + } + } + }; +} diff --git a/test/transform/resource/after-ecj/AccessorsInAnonymousClass.java b/test/transform/resource/after-ecj/AccessorsInAnonymousClass.java new file mode 100644 index 00000000..34db4f2d --- /dev/null +++ b/test/transform/resource/after-ecj/AccessorsInAnonymousClass.java @@ -0,0 +1,29 @@ +import lombok.Getter; +import lombok.Setter; +import lombok.experimental.Accessors; +public class AccessorsInAnonymousClass { + Object annonymous = new Object() { + @Getter @Setter @Accessors(fluent = true) class Inner { + private String string; + Inner() { + super(); + } + public @java.lang.SuppressWarnings("all") String string() { + return this.string; + } + /** + * @return {@code this}. + */ + public @java.lang.SuppressWarnings("all") Inner string(final String string) { + this.string = string; + return this; + } + } + x() { + super(); + } + }; + public AccessorsInAnonymousClass() { + super(); + } +} diff --git a/test/transform/resource/after-ecj/BuilderInAnonymousClass.java b/test/transform/resource/after-ecj/BuilderInAnonymousClass.java new file mode 100644 index 00000000..67660822 --- /dev/null +++ b/test/transform/resource/after-ecj/BuilderInAnonymousClass.java @@ -0,0 +1,17 @@ +import lombok.Builder; +public class BuilderInAnonymousClass { + Object annonymous = new Object() { + @Builder class Inner { + private String string; + Inner() { + super(); + } + } + x() { + super(); + } + }; + public BuilderInAnonymousClass() { + super(); + } +} diff --git a/test/transform/resource/after-ecj/ConstructorsInAnonymousClass.java b/test/transform/resource/after-ecj/ConstructorsInAnonymousClass.java new file mode 100644 index 00000000..545ab04d --- /dev/null +++ b/test/transform/resource/after-ecj/ConstructorsInAnonymousClass.java @@ -0,0 +1,38 @@ +import lombok.AllArgsConstructor; +import lombok.NoArgsConstructor; +import lombok.NonNull; +import lombok.RequiredArgsConstructor; +public class ConstructorsInAnonymousClass { + Object annonymous = new Object() { + @AllArgsConstructor @RequiredArgsConstructor @NoArgsConstructor class Inner { + private String string; + private @NonNull String string2; + public @java.lang.SuppressWarnings("all") Inner(final String string, final @NonNull String string2) { + super(); + if ((string2 == null)) + { + throw new java.lang.NullPointerException("string2 is marked non-null but is null"); + } + this.string = string; + this.string2 = string2; + } + public @java.lang.SuppressWarnings("all") Inner(final @NonNull String string2) { + super(); + if ((string2 == null)) + { + throw new java.lang.NullPointerException("string2 is marked non-null but is null"); + } + this.string2 = string2; + } + public @java.lang.SuppressWarnings("all") Inner() { + super(); + } + } + x() { + super(); + } + }; + public ConstructorsInAnonymousClass() { + super(); + } +} diff --git a/test/transform/resource/after-ecj/DataInAnonymousClass.java b/test/transform/resource/after-ecj/DataInAnonymousClass.java new file mode 100644 index 00000000..c6e22f80 --- /dev/null +++ b/test/transform/resource/after-ecj/DataInAnonymousClass.java @@ -0,0 +1,50 @@ +import lombok.Data; +public class DataInAnonymousClass { + Object annonymous = new Object() { + @Data class Inner { + private String string; + public @java.lang.SuppressWarnings("all") String getString() { + return this.string; + } + public @java.lang.SuppressWarnings("all") void setString(final String string) { + this.string = string; + } + public @java.lang.Override @java.lang.SuppressWarnings("all") boolean equals(final java.lang.Object o) { + if ((o == this)) + return true; + if ((! (o instanceof Inner))) + return false; + final Inner other = (Inner) o; + if ((! other.canEqual((java.lang.Object) this))) + return false; + final java.lang.Object this$string = this.getString(); + final java.lang.Object other$string = other.getString(); + if (((this$string == null) ? (other$string != null) : (! this$string.equals(other$string)))) + return false; + return true; + } + protected @java.lang.SuppressWarnings("all") boolean canEqual(final java.lang.Object other) { + return (other instanceof Inner); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") int hashCode() { + final int PRIME = 59; + int result = 1; + final java.lang.Object $string = this.getString(); + result = ((result * PRIME) + (($string == null) ? 43 : $string.hashCode())); + return result; + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (("Inner(string=" + this.getString()) + ")"); + } + public @java.lang.SuppressWarnings("all") Inner() { + super(); + } + } + x() { + super(); + } + }; + public DataInAnonymousClass() { + super(); + } +} diff --git a/test/transform/resource/after-ecj/EqualsAndHashCodeInAnonymousClass.java b/test/transform/resource/after-ecj/EqualsAndHashCodeInAnonymousClass.java new file mode 100644 index 00000000..e66850bb --- /dev/null +++ b/test/transform/resource/after-ecj/EqualsAndHashCodeInAnonymousClass.java @@ -0,0 +1,41 @@ +import lombok.EqualsAndHashCode; +public class EqualsAndHashCodeInAnonymousClass { + Object annonymous = new Object() { + @EqualsAndHashCode class Inner { + private String string; + Inner() { + super(); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") boolean equals(final java.lang.Object o) { + if ((o == this)) + return true; + if ((! (o instanceof Inner))) + return false; + final Inner other = (Inner) o; + if ((! other.canEqual((java.lang.Object) this))) + return false; + final java.lang.Object this$string = this.string; + final java.lang.Object other$string = other.string; + if (((this$string == null) ? (other$string != null) : (! this$string.equals(other$string)))) + return false; + return true; + } + protected @java.lang.SuppressWarnings("all") boolean canEqual(final java.lang.Object other) { + return (other instanceof Inner); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") int hashCode() { + final int PRIME = 59; + int result = 1; + final java.lang.Object $string = this.string; + result = ((result * PRIME) + (($string == null) ? 43 : $string.hashCode())); + return result; + } + } + x() { + super(); + } + }; + public EqualsAndHashCodeInAnonymousClass() { + super(); + } +} diff --git a/test/transform/resource/after-ecj/FieldNameConstantsInAnonymousClass.java b/test/transform/resource/after-ecj/FieldNameConstantsInAnonymousClass.java new file mode 100644 index 00000000..b04bef51 --- /dev/null +++ b/test/transform/resource/after-ecj/FieldNameConstantsInAnonymousClass.java @@ -0,0 +1,17 @@ +import lombok.experimental.FieldNameConstants; +public class FieldNameConstantsInAnonymousClass { + Object annonymous = new Object() { + @FieldNameConstants class Inner { + private String string; + Inner() { + super(); + } + } + x() { + super(); + } + }; + public FieldNameConstantsInAnonymousClass() { + super(); + } +} diff --git a/test/transform/resource/after-ecj/GetterInAnonymousClass.java b/test/transform/resource/after-ecj/GetterInAnonymousClass.java new file mode 100644 index 00000000..30e6338d --- /dev/null +++ b/test/transform/resource/after-ecj/GetterInAnonymousClass.java @@ -0,0 +1,20 @@ +import lombok.Getter; +public class GetterInAnonymousClass { + Object annonymous = new Object() { + @Getter class Inner { + private String string; + Inner() { + super(); + } + public @java.lang.SuppressWarnings("all") String getString() { + return this.string; + } + } + x() { + super(); + } + }; + public GetterInAnonymousClass() { + super(); + } +} diff --git a/test/transform/resource/after-ecj/GetterLazyInAnonymousClass.java b/test/transform/resource/after-ecj/GetterLazyInAnonymousClass.java new file mode 100644 index 00000000..ab8bc599 --- /dev/null +++ b/test/transform/resource/after-ecj/GetterLazyInAnonymousClass.java @@ -0,0 +1,34 @@ +import lombok.Getter; +public class GetterLazyInAnonymousClass { + Object annonymous = new Object() { + class Inner { + private final @Getter(lazy = true) java.util.concurrent.atomic.AtomicReference<java.lang.Object> string = new java.util.concurrent.atomic.AtomicReference<java.lang.Object>(); + Inner() { + super(); + } + public @java.lang.SuppressWarnings({"all", "unchecked"}) String getString() { + java.lang.Object value = this.string.get(); + if ((value == null)) + { + synchronized (this.string) + { + value = this.string.get(); + if ((value == null)) + { + final String actualValue = "test"; + value = ((actualValue == null) ? this.string : actualValue); + this.string.set(value); + } + } + } + return (String) ((value == this.string) ? null : value); + } + } + x() { + super(); + } + }; + public GetterLazyInAnonymousClass() { + super(); + } +} diff --git a/test/transform/resource/after-ecj/LoggerSlf4jInAnonymousClass.java b/test/transform/resource/after-ecj/LoggerSlf4jInAnonymousClass.java new file mode 100644 index 00000000..0c78a288 --- /dev/null +++ b/test/transform/resource/after-ecj/LoggerSlf4jInAnonymousClass.java @@ -0,0 +1,16 @@ +import lombok.extern.slf4j.Slf4j; +public class LoggerSlf4jInAnonymousClass { + Object annonymous = new Object() { + @Slf4j class Inner { + Inner() { + super(); + } + } + x() { + super(); + } + }; + public LoggerSlf4jInAnonymousClass() { + super(); + } +} diff --git a/test/transform/resource/after-ecj/SetterInAnonymousClass.java b/test/transform/resource/after-ecj/SetterInAnonymousClass.java new file mode 100644 index 00000000..fc0bf2d8 --- /dev/null +++ b/test/transform/resource/after-ecj/SetterInAnonymousClass.java @@ -0,0 +1,20 @@ +import lombok.Setter; +public class SetterInAnonymousClass { + Object annonymous = new Object() { + @Setter class Inner { + private String string; + Inner() { + super(); + } + public @java.lang.SuppressWarnings("all") void setString(final String string) { + this.string = string; + } + } + x() { + super(); + } + }; + public SetterInAnonymousClass() { + super(); + } +} diff --git a/test/transform/resource/after-ecj/SuperBuilderInAnonymousClass.java b/test/transform/resource/after-ecj/SuperBuilderInAnonymousClass.java new file mode 100644 index 00000000..238f42df --- /dev/null +++ b/test/transform/resource/after-ecj/SuperBuilderInAnonymousClass.java @@ -0,0 +1,23 @@ +import lombok.experimental.SuperBuilder; +public class SuperBuilderInAnonymousClass { + Object annonymous = new Object() { + @SuperBuilder class InnerParent { + private String string; + InnerParent() { + super(); + } + } + @SuperBuilder class InnerChild { + private String string; + InnerChild() { + super(); + } + } + x() { + super(); + } + }; + public SuperBuilderInAnonymousClass() { + super(); + } +} diff --git a/test/transform/resource/after-ecj/SynchronizedInAnonymousClass.java b/test/transform/resource/after-ecj/SynchronizedInAnonymousClass.java new file mode 100644 index 00000000..77013f2f --- /dev/null +++ b/test/transform/resource/after-ecj/SynchronizedInAnonymousClass.java @@ -0,0 +1,23 @@ +import lombok.Synchronized; +public class SynchronizedInAnonymousClass { + Object annonymous = new Object() { + class Inner { + private final java.lang.Object $lock = new java.lang.Object[0]; + Inner() { + super(); + } + public @Synchronized void foo() { + synchronized (this.$lock) + { + String foo = "bar"; + } + } + } + x() { + super(); + } + }; + public SynchronizedInAnonymousClass() { + super(); + } +} diff --git a/test/transform/resource/after-ecj/ToStringInAnonymousClass.java b/test/transform/resource/after-ecj/ToStringInAnonymousClass.java new file mode 100644 index 00000000..02ad2a88 --- /dev/null +++ b/test/transform/resource/after-ecj/ToStringInAnonymousClass.java @@ -0,0 +1,20 @@ +import lombok.ToString; +public class ToStringInAnonymousClass { + Object annonymous = new Object() { + @ToString class Inner { + private String string; + Inner() { + super(); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (("Inner(string=" + this.string) + ")"); + } + } + x() { + super(); + } + }; + public ToStringInAnonymousClass() { + super(); + } +} diff --git a/test/transform/resource/after-ecj/UtilityClassInAnonymousClass.java b/test/transform/resource/after-ecj/UtilityClassInAnonymousClass.java new file mode 100644 index 00000000..e836636d --- /dev/null +++ b/test/transform/resource/after-ecj/UtilityClassInAnonymousClass.java @@ -0,0 +1,17 @@ +import lombok.experimental.UtilityClass; +public class UtilityClassInAnonymousClass { + Object annonymous = new Object() { + @UtilityClass class Inner { + private String string; + Inner() { + super(); + } + } + x() { + super(); + } + }; + public UtilityClassInAnonymousClass() { + super(); + } +} diff --git a/test/transform/resource/after-ecj/ValueInAnonymousClass.java b/test/transform/resource/after-ecj/ValueInAnonymousClass.java new file mode 100644 index 00000000..49cf8fc2 --- /dev/null +++ b/test/transform/resource/after-ecj/ValueInAnonymousClass.java @@ -0,0 +1,43 @@ +import lombok.Value; +public class ValueInAnonymousClass { + Object annonymous = new Object() { + final @Value class Inner { + private final String string; + public @java.lang.SuppressWarnings("all") String getString() { + return this.string; + } + public @java.lang.Override @java.lang.SuppressWarnings("all") boolean equals(final java.lang.Object o) { + if ((o == this)) + return true; + if ((! (o instanceof Inner))) + return false; + final Inner other = (Inner) o; + final java.lang.Object this$string = this.getString(); + final java.lang.Object other$string = other.getString(); + if (((this$string == null) ? (other$string != null) : (! this$string.equals(other$string)))) + return false; + return true; + } + public @java.lang.Override @java.lang.SuppressWarnings("all") int hashCode() { + final int PRIME = 59; + int result = 1; + final java.lang.Object $string = this.getString(); + result = ((result * PRIME) + (($string == null) ? 43 : $string.hashCode())); + return result; + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (("Inner(string=" + this.getString()) + ")"); + } + public @java.lang.SuppressWarnings("all") Inner(final String string) { + super(); + this.string = string; + } + } + x() { + super(); + } + }; + public ValueInAnonymousClass() { + super(); + } +} diff --git a/test/transform/resource/after-ecj/WithByInAnonymousClass.java b/test/transform/resource/after-ecj/WithByInAnonymousClass.java new file mode 100644 index 00000000..1bc3e80c --- /dev/null +++ b/test/transform/resource/after-ecj/WithByInAnonymousClass.java @@ -0,0 +1,20 @@ +import lombok.experimental.WithBy; +public class WithByInAnonymousClass { + Object annonymous = new Object() { + @WithBy class Inner { + private String string; + private Inner(String string) { + super(); + } + public @java.lang.SuppressWarnings("all") Inner withStringBy(final java.util.function.Function<? super String, ? extends String> transformer) { + return new Inner(transformer.apply(this.string)); + } + } + x() { + super(); + } + }; + public WithByInAnonymousClass() { + super(); + } +} diff --git a/test/transform/resource/after-ecj/WithInAnonymousClass.java b/test/transform/resource/after-ecj/WithInAnonymousClass.java new file mode 100644 index 00000000..fef96022 --- /dev/null +++ b/test/transform/resource/after-ecj/WithInAnonymousClass.java @@ -0,0 +1,23 @@ +import lombok.With; +public class WithInAnonymousClass { + Object annonymous = new Object() { + @With class Inner { + private String string; + private Inner(String string) { + super(); + } + /** + * @return a clone of this object, except with this updated property (returns {@code this} if an identical value is passed). + */ + public @java.lang.SuppressWarnings("all") Inner withString(final String string) { + return ((this.string == string) ? this : new Inner(string)); + } + } + x() { + super(); + } + }; + public WithInAnonymousClass() { + super(); + } +} diff --git a/test/transform/resource/before/AccessorsInAnonymousClass.java b/test/transform/resource/before/AccessorsInAnonymousClass.java new file mode 100644 index 00000000..0bbab1d6 --- /dev/null +++ b/test/transform/resource/before/AccessorsInAnonymousClass.java @@ -0,0 +1,14 @@ +import lombok.Getter; +import lombok.Setter; +import lombok.experimental.Accessors; + +public class AccessorsInAnonymousClass { + Object annonymous = new Object() { + @Getter + @Setter + @Accessors(fluent = true) + class Inner { + private String string; + } + }; +}
\ No newline at end of file diff --git a/test/transform/resource/before/BuilderInAnonymousClass.java b/test/transform/resource/before/BuilderInAnonymousClass.java new file mode 100644 index 00000000..8291e678 --- /dev/null +++ b/test/transform/resource/before/BuilderInAnonymousClass.java @@ -0,0 +1,10 @@ +import lombok.Builder; + +public class BuilderInAnonymousClass { + Object annonymous = new Object() { + @Builder + class Inner { + private String string; + } + }; +}
\ No newline at end of file diff --git a/test/transform/resource/before/ConstructorsInAnonymousClass.java b/test/transform/resource/before/ConstructorsInAnonymousClass.java new file mode 100644 index 00000000..b6e78dd3 --- /dev/null +++ b/test/transform/resource/before/ConstructorsInAnonymousClass.java @@ -0,0 +1,17 @@ +import lombok.AllArgsConstructor; +import lombok.NoArgsConstructor; +import lombok.NonNull; +import lombok.RequiredArgsConstructor; + +public class ConstructorsInAnonymousClass { + Object annonymous = new Object() { + @AllArgsConstructor + @RequiredArgsConstructor + @NoArgsConstructor + class Inner { + private String string; + @NonNull + private String string2; + } + }; +}
\ No newline at end of file diff --git a/test/transform/resource/before/DataInAnonymousClass.java b/test/transform/resource/before/DataInAnonymousClass.java new file mode 100644 index 00000000..3de5ac0b --- /dev/null +++ b/test/transform/resource/before/DataInAnonymousClass.java @@ -0,0 +1,10 @@ +import lombok.Data; + +public class DataInAnonymousClass { + Object annonymous = new Object() { + @Data + class Inner { + private String string; + } + }; +}
\ No newline at end of file diff --git a/test/transform/resource/before/EqualsAndHashCodeInAnonymousClass.java b/test/transform/resource/before/EqualsAndHashCodeInAnonymousClass.java new file mode 100644 index 00000000..0f0995b6 --- /dev/null +++ b/test/transform/resource/before/EqualsAndHashCodeInAnonymousClass.java @@ -0,0 +1,10 @@ +import lombok.EqualsAndHashCode; + +public class EqualsAndHashCodeInAnonymousClass { + Object annonymous = new Object() { + @EqualsAndHashCode + class Inner { + private String string; + } + }; +}
\ No newline at end of file diff --git a/test/transform/resource/before/FieldNameConstantsInAnonymousClass.java b/test/transform/resource/before/FieldNameConstantsInAnonymousClass.java new file mode 100644 index 00000000..86325ce5 --- /dev/null +++ b/test/transform/resource/before/FieldNameConstantsInAnonymousClass.java @@ -0,0 +1,10 @@ +import lombok.experimental.FieldNameConstants; + +public class FieldNameConstantsInAnonymousClass { + Object annonymous = new Object() { + @FieldNameConstants + class Inner { + private String string; + } + }; +}
\ No newline at end of file diff --git a/test/transform/resource/before/GetterInAnonymousClass.java b/test/transform/resource/before/GetterInAnonymousClass.java new file mode 100644 index 00000000..e8195021 --- /dev/null +++ b/test/transform/resource/before/GetterInAnonymousClass.java @@ -0,0 +1,10 @@ +import lombok.Getter; + +public class GetterInAnonymousClass { + Object annonymous = new Object() { + @Getter + class Inner { + private String string; + } + }; +}
\ No newline at end of file diff --git a/test/transform/resource/before/GetterLazyInAnonymousClass.java b/test/transform/resource/before/GetterLazyInAnonymousClass.java new file mode 100644 index 00000000..e342e636 --- /dev/null +++ b/test/transform/resource/before/GetterLazyInAnonymousClass.java @@ -0,0 +1,10 @@ +import lombok.Getter; + +public class GetterLazyInAnonymousClass { + Object annonymous = new Object() { + class Inner { + @Getter(lazy = true) + private final String string = "test"; + } + }; +}
\ No newline at end of file diff --git a/test/transform/resource/before/LoggerSlf4jInAnonymousClass.java b/test/transform/resource/before/LoggerSlf4jInAnonymousClass.java new file mode 100644 index 00000000..4839c7aa --- /dev/null +++ b/test/transform/resource/before/LoggerSlf4jInAnonymousClass.java @@ -0,0 +1,9 @@ +import lombok.extern.slf4j.Slf4j; + +public class LoggerSlf4jInAnonymousClass { + Object annonymous = new Object() { + @Slf4j + class Inner { + } + }; +}
\ No newline at end of file diff --git a/test/transform/resource/before/SetterInAnonymousClass.java b/test/transform/resource/before/SetterInAnonymousClass.java new file mode 100644 index 00000000..1b3c817b --- /dev/null +++ b/test/transform/resource/before/SetterInAnonymousClass.java @@ -0,0 +1,10 @@ +import lombok.Setter; + +public class SetterInAnonymousClass { + Object annonymous = new Object() { + @Setter + class Inner { + private String string; + } + }; +}
\ No newline at end of file diff --git a/test/transform/resource/before/SuperBuilderInAnonymousClass.java b/test/transform/resource/before/SuperBuilderInAnonymousClass.java new file mode 100644 index 00000000..bff871aa --- /dev/null +++ b/test/transform/resource/before/SuperBuilderInAnonymousClass.java @@ -0,0 +1,15 @@ +import lombok.experimental.SuperBuilder; + +public class SuperBuilderInAnonymousClass { + Object annonymous = new Object() { + @SuperBuilder + class InnerParent { + private String string; + } + + @SuperBuilder + class InnerChild { + private String string; + } + }; +}
\ No newline at end of file diff --git a/test/transform/resource/before/SynchronizedInAnonymousClass.java b/test/transform/resource/before/SynchronizedInAnonymousClass.java new file mode 100644 index 00000000..11c623ce --- /dev/null +++ b/test/transform/resource/before/SynchronizedInAnonymousClass.java @@ -0,0 +1,12 @@ +import lombok.Synchronized; + +public class SynchronizedInAnonymousClass { + Object annonymous = new Object() { + class Inner { + @Synchronized + public void foo() { + String foo = "bar"; + } + } + }; +}
\ No newline at end of file diff --git a/test/transform/resource/before/ToStringInAnonymousClass.java b/test/transform/resource/before/ToStringInAnonymousClass.java new file mode 100644 index 00000000..87a7a6c1 --- /dev/null +++ b/test/transform/resource/before/ToStringInAnonymousClass.java @@ -0,0 +1,10 @@ +import lombok.ToString; + +public class ToStringInAnonymousClass { + Object annonymous = new Object() { + @ToString + class Inner { + private String string; + } + }; +}
\ No newline at end of file diff --git a/test/transform/resource/before/UtilityClassInAnonymousClass.java b/test/transform/resource/before/UtilityClassInAnonymousClass.java new file mode 100644 index 00000000..41757502 --- /dev/null +++ b/test/transform/resource/before/UtilityClassInAnonymousClass.java @@ -0,0 +1,10 @@ +import lombok.experimental.UtilityClass; + +public class UtilityClassInAnonymousClass { + Object annonymous = new Object() { + @UtilityClass + class Inner { + private String string; + } + }; +}
\ No newline at end of file diff --git a/test/transform/resource/before/ValueInAnonymousClass.java b/test/transform/resource/before/ValueInAnonymousClass.java new file mode 100644 index 00000000..c0bde2ab --- /dev/null +++ b/test/transform/resource/before/ValueInAnonymousClass.java @@ -0,0 +1,10 @@ +import lombok.Value; + +public class ValueInAnonymousClass { + Object annonymous = new Object() { + @Value + class Inner { + private String string; + } + }; +}
\ No newline at end of file diff --git a/test/transform/resource/before/WithByInAnonymousClass.java b/test/transform/resource/before/WithByInAnonymousClass.java new file mode 100644 index 00000000..b366f168 --- /dev/null +++ b/test/transform/resource/before/WithByInAnonymousClass.java @@ -0,0 +1,12 @@ +import lombok.experimental.WithBy; + +public class WithByInAnonymousClass { + Object annonymous = new Object() { + @WithBy + class Inner { + private Inner(String string) { } + + private String string; + } + }; +}
\ No newline at end of file diff --git a/test/transform/resource/before/WithInAnonymousClass.java b/test/transform/resource/before/WithInAnonymousClass.java new file mode 100644 index 00000000..daf1bce5 --- /dev/null +++ b/test/transform/resource/before/WithInAnonymousClass.java @@ -0,0 +1,12 @@ +import lombok.With; + +public class WithInAnonymousClass { + Object annonymous = new Object() { + @With + class Inner { + private Inner(String string) { } + + private String string; + } + }; +}
\ No newline at end of file diff --git a/test/transform/resource/messages-delombok/BuilderInAnonymousClass.java.messages b/test/transform/resource/messages-delombok/BuilderInAnonymousClass.java.messages new file mode 100644 index 00000000..7607e734 --- /dev/null +++ b/test/transform/resource/messages-delombok/BuilderInAnonymousClass.java.messages @@ -0,0 +1 @@ +5 @Builder is not supported on non-static nested classes. diff --git a/test/transform/resource/messages-delombok/FieldNameConstantsInAnonymousClass.java.messages b/test/transform/resource/messages-delombok/FieldNameConstantsInAnonymousClass.java.messages new file mode 100644 index 00000000..b9d4887f --- /dev/null +++ b/test/transform/resource/messages-delombok/FieldNameConstantsInAnonymousClass.java.messages @@ -0,0 +1 @@ +5 @FieldNameConstants is not supported on non-static nested classes. diff --git a/test/transform/resource/messages-delombok/LoggerSlf4jInAnonymousClass.java.messages b/test/transform/resource/messages-delombok/LoggerSlf4jInAnonymousClass.java.messages new file mode 100644 index 00000000..d4da9f99 --- /dev/null +++ b/test/transform/resource/messages-delombok/LoggerSlf4jInAnonymousClass.java.messages @@ -0,0 +1 @@ +5 @Slf4j is not supported on non-static nested classes. diff --git a/test/transform/resource/messages-delombok/SuperBuilderInAnonymousClass.java.messages b/test/transform/resource/messages-delombok/SuperBuilderInAnonymousClass.java.messages new file mode 100644 index 00000000..f0cf3243 --- /dev/null +++ b/test/transform/resource/messages-delombok/SuperBuilderInAnonymousClass.java.messages @@ -0,0 +1,2 @@ +5 @SuperBuilder is not supported on non-static nested classes. +10 @SuperBuilder is not supported on non-static nested classes. diff --git a/test/transform/resource/messages-delombok/UtilityClassInAnonymousClass.java.messages b/test/transform/resource/messages-delombok/UtilityClassInAnonymousClass.java.messages new file mode 100644 index 00000000..8884e02d --- /dev/null +++ b/test/transform/resource/messages-delombok/UtilityClassInAnonymousClass.java.messages @@ -0,0 +1 @@ +5 @UtilityClass automatically makes the class static, however, this class cannot be made static. diff --git a/test/transform/resource/messages-ecj/BuilderInAnonymousClass.java.messages b/test/transform/resource/messages-ecj/BuilderInAnonymousClass.java.messages new file mode 100644 index 00000000..7607e734 --- /dev/null +++ b/test/transform/resource/messages-ecj/BuilderInAnonymousClass.java.messages @@ -0,0 +1 @@ +5 @Builder is not supported on non-static nested classes. diff --git a/test/transform/resource/messages-ecj/FieldNameConstantsInAnonymousClass.java.messages b/test/transform/resource/messages-ecj/FieldNameConstantsInAnonymousClass.java.messages new file mode 100644 index 00000000..b9d4887f --- /dev/null +++ b/test/transform/resource/messages-ecj/FieldNameConstantsInAnonymousClass.java.messages @@ -0,0 +1 @@ +5 @FieldNameConstants is not supported on non-static nested classes. diff --git a/test/transform/resource/messages-ecj/LoggerSlf4jInAnonymousClass.java.messages b/test/transform/resource/messages-ecj/LoggerSlf4jInAnonymousClass.java.messages new file mode 100644 index 00000000..d4da9f99 --- /dev/null +++ b/test/transform/resource/messages-ecj/LoggerSlf4jInAnonymousClass.java.messages @@ -0,0 +1 @@ +5 @Slf4j is not supported on non-static nested classes. diff --git a/test/transform/resource/messages-ecj/SuperBuilderInAnonymousClass.java.messages b/test/transform/resource/messages-ecj/SuperBuilderInAnonymousClass.java.messages new file mode 100644 index 00000000..f0cf3243 --- /dev/null +++ b/test/transform/resource/messages-ecj/SuperBuilderInAnonymousClass.java.messages @@ -0,0 +1,2 @@ +5 @SuperBuilder is not supported on non-static nested classes. +10 @SuperBuilder is not supported on non-static nested classes. diff --git a/test/transform/resource/messages-ecj/UtilityClassInAnonymousClass.java.messages b/test/transform/resource/messages-ecj/UtilityClassInAnonymousClass.java.messages new file mode 100644 index 00000000..8884e02d --- /dev/null +++ b/test/transform/resource/messages-ecj/UtilityClassInAnonymousClass.java.messages @@ -0,0 +1 @@ +5 @UtilityClass automatically makes the class static, however, this class cannot be made static. |