aboutsummaryrefslogtreecommitdiff
path: root/test/transform
diff options
context:
space:
mode:
authorReinier Zwitserloot <r.zwitserloot@projectlombok.org>2019-08-13 15:04:43 +0200
committerReinier Zwitserloot <r.zwitserloot@projectlombok.org>2019-08-22 22:42:48 +0200
commit15df143df6d35dd64459d717a451a039eb26d761 (patch)
tree70fc0be372fd02491f9c5e9d7d68ffe7901da6d8 /test/transform
parentff1c01d9e9e66d898c30939b497490b04fe6163c (diff)
downloadlombok-15df143df6d35dd64459d717a451a039eb26d761.tar.gz
lombok-15df143df6d35dd64459d717a451a039eb26d761.tar.bz2
lombok-15df143df6d35dd64459d717a451a039eb26d761.zip
[checkerframework]
A bit of a shadow feature because the checker framework folks need to do some work on their side. this update makes lombok generate a few checker framework annotations (if configured to do so) which let the checker framework add warnings and errors for example if you misuse builders, or ignore the return values of withers, etc.
Diffstat (limited to 'test/transform')
-rw-r--r--test/transform/resource/after-delombok/CheckerFrameworkBasic.java72
-rw-r--r--test/transform/resource/after-delombok/CheckerFrameworkBuilder.java106
-rw-r--r--test/transform/resource/after-delombok/CheckerFrameworkSuperBuilder.java202
-rw-r--r--test/transform/resource/after-ecj/CheckerFrameworkBasic.java59
-rw-r--r--test/transform/resource/after-ecj/CheckerFrameworkBuilder.java79
-rw-r--r--test/transform/resource/after-ecj/CheckerFrameworkSuperBuilder.java142
-rw-r--r--test/transform/resource/before/CheckerFrameworkBasic.java11
-rw-r--r--test/transform/resource/before/CheckerFrameworkBuilder.java12
-rw-r--r--test/transform/resource/before/CheckerFrameworkSuperBuilder.java19
-rw-r--r--test/transform/resource/messages-delombok/CheckerFrameworkBasic.java.messages4
-rw-r--r--test/transform/resource/messages-delombok/CheckerFrameworkBuilder.java.messages1
-rw-r--r--test/transform/resource/messages-delombok/CheckerFrameworkSuperBuilder.java.messages3
-rw-r--r--test/transform/resource/messages-ecj/CheckerFrameworkBasic.java.messages1
-rw-r--r--test/transform/resource/messages-ecj/CheckerFrameworkBuilder.java.messages1
-rw-r--r--test/transform/resource/messages-ecj/CheckerFrameworkSuperBuilder.java.messages1
-rw-r--r--test/transform/resource/messages-idempotent/CheckerFrameworkBasic.java.messages10
16 files changed, 723 insertions, 0 deletions
diff --git a/test/transform/resource/after-delombok/CheckerFrameworkBasic.java b/test/transform/resource/after-delombok/CheckerFrameworkBasic.java
new file mode 100644
index 00000000..b9d4e0fa
--- /dev/null
+++ b/test/transform/resource/after-delombok/CheckerFrameworkBasic.java
@@ -0,0 +1,72 @@
+class CheckerFrameworkBasic {
+ private final int x;
+ private final int y;
+ private int z;
+ @org.checkerframework.common.aliasing.qual.Unique
+ @java.lang.SuppressWarnings("all")
+ public CheckerFrameworkBasic(final int x, final int y) {
+ this.x = x;
+ this.y = y;
+ }
+ @org.checkerframework.dataflow.qual.SideEffectFree
+ @java.lang.SuppressWarnings("all")
+ public int getX() {
+ return this.x;
+ }
+ @org.checkerframework.dataflow.qual.SideEffectFree
+ @java.lang.SuppressWarnings("all")
+ public int getY() {
+ return this.y;
+ }
+ @org.checkerframework.dataflow.qual.SideEffectFree
+ @java.lang.SuppressWarnings("all")
+ public int getZ() {
+ return this.z;
+ }
+ @org.checkerframework.checker.builder.qual.ReturnsReceiver
+ @java.lang.SuppressWarnings("all")
+ public CheckerFrameworkBasic setZ(final int z) {
+ this.z = z;
+ return this;
+ }
+ @org.checkerframework.dataflow.qual.SideEffectFree
+ @java.lang.Override
+ @java.lang.SuppressWarnings("all")
+ public boolean equals(final java.lang.Object o) {
+ if (o == this) return true;
+ if (!(o instanceof CheckerFrameworkBasic)) return false;
+ final CheckerFrameworkBasic other = (CheckerFrameworkBasic) o;
+ if (!other.canEqual((java.lang.Object) this)) return false;
+ if (this.getX() != other.getX()) return false;
+ if (this.getY() != other.getY()) return false;
+ if (this.getZ() != other.getZ()) return false;
+ return true;
+ }
+ @org.checkerframework.dataflow.qual.SideEffectFree
+ @java.lang.SuppressWarnings("all")
+ protected boolean canEqual(final java.lang.Object other) {
+ return other instanceof CheckerFrameworkBasic;
+ }
+ @org.checkerframework.dataflow.qual.SideEffectFree
+ @java.lang.Override
+ @java.lang.SuppressWarnings("all")
+ public int hashCode() {
+ final int PRIME = 59;
+ int result = 1;
+ result = result * PRIME + this.getX();
+ result = result * PRIME + this.getY();
+ result = result * PRIME + this.getZ();
+ return result;
+ }
+ @org.checkerframework.dataflow.qual.SideEffectFree
+ @java.lang.Override
+ @java.lang.SuppressWarnings("all")
+ public java.lang.String toString() {
+ return "CheckerFrameworkBasic(x=" + this.getX() + ", y=" + this.getY() + ", z=" + this.getZ() + ")";
+ }
+ @org.checkerframework.dataflow.qual.SideEffectFree
+ @java.lang.SuppressWarnings("all")
+ public CheckerFrameworkBasic withX(final int x) {
+ return this.x == x ? this : new CheckerFrameworkBasic(x, this.y, this.z);
+ }
+}
diff --git a/test/transform/resource/after-delombok/CheckerFrameworkBuilder.java b/test/transform/resource/after-delombok/CheckerFrameworkBuilder.java
new file mode 100644
index 00000000..d21ad044
--- /dev/null
+++ b/test/transform/resource/after-delombok/CheckerFrameworkBuilder.java
@@ -0,0 +1,106 @@
+// skip-idempotent
+import java.util.List;
+class CheckerFrameworkBuilder {
+ int x;
+ int y;
+ int z;
+ List<String> names;
+ @java.lang.SuppressWarnings("all")
+ private static int $default$x() {
+ return 5;
+ }
+ @org.checkerframework.common.aliasing.qual.Unique
+ @java.lang.SuppressWarnings("all")
+ CheckerFrameworkBuilder(final int x, final int y, final int z, final List<String> names) {
+ this.x = x;
+ this.y = y;
+ this.z = z;
+ this.names = names;
+ }
+ @java.lang.SuppressWarnings("all")
+ public static class CheckerFrameworkBuilderBuilder {
+ @java.lang.SuppressWarnings("all")
+ private boolean x$set;
+ @java.lang.SuppressWarnings("all")
+ private int x$value;
+ @java.lang.SuppressWarnings("all")
+ private int y;
+ @java.lang.SuppressWarnings("all")
+ private int z;
+ @java.lang.SuppressWarnings("all")
+ private java.util.ArrayList<String> names;
+ @org.checkerframework.common.aliasing.qual.Unique
+ @java.lang.SuppressWarnings("all")
+ CheckerFrameworkBuilderBuilder() {
+ }
+ @org.checkerframework.checker.builder.qual.ReturnsReceiver
+ @java.lang.SuppressWarnings("all")
+ public CheckerFrameworkBuilderBuilder x(@org.checkerframework.checker.builder.qual.NotCalledMethods("x") CheckerFrameworkBuilderBuilder this, final int x) {
+ this.x$value = x;
+ x$set = true;
+ return this;
+ }
+ @org.checkerframework.checker.builder.qual.ReturnsReceiver
+ @java.lang.SuppressWarnings("all")
+ public CheckerFrameworkBuilderBuilder y(@org.checkerframework.checker.builder.qual.NotCalledMethods("y") CheckerFrameworkBuilderBuilder this, final int y) {
+ this.y = y;
+ return this;
+ }
+ @org.checkerframework.checker.builder.qual.ReturnsReceiver
+ @java.lang.SuppressWarnings("all")
+ public CheckerFrameworkBuilderBuilder z(@org.checkerframework.checker.builder.qual.NotCalledMethods("z") CheckerFrameworkBuilderBuilder this, final int z) {
+ this.z = z;
+ return this;
+ }
+ @org.checkerframework.checker.builder.qual.ReturnsReceiver
+ @java.lang.SuppressWarnings("all")
+ public CheckerFrameworkBuilderBuilder name(final String name) {
+ if (this.names == null) this.names = new java.util.ArrayList<String>();
+ this.names.add(name);
+ return this;
+ }
+ @org.checkerframework.checker.builder.qual.ReturnsReceiver
+ @java.lang.SuppressWarnings("all")
+ public CheckerFrameworkBuilderBuilder names(final java.util.Collection<? extends String> names) {
+ if (this.names == null) this.names = new java.util.ArrayList<String>();
+ this.names.addAll(names);
+ return this;
+ }
+ @org.checkerframework.checker.builder.qual.ReturnsReceiver
+ @java.lang.SuppressWarnings("all")
+ public CheckerFrameworkBuilderBuilder clearNames() {
+ if (this.names != null) this.names.clear();
+ return this;
+ }
+ @org.checkerframework.dataflow.qual.SideEffectFree
+ @java.lang.SuppressWarnings("all")
+ public CheckerFrameworkBuilder build(@org.checkerframework.checker.builder.qual.CalledMethods({"y", "z"}) CheckerFrameworkBuilderBuilder this) {
+ java.util.List<String> names;
+ switch (this.names == null ? 0 : this.names.size()) {
+ case 0:
+ names = java.util.Collections.emptyList();
+ break;
+ case 1:
+ names = java.util.Collections.singletonList(this.names.get(0));
+ break;
+ default:
+ names = java.util.Collections.unmodifiableList(new java.util.ArrayList<String>(this.names));
+ }
+ int x$value = this.x$value;
+ if (!x$set) x$value = CheckerFrameworkBuilder.$default$x();
+ return new CheckerFrameworkBuilder(x$value, y, z, names);
+ }
+ @org.checkerframework.dataflow.qual.SideEffectFree
+ @java.lang.Override
+ @java.lang.SuppressWarnings("all")
+ public java.lang.String toString() {
+ return "CheckerFrameworkBuilder.CheckerFrameworkBuilderBuilder(x$value=" + this.x$value + ", y=" + this.y + ", z=" + this.z + ", names=" + this.names + ")";
+ }
+ }
+ @org.checkerframework.common.aliasing.qual.Unique
+ @org.checkerframework.dataflow.qual.SideEffectFree
+ @java.lang.SuppressWarnings("all")
+ public static CheckerFrameworkBuilderBuilder builder() {
+ return new CheckerFrameworkBuilderBuilder();
+ }
+}
diff --git a/test/transform/resource/after-delombok/CheckerFrameworkSuperBuilder.java b/test/transform/resource/after-delombok/CheckerFrameworkSuperBuilder.java
new file mode 100644
index 00000000..40876369
--- /dev/null
+++ b/test/transform/resource/after-delombok/CheckerFrameworkSuperBuilder.java
@@ -0,0 +1,202 @@
+// skip-idempotent
+import java.util.List;
+class CheckerFrameworkSuperBuilder {
+ public static class Parent {
+ int x;
+ int y;
+ int z;
+ List<String> names;
+ @java.lang.SuppressWarnings("all")
+ private static int $default$x() {
+ return 5;
+ }
+ @java.lang.SuppressWarnings("all")
+ public static abstract class ParentBuilder<C extends Parent, B extends ParentBuilder<C, B>> {
+ @java.lang.SuppressWarnings("all")
+ private boolean x$set;
+ @java.lang.SuppressWarnings("all")
+ private int x$value;
+ @java.lang.SuppressWarnings("all")
+ private int y;
+ @java.lang.SuppressWarnings("all")
+ private int z;
+ @java.lang.SuppressWarnings("all")
+ private java.util.ArrayList<String> names;
+ @org.checkerframework.checker.builder.qual.ReturnsReceiver
+ @org.checkerframework.dataflow.qual.SideEffectFree
+ @java.lang.SuppressWarnings("all")
+ protected abstract B self();
+ @org.checkerframework.dataflow.qual.SideEffectFree
+ @java.lang.SuppressWarnings("all")
+ public abstract C build(@org.checkerframework.checker.builder.qual.CalledMethods({"y", "z"}) Parent this);
+ @org.checkerframework.checker.builder.qual.ReturnsReceiver
+ @java.lang.SuppressWarnings("all")
+ public B x(@org.checkerframework.checker.builder.qual.NotCalledMethods("x") ParentBuilder this, final int x) {
+ this.x$value = x;
+ x$set = true;
+ return self();
+ }
+ @org.checkerframework.checker.builder.qual.ReturnsReceiver
+ @java.lang.SuppressWarnings("all")
+ public B y(@org.checkerframework.checker.builder.qual.NotCalledMethods("y") ParentBuilder this, final int y) {
+ this.y = y;
+ return self();
+ }
+ @org.checkerframework.checker.builder.qual.ReturnsReceiver
+ @java.lang.SuppressWarnings("all")
+ public B z(@org.checkerframework.checker.builder.qual.NotCalledMethods("z") ParentBuilder this, final int z) {
+ this.z = z;
+ return self();
+ }
+ @org.checkerframework.checker.builder.qual.ReturnsReceiver
+ @java.lang.SuppressWarnings("all")
+ public B name(final String name) {
+ if (this.names == null) this.names = new java.util.ArrayList<String>();
+ this.names.add(name);
+ return self();
+ }
+ @org.checkerframework.checker.builder.qual.ReturnsReceiver
+ @java.lang.SuppressWarnings("all")
+ public B names(final java.util.Collection<? extends String> names) {
+ if (this.names == null) this.names = new java.util.ArrayList<String>();
+ this.names.addAll(names);
+ return self();
+ }
+ @org.checkerframework.checker.builder.qual.ReturnsReceiver
+ @java.lang.SuppressWarnings("all")
+ public B clearNames() {
+ if (this.names != null) this.names.clear();
+ return self();
+ }
+ @org.checkerframework.dataflow.qual.SideEffectFree
+ @java.lang.Override
+ @java.lang.SuppressWarnings("all")
+ public java.lang.String toString() {
+ return "CheckerFrameworkSuperBuilder.Parent.ParentBuilder(x$value=" + this.x$value + ", y=" + this.y + ", z=" + this.z + ", names=" + this.names + ")";
+ }
+ }
+ @java.lang.SuppressWarnings("all")
+ private static final class ParentBuilderImpl extends ParentBuilder<Parent, ParentBuilderImpl> {
+ @org.checkerframework.common.aliasing.qual.Unique
+ @java.lang.SuppressWarnings("all")
+ private ParentBuilderImpl() {
+ }
+ @java.lang.Override
+ @org.checkerframework.checker.builder.qual.ReturnsReceiver
+ @org.checkerframework.dataflow.qual.SideEffectFree
+ @java.lang.SuppressWarnings("all")
+ protected ParentBuilderImpl self() {
+ return this;
+ }
+ @org.checkerframework.dataflow.qual.SideEffectFree
+ @java.lang.Override
+ @java.lang.SuppressWarnings("all")
+ public Parent build(@org.checkerframework.checker.builder.qual.CalledMethods({"y", "z"}) ParentBuilderImpl this) {
+ return new Parent(this);
+ }
+ }
+ @org.checkerframework.dataflow.qual.SideEffectFree
+ @java.lang.SuppressWarnings("all")
+ protected Parent(final ParentBuilder<?, ?> b) {
+ if (b.x$set) this.x = b.x$value;
+ else this.x = Parent.$default$x();
+ this.y = b.y;
+ this.z = b.z;
+ java.util.List<String> names;
+ switch (b.names == null ? 0 : b.names.size()) {
+ case 0:
+ names = java.util.Collections.emptyList();
+ break;
+ case 1:
+ names = java.util.Collections.singletonList(b.names.get(0));
+ break;
+ default:
+ names = java.util.Collections.unmodifiableList(new java.util.ArrayList<String>(b.names));
+ }
+ this.names = names;
+ }
+ @org.checkerframework.dataflow.qual.SideEffectFree
+ @java.lang.SuppressWarnings("all")
+ public static ParentBuilder<?, ?> builder() {
+ return new ParentBuilderImpl();
+ }
+ }
+ public static class Child extends Parent {
+ int a;
+ int b;
+ @java.lang.SuppressWarnings("all")
+ private static int $default$a() {
+ return 1;
+ }
+ @java.lang.SuppressWarnings("all")
+ public static abstract class ChildBuilder<C extends Child, B extends ChildBuilder<C, B>> extends Parent.ParentBuilder<C, B> {
+ @java.lang.SuppressWarnings("all")
+ private boolean a$set;
+ @java.lang.SuppressWarnings("all")
+ private int a$value;
+ @java.lang.SuppressWarnings("all")
+ private int b;
+ @java.lang.Override
+ @org.checkerframework.checker.builder.qual.ReturnsReceiver
+ @org.checkerframework.dataflow.qual.SideEffectFree
+ @java.lang.SuppressWarnings("all")
+ protected abstract B self();
+ @org.checkerframework.dataflow.qual.SideEffectFree
+ @java.lang.Override
+ @java.lang.SuppressWarnings("all")
+ public abstract C build(@org.checkerframework.checker.builder.qual.CalledMethods("b") Child this);
+ @org.checkerframework.checker.builder.qual.ReturnsReceiver
+ @java.lang.SuppressWarnings("all")
+ public B a(@org.checkerframework.checker.builder.qual.NotCalledMethods("a") ChildBuilder this, final int a) {
+ this.a$value = a;
+ a$set = true;
+ return self();
+ }
+ @org.checkerframework.checker.builder.qual.ReturnsReceiver
+ @java.lang.SuppressWarnings("all")
+ public B b(@org.checkerframework.checker.builder.qual.NotCalledMethods("b") ChildBuilder this, final int b) {
+ this.b = b;
+ return self();
+ }
+ @org.checkerframework.dataflow.qual.SideEffectFree
+ @java.lang.Override
+ @java.lang.SuppressWarnings("all")
+ public java.lang.String toString() {
+ return "CheckerFrameworkSuperBuilder.Child.ChildBuilder(super=" + super.toString() + ", a$value=" + this.a$value + ", b=" + this.b + ")";
+ }
+ }
+ @java.lang.SuppressWarnings("all")
+ private static final class ChildBuilderImpl extends ChildBuilder<Child, ChildBuilderImpl> {
+ @org.checkerframework.common.aliasing.qual.Unique
+ @java.lang.SuppressWarnings("all")
+ private ChildBuilderImpl() {
+ }
+ @java.lang.Override
+ @org.checkerframework.checker.builder.qual.ReturnsReceiver
+ @org.checkerframework.dataflow.qual.SideEffectFree
+ @java.lang.SuppressWarnings("all")
+ protected ChildBuilderImpl self() {
+ return this;
+ }
+ @org.checkerframework.dataflow.qual.SideEffectFree
+ @java.lang.Override
+ @java.lang.SuppressWarnings("all")
+ public Child build(@org.checkerframework.checker.builder.qual.CalledMethods("b") ChildBuilderImpl this) {
+ return new Child(this);
+ }
+ }
+ @org.checkerframework.dataflow.qual.SideEffectFree
+ @java.lang.SuppressWarnings("all")
+ protected Child(final ChildBuilder<?, ?> b) {
+ super(b);
+ if (b.a$set) this.a = b.a$value;
+ else this.a = Child.$default$a();
+ this.b = b.b;
+ }
+ @org.checkerframework.dataflow.qual.SideEffectFree
+ @java.lang.SuppressWarnings("all")
+ public static ChildBuilder<?, ?> builder() {
+ return new ChildBuilderImpl();
+ }
+ }
+} \ No newline at end of file
diff --git a/test/transform/resource/after-ecj/CheckerFrameworkBasic.java b/test/transform/resource/after-ecj/CheckerFrameworkBasic.java
new file mode 100644
index 00000000..03313c6d
--- /dev/null
+++ b/test/transform/resource/after-ecj/CheckerFrameworkBasic.java
@@ -0,0 +1,59 @@
+import lombok.Data;
+import lombok.experimental.Accessors;
+import lombok.experimental.Wither;
+@Data @Accessors(chain = true) class CheckerFrameworkBasic {
+ private final @Wither int x;
+ private final int y;
+ private int z;
+ public @org.checkerframework.dataflow.qual.SideEffectFree @java.lang.SuppressWarnings("all") CheckerFrameworkBasic withX(final int x) {
+ return ((this.x == x) ? this : new CheckerFrameworkBasic(x, this.y, this.z));
+ }
+ public @org.checkerframework.dataflow.qual.SideEffectFree @java.lang.SuppressWarnings("all") int getX() {
+ return this.x;
+ }
+ public @org.checkerframework.dataflow.qual.SideEffectFree @java.lang.SuppressWarnings("all") int getY() {
+ return this.y;
+ }
+ public @org.checkerframework.dataflow.qual.SideEffectFree @java.lang.SuppressWarnings("all") int getZ() {
+ return this.z;
+ }
+ public @org.checkerframework.checker.builder.qual.ReturnsReceiver @java.lang.SuppressWarnings("all") CheckerFrameworkBasic setZ(final int z) {
+ this.z = z;
+ return this;
+ }
+ public @java.lang.Override @org.checkerframework.dataflow.qual.SideEffectFree @java.lang.SuppressWarnings("all") boolean equals(final java.lang.Object o) {
+ if ((o == this))
+ return true;
+ if ((! (o instanceof CheckerFrameworkBasic)))
+ return false;
+ final CheckerFrameworkBasic other = (CheckerFrameworkBasic) o;
+ if ((! other.canEqual((java.lang.Object) this)))
+ return false;
+ if ((this.getX() != other.getX()))
+ return false;
+ if ((this.getY() != other.getY()))
+ return false;
+ if ((this.getZ() != other.getZ()))
+ return false;
+ return true;
+ }
+ protected @org.checkerframework.dataflow.qual.SideEffectFree @java.lang.SuppressWarnings("all") boolean canEqual(final java.lang.Object other) {
+ return (other instanceof CheckerFrameworkBasic);
+ }
+ public @java.lang.Override @org.checkerframework.dataflow.qual.SideEffectFree @java.lang.SuppressWarnings("all") int hashCode() {
+ final int PRIME = 59;
+ int result = 1;
+ result = ((result * PRIME) + this.getX());
+ result = ((result * PRIME) + this.getY());
+ result = ((result * PRIME) + this.getZ());
+ return result;
+ }
+ public @java.lang.Override @org.checkerframework.dataflow.qual.SideEffectFree @java.lang.SuppressWarnings("all") java.lang.String toString() {
+ return (((((("CheckerFrameworkBasic(x=" + this.getX()) + ", y=") + this.getY()) + ", z=") + this.getZ()) + ")");
+ }
+ public @org.checkerframework.common.aliasing.qual.Unique @java.lang.SuppressWarnings("all") CheckerFrameworkBasic(final int x, final int y) {
+ super();
+ this.x = x;
+ this.y = y;
+ }
+}
diff --git a/test/transform/resource/after-ecj/CheckerFrameworkBuilder.java b/test/transform/resource/after-ecj/CheckerFrameworkBuilder.java
new file mode 100644
index 00000000..2baad9d9
--- /dev/null
+++ b/test/transform/resource/after-ecj/CheckerFrameworkBuilder.java
@@ -0,0 +1,79 @@
+import java.util.List;
+import lombok.Builder;
+import lombok.Singular;
+@Builder class CheckerFrameworkBuilder {
+ public static @java.lang.SuppressWarnings("all") class CheckerFrameworkBuilderBuilder {
+ private @java.lang.SuppressWarnings("all") int x$value;
+ private @java.lang.SuppressWarnings("all") boolean x$set;
+ private @java.lang.SuppressWarnings("all") int y;
+ private @java.lang.SuppressWarnings("all") int z;
+ private @java.lang.SuppressWarnings("all") java.util.ArrayList<String> names;
+ @org.checkerframework.common.aliasing.qual.Unique @java.lang.SuppressWarnings("all") CheckerFrameworkBuilderBuilder() {
+ super();
+ }
+ public @org.checkerframework.checker.builder.qual.ReturnsReceiver @java.lang.SuppressWarnings("all") CheckerFrameworkBuilderBuilder x(final @org.checkerframework.checker.builder.qual.NotCalledMethods("x") CheckerFrameworkBuilderBuilder this, final int x) {
+ this.x$value = x;
+ x$set = true;
+ return this;
+ }
+ public @org.checkerframework.checker.builder.qual.ReturnsReceiver @java.lang.SuppressWarnings("all") CheckerFrameworkBuilderBuilder y(final @org.checkerframework.checker.builder.qual.NotCalledMethods("y") CheckerFrameworkBuilderBuilder this, final int y) {
+ this.y = y;
+ return this;
+ }
+ public @org.checkerframework.checker.builder.qual.ReturnsReceiver @java.lang.SuppressWarnings("all") CheckerFrameworkBuilderBuilder z(final @org.checkerframework.checker.builder.qual.NotCalledMethods("z") CheckerFrameworkBuilderBuilder this, final int z) {
+ this.z = z;
+ return this;
+ }
+ public @org.checkerframework.checker.builder.qual.ReturnsReceiver @java.lang.SuppressWarnings("all") CheckerFrameworkBuilderBuilder name(final String name) {
+ if ((this.names == null))
+ this.names = new java.util.ArrayList<String>();
+ this.names.add(name);
+ return this;
+ }
+ public @org.checkerframework.checker.builder.qual.ReturnsReceiver @java.lang.SuppressWarnings("all") CheckerFrameworkBuilderBuilder names(final java.util.Collection<? extends String> names) {
+ if ((this.names == null))
+ this.names = new java.util.ArrayList<String>();
+ this.names.addAll(names);
+ return this;
+ }
+ public @org.checkerframework.checker.builder.qual.ReturnsReceiver @java.lang.SuppressWarnings("all") CheckerFrameworkBuilderBuilder clearNames() {
+ if ((this.names != null))
+ this.names.clear();
+ return this;
+ }
+ public @org.checkerframework.dataflow.qual.SideEffectFree @java.lang.SuppressWarnings("all") CheckerFrameworkBuilder build(final @org.checkerframework.checker.builder.qual.CalledMethods({"y", "z"}) CheckerFrameworkBuilderBuilder this) {
+ java.util.List<String> names;
+ switch (((this.names == null) ? 0 : this.names.size())) {
+ case 0 :
+ names = java.util.Collections.emptyList();
+ break;
+ case 1 :
+ names = java.util.Collections.singletonList(this.names.get(0));
+ break;
+ default :
+ names = java.util.Collections.unmodifiableList(new java.util.ArrayList<String>(this.names));
+ }
+ return new CheckerFrameworkBuilder((x$set ? x$value : CheckerFrameworkBuilder.$default$x()), y, z, names);
+ }
+ public @java.lang.Override @org.checkerframework.dataflow.qual.SideEffectFree @java.lang.SuppressWarnings("all") java.lang.String toString() {
+ return (((((((("CheckerFrameworkBuilder.CheckerFrameworkBuilderBuilder(x$value=" + this.x$value) + ", y=") + this.y) + ", z=") + this.z) + ", names=") + this.names) + ")");
+ }
+ }
+ @Builder.Default int x;
+ int y;
+ int z;
+ @Singular List<String> names;
+ private static @java.lang.SuppressWarnings("all") int $default$x() {
+ return 5;
+ }
+ @org.checkerframework.common.aliasing.qual.Unique @java.lang.SuppressWarnings("all") CheckerFrameworkBuilder(final int x, final int y, final int z, final List<String> names) {
+ super();
+ this.x = x;
+ this.y = y;
+ this.z = z;
+ this.names = names;
+ }
+ public static @org.checkerframework.common.aliasing.qual.Unique @org.checkerframework.dataflow.qual.SideEffectFree @java.lang.SuppressWarnings("all") CheckerFrameworkBuilderBuilder builder() {
+ return new CheckerFrameworkBuilderBuilder();
+ }
+} \ No newline at end of file
diff --git a/test/transform/resource/after-ecj/CheckerFrameworkSuperBuilder.java b/test/transform/resource/after-ecj/CheckerFrameworkSuperBuilder.java
new file mode 100644
index 00000000..3901bfce
--- /dev/null
+++ b/test/transform/resource/after-ecj/CheckerFrameworkSuperBuilder.java
@@ -0,0 +1,142 @@
+import java.util.List;
+import lombok.Singular;
+class CheckerFrameworkSuperBuilder {
+ public static @lombok.experimental.SuperBuilder class Parent {
+ public static abstract @java.lang.SuppressWarnings("all") class ParentBuilder<C extends Parent, B extends ParentBuilder<C, B>> {
+ private @java.lang.SuppressWarnings("all") int x$value;
+ private @java.lang.SuppressWarnings("all") boolean x$set;
+ private @java.lang.SuppressWarnings("all") int y;
+ private @java.lang.SuppressWarnings("all") int z;
+ private @java.lang.SuppressWarnings("all") java.util.ArrayList<String> names;
+ public ParentBuilder() {
+ }
+ protected abstract @org.checkerframework.checker.builder.qual.ReturnsReceiver @org.checkerframework.dataflow.qual.SideEffectFree @java.lang.SuppressWarnings("all") B self();
+ public abstract @org.checkerframework.dataflow.qual.SideEffectFree @java.lang.SuppressWarnings("all") C build(final @org.checkerframework.checker.builder.qual.CalledMethods({"y", "z"}) ParentBuilder this);
+ public @org.checkerframework.checker.builder.qual.ReturnsReceiver @java.lang.SuppressWarnings("all") B x(final @org.checkerframework.checker.builder.qual.NotCalledMethods("x") ParentBuilder this, final int x) {
+ this.x$value = x;
+ x$set = true;
+ return self();
+ }
+ public @org.checkerframework.checker.builder.qual.ReturnsReceiver @java.lang.SuppressWarnings("all") B y(final @org.checkerframework.checker.builder.qual.NotCalledMethods("y") ParentBuilder this, final int y) {
+ this.y = y;
+ return self();
+ }
+ public @org.checkerframework.checker.builder.qual.ReturnsReceiver @java.lang.SuppressWarnings("all") B z(final @org.checkerframework.checker.builder.qual.NotCalledMethods("z") ParentBuilder this, final int z) {
+ this.z = z;
+ return self();
+ }
+ public @org.checkerframework.checker.builder.qual.ReturnsReceiver @java.lang.SuppressWarnings("all") B name(final String name) {
+ if ((this.names == null))
+ this.names = new java.util.ArrayList<String>();
+ this.names.add(name);
+ return self();
+ }
+ public @org.checkerframework.checker.builder.qual.ReturnsReceiver @java.lang.SuppressWarnings("all") B names(final java.util.Collection<? extends String> names) {
+ if ((this.names == null))
+ this.names = new java.util.ArrayList<String>();
+ this.names.addAll(names);
+ return self();
+ }
+ public @org.checkerframework.checker.builder.qual.ReturnsReceiver @java.lang.SuppressWarnings("all") B clearNames() {
+ if ((this.names != null))
+ this.names.clear();
+ return self();
+ }
+ public @java.lang.Override @org.checkerframework.dataflow.qual.SideEffectFree @java.lang.SuppressWarnings("all") java.lang.String toString() {
+ return (((((((("CheckerFrameworkSuperBuilder.Parent.ParentBuilder(x$value=" + this.x$value) + ", y=") + this.y) + ", z=") + this.z) + ", names=") + this.names) + ")");
+ }
+ }
+ private static final @java.lang.SuppressWarnings("all") class ParentBuilderImpl extends ParentBuilder<Parent, ParentBuilderImpl> {
+ private ParentBuilderImpl() {
+ }
+ protected @java.lang.Override @org.checkerframework.checker.builder.qual.ReturnsReceiver @org.checkerframework.dataflow.qual.SideEffectFree @java.lang.SuppressWarnings("all") ParentBuilderImpl self() {
+ return this;
+ }
+ public @java.lang.Override @org.checkerframework.dataflow.qual.SideEffectFree @java.lang.SuppressWarnings("all") Parent build(final @org.checkerframework.checker.builder.qual.CalledMethods({"y", "z"}) ParentBuilderImpl this) {
+ return new Parent(this);
+ }
+ }
+ @lombok.Builder.Default int x;
+ int y;
+ int z;
+ @Singular List<String> names;
+ private static @java.lang.SuppressWarnings("all") int $default$x() {
+ return 5;
+ }
+ protected @org.checkerframework.common.aliasing.qual.Unique @java.lang.SuppressWarnings("all") Parent(final ParentBuilder<?, ?> b) {
+ super();
+ if (b.x$set)
+ this.x = b.x$value;
+ else
+ this.x = Parent.$default$x();
+ this.y = b.y;
+ this.z = b.z;
+ java.util.List<String> names;
+ switch (((b.names == null) ? 0 : b.names.size())) {
+ case 0 :
+ names = java.util.Collections.emptyList();
+ break;
+ case 1 :
+ names = java.util.Collections.singletonList(b.names.get(0));
+ break;
+ default :
+ names = java.util.Collections.unmodifiableList(new java.util.ArrayList<String>(b.names));
+ }
+ this.names = names;
+ }
+ public static @org.checkerframework.common.aliasing.qual.Unique @java.lang.SuppressWarnings("all") ParentBuilder<?, ?> builder() {
+ return new ParentBuilderImpl();
+ }
+ }
+ public static @lombok.experimental.SuperBuilder class Child extends Parent {
+ public static abstract @java.lang.SuppressWarnings("all") class ChildBuilder<C extends Child, B extends ChildBuilder<C, B>> extends Parent.ParentBuilder<C, B> {
+ private @java.lang.SuppressWarnings("all") int a$value;
+ private @java.lang.SuppressWarnings("all") boolean a$set;
+ private @java.lang.SuppressWarnings("all") int b;
+ public ChildBuilder() {
+ }
+ protected abstract @java.lang.Override @org.checkerframework.checker.builder.qual.ReturnsReceiver @org.checkerframework.dataflow.qual.SideEffectFree @java.lang.SuppressWarnings("all") B self();
+ protected abstract @java.lang.Override @org.checkerframework.dataflow.qual.SideEffectFree @java.lang.SuppressWarnings("all") C build(final @org.checkerframework.checker.builder.qual.CalledMethods("b") ChildBuilder this);
+ public @org.checkerframework.checker.builder.qual.ReturnsReceiver @java.lang.SuppressWarnings("all") B a(final @org.checkerframework.checker.builder.qual.NotCalledMethods("a") ChildBuilder this, final int a) {
+ this.a$value = a;
+ a$set = true;
+ return self();
+ }
+ public @org.checkerframework.checker.builder.qual.ReturnsReceiver @java.lang.SuppressWarnings("all") B b(final @org.checkerframework.checker.builder.qual.NotCalledMethods("b") ChildBuilder this, final int b) {
+ this.b = b;
+ return self();
+ }
+ public @java.lang.Override @org.checkerframework.dataflow.qual.SideEffectFree @java.lang.SuppressWarnings("all") java.lang.String toString() {
+ return (((((("CheckerFrameworkSuperBuilder.Child.ChildBuilder(super=" + super.toString()) + ", a$value=") + this.a$value) + ", b=") + this.b) + ")");
+ }
+ }
+ private static final @java.lang.SuppressWarnings("all") class ChildBuilderImpl extends ChildBuilder<Child, ChildBuilderImpl> {
+ private ChildBuilderImpl() {
+ }
+ protected @java.lang.Override @org.checkerframework.checker.builder.qual.ReturnsReceiver @org.checkerframework.dataflow.qual.SideEffectFree @java.lang.SuppressWarnings("all") ChildBuilderImpl self() {
+ return this;
+ }
+ public @java.lang.Override @org.checkerframework.dataflow.qual.SideEffectFree @java.lang.SuppressWarnings("all") Child build(final @org.checkerframework.checker.builder.qual.CalledMethods("b") ChildBuilderImpl this) {
+ return new Child(this);
+ }
+ }
+ @lombok.Builder.Default int a;
+ int b;
+ private static @java.lang.SuppressWarnings("all") int $default$a() {
+ return 1;
+ }
+ protected @org.checkerframework.common.aliasing.qual.Unique @java.lang.SuppressWarnings("all") Child(final ChildBuilder<?, ?> b) {
+ super(b);
+ if (b.a$set)
+ this.a = b.a$value;
+ else
+ this.a = Child.$default$a();
+ this.b = b.b;
+ }
+ public static @org.checkerframework.common.aliasing.qual.Unique @java.lang.SuppressWarnings("all") ChildBuilder<?, ?> builder() {
+ return new ChildBuilderImpl();
+ }
+ }
+ CheckerFrameworkSuperBuilder() {
+ }
+}
diff --git a/test/transform/resource/before/CheckerFrameworkBasic.java b/test/transform/resource/before/CheckerFrameworkBasic.java
new file mode 100644
index 00000000..5b59165a
--- /dev/null
+++ b/test/transform/resource/before/CheckerFrameworkBasic.java
@@ -0,0 +1,11 @@
+//CONF: checkerframework = 3.0
+import lombok.Data;
+import lombok.experimental.Accessors;
+import lombok.experimental.Wither;
+
+@Data @Accessors(chain = true)
+class CheckerFrameworkBasic {
+ @Wither private final int x;
+ private final int y;
+ private int z;
+}
diff --git a/test/transform/resource/before/CheckerFrameworkBuilder.java b/test/transform/resource/before/CheckerFrameworkBuilder.java
new file mode 100644
index 00000000..4b501ab8
--- /dev/null
+++ b/test/transform/resource/before/CheckerFrameworkBuilder.java
@@ -0,0 +1,12 @@
+//CONF: checkerframework = true
+import java.util.List;
+import lombok.Builder;
+import lombok.Singular;
+
+@Builder
+class CheckerFrameworkBuilder {
+ @Builder.Default int x = 5;
+ int y;
+ int z;
+ @Singular List<String> names;
+}
diff --git a/test/transform/resource/before/CheckerFrameworkSuperBuilder.java b/test/transform/resource/before/CheckerFrameworkSuperBuilder.java
new file mode 100644
index 00000000..74d50ef1
--- /dev/null
+++ b/test/transform/resource/before/CheckerFrameworkSuperBuilder.java
@@ -0,0 +1,19 @@
+//CONF: checkerframework = true
+import java.util.List;
+import lombok.Singular;
+
+class CheckerFrameworkSuperBuilder {
+ @lombok.experimental.SuperBuilder
+ public static class Parent {
+ @lombok.Builder.Default int x = 5;
+ int y;
+ int z;
+ @Singular List<String> names;
+ }
+
+ @lombok.experimental.SuperBuilder
+ public static class Child extends Parent {
+ @lombok.Builder.Default int a = 1;
+ int b;
+ }
+}
diff --git a/test/transform/resource/messages-delombok/CheckerFrameworkBasic.java.messages b/test/transform/resource/messages-delombok/CheckerFrameworkBasic.java.messages
new file mode 100644
index 00000000..9ee959a4
--- /dev/null
+++ b/test/transform/resource/messages-delombok/CheckerFrameworkBasic.java.messages
@@ -0,0 +1,4 @@
+6 package org.checkerframework.common.aliasing.qual does not exist
+8 package org.checkerframework.dataflow.qual does not exist
+9 package org.checkerframework.dataflow.qual does not exist
+10 package org.checkerframework.dataflow.qual does not exist
diff --git a/test/transform/resource/messages-delombok/CheckerFrameworkBuilder.java.messages b/test/transform/resource/messages-delombok/CheckerFrameworkBuilder.java.messages
new file mode 100644
index 00000000..8c736705
--- /dev/null
+++ b/test/transform/resource/messages-delombok/CheckerFrameworkBuilder.java.messages
@@ -0,0 +1 @@
+6 package org.checkerframework.common.aliasing.qual does not exist
diff --git a/test/transform/resource/messages-delombok/CheckerFrameworkSuperBuilder.java.messages b/test/transform/resource/messages-delombok/CheckerFrameworkSuperBuilder.java.messages
new file mode 100644
index 00000000..5dd6251a
--- /dev/null
+++ b/test/transform/resource/messages-delombok/CheckerFrameworkSuperBuilder.java.messages
@@ -0,0 +1,3 @@
+6 package org.checkerframework.dataflow.qual does not exist
+-1 package org.checkerframework.checker.builder.qual does not exist
+14 package org.checkerframework.dataflow.qual does not exist
diff --git a/test/transform/resource/messages-ecj/CheckerFrameworkBasic.java.messages b/test/transform/resource/messages-ecj/CheckerFrameworkBasic.java.messages
new file mode 100644
index 00000000..9bfcba0c
--- /dev/null
+++ b/test/transform/resource/messages-ecj/CheckerFrameworkBasic.java.messages
@@ -0,0 +1 @@
+8 org.checkerframework cannot be resolved to a type
diff --git a/test/transform/resource/messages-ecj/CheckerFrameworkBuilder.java.messages b/test/transform/resource/messages-ecj/CheckerFrameworkBuilder.java.messages
new file mode 100644
index 00000000..d385a95c
--- /dev/null
+++ b/test/transform/resource/messages-ecj/CheckerFrameworkBuilder.java.messages
@@ -0,0 +1 @@
+6 org.checkerframework cannot be resolved to a type
diff --git a/test/transform/resource/messages-ecj/CheckerFrameworkSuperBuilder.java.messages b/test/transform/resource/messages-ecj/CheckerFrameworkSuperBuilder.java.messages
new file mode 100644
index 00000000..d385a95c
--- /dev/null
+++ b/test/transform/resource/messages-ecj/CheckerFrameworkSuperBuilder.java.messages
@@ -0,0 +1 @@
+6 org.checkerframework cannot be resolved to a type
diff --git a/test/transform/resource/messages-idempotent/CheckerFrameworkBasic.java.messages b/test/transform/resource/messages-idempotent/CheckerFrameworkBasic.java.messages
new file mode 100644
index 00000000..80694a06
--- /dev/null
+++ b/test/transform/resource/messages-idempotent/CheckerFrameworkBasic.java.messages
@@ -0,0 +1,10 @@
+5 package org.checkerframework.common.aliasing.qual does not exist
+11 package org.checkerframework.dataflow.qual does not exist
+16 package org.checkerframework.dataflow.qual does not exist
+21 package org.checkerframework.dataflow.qual does not exist
+26 package org.checkerframework.checker.builder.qual does not exist
+32 package org.checkerframework.dataflow.qual does not exist
+45 package org.checkerframework.dataflow.qual does not exist
+50 package org.checkerframework.dataflow.qual does not exist
+61 package org.checkerframework.dataflow.qual does not exist
+67 package org.checkerframework.dataflow.qual does not exist