diff options
author | Reinier Zwitserloot <r.zwitserloot@projectlombok.org> | 2021-10-18 15:44:45 +0200 |
---|---|---|
committer | Reinier Zwitserloot <r.zwitserloot@projectlombok.org> | 2021-10-18 20:24:37 +0200 |
commit | dbc67c5c2d0388692f9c9dec02b294da14fd5b56 (patch) | |
tree | b3e95fc757976fb3c9188c6c046191eaaea7496e /test/transform/resource/after-ecj | |
parent | 1ae87bad9583620ca79c1f3ede31703cbb95cbc5 (diff) | |
download | lombok-dbc67c5c2d0388692f9c9dec02b294da14fd5b56.tar.gz lombok-dbc67c5c2d0388692f9c9dec02b294da14fd5b56.tar.bz2 lombok-dbc67c5c2d0388692f9c9dec02b294da14fd5b56.zip |
[#2693] Review and updates for javabeans-style capitalization lombok.config
Diffstat (limited to 'test/transform/resource/after-ecj')
6 files changed, 116 insertions, 99 deletions
diff --git a/test/transform/resource/after-ecj/BuilderWithJavaBeansSpecCapitalization.java b/test/transform/resource/after-ecj/BuilderWithJavaBeansSpecCapitalization.java new file mode 100644 index 00000000..1107254f --- /dev/null +++ b/test/transform/resource/after-ecj/BuilderWithJavaBeansSpecCapitalization.java @@ -0,0 +1,99 @@ +@lombok.Builder(setterPrefix = "set") class BuilderWithJavaBeansSpecCapitalization { + public static @java.lang.SuppressWarnings("all") class BuilderWithJavaBeansSpecCapitalizationBuilder { + private @java.lang.SuppressWarnings("all") java.util.ArrayList<String> a; + private @java.lang.SuppressWarnings("all") java.util.ArrayList<String> aField; + private @java.lang.SuppressWarnings("all") String bField; + @java.lang.SuppressWarnings("all") BuilderWithJavaBeansSpecCapitalizationBuilder() { + super(); + } + public @java.lang.SuppressWarnings("all") BuilderWithJavaBeansSpecCapitalization.BuilderWithJavaBeansSpecCapitalizationBuilder setZ(final String z) { + if ((this.a == null)) + this.a = new java.util.ArrayList<String>(); + this.a.add(z); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderWithJavaBeansSpecCapitalization.BuilderWithJavaBeansSpecCapitalizationBuilder setA(final java.util.Collection<? extends String> a) { + if ((a == null)) + { + throw new java.lang.NullPointerException("a cannot be null"); + } + if ((this.a == null)) + this.a = new java.util.ArrayList<String>(); + this.a.addAll(a); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderWithJavaBeansSpecCapitalization.BuilderWithJavaBeansSpecCapitalizationBuilder clearA() { + if ((this.a != null)) + this.a.clear(); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderWithJavaBeansSpecCapitalization.BuilderWithJavaBeansSpecCapitalizationBuilder setyField(final String yField) { + if ((this.aField == null)) + this.aField = new java.util.ArrayList<String>(); + this.aField.add(yField); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderWithJavaBeansSpecCapitalization.BuilderWithJavaBeansSpecCapitalizationBuilder setaField(final java.util.Collection<? extends String> aField) { + if ((aField == null)) + { + throw new java.lang.NullPointerException("aField cannot be null"); + } + if ((this.aField == null)) + this.aField = new java.util.ArrayList<String>(); + this.aField.addAll(aField); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderWithJavaBeansSpecCapitalization.BuilderWithJavaBeansSpecCapitalizationBuilder clearaField() { + if ((this.aField != null)) + this.aField.clear(); + return this; + } + /** + * @return {@code this}. + */ + public @java.lang.SuppressWarnings("all") BuilderWithJavaBeansSpecCapitalization.BuilderWithJavaBeansSpecCapitalizationBuilder setbField(final String bField) { + this.bField = bField; + return this; + } + public @java.lang.SuppressWarnings("all") BuilderWithJavaBeansSpecCapitalization build() { + java.util.List<String> a; + switch (((this.a == null) ? 0 : this.a.size())) { + case 0 : + a = java.util.Collections.emptyList(); + break; + case 1 : + a = java.util.Collections.singletonList(this.a.get(0)); + break; + default : + a = java.util.Collections.unmodifiableList(new java.util.ArrayList<String>(this.a)); + } + java.util.List<String> aField; + switch (((this.aField == null) ? 0 : this.aField.size())) { + case 0 : + aField = java.util.Collections.emptyList(); + break; + case 1 : + aField = java.util.Collections.singletonList(this.aField.get(0)); + break; + default : + aField = java.util.Collections.unmodifiableList(new java.util.ArrayList<String>(this.aField)); + } + return new BuilderWithJavaBeansSpecCapitalization(a, aField, this.bField); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (((((("BuilderWithJavaBeansSpecCapitalization.BuilderWithJavaBeansSpecCapitalizationBuilder(a=" + this.a) + ", aField=") + this.aField) + ", bField=") + this.bField) + ")"); + } + } + @lombok.Singular("z") java.util.List<String> a; + @lombok.Singular("yField") java.util.List<String> aField; + String bField; + @java.lang.SuppressWarnings("all") BuilderWithJavaBeansSpecCapitalization(final java.util.List<String> a, final java.util.List<String> aField, final String bField) { + super(); + this.a = a; + this.aField = aField; + this.bField = bField; + } + public static @java.lang.SuppressWarnings("all") BuilderWithJavaBeansSpecCapitalization.BuilderWithJavaBeansSpecCapitalizationBuilder builder() { + return new BuilderWithJavaBeansSpecCapitalization.BuilderWithJavaBeansSpecCapitalizationBuilder(); + } +} diff --git a/test/transform/resource/after-ecj/GetterWithJavaBeansSpecCapitalization.java b/test/transform/resource/after-ecj/GetterWithJavaBeansSpecCapitalization.java index d605b4ac..745529a0 100644 --- a/test/transform/resource/after-ecj/GetterWithJavaBeansSpecCapitalization.java +++ b/test/transform/resource/after-ecj/GetterWithJavaBeansSpecCapitalization.java @@ -1,33 +1,13 @@ -class GetterWithoutJavaBeansSpecCapitalization { +class GetterWithJavaBeansSpecCapitalization { @lombok.Getter int a; @lombok.Getter int aField; - - GetterWithoutJavaBeansSpecCapitalization() { - super(); - } - - public @java.lang.SuppressWarnings("all") int getA() { - return this.a; - } - - public @java.lang.SuppressWarnings("all") int getAField() { - return this.aField; - } -} - -@lombok.experimental.Accessors(javaBeansSpecCapitalization = true) class GetterWithJavaBeansSpecCapitalization { - @lombok.Getter int a; - @lombok.Getter int aField; - GetterWithJavaBeansSpecCapitalization() { super(); } - public @java.lang.SuppressWarnings("all") int getA() { return this.a; } - public @java.lang.SuppressWarnings("all") int getaField() { return this.aField; } -} +}
\ No newline at end of file diff --git a/test/transform/resource/after-ecj/SetterWithJavaBeansSpecCapitalization.java b/test/transform/resource/after-ecj/SetterWithJavaBeansSpecCapitalization.java index 9907621f..4e99890a 100644 --- a/test/transform/resource/after-ecj/SetterWithJavaBeansSpecCapitalization.java +++ b/test/transform/resource/after-ecj/SetterWithJavaBeansSpecCapitalization.java @@ -1,33 +1,13 @@ -class SetterWithoutJavaBeansSpecCapitalization { +class SetterWithJavaBeansSpecCapitalization { @lombok.Setter int a; @lombok.Setter int aField; - - SetterWithoutJavaBeansSpecCapitalization() { - super(); - } - - public @java.lang.SuppressWarnings("all") void setA(final int a) { - this.a = a; - } - - public @java.lang.SuppressWarnings("all") void setAField(final int aField) { - this.aField = aField; - } -} - -@lombok.experimental.Accessors(javaBeansSpecCapitalization = true) class SetterWithJavaBeansSpecCapitalization { - @lombok.Setter int a; - @lombok.Setter int aField; - SetterWithJavaBeansSpecCapitalization() { super(); } - public @java.lang.SuppressWarnings("all") void setA(final int a) { this.a = a; } - public @java.lang.SuppressWarnings("all") void setaField(final int aField) { this.aField = aField; } -} +}
\ No newline at end of file diff --git a/test/transform/resource/after-ecj/ValueWithJavaBeansSpecCapitalization.java b/test/transform/resource/after-ecj/ValueWithJavaBeansSpecCapitalization.java index f41fcf58..8117dbb0 100644 --- a/test/transform/resource/after-ecj/ValueWithJavaBeansSpecCapitalization.java +++ b/test/transform/resource/after-ecj/ValueWithJavaBeansSpecCapitalization.java @@ -1,4 +1,4 @@ -final @lombok.Value @lombok.experimental.Accessors(javaBeansSpecCapitalization = true) class ValueWithJavaBeansSpecCapitalization { +final @lombok.Value class ValueWithJavaBeansSpecCapitalization { private final int aField; public @java.lang.SuppressWarnings("all") int getaField() { return this.aField; @@ -27,32 +27,3 @@ final @lombok.Value @lombok.experimental.Accessors(javaBeansSpecCapitalization = this.aField = aField; } } -final @lombok.Value class ValueWithoutJavaBeansSpecCapitalization { - private final int aField; - public @java.lang.SuppressWarnings("all") int getAField() { - return this.aField; - } - public @java.lang.Override @java.lang.SuppressWarnings("all") boolean equals(final java.lang.Object o) { - if ((o == this)) - return true; - if ((! (o instanceof ValueWithoutJavaBeansSpecCapitalization))) - return false; - final ValueWithoutJavaBeansSpecCapitalization other = (ValueWithoutJavaBeansSpecCapitalization) o; - if ((this.getAField() != other.getAField())) - return false; - return true; - } - public @java.lang.Override @java.lang.SuppressWarnings("all") int hashCode() { - final int PRIME = 59; - int result = 1; - result = ((result * PRIME) + this.getAField()); - return result; - } - public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { - return (("ValueWithoutJavaBeansSpecCapitalization(aField=" + this.getAField()) + ")"); - } - public @java.lang.SuppressWarnings("all") ValueWithoutJavaBeansSpecCapitalization(final int aField) { - super(); - this.aField = aField; - } -} diff --git a/test/transform/resource/after-ecj/WithOnJavaBeansSpecCapitalization.java b/test/transform/resource/after-ecj/WithOnJavaBeansSpecCapitalization.java deleted file mode 100644 index 06164fe9..00000000 --- a/test/transform/resource/after-ecj/WithOnJavaBeansSpecCapitalization.java +++ /dev/null @@ -1,25 +0,0 @@ -@lombok.With @lombok.experimental.Accessors(javaBeansSpecCapitalization = true) class WithOnJavaBeansSpecCapitalization { - int aField; - WithOnJavaBeansSpecCapitalization(int aField) { - 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") WithOnJavaBeansSpecCapitalization withaField(final int aField) { - return ((this.aField == aField) ? this : new WithOnJavaBeansSpecCapitalization(aField)); - } -} - -@lombok.With class WithOffJavaBeansSpecCapitalization { - int aField; - WithOffJavaBeansSpecCapitalization(int aField) { - 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") WithOffJavaBeansSpecCapitalization withAField(final int aField) { - return ((this.aField == aField) ? this : new WithOffJavaBeansSpecCapitalization(aField)); - } -} diff --git a/test/transform/resource/after-ecj/WithWithJavaBeansSpecCapitalization.java b/test/transform/resource/after-ecj/WithWithJavaBeansSpecCapitalization.java new file mode 100644 index 00000000..d530ad8a --- /dev/null +++ b/test/transform/resource/after-ecj/WithWithJavaBeansSpecCapitalization.java @@ -0,0 +1,12 @@ +@lombok.With class WithOnJavaBeansSpecCapitalization { + int aField; + WithWithJavaBeansSpecCapitalization(int aField) { + 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") WithWithJavaBeansSpecCapitalization withaField(final int aField) { + return ((this.aField == aField) ? this : new WithWithJavaBeansSpecCapitalization(aField)); + } +} |