aboutsummaryrefslogtreecommitdiff
path: root/test/transform/resource/after-delombok
diff options
context:
space:
mode:
authorJan Rieke <rieke@subshell.com>2018-09-24 16:46:00 +0200
committerJan Rieke <rieke@subshell.com>2018-09-24 16:46:00 +0200
commitb5648976b6501bdf755814d8d8a096c33f6997ec (patch)
treeaafe939cdc6fdda41719deb42f03c77934cb5209 /test/transform/resource/after-delombok
parentfd4c9d4bff6e75b30a3ee247edafaabc6888a691 (diff)
parentaee4e76d864e01b5d453409e703ad54852fa57bb (diff)
downloadlombok-b5648976b6501bdf755814d8d8a096c33f6997ec.tar.gz
lombok-b5648976b6501bdf755814d8d8a096c33f6997ec.tar.bz2
lombok-b5648976b6501bdf755814d8d8a096c33f6997ec.zip
Merge remote-tracking branch 'upstream/master' into superToBuilder
Diffstat (limited to 'test/transform/resource/after-delombok')
-rw-r--r--test/transform/resource/after-delombok/BuilderSingularAnnotatedTypes.java124
-rw-r--r--test/transform/resource/after-delombok/BuilderTypeAnnos.java45
-rw-r--r--test/transform/resource/after-delombok/ConstructorsTypeAnnos.java18
-rw-r--r--test/transform/resource/after-delombok/GetterTypeAnnos.java19
-rw-r--r--test/transform/resource/after-delombok/SetterTypeAnnos.java18
-rw-r--r--test/transform/resource/after-delombok/SuperBuilderSingularAnnotatedTypes.java137
-rw-r--r--test/transform/resource/after-delombok/SuperBuilderWithNonNull.java10
-rw-r--r--test/transform/resource/after-delombok/WitherTypeAnnos.java21
8 files changed, 390 insertions, 2 deletions
diff --git a/test/transform/resource/after-delombok/BuilderSingularAnnotatedTypes.java b/test/transform/resource/after-delombok/BuilderSingularAnnotatedTypes.java
new file mode 100644
index 00000000..93825659
--- /dev/null
+++ b/test/transform/resource/after-delombok/BuilderSingularAnnotatedTypes.java
@@ -0,0 +1,124 @@
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Target;
+import java.util.Set;
+import java.util.Map;
+import lombok.NonNull;
+@Target(ElementType.TYPE_USE)
+@interface MyAnnotation {
+}
+class BuilderSingularAnnotatedTypes {
+ private Set<@MyAnnotation @NonNull String> foos;
+ private Map<@MyAnnotation @NonNull String, @MyAnnotation @NonNull Integer> bars;
+ @java.lang.SuppressWarnings("all")
+ BuilderSingularAnnotatedTypes(final Set<@MyAnnotation @NonNull String> foos, final Map<@MyAnnotation @NonNull String, @MyAnnotation @NonNull Integer> bars) {
+ this.foos = foos;
+ this.bars = bars;
+ }
+ @java.lang.SuppressWarnings("all")
+ public static class BuilderSingularAnnotatedTypesBuilder {
+ @java.lang.SuppressWarnings("all")
+ private java.util.ArrayList<@MyAnnotation @NonNull String> foos;
+ @java.lang.SuppressWarnings("all")
+ private java.util.ArrayList<@MyAnnotation @NonNull String> bars$key;
+ @java.lang.SuppressWarnings("all")
+ private java.util.ArrayList<@MyAnnotation @NonNull Integer> bars$value;
+ @java.lang.SuppressWarnings("all")
+ BuilderSingularAnnotatedTypesBuilder() {
+ }
+ @java.lang.SuppressWarnings("all")
+ public BuilderSingularAnnotatedTypesBuilder foo(@MyAnnotation @NonNull final String foo) {
+ if (foo == null) {
+ throw new java.lang.NullPointerException("foo is marked @NonNull but is null");
+ }
+ if (this.foos == null) this.foos = new java.util.ArrayList<@MyAnnotation @NonNull String>();
+ this.foos.add(foo);
+ return this;
+ }
+ @java.lang.SuppressWarnings("all")
+ public BuilderSingularAnnotatedTypesBuilder foos(final java.util.Collection<? extends @MyAnnotation @NonNull String> foos) {
+ if (this.foos == null) this.foos = new java.util.ArrayList<@MyAnnotation @NonNull String>();
+ this.foos.addAll(foos);
+ return this;
+ }
+ @java.lang.SuppressWarnings("all")
+ public BuilderSingularAnnotatedTypesBuilder clearFoos() {
+ if (this.foos != null) this.foos.clear();
+ return this;
+ }
+ @java.lang.SuppressWarnings("all")
+ public BuilderSingularAnnotatedTypesBuilder bar(@MyAnnotation @NonNull final String barKey, @MyAnnotation @NonNull final Integer barValue) {
+ if (barKey == null) {
+ throw new java.lang.NullPointerException("barKey is marked @NonNull but is null");
+ }
+ if (barValue == null) {
+ throw new java.lang.NullPointerException("barValue is marked @NonNull but is null");
+ }
+ if (this.bars$key == null) {
+ this.bars$key = new java.util.ArrayList<@MyAnnotation @NonNull String>();
+ this.bars$value = new java.util.ArrayList<@MyAnnotation @NonNull Integer>();
+ }
+ this.bars$key.add(barKey);
+ this.bars$value.add(barValue);
+ return this;
+ }
+ @java.lang.SuppressWarnings("all")
+ public BuilderSingularAnnotatedTypesBuilder bars(final java.util.Map<? extends @MyAnnotation @NonNull String, ? extends @MyAnnotation @NonNull Integer> bars) {
+ if (this.bars$key == null) {
+ this.bars$key = new java.util.ArrayList<@MyAnnotation @NonNull String>();
+ this.bars$value = new java.util.ArrayList<@MyAnnotation @NonNull Integer>();
+ }
+ for (final java.util.Map.Entry<? extends @MyAnnotation @NonNull String, ? extends @MyAnnotation @NonNull Integer> $lombokEntry : bars.entrySet()) {
+ this.bars$key.add($lombokEntry.getKey());
+ this.bars$value.add($lombokEntry.getValue());
+ }
+ return this;
+ }
+ @java.lang.SuppressWarnings("all")
+ public BuilderSingularAnnotatedTypesBuilder clearBars() {
+ if (this.bars$key != null) {
+ this.bars$key.clear();
+ this.bars$value.clear();
+ }
+ return this;
+ }
+ @java.lang.SuppressWarnings("all")
+ public BuilderSingularAnnotatedTypes build() {
+ java.util.Set<@MyAnnotation @NonNull String> foos;
+ switch (this.foos == null ? 0 : this.foos.size()) {
+ case 0:
+ foos = java.util.Collections.emptySet();
+ break;
+ case 1:
+ foos = java.util.Collections.singleton(this.foos.get(0));
+ break;
+ default:
+ foos = new java.util.LinkedHashSet<@MyAnnotation @NonNull String>(this.foos.size() < 1073741824 ? 1 + this.foos.size() + (this.foos.size() - 3) / 3 : java.lang.Integer.MAX_VALUE);
+ foos.addAll(this.foos);
+ foos = java.util.Collections.unmodifiableSet(foos);
+ }
+ java.util.Map<@MyAnnotation @NonNull String, @MyAnnotation @NonNull Integer> bars;
+ switch (this.bars$key == null ? 0 : this.bars$key.size()) {
+ case 0:
+ bars = java.util.Collections.emptyMap();
+ break;
+ case 1:
+ bars = java.util.Collections.singletonMap(this.bars$key.get(0), this.bars$value.get(0));
+ break;
+ default:
+ bars = new java.util.LinkedHashMap<@MyAnnotation @NonNull String, @MyAnnotation @NonNull Integer>(this.bars$key.size() < 1073741824 ? 1 + this.bars$key.size() + (this.bars$key.size() - 3) / 3 : java.lang.Integer.MAX_VALUE);
+ for (int $i = 0; $i < this.bars$key.size(); $i++) bars.put(this.bars$key.get($i), (@MyAnnotation @NonNull Integer) this.bars$value.get($i));
+ bars = java.util.Collections.unmodifiableMap(bars);
+ }
+ return new BuilderSingularAnnotatedTypes(foos, bars);
+ }
+ @java.lang.Override
+ @java.lang.SuppressWarnings("all")
+ public java.lang.String toString() {
+ return "BuilderSingularAnnotatedTypes.BuilderSingularAnnotatedTypesBuilder(foos=" + this.foos + ", bars$key=" + this.bars$key + ", bars$value=" + this.bars$value + ")";
+ }
+ }
+ @java.lang.SuppressWarnings("all")
+ public static BuilderSingularAnnotatedTypesBuilder builder() {
+ return new BuilderSingularAnnotatedTypesBuilder();
+ }
+} \ No newline at end of file
diff --git a/test/transform/resource/after-delombok/BuilderTypeAnnos.java b/test/transform/resource/after-delombok/BuilderTypeAnnos.java
new file mode 100644
index 00000000..8a31762a
--- /dev/null
+++ b/test/transform/resource/after-delombok/BuilderTypeAnnos.java
@@ -0,0 +1,45 @@
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Target;
+import java.util.List;
+@Target({ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER})
+@interface TA {
+}
+@Target({ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER})
+@interface TB {
+}
+class BuilderTypeAnnos {
+ @TA
+ @TB
+ private List<String> foo;
+ @java.lang.SuppressWarnings("all")
+ BuilderTypeAnnos(@TA final List<String> foo) {
+ this.foo = foo;
+ }
+ @java.lang.SuppressWarnings("all")
+ public static class BuilderTypeAnnosBuilder {
+ @java.lang.SuppressWarnings("all")
+ private List<String> foo;
+ @java.lang.SuppressWarnings("all")
+ BuilderTypeAnnosBuilder() {
+ }
+ @java.lang.SuppressWarnings("all")
+ public BuilderTypeAnnosBuilder foo(@TA final List<String> foo) {
+ this.foo = foo;
+ return this;
+ }
+ @java.lang.SuppressWarnings("all")
+ public BuilderTypeAnnos build() {
+ return new BuilderTypeAnnos(foo);
+ }
+ @java.lang.Override
+ @java.lang.SuppressWarnings("all")
+ public java.lang.String toString() {
+ return "BuilderTypeAnnos.BuilderTypeAnnosBuilder(foo=" + this.foo + ")";
+ }
+ }
+ @java.lang.SuppressWarnings("all")
+ public static BuilderTypeAnnosBuilder builder() {
+ return new BuilderTypeAnnosBuilder();
+ }
+}
+
diff --git a/test/transform/resource/after-delombok/ConstructorsTypeAnnos.java b/test/transform/resource/after-delombok/ConstructorsTypeAnnos.java
new file mode 100644
index 00000000..2d59681c
--- /dev/null
+++ b/test/transform/resource/after-delombok/ConstructorsTypeAnnos.java
@@ -0,0 +1,18 @@
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Target;
+import java.util.List;
+@Target({ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER})
+@interface TA {
+}
+@Target({ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER})
+@interface TB {
+}
+class ConstructorsTypeAnnos {
+ @TA
+ @TB
+ List<String> foo;
+ @java.lang.SuppressWarnings("all")
+ public ConstructorsTypeAnnos(@TA final List<String> foo) {
+ this.foo = foo;
+ }
+}
diff --git a/test/transform/resource/after-delombok/GetterTypeAnnos.java b/test/transform/resource/after-delombok/GetterTypeAnnos.java
new file mode 100644
index 00000000..4a22c822
--- /dev/null
+++ b/test/transform/resource/after-delombok/GetterTypeAnnos.java
@@ -0,0 +1,19 @@
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Target;
+import java.util.List;
+@Target({ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER})
+@interface TA {
+}
+@Target({ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER})
+@interface TB {
+}
+class GetterTypeAnnos {
+ @TA
+ @TB
+ List<String> foo;
+ @TA
+ @java.lang.SuppressWarnings("all")
+ public List<String> getFoo() {
+ return this.foo;
+ }
+}
diff --git a/test/transform/resource/after-delombok/SetterTypeAnnos.java b/test/transform/resource/after-delombok/SetterTypeAnnos.java
new file mode 100644
index 00000000..77ddf9ce
--- /dev/null
+++ b/test/transform/resource/after-delombok/SetterTypeAnnos.java
@@ -0,0 +1,18 @@
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Target;
+import java.util.List;
+@Target({ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER})
+@interface TA {
+}
+@Target({ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER})
+@interface TB {
+}
+class SetterTypeAnnos {
+ @TA
+ @TB
+ List<String> foo;
+ @java.lang.SuppressWarnings("all")
+ public void setFoo(@TA final List<String> foo) {
+ this.foo = foo;
+ }
+}
diff --git a/test/transform/resource/after-delombok/SuperBuilderSingularAnnotatedTypes.java b/test/transform/resource/after-delombok/SuperBuilderSingularAnnotatedTypes.java
new file mode 100644
index 00000000..1baf81aa
--- /dev/null
+++ b/test/transform/resource/after-delombok/SuperBuilderSingularAnnotatedTypes.java
@@ -0,0 +1,137 @@
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Target;
+import java.util.Set;
+import java.util.Map;
+import lombok.NonNull;
+@Target(ElementType.TYPE_USE)
+@interface MyAnnotation {
+}
+class SuperBuilderSingularAnnotatedTypes {
+ private Set<@MyAnnotation @NonNull String> foos;
+ private Map<@MyAnnotation @NonNull String, @MyAnnotation @NonNull Integer> bars;
+ @java.lang.SuppressWarnings("all")
+ public static abstract class SuperBuilderSingularAnnotatedTypesBuilder<C extends SuperBuilderSingularAnnotatedTypes, B extends SuperBuilderSingularAnnotatedTypesBuilder<C, B>> {
+ @java.lang.SuppressWarnings("all")
+ private java.util.ArrayList<@MyAnnotation @NonNull String> foos;
+ @java.lang.SuppressWarnings("all")
+ private java.util.ArrayList<@MyAnnotation @NonNull String> bars$key;
+ @java.lang.SuppressWarnings("all")
+ private java.util.ArrayList<@MyAnnotation @NonNull Integer> bars$value;
+ @java.lang.SuppressWarnings("all")
+ protected abstract B self();
+ @java.lang.SuppressWarnings("all")
+ public abstract C build();
+ @java.lang.SuppressWarnings("all")
+ public B foo(@MyAnnotation @NonNull final String foo) {
+ if (foo == null) {
+ throw new java.lang.NullPointerException("foo is marked @NonNull but is null");
+ }
+ if (this.foos == null) this.foos = new java.util.ArrayList<@MyAnnotation @NonNull String>();
+ this.foos.add(foo);
+ return self();
+ }
+ @java.lang.SuppressWarnings("all")
+ public B foos(final java.util.Collection<? extends @MyAnnotation @NonNull String> foos) {
+ if (this.foos == null) this.foos = new java.util.ArrayList<@MyAnnotation @NonNull String>();
+ this.foos.addAll(foos);
+ return self();
+ }
+ @java.lang.SuppressWarnings("all")
+ public B clearFoos() {
+ if (this.foos != null) this.foos.clear();
+ return self();
+ }
+ @java.lang.SuppressWarnings("all")
+ public B bar(@MyAnnotation @NonNull final String barKey, @MyAnnotation @NonNull final Integer barValue) {
+ if (barKey == null) {
+ throw new java.lang.NullPointerException("barKey is marked @NonNull but is null");
+ }
+ if (barValue == null) {
+ throw new java.lang.NullPointerException("barValue is marked @NonNull but is null");
+ }
+ if (this.bars$key == null) {
+ this.bars$key = new java.util.ArrayList<@MyAnnotation @NonNull String>();
+ this.bars$value = new java.util.ArrayList<@MyAnnotation @NonNull Integer>();
+ }
+ this.bars$key.add(barKey);
+ this.bars$value.add(barValue);
+ return self();
+ }
+ @java.lang.SuppressWarnings("all")
+ public B bars(final java.util.Map<? extends @MyAnnotation @NonNull String, ? extends @MyAnnotation @NonNull Integer> bars) {
+ if (this.bars$key == null) {
+ this.bars$key = new java.util.ArrayList<@MyAnnotation @NonNull String>();
+ this.bars$value = new java.util.ArrayList<@MyAnnotation @NonNull Integer>();
+ }
+ for (final java.util.Map.Entry<? extends @MyAnnotation @NonNull String, ? extends @MyAnnotation @NonNull Integer> $lombokEntry : bars.entrySet()) {
+ this.bars$key.add($lombokEntry.getKey());
+ this.bars$value.add($lombokEntry.getValue());
+ }
+ return self();
+ }
+ @java.lang.SuppressWarnings("all")
+ public B clearBars() {
+ if (this.bars$key != null) {
+ this.bars$key.clear();
+ this.bars$value.clear();
+ }
+ return self();
+ }
+ @java.lang.Override
+ @java.lang.SuppressWarnings("all")
+ public java.lang.String toString() {
+ return "SuperBuilderSingularAnnotatedTypes.SuperBuilderSingularAnnotatedTypesBuilder(foos=" + this.foos + ", bars$key=" + this.bars$key + ", bars$value=" + this.bars$value + ")";
+ }
+ }
+ @java.lang.SuppressWarnings("all")
+ private static final class SuperBuilderSingularAnnotatedTypesBuilderImpl extends SuperBuilderSingularAnnotatedTypesBuilder<SuperBuilderSingularAnnotatedTypes, SuperBuilderSingularAnnotatedTypesBuilderImpl> {
+ @java.lang.SuppressWarnings("all")
+ private SuperBuilderSingularAnnotatedTypesBuilderImpl() {
+ }
+ @java.lang.Override
+ @java.lang.SuppressWarnings("all")
+ protected SuperBuilderSingularAnnotatedTypesBuilderImpl self() {
+ return this;
+ }
+ @java.lang.Override
+ @java.lang.SuppressWarnings("all")
+ public SuperBuilderSingularAnnotatedTypes build() {
+ return new SuperBuilderSingularAnnotatedTypes(this);
+ }
+ }
+ @java.lang.SuppressWarnings("all")
+ protected SuperBuilderSingularAnnotatedTypes(final SuperBuilderSingularAnnotatedTypesBuilder<?, ?> b) {
+ java.util.Set<@MyAnnotation @NonNull String> foos;
+ switch (b.foos == null ? 0 : b.foos.size()) {
+ case 0:
+ foos = java.util.Collections.emptySet();
+ break;
+ case 1:
+ foos = java.util.Collections.singleton(b.foos.get(0));
+ break;
+ default:
+ foos = new java.util.LinkedHashSet<@MyAnnotation @NonNull String>(b.foos.size() < 1073741824 ? 1 + b.foos.size() + (b.foos.size() - 3) / 3 : java.lang.Integer.MAX_VALUE);
+ foos.addAll(b.foos);
+ foos = java.util.Collections.unmodifiableSet(foos);
+ }
+ this.foos = foos;
+ java.util.Map<@MyAnnotation @NonNull String, @MyAnnotation @NonNull Integer> bars;
+ switch (b.bars$key == null ? 0 : b.bars$key.size()) {
+ case 0:
+ bars = java.util.Collections.emptyMap();
+ break;
+ case 1:
+ bars = java.util.Collections.singletonMap(b.bars$key.get(0), b.bars$value.get(0));
+ break;
+ default:
+ bars = new java.util.LinkedHashMap<@MyAnnotation @NonNull String, @MyAnnotation @NonNull Integer>(b.bars$key.size() < 1073741824 ? 1 + b.bars$key.size() + (b.bars$key.size() - 3) / 3 : java.lang.Integer.MAX_VALUE);
+ for (int $i = 0; $i < b.bars$key.size(); $i++) bars.put(b.bars$key.get($i), (@MyAnnotation @NonNull Integer) b.bars$value.get($i));
+ bars = java.util.Collections.unmodifiableMap(bars);
+ }
+ this.bars = bars;
+ }
+ @java.lang.SuppressWarnings("all")
+ public static SuperBuilderSingularAnnotatedTypesBuilder<?, ?> builder() {
+ return new SuperBuilderSingularAnnotatedTypesBuilderImpl();
+ }
+} \ No newline at end of file
diff --git a/test/transform/resource/after-delombok/SuperBuilderWithNonNull.java b/test/transform/resource/after-delombok/SuperBuilderWithNonNull.java
index 5eba938f..cac5482b 100644
--- a/test/transform/resource/after-delombok/SuperBuilderWithNonNull.java
+++ b/test/transform/resource/after-delombok/SuperBuilderWithNonNull.java
@@ -18,7 +18,10 @@ public class SuperBuilderWithNonNull {
@java.lang.SuppressWarnings("all")
public abstract C build();
@java.lang.SuppressWarnings("all")
- public B nonNullParentField(final String nonNullParentField) {
+ public B nonNullParentField(@lombok.NonNull final String nonNullParentField) {
+ if (nonNullParentField == null) {
+ throw new java.lang.NullPointerException("nonNullParentField is marked @NonNull but is null");
+ }
this.nonNullParentField = nonNullParentField;
nonNullParentField$set = true;
return self();
@@ -72,7 +75,10 @@ public class SuperBuilderWithNonNull {
@java.lang.SuppressWarnings("all")
public abstract C build();
@java.lang.SuppressWarnings("all")
- public B nonNullChildField(final String nonNullChildField) {
+ public B nonNullChildField(@lombok.NonNull final String nonNullChildField) {
+ if (nonNullChildField == null) {
+ throw new java.lang.NullPointerException("nonNullChildField is marked @NonNull but is null");
+ }
this.nonNullChildField = nonNullChildField;
return self();
}
diff --git a/test/transform/resource/after-delombok/WitherTypeAnnos.java b/test/transform/resource/after-delombok/WitherTypeAnnos.java
new file mode 100644
index 00000000..b57438af
--- /dev/null
+++ b/test/transform/resource/after-delombok/WitherTypeAnnos.java
@@ -0,0 +1,21 @@
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Target;
+import java.util.List;
+@Target({ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER})
+@interface TA {
+}
+@Target({ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER})
+@interface TB {
+}
+class WitherTypeAnnos {
+ @TA
+ @TB
+ final List<String> foo;
+ WitherTypeAnnos(@TA @TB List<String> foo) {
+ this.foo = foo;
+ }
+ @java.lang.SuppressWarnings("all")
+ public WitherTypeAnnos withFoo(@TA final List<String> foo) {
+ return this.foo == foo ? this : new WitherTypeAnnos(foo);
+ }
+}