aboutsummaryrefslogtreecommitdiff
path: root/test/transform/resource/before
diff options
context:
space:
mode:
Diffstat (limited to 'test/transform/resource/before')
-rw-r--r--test/transform/resource/before/BuilderWithToBuilder.java15
-rw-r--r--test/transform/resource/before/EqualsAndHashCodeExplicitInclude.java4
-rw-r--r--test/transform/resource/before/NoArgsConstructorForce.java1
-rw-r--r--test/transform/resource/before/SuperBuilderAbstractToBuilder.java20
-rw-r--r--test/transform/resource/before/SuperBuilderBasicToBuilder.java32
-rw-r--r--test/transform/resource/before/SuperBuilderCustomized.java33
-rw-r--r--test/transform/resource/before/SuperBuilderWithGenericsAndToBuilder.java18
-rw-r--r--test/transform/resource/before/ToStringExplicitInclude.java4
8 files changed, 114 insertions, 13 deletions
diff --git a/test/transform/resource/before/BuilderWithToBuilder.java b/test/transform/resource/before/BuilderWithToBuilder.java
index 63e16ae8..50938ab2 100644
--- a/test/transform/resource/before/BuilderWithToBuilder.java
+++ b/test/transform/resource/before/BuilderWithToBuilder.java
@@ -13,19 +13,8 @@ class BuilderWithToBuilder<T> {
class ConstructorWithToBuilder<T> {
private String mOne, mTwo;
private T foo;
- @lombok.Singular private List<T> bars;
- @Builder(toBuilder = true)
- public ConstructorWithToBuilder(String mOne, @Builder.ObtainVia(field = "foo") T bar) {
- }
-}
-@lombok.experimental.Accessors(prefix = "m")
-class StaticWithToBuilder<T, K> {
- private String mOne, mTwo;
- private T foo;
- private K bar;
- @lombok.Singular private List<T> bars;
+ @lombok.Singular private com.google.common.collect.ImmutableList<T> bars;
@Builder(toBuilder = true)
- public static <Z> StaticWithToBuilder<Z, String> test(String mOne, @Builder.ObtainVia(field = "foo") Z bar) {
- return new StaticWithToBuilder<Z, String>();
+ public ConstructorWithToBuilder(String mOne, @Builder.ObtainVia(field = "foo") T baz, com.google.common.collect.ImmutableList<T> bars) {
}
}
diff --git a/test/transform/resource/before/EqualsAndHashCodeExplicitInclude.java b/test/transform/resource/before/EqualsAndHashCodeExplicitInclude.java
new file mode 100644
index 00000000..06b77f14
--- /dev/null
+++ b/test/transform/resource/before/EqualsAndHashCodeExplicitInclude.java
@@ -0,0 +1,4 @@
+@lombok.EqualsAndHashCode(onlyExplicitlyIncluded = true)
+class EqualsAndHashCodeExplicitInclude {
+ int x;
+}
diff --git a/test/transform/resource/before/NoArgsConstructorForce.java b/test/transform/resource/before/NoArgsConstructorForce.java
index 48df1a37..6193eb0a 100644
--- a/test/transform/resource/before/NoArgsConstructorForce.java
+++ b/test/transform/resource/before/NoArgsConstructorForce.java
@@ -5,4 +5,5 @@ public class NoArgsConstructorForce {
private final int[] i;
private final Object[] o;
private final java.util.List<?>[] fullQualifiedList;
+ private final String alreadyInitialized = "yes";
} \ No newline at end of file
diff --git a/test/transform/resource/before/SuperBuilderAbstractToBuilder.java b/test/transform/resource/before/SuperBuilderAbstractToBuilder.java
new file mode 100644
index 00000000..3359829c
--- /dev/null
+++ b/test/transform/resource/before/SuperBuilderAbstractToBuilder.java
@@ -0,0 +1,20 @@
+public class SuperBuilderAbstractToBuilder {
+ @lombok.experimental.SuperBuilder(toBuilder = true)
+ public static class Parent {
+ int parentField;
+ }
+
+ @lombok.experimental.SuperBuilder(toBuilder = true)
+ public abstract static class Child extends Parent {
+ double childField;
+ }
+
+ @lombok.experimental.SuperBuilder(toBuilder = true)
+ public static class GrandChild extends Child {
+ String grandChildField;
+ }
+
+ public static void test() {
+ GrandChild x = GrandChild.builder().grandChildField("").parentField(5).childField(2.5).build().toBuilder().build();
+ }
+}
diff --git a/test/transform/resource/before/SuperBuilderBasicToBuilder.java b/test/transform/resource/before/SuperBuilderBasicToBuilder.java
new file mode 100644
index 00000000..93161443
--- /dev/null
+++ b/test/transform/resource/before/SuperBuilderBasicToBuilder.java
@@ -0,0 +1,32 @@
+import java.util.List;
+
+public class SuperBuilderBasicToBuilder {
+ @lombok.experimental.SuperBuilder(toBuilder=true)
+ public static class Parent {
+ private int field1;
+ @lombok.Builder.ObtainVia(field="field1")
+ int obtainViaField;
+ @lombok.Builder.ObtainVia(method="method")
+ int obtainViaMethod;
+ @lombok.Builder.ObtainVia(method = "staticMethod", isStatic = true)
+ String obtainViaStaticMethod;
+ @lombok.Singular List<String> items;
+
+ private int method() {
+ return 2;
+ }
+
+ private static String staticMethod(Parent instance) {
+ return "staticMethod";
+ }
+ }
+
+ @lombok.experimental.SuperBuilder(toBuilder=true)
+ public static class Child extends Parent {
+ private double field3;
+ }
+
+ public static void test() {
+ Child x = Child.builder().field3(0.0).field1(5).item("").build().toBuilder().build();
+ }
+}
diff --git a/test/transform/resource/before/SuperBuilderCustomized.java b/test/transform/resource/before/SuperBuilderCustomized.java
new file mode 100644
index 00000000..58f2797c
--- /dev/null
+++ b/test/transform/resource/before/SuperBuilderCustomized.java
@@ -0,0 +1,33 @@
+import java.util.List;
+
+public class SuperBuilderCustomized {
+ @lombok.experimental.SuperBuilder
+ public static class Parent {
+ public static abstract class ParentBuilder<C extends Parent, B extends ParentBuilder<C, B>> {
+ public B resetToDefault() {
+ field1 = 0;
+ return self();
+ }
+ }
+ int field1;
+ }
+
+ @lombok.experimental.SuperBuilder
+ public static class Child extends Parent {
+ private static final class ChildBuilderImpl extends ChildBuilder<Child, ChildBuilderImpl> {
+ @Override
+ public Child build() {
+ this.resetToDefault();
+ return new Child(this);
+ }
+ }
+ double field2;
+ public static ChildBuilder<?, ?> builder() {
+ return new ChildBuilderImpl().field2(10.0);
+ }
+ }
+
+ public static void test() {
+ Child x = Child.builder().field2(1.0).field1(5).resetToDefault().build();
+ }
+}
diff --git a/test/transform/resource/before/SuperBuilderWithGenericsAndToBuilder.java b/test/transform/resource/before/SuperBuilderWithGenericsAndToBuilder.java
new file mode 100644
index 00000000..dae68034
--- /dev/null
+++ b/test/transform/resource/before/SuperBuilderWithGenericsAndToBuilder.java
@@ -0,0 +1,18 @@
+import java.util.List;
+
+public class SuperBuilderWithGenericsAndToBuilder {
+ @lombok.experimental.SuperBuilder(toBuilder = true)
+ public static class Parent<A> {
+ A field1;
+ @lombok.Singular List<String> items;
+ }
+
+ @lombok.experimental.SuperBuilder(toBuilder = true)
+ public static class Child<A> extends Parent<A> {
+ double field3;
+ }
+
+ public static void test() {
+ Child<Integer> x = Child.<Integer>builder().field3(0.0).field1(5).item("").build().toBuilder().build();
+ }
+}
diff --git a/test/transform/resource/before/ToStringExplicitInclude.java b/test/transform/resource/before/ToStringExplicitInclude.java
new file mode 100644
index 00000000..31687bc6
--- /dev/null
+++ b/test/transform/resource/before/ToStringExplicitInclude.java
@@ -0,0 +1,4 @@
+@lombok.ToString(onlyExplicitlyIncluded = true)
+class ToStringExplicitInclude {
+ int x;
+}