diff options
author | Reinier Zwitserloot <reinier@zwitserloot.com> | 2018-08-28 00:37:38 +0200 |
---|---|---|
committer | Reinier Zwitserloot <reinier@zwitserloot.com> | 2018-08-28 00:37:54 +0200 |
commit | ef90e2ec2dcea35a22959f2c1295517edf090133 (patch) | |
tree | 32e8c25055b86ce36d80e5abee150ef862d13e99 /test/transform/resource/after-ecj | |
parent | 572222c54bc379ac322d906c39499e8dd02a4d59 (diff) | |
download | lombok-ef90e2ec2dcea35a22959f2c1295517edf090133.tar.gz lombok-ef90e2ec2dcea35a22959f2c1295517edf090133.tar.bz2 lombok-ef90e2ec2dcea35a22959f2c1295517edf090133.zip |
[fixes #1836] superbuilder didn’t play ball with field prefixes, at least in javac.
Diffstat (limited to 'test/transform/resource/after-ecj')
3 files changed, 77 insertions, 3 deletions
diff --git a/test/transform/resource/after-ecj/SuperBuilderWithCustomBuilderMethod.java b/test/transform/resource/after-ecj/SuperBuilderWithCustomBuilderMethod.java index fe4938bf..ed0655c7 100644 --- a/test/transform/resource/after-ecj/SuperBuilderWithCustomBuilderMethod.java +++ b/test/transform/resource/after-ecj/SuperBuilderWithCustomBuilderMethod.java @@ -38,7 +38,7 @@ public class SuperBuilderWithCustomBuilderMethod { private ParentBuilderImpl() {
super();
}
- protected @java.lang.Override @java.lang.SuppressWarnings("all") ParentBuilderImpl self() {
+ protected @java.lang.Override @java.lang.SuppressWarnings("all") ParentBuilderImpl<A> self() {
return this;
}
public @java.lang.Override @java.lang.SuppressWarnings("all") Parent<A> build() {
@@ -87,7 +87,7 @@ public class SuperBuilderWithCustomBuilderMethod { private ChildBuilderImpl() {
super();
}
- protected @java.lang.Override @java.lang.SuppressWarnings("all") ChildBuilderImpl self() {
+ protected @java.lang.Override @java.lang.SuppressWarnings("all") ChildBuilderImpl<A> self() {
return this;
}
public @java.lang.Override @java.lang.SuppressWarnings("all") Child<A> build() {
diff --git a/test/transform/resource/after-ecj/SuperBuilderWithDefaults.java b/test/transform/resource/after-ecj/SuperBuilderWithDefaults.java index ef0713c5..e259b68d 100644 --- a/test/transform/resource/after-ecj/SuperBuilderWithDefaults.java +++ b/test/transform/resource/after-ecj/SuperBuilderWithDefaults.java @@ -29,7 +29,7 @@ public class SuperBuilderWithDefaults { private ParentBuilderImpl() {
super();
}
- protected @java.lang.Override @java.lang.SuppressWarnings("all") ParentBuilderImpl self() {
+ protected @java.lang.Override @java.lang.SuppressWarnings("all") ParentBuilderImpl<N> self() {
return this;
}
public @java.lang.Override @java.lang.SuppressWarnings("all") Parent<N> build() {
diff --git a/test/transform/resource/after-ecj/SuperBuilderWithPrefixes.java b/test/transform/resource/after-ecj/SuperBuilderWithPrefixes.java new file mode 100644 index 00000000..33400b3c --- /dev/null +++ b/test/transform/resource/after-ecj/SuperBuilderWithPrefixes.java @@ -0,0 +1,74 @@ +@lombok.experimental.SuperBuilder class SuperBuilderWithPrefixes { + public static abstract @java.lang.SuppressWarnings("all") class SuperBuilderWithPrefixesBuilder<C extends SuperBuilderWithPrefixes, B extends SuperBuilderWithPrefixesBuilder<C, B>> { + private @java.lang.SuppressWarnings("all") int field; + private @java.lang.SuppressWarnings("all") int otherField; + private @java.lang.SuppressWarnings("all") java.util.ArrayList<String> items; + public SuperBuilderWithPrefixesBuilder() { + super(); + } + protected abstract @java.lang.SuppressWarnings("all") B self(); + public abstract @java.lang.SuppressWarnings("all") C build(); + public @java.lang.SuppressWarnings("all") B field(final int field) { + this.field = field; + return self(); + } + public @java.lang.SuppressWarnings("all") B otherField(final int otherField) { + this.otherField = otherField; + return self(); + } + public @java.lang.SuppressWarnings("all") B item(String item) { + if ((this.items == null)) + this.items = new java.util.ArrayList<String>(); + this.items.add(item); + return self(); + } + public @java.lang.SuppressWarnings("all") B items(java.util.Collection<? extends String> items) { + if ((this.items == null)) + this.items = new java.util.ArrayList<String>(); + this.items.addAll(items); + return self(); + } + public @java.lang.SuppressWarnings("all") B clearItems() { + if ((this.items != null)) + this.items.clear(); + return self(); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (((((("SuperBuilderWithPrefixes.SuperBuilderWithPrefixesBuilder(field=" + this.field) + ", otherField=") + this.otherField) + ", items=") + this.items) + ")"); + } + } + private static final @java.lang.SuppressWarnings("all") class SuperBuilderWithPrefixesBuilderImpl extends SuperBuilderWithPrefixesBuilder<SuperBuilderWithPrefixes, SuperBuilderWithPrefixesBuilderImpl> { + private SuperBuilderWithPrefixesBuilderImpl() { + super(); + } + protected @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderWithPrefixesBuilderImpl self() { + return this; + } + public @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderWithPrefixes build() { + return new SuperBuilderWithPrefixes(this); + } + } + int mField; + int xOtherField; + @lombok.Singular java.util.List<String> mItems; + protected @java.lang.SuppressWarnings("all") SuperBuilderWithPrefixes(final SuperBuilderWithPrefixesBuilder<?, ?> b) { + super(); + this.mField = b.field; + this.xOtherField = b.otherField; + java.util.List<String> items; + switch (((b.items == null) ? 0 : b.items.size())) { + case 0 : + items = java.util.Collections.emptyList(); + break; + case 1 : + items = java.util.Collections.singletonList(b.items.get(0)); + break; + default : + items = java.util.Collections.unmodifiableList(new java.util.ArrayList<String>(b.items)); + } + this.mItems = items; + } + public static @java.lang.SuppressWarnings("all") SuperBuilderWithPrefixesBuilder<?, ?> builder() { + return new SuperBuilderWithPrefixesBuilderImpl(); + } +} |