diff options
author | Bulgakov Alexander <buls@yandex.ru> | 2019-05-04 23:41:14 +0300 |
---|---|---|
committer | Bulgakov Alexander <buls@yandex.ru> | 2019-05-04 23:41:14 +0300 |
commit | 8276dee2551d3f8d29f414a0a762565eec381258 (patch) | |
tree | 58e279150b6577b26e3a7a9c24aed4e1b347fda1 /test/transform/resource/after-ecj | |
parent | afe9e374975c85a87fdf6c0d45171ac44f616a37 (diff) | |
parent | 2611e6bf9830e4971dcae3abedfede59f3cc86a5 (diff) | |
download | lombok-8276dee2551d3f8d29f414a0a762565eec381258.tar.gz lombok-8276dee2551d3f8d29f414a0a762565eec381258.tar.bz2 lombok-8276dee2551d3f8d29f414a0a762565eec381258.zip |
Merge branch 'feature/typeInferenceImprovements' of https://github.com/bulgakovalexander/lombok into feature/typeInferenceImprovements
Diffstat (limited to 'test/transform/resource/after-ecj')
4 files changed, 123 insertions, 24 deletions
diff --git a/test/transform/resource/after-ecj/BuilderSimple.java b/test/transform/resource/after-ecj/BuilderSimple.java index bc0ff186..9d9fb7f3 100644 --- a/test/transform/resource/after-ecj/BuilderSimple.java +++ b/test/transform/resource/after-ecj/BuilderSimple.java @@ -1,6 +1,6 @@ import java.util.List; -@lombok.Builder class BuilderSimple<T> { - public static @java.lang.SuppressWarnings("all") class BuilderSimpleBuilder<T> { +@lombok.Builder(access = lombok.AccessLevel.PROTECTED) class BuilderSimple<T> { + protected static @java.lang.SuppressWarnings("all") class BuilderSimpleBuilder<T> { private @java.lang.SuppressWarnings("all") int yes; private @java.lang.SuppressWarnings("all") List<T> also; @java.lang.SuppressWarnings("all") BuilderSimpleBuilder() { @@ -30,7 +30,7 @@ import java.util.List; this.yes = yes; this.also = also; } - public static @java.lang.SuppressWarnings("all") <T>BuilderSimpleBuilder<T> builder() { + protected static @java.lang.SuppressWarnings("all") <T>BuilderSimpleBuilder<T> builder() { return new BuilderSimpleBuilder<T>(); } } diff --git a/test/transform/resource/after-ecj/FieldNameConstantsUppercased.java b/test/transform/resource/after-ecj/FieldNameConstantsUppercased.java new file mode 100644 index 00000000..a858b91f --- /dev/null +++ b/test/transform/resource/after-ecj/FieldNameConstantsUppercased.java @@ -0,0 +1,23 @@ +import lombok.experimental.FieldNameConstants; +import lombok.AccessLevel; +public @FieldNameConstants(level = AccessLevel.PACKAGE) class FieldNameConstantsUppercased { + static final @java.lang.SuppressWarnings("all") class Fields { + public static final java.lang.String I_AM_A_DVD_PLAYER = "iAmADvdPlayer"; + public static final java.lang.String BUT_PRINT_ME_PLEASE = "butPrintMePlease"; + <clinit>() { + } + private @java.lang.SuppressWarnings("all") Fields() { + super(); + } + } + String iAmADvdPlayer; + int $skipMe; + static double skipMeToo; + @FieldNameConstants.Exclude int andMe; + String butPrintMePlease; + <clinit>() { + } + public FieldNameConstantsUppercased() { + super(); + } +}
\ No newline at end of file diff --git a/test/transform/resource/after-ecj/SuperBuilderWithGenericsAndToBuilder.java b/test/transform/resource/after-ecj/SuperBuilderWithGenericsAndToBuilder.java index 107ee362..ce960d61 100644 --- a/test/transform/resource/after-ecj/SuperBuilderWithGenericsAndToBuilder.java +++ b/test/transform/resource/after-ecj/SuperBuilderWithGenericsAndToBuilder.java @@ -1,9 +1,10 @@ -import java.util.List;
+import java.util.Map;
public class SuperBuilderWithGenericsAndToBuilder {
public static @lombok.experimental.SuperBuilder(toBuilder = true) class Parent<A> {
public static abstract @java.lang.SuppressWarnings("all") class ParentBuilder<A, C extends Parent<A>, B extends ParentBuilder<A, C, B>> {
private @java.lang.SuppressWarnings("all") A field1;
- private @java.lang.SuppressWarnings("all") java.util.ArrayList<String> items;
+ private @java.lang.SuppressWarnings("all") java.util.ArrayList<Integer> items$key;
+ private @java.lang.SuppressWarnings("all") java.util.ArrayList<String> items$value;
public ParentBuilder() {
super();
}
@@ -13,7 +14,7 @@ public class SuperBuilderWithGenericsAndToBuilder { }
private static @java.lang.SuppressWarnings("all") <A>void $fillValuesFromInstanceIntoBuilder(final Parent<A> instance, final ParentBuilder<A, ?, ?> b) {
b.field1(instance.field1);
- b.items(((instance.items == null) ? java.util.Collections.emptyList() : instance.items));
+ b.items(((instance.items == null) ? java.util.Collections.emptyMap() : instance.items));
}
protected abstract @java.lang.SuppressWarnings("all") B self();
public abstract @java.lang.SuppressWarnings("all") C build();
@@ -21,25 +22,39 @@ public class SuperBuilderWithGenericsAndToBuilder { this.field1 = field1;
return self();
}
- public @java.lang.SuppressWarnings("all") B item(final String item) {
- if ((this.items == null))
- this.items = new java.util.ArrayList<String>();
- this.items.add(item);
+ public @java.lang.SuppressWarnings("all") B item(final Integer itemKey, final String itemValue) {
+ if ((this.items$key == null))
+ {
+ this.items$key = new java.util.ArrayList<Integer>();
+ this.items$value = new java.util.ArrayList<String>();
+ }
+ this.items$key.add(itemKey);
+ this.items$value.add(itemValue);
return self();
}
- public @java.lang.SuppressWarnings("all") B items(final java.util.Collection<? extends String> items) {
- if ((this.items == null))
- this.items = new java.util.ArrayList<String>();
- this.items.addAll(items);
+ public @java.lang.SuppressWarnings("all") B items(final java.util.Map<? extends Integer, ? extends String> items) {
+ if ((this.items$key == null))
+ {
+ this.items$key = new java.util.ArrayList<Integer>();
+ this.items$value = new java.util.ArrayList<String>();
+ }
+ for (java.util.Map.Entry<? extends Integer, ? extends String> $lombokEntry : items.entrySet())
+ {
+ this.items$key.add($lombokEntry.getKey());
+ this.items$value.add($lombokEntry.getValue());
+ }
return self();
}
public @java.lang.SuppressWarnings("all") B clearItems() {
- if ((this.items != null))
- this.items.clear();
+ if ((this.items$key != null))
+ {
+ this.items$key.clear();
+ this.items$value.clear();
+ }
return self();
}
public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() {
- return (((("SuperBuilderWithGenericsAndToBuilder.Parent.ParentBuilder(field1=" + this.field1) + ", items=") + this.items) + ")");
+ return (((((("SuperBuilderWithGenericsAndToBuilder.Parent.ParentBuilder(field1=" + this.field1) + ", items$key=") + this.items$key) + ", items$value=") + this.items$value) + ")");
}
}
private static final @java.lang.SuppressWarnings("all") class ParentBuilderImpl<A> extends ParentBuilder<A, Parent<A>, ParentBuilderImpl<A>> {
@@ -54,20 +69,23 @@ public class SuperBuilderWithGenericsAndToBuilder { }
}
A field1;
- @lombok.Singular List<String> items;
+ @lombok.Singular Map<Integer, String> items;
protected @java.lang.SuppressWarnings("all") Parent(final ParentBuilder<A, ?, ?> b) {
super();
this.field1 = b.field1;
- java.util.List<String> items;
- switch (((b.items == null) ? 0 : b.items.size())) {
+ java.util.Map<Integer, String> items;
+ switch (((b.items$key == null) ? 0 : b.items$key.size())) {
case 0 :
- items = java.util.Collections.emptyList();
+ items = java.util.Collections.emptyMap();
break;
case 1 :
- items = java.util.Collections.singletonList(b.items.get(0));
+ items = java.util.Collections.singletonMap(b.items$key.get(0), b.items$value.get(0));
break;
default :
- items = java.util.Collections.unmodifiableList(new java.util.ArrayList<String>(b.items));
+ items = new java.util.LinkedHashMap<Integer, String>(((b.items$key.size() < 0x40000000) ? ((1 + b.items$key.size()) + ((b.items$key.size() - 3) / 3)) : java.lang.Integer.MAX_VALUE));
+ for (int $i = 0;; ($i < b.items$key.size()); $i ++)
+ items.put(b.items$key.get($i), b.items$value.get($i));
+ items = java.util.Collections.unmodifiableMap(items);
}
this.items = items;
}
@@ -129,6 +147,6 @@ public class SuperBuilderWithGenericsAndToBuilder { super();
}
public static void test() {
- Child<Integer> x = Child.<Integer>builder().field3(0.0).field1(5).item("").build().toBuilder().build();
+ Child<Integer> x = Child.<Integer>builder().field3(0.0).field1(5).item(5, "").build().toBuilder().build();
}
}
diff --git a/test/transform/resource/after-ecj/ValDelegateMethodReference.java b/test/transform/resource/after-ecj/ValDelegateMethodReference.java new file mode 100644 index 00000000..cfd0dab2 --- /dev/null +++ b/test/transform/resource/after-ecj/ValDelegateMethodReference.java @@ -0,0 +1,58 @@ +import lombok.Getter; +import lombok.Setter; +import lombok.experimental.Delegate; +import lombok.val; +import java.util.function.Function; +public class ValDelegateMethodReference { + public ValDelegateMethodReference() { + super(); + } + public void config() { + final @val Column<Entity, java.lang.String> column = createColumn(Entity::getValue); + } + private <V>Column<Entity, V> createColumn(Function<Entity, V> func) { + return new Column<>(func); + } +} +class Column<T, V> { + public Column(Function<T, V> vp) { + super(); + } +} +class Entity { + private @Delegate MyDelegate innerDelegate; + Entity() { + super(); + } + public @java.lang.SuppressWarnings("all") java.lang.Boolean getABoolean() { + return this.innerDelegate.getABoolean(); + } + public @java.lang.SuppressWarnings("all") java.lang.String getValue() { + return this.innerDelegate.getValue(); + } + public @java.lang.SuppressWarnings("all") void setABoolean(final java.lang.Boolean aBoolean) { + this.innerDelegate.setABoolean(aBoolean); + } + public @java.lang.SuppressWarnings("all") void setValue(final java.lang.String value) { + this.innerDelegate.setValue(value); + } +} +@Getter @Setter class MyDelegate { + private String value; + private Boolean aBoolean; + MyDelegate() { + super(); + } + public @java.lang.SuppressWarnings("all") String getValue() { + return this.value; + } + public @java.lang.SuppressWarnings("all") Boolean getABoolean() { + return this.aBoolean; + } + public @java.lang.SuppressWarnings("all") void setValue(final String value) { + this.value = value; + } + public @java.lang.SuppressWarnings("all") void setABoolean(final Boolean aBoolean) { + this.aBoolean = aBoolean; + } +} |