aboutsummaryrefslogtreecommitdiff
path: root/test/transform/resource/after-delombok
diff options
context:
space:
mode:
authorBulgakov Alexander <mfourgeneralsherman@gmail.com>2019-05-03 21:50:15 +0300
committerBulgakov Alexander <mfourgeneralsherman@gmail.com>2019-05-03 21:50:15 +0300
commit715c731fc24bf2915d2eaefefd964615e62c12ed (patch)
treeabca888cf3284c6e4bb911a041e15c50d8ca92f9 /test/transform/resource/after-delombok
parentf0343886a331f3cb2175545a062f3736610f9179 (diff)
parent2335f251665d43b4c8cebe00b980f07ef33bdb17 (diff)
downloadlombok-715c731fc24bf2915d2eaefefd964615e62c12ed.tar.gz
lombok-715c731fc24bf2915d2eaefefd964615e62c12ed.tar.bz2
lombok-715c731fc24bf2915d2eaefefd964615e62c12ed.zip
Merge remote-tracking branch 'lombok/master' into feature/typeInferenceImprovements
Diffstat (limited to 'test/transform/resource/after-delombok')
-rw-r--r--test/transform/resource/after-delombok/BuilderSimple.java4
-rw-r--r--test/transform/resource/after-delombok/FieldNameConstantsUppercased.java12
-rw-r--r--test/transform/resource/after-delombok/SuperBuilderWithGenericsAndToBuilder.java53
-rw-r--r--test/transform/resource/after-delombok/ValDelegateMethodReference.java65
4 files changed, 114 insertions, 20 deletions
diff --git a/test/transform/resource/after-delombok/BuilderSimple.java b/test/transform/resource/after-delombok/BuilderSimple.java
index e3821c9a..4cd20b23 100644
--- a/test/transform/resource/after-delombok/BuilderSimple.java
+++ b/test/transform/resource/after-delombok/BuilderSimple.java
@@ -10,7 +10,7 @@ class BuilderSimple<T> {
this.also = also;
}
@java.lang.SuppressWarnings("all")
- public static class BuilderSimpleBuilder<T> {
+ protected static class BuilderSimpleBuilder<T> {
@java.lang.SuppressWarnings("all")
private int yes;
@java.lang.SuppressWarnings("all")
@@ -39,7 +39,7 @@ class BuilderSimple<T> {
}
}
@java.lang.SuppressWarnings("all")
- public static <T> BuilderSimpleBuilder<T> builder() {
+ protected static <T> BuilderSimpleBuilder<T> builder() {
return new BuilderSimpleBuilder<T>();
}
}
diff --git a/test/transform/resource/after-delombok/FieldNameConstantsUppercased.java b/test/transform/resource/after-delombok/FieldNameConstantsUppercased.java
new file mode 100644
index 00000000..dd7de86a
--- /dev/null
+++ b/test/transform/resource/after-delombok/FieldNameConstantsUppercased.java
@@ -0,0 +1,12 @@
+public class FieldNameConstantsUppercased {
+ String iAmADvdPlayer;
+ int $skipMe;
+ static double skipMeToo;
+ int andMe;
+ String butPrintMePlease;
+ @java.lang.SuppressWarnings("all")
+ static final 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";
+ }
+}
diff --git a/test/transform/resource/after-delombok/SuperBuilderWithGenericsAndToBuilder.java b/test/transform/resource/after-delombok/SuperBuilderWithGenericsAndToBuilder.java
index deb5a223..af67e900 100644
--- a/test/transform/resource/after-delombok/SuperBuilderWithGenericsAndToBuilder.java
+++ b/test/transform/resource/after-delombok/SuperBuilderWithGenericsAndToBuilder.java
@@ -1,14 +1,16 @@
-import java.util.List;
+import java.util.Map;
public class SuperBuilderWithGenericsAndToBuilder {
public static class Parent<A> {
A field1;
- List<String> items;
+ Map<Integer, String> items;
@java.lang.SuppressWarnings("all")
public static abstract class ParentBuilder<A, C extends Parent<A>, B extends ParentBuilder<A, C, B>> {
@java.lang.SuppressWarnings("all")
private A field1;
@java.lang.SuppressWarnings("all")
- private java.util.ArrayList<String> items;
+ private java.util.ArrayList<Integer> items$key;
+ @java.lang.SuppressWarnings("all")
+ private java.util.ArrayList<String> items$value;
@java.lang.SuppressWarnings("all")
protected B $fillValuesFrom(final C instance) {
ParentBuilder.$fillValuesFromInstanceIntoBuilder(instance, this);
@@ -17,7 +19,7 @@ public class SuperBuilderWithGenericsAndToBuilder {
@java.lang.SuppressWarnings("all")
private static <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);
}
@java.lang.SuppressWarnings("all")
protected abstract B self();
@@ -29,26 +31,39 @@ public class SuperBuilderWithGenericsAndToBuilder {
return self();
}
@java.lang.SuppressWarnings("all")
- public B item(final String item) {
- if (this.items == null) this.items = new java.util.ArrayList<String>();
- this.items.add(item);
+ public 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();
}
@java.lang.SuppressWarnings("all")
- public 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 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 (final 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();
}
@java.lang.SuppressWarnings("all")
public B clearItems() {
- if (this.items != null) this.items.clear();
+ if (this.items$key != null) {
+ this.items$key.clear();
+ this.items$value.clear();
+ }
return self();
}
@java.lang.Override
@java.lang.SuppressWarnings("all")
public 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 + ")";
}
}
@java.lang.SuppressWarnings("all")
@@ -70,16 +85,18 @@ public class SuperBuilderWithGenericsAndToBuilder {
@java.lang.SuppressWarnings("all")
protected Parent(final ParentBuilder<A, ?, ?> b) {
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() < 1073741824 ? 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), (String) b.items$value.get($i));
+ items = java.util.Collections.unmodifiableMap(items);
}
this.items = items;
}
@@ -157,6 +174,6 @@ public class SuperBuilderWithGenericsAndToBuilder {
}
}
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-delombok/ValDelegateMethodReference.java b/test/transform/resource/after-delombok/ValDelegateMethodReference.java
new file mode 100644
index 00000000..186e2aaa
--- /dev/null
+++ b/test/transform/resource/after-delombok/ValDelegateMethodReference.java
@@ -0,0 +1,65 @@
+import java.util.function.Function;
+
+public class ValDelegateMethodReference {
+ public void config() {
+ final 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) {
+ }
+}
+
+class Entity {
+ private MyDelegate innerDelegate;
+
+ @java.lang.SuppressWarnings("all")
+ public java.lang.String getValue() {
+ return this.innerDelegate.getValue();
+ }
+
+ @java.lang.SuppressWarnings("all")
+ public java.lang.Boolean getABoolean() {
+ return this.innerDelegate.getABoolean();
+ }
+
+ @java.lang.SuppressWarnings("all")
+ public void setValue(final java.lang.String value) {
+ this.innerDelegate.setValue(value);
+ }
+
+ @java.lang.SuppressWarnings("all")
+ public void setABoolean(final java.lang.Boolean aBoolean) {
+ this.innerDelegate.setABoolean(aBoolean);
+ }
+}
+
+class MyDelegate {
+ private String value;
+ private Boolean aBoolean;
+
+ @java.lang.SuppressWarnings("all")
+ public String getValue() {
+ return this.value;
+ }
+
+ @java.lang.SuppressWarnings("all")
+ public Boolean getABoolean() {
+ return this.aBoolean;
+ }
+
+ @java.lang.SuppressWarnings("all")
+ public void setValue(final String value) {
+ this.value = value;
+ }
+
+ @java.lang.SuppressWarnings("all")
+ public void setABoolean(final Boolean aBoolean) {
+ this.aBoolean = aBoolean;
+ }
+} \ No newline at end of file