From ae8ff327d2734e373df2839335ba9b1923c6eb67 Mon Sep 17 00:00:00 2001 From: Jan Rieke Date: Wed, 21 Jul 2021 13:54:54 +0200 Subject: [fixes #3081] make CheckerFramework's This a type annotation --- .../common/returnsreceiver/qual/This.java | 4 +-- .../after-delombok/CheckerFrameworkBasic.java | 4 +-- .../after-delombok/CheckerFrameworkBuilder.java | 19 ++++------- .../CheckerFrameworkSuperBuilder.java | 37 ++++++++-------------- .../resource/after-ecj/CheckerFrameworkBasic.java | 2 +- .../after-ecj/CheckerFrameworkBuilder.java | 12 +++---- .../after-ecj/CheckerFrameworkSuperBuilder.java | 24 +++++++------- 7 files changed, 41 insertions(+), 61 deletions(-) (limited to 'test') diff --git a/test/stubs/org/checkerframework/common/returnsreceiver/qual/This.java b/test/stubs/org/checkerframework/common/returnsreceiver/qual/This.java index 8ae1cd59..2683ef5f 100644 --- a/test/stubs/org/checkerframework/common/returnsreceiver/qual/This.java +++ b/test/stubs/org/checkerframework/common/returnsreceiver/qual/This.java @@ -1,12 +1,10 @@ package org.checkerframework.common.returnsreceiver.qual; import java.lang.annotation.ElementType; -import java.lang.annotation.Inherited; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; @Retention(RetentionPolicy.RUNTIME) -@Target(ElementType.METHOD) -@Inherited +@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER}) public @interface This {} \ No newline at end of file diff --git a/test/transform/resource/after-delombok/CheckerFrameworkBasic.java b/test/transform/resource/after-delombok/CheckerFrameworkBasic.java index 2beafc4c..bdd7921a 100644 --- a/test/transform/resource/after-delombok/CheckerFrameworkBasic.java +++ b/test/transform/resource/after-delombok/CheckerFrameworkBasic.java @@ -1,3 +1,4 @@ +// skip-idempotent //version 8: class CheckerFrameworkBasic { private final int x; @@ -21,9 +22,8 @@ class CheckerFrameworkBasic { /** * @return {@code this}. */ - @org.checkerframework.common.returnsreceiver.qual.This @java.lang.SuppressWarnings("all") - public CheckerFrameworkBasic setZ(final int z) { + public @org.checkerframework.common.returnsreceiver.qual.This CheckerFrameworkBasic setZ(final int z) { this.z = z; return this; } diff --git a/test/transform/resource/after-delombok/CheckerFrameworkBuilder.java b/test/transform/resource/after-delombok/CheckerFrameworkBuilder.java index 8c9197e2..99245e11 100644 --- a/test/transform/resource/after-delombok/CheckerFrameworkBuilder.java +++ b/test/transform/resource/after-delombok/CheckerFrameworkBuilder.java @@ -1,4 +1,3 @@ -// skip-idempotent import java.util.List; class CheckerFrameworkBuilder { int x; @@ -34,9 +33,8 @@ class CheckerFrameworkBuilder { /** * @return {@code this}. */ - @org.checkerframework.common.returnsreceiver.qual.This @java.lang.SuppressWarnings("all") - public CheckerFrameworkBuilder.CheckerFrameworkBuilderBuilder x(final int x) { + public CheckerFrameworkBuilder.@org.checkerframework.common.returnsreceiver.qual.This CheckerFrameworkBuilderBuilder x(final int x) { this.x$value = x; x$set = true; return this; @@ -44,31 +42,27 @@ class CheckerFrameworkBuilder { /** * @return {@code this}. */ - @org.checkerframework.common.returnsreceiver.qual.This @java.lang.SuppressWarnings("all") - public CheckerFrameworkBuilder.CheckerFrameworkBuilderBuilder y(final int y) { + public CheckerFrameworkBuilder.@org.checkerframework.common.returnsreceiver.qual.This CheckerFrameworkBuilderBuilder y(final int y) { this.y = y; return this; } /** * @return {@code this}. */ - @org.checkerframework.common.returnsreceiver.qual.This @java.lang.SuppressWarnings("all") - public CheckerFrameworkBuilder.CheckerFrameworkBuilderBuilder z(final int z) { + public CheckerFrameworkBuilder.@org.checkerframework.common.returnsreceiver.qual.This CheckerFrameworkBuilderBuilder z(final int z) { this.z = z; return this; } - @org.checkerframework.common.returnsreceiver.qual.This @java.lang.SuppressWarnings("all") - public CheckerFrameworkBuilder.CheckerFrameworkBuilderBuilder name(final String name) { + public CheckerFrameworkBuilder.@org.checkerframework.common.returnsreceiver.qual.This CheckerFrameworkBuilderBuilder name(final String name) { if (this.names == null) this.names = new java.util.ArrayList(); this.names.add(name); return this; } - @org.checkerframework.common.returnsreceiver.qual.This @java.lang.SuppressWarnings("all") - public CheckerFrameworkBuilder.CheckerFrameworkBuilderBuilder names(final java.util.Collection names) { + public CheckerFrameworkBuilder.@org.checkerframework.common.returnsreceiver.qual.This CheckerFrameworkBuilderBuilder names(final java.util.Collection names) { if (names == null) { throw new java.lang.NullPointerException("names cannot be null"); } @@ -76,9 +70,8 @@ class CheckerFrameworkBuilder { this.names.addAll(names); return this; } - @org.checkerframework.common.returnsreceiver.qual.This @java.lang.SuppressWarnings("all") - public CheckerFrameworkBuilder.CheckerFrameworkBuilderBuilder clearNames() { + public CheckerFrameworkBuilder.@org.checkerframework.common.returnsreceiver.qual.This CheckerFrameworkBuilderBuilder clearNames() { if (this.names != null) this.names.clear(); return this; } diff --git a/test/transform/resource/after-delombok/CheckerFrameworkSuperBuilder.java b/test/transform/resource/after-delombok/CheckerFrameworkSuperBuilder.java index 9beaef1f..cab11f3c 100644 --- a/test/transform/resource/after-delombok/CheckerFrameworkSuperBuilder.java +++ b/test/transform/resource/after-delombok/CheckerFrameworkSuperBuilder.java @@ -1,3 +1,4 @@ +// skip-idempotent //version 8: import java.util.List; class CheckerFrameworkSuperBuilder { @@ -22,19 +23,17 @@ class CheckerFrameworkSuperBuilder { private int z; @java.lang.SuppressWarnings("all") private java.util.ArrayList names; - @org.checkerframework.common.returnsreceiver.qual.This @org.checkerframework.dataflow.qual.Pure @java.lang.SuppressWarnings("all") - protected abstract B self(); + protected abstract @org.checkerframework.common.returnsreceiver.qual.This B self(); @org.checkerframework.dataflow.qual.SideEffectFree @java.lang.SuppressWarnings("all") public abstract C build(CheckerFrameworkSuperBuilder.Parent.@org.checkerframework.checker.calledmethods.qual.CalledMethods({"y", "z"}) ParentBuilder this); /** * @return {@code this}. */ - @org.checkerframework.common.returnsreceiver.qual.This @java.lang.SuppressWarnings("all") - public B x(final int x) { + public @org.checkerframework.common.returnsreceiver.qual.This B x(final int x) { this.x$value = x; x$set = true; return self(); @@ -42,31 +41,27 @@ class CheckerFrameworkSuperBuilder { /** * @return {@code this}. */ - @org.checkerframework.common.returnsreceiver.qual.This @java.lang.SuppressWarnings("all") - public B y(final int y) { + public @org.checkerframework.common.returnsreceiver.qual.This B y(final int y) { this.y = y; return self(); } /** * @return {@code this}. */ - @org.checkerframework.common.returnsreceiver.qual.This @java.lang.SuppressWarnings("all") - public B z(final int z) { + public @org.checkerframework.common.returnsreceiver.qual.This B z(final int z) { this.z = z; return self(); } - @org.checkerframework.common.returnsreceiver.qual.This @java.lang.SuppressWarnings("all") - public B name(final String name) { + public @org.checkerframework.common.returnsreceiver.qual.This B name(final String name) { if (this.names == null) this.names = new java.util.ArrayList(); this.names.add(name); return self(); } - @org.checkerframework.common.returnsreceiver.qual.This @java.lang.SuppressWarnings("all") - public B names(final java.util.Collection names) { + public @org.checkerframework.common.returnsreceiver.qual.This B names(final java.util.Collection names) { if (names == null) { throw new java.lang.NullPointerException("names cannot be null"); } @@ -74,9 +69,8 @@ class CheckerFrameworkSuperBuilder { this.names.addAll(names); return self(); } - @org.checkerframework.common.returnsreceiver.qual.This @java.lang.SuppressWarnings("all") - public B clearNames() { + public @org.checkerframework.common.returnsreceiver.qual.This B clearNames() { if (this.names != null) this.names.clear(); return self(); } @@ -93,10 +87,9 @@ class CheckerFrameworkSuperBuilder { private ParentBuilderImpl() { } @java.lang.Override - @org.checkerframework.common.returnsreceiver.qual.This @org.checkerframework.dataflow.qual.Pure @java.lang.SuppressWarnings("all") - protected CheckerFrameworkSuperBuilder.Parent.ParentBuilderImpl self() { + protected CheckerFrameworkSuperBuilder.Parent.@org.checkerframework.common.returnsreceiver.qual.This ParentBuilderImpl self() { return this; } @org.checkerframework.dataflow.qual.SideEffectFree @@ -148,10 +141,9 @@ class CheckerFrameworkSuperBuilder { @java.lang.SuppressWarnings("all") private int b; @java.lang.Override - @org.checkerframework.common.returnsreceiver.qual.This @org.checkerframework.dataflow.qual.Pure @java.lang.SuppressWarnings("all") - protected abstract B self(); + protected abstract @org.checkerframework.common.returnsreceiver.qual.This B self(); @org.checkerframework.dataflow.qual.SideEffectFree @java.lang.Override @java.lang.SuppressWarnings("all") @@ -159,9 +151,8 @@ class CheckerFrameworkSuperBuilder { /** * @return {@code this}. */ - @org.checkerframework.common.returnsreceiver.qual.This @java.lang.SuppressWarnings("all") - public B a(final int a) { + public @org.checkerframework.common.returnsreceiver.qual.This B a(final int a) { this.a$value = a; a$set = true; return self(); @@ -169,9 +160,8 @@ class CheckerFrameworkSuperBuilder { /** * @return {@code this}. */ - @org.checkerframework.common.returnsreceiver.qual.This @java.lang.SuppressWarnings("all") - public B b(final int b) { + public @org.checkerframework.common.returnsreceiver.qual.This B b(final int b) { this.b = b; return self(); } @@ -188,10 +178,9 @@ class CheckerFrameworkSuperBuilder { private ZChildBuilderImpl() { } @java.lang.Override - @org.checkerframework.common.returnsreceiver.qual.This @org.checkerframework.dataflow.qual.Pure @java.lang.SuppressWarnings("all") - protected CheckerFrameworkSuperBuilder.ZChild.ZChildBuilderImpl self() { + protected CheckerFrameworkSuperBuilder.ZChild.@org.checkerframework.common.returnsreceiver.qual.This ZChildBuilderImpl self() { return this; } @org.checkerframework.dataflow.qual.SideEffectFree diff --git a/test/transform/resource/after-ecj/CheckerFrameworkBasic.java b/test/transform/resource/after-ecj/CheckerFrameworkBasic.java index 87466c7d..670d7a2d 100644 --- a/test/transform/resource/after-ecj/CheckerFrameworkBasic.java +++ b/test/transform/resource/after-ecj/CheckerFrameworkBasic.java @@ -24,7 +24,7 @@ import lombok.With; /** * @return {@code this}. */ - public @org.checkerframework.common.returnsreceiver.qual.This @java.lang.SuppressWarnings("all") CheckerFrameworkBasic setZ(final int z) { + public @java.lang.SuppressWarnings("all") @org.checkerframework.common.returnsreceiver.qual.This CheckerFrameworkBasic setZ(final int z) { this.z = z; return this; } diff --git a/test/transform/resource/after-ecj/CheckerFrameworkBuilder.java b/test/transform/resource/after-ecj/CheckerFrameworkBuilder.java index 290ca381..2aa89e5d 100644 --- a/test/transform/resource/after-ecj/CheckerFrameworkBuilder.java +++ b/test/transform/resource/after-ecj/CheckerFrameworkBuilder.java @@ -14,7 +14,7 @@ import lombok.Singular; /** * @return {@code this}. */ - public @org.checkerframework.common.returnsreceiver.qual.This @java.lang.SuppressWarnings("all") CheckerFrameworkBuilder.CheckerFrameworkBuilderBuilder x(final int x) { + public @java.lang.SuppressWarnings("all") CheckerFrameworkBuilder.@org.checkerframework.common.returnsreceiver.qual.This CheckerFrameworkBuilderBuilder x(final int x) { this.x$value = x; x$set = true; return this; @@ -22,24 +22,24 @@ import lombok.Singular; /** * @return {@code this}. */ - public @org.checkerframework.common.returnsreceiver.qual.This @java.lang.SuppressWarnings("all") CheckerFrameworkBuilder.CheckerFrameworkBuilderBuilder y(final int y) { + public @java.lang.SuppressWarnings("all") CheckerFrameworkBuilder.@org.checkerframework.common.returnsreceiver.qual.This CheckerFrameworkBuilderBuilder y(final int y) { this.y = y; return this; } /** * @return {@code this}. */ - public @org.checkerframework.common.returnsreceiver.qual.This @java.lang.SuppressWarnings("all") CheckerFrameworkBuilder.CheckerFrameworkBuilderBuilder z(final int z) { + public @java.lang.SuppressWarnings("all") CheckerFrameworkBuilder.@org.checkerframework.common.returnsreceiver.qual.This CheckerFrameworkBuilderBuilder z(final int z) { this.z = z; return this; } - public @org.checkerframework.common.returnsreceiver.qual.This @java.lang.SuppressWarnings("all") CheckerFrameworkBuilder.CheckerFrameworkBuilderBuilder name(final String name) { + public @java.lang.SuppressWarnings("all") CheckerFrameworkBuilder.@org.checkerframework.common.returnsreceiver.qual.This CheckerFrameworkBuilderBuilder name(final String name) { if ((this.names == null)) this.names = new java.util.ArrayList(); this.names.add(name); return this; } - public @org.checkerframework.common.returnsreceiver.qual.This @java.lang.SuppressWarnings("all") CheckerFrameworkBuilder.CheckerFrameworkBuilderBuilder names(final java.util.Collection names) { + public @java.lang.SuppressWarnings("all") CheckerFrameworkBuilder.@org.checkerframework.common.returnsreceiver.qual.This CheckerFrameworkBuilderBuilder names(final java.util.Collection names) { if ((names == null)) { throw new java.lang.NullPointerException("names cannot be null"); @@ -49,7 +49,7 @@ import lombok.Singular; this.names.addAll(names); return this; } - public @org.checkerframework.common.returnsreceiver.qual.This @java.lang.SuppressWarnings("all") CheckerFrameworkBuilder.CheckerFrameworkBuilderBuilder clearNames() { + public @java.lang.SuppressWarnings("all") CheckerFrameworkBuilder.@org.checkerframework.common.returnsreceiver.qual.This CheckerFrameworkBuilderBuilder clearNames() { if ((this.names != null)) this.names.clear(); return this; diff --git a/test/transform/resource/after-ecj/CheckerFrameworkSuperBuilder.java b/test/transform/resource/after-ecj/CheckerFrameworkSuperBuilder.java index 340f04fe..74a1c80f 100644 --- a/test/transform/resource/after-ecj/CheckerFrameworkSuperBuilder.java +++ b/test/transform/resource/after-ecj/CheckerFrameworkSuperBuilder.java @@ -11,12 +11,12 @@ class CheckerFrameworkSuperBuilder { public ParentBuilder() { super(); } - protected abstract @org.checkerframework.common.returnsreceiver.qual.This @org.checkerframework.dataflow.qual.Pure @java.lang.SuppressWarnings("all") B self(); + protected abstract @org.checkerframework.dataflow.qual.Pure @java.lang.SuppressWarnings("all") @org.checkerframework.common.returnsreceiver.qual.This B self(); public abstract @org.checkerframework.dataflow.qual.SideEffectFree @java.lang.SuppressWarnings("all") C build(CheckerFrameworkSuperBuilder.Parent. @org.checkerframework.checker.calledmethods.qual.CalledMethods({"y", "z"}) ParentBuilder this); /** * @return {@code this}. */ - public @org.checkerframework.common.returnsreceiver.qual.This @java.lang.SuppressWarnings("all") B x(final int x) { + public @java.lang.SuppressWarnings("all") @org.checkerframework.common.returnsreceiver.qual.This B x(final int x) { this.x$value = x; x$set = true; return self(); @@ -24,24 +24,24 @@ class CheckerFrameworkSuperBuilder { /** * @return {@code this}. */ - public @org.checkerframework.common.returnsreceiver.qual.This @java.lang.SuppressWarnings("all") B y(final int y) { + public @java.lang.SuppressWarnings("all") @org.checkerframework.common.returnsreceiver.qual.This B y(final int y) { this.y = y; return self(); } /** * @return {@code this}. */ - public @org.checkerframework.common.returnsreceiver.qual.This @java.lang.SuppressWarnings("all") B z(final int z) { + public @java.lang.SuppressWarnings("all") @org.checkerframework.common.returnsreceiver.qual.This B z(final int z) { this.z = z; return self(); } - public @org.checkerframework.common.returnsreceiver.qual.This @java.lang.SuppressWarnings("all") B name(final String name) { + public @java.lang.SuppressWarnings("all") @org.checkerframework.common.returnsreceiver.qual.This B name(final String name) { if ((this.names == null)) this.names = new java.util.ArrayList(); this.names.add(name); return self(); } - public @org.checkerframework.common.returnsreceiver.qual.This @java.lang.SuppressWarnings("all") B names(final java.util.Collection names) { + public @java.lang.SuppressWarnings("all") @org.checkerframework.common.returnsreceiver.qual.This B names(final java.util.Collection names) { if ((names == null)) { throw new java.lang.NullPointerException("names cannot be null"); @@ -51,7 +51,7 @@ class CheckerFrameworkSuperBuilder { this.names.addAll(names); return self(); } - public @org.checkerframework.common.returnsreceiver.qual.This @java.lang.SuppressWarnings("all") B clearNames() { + public @java.lang.SuppressWarnings("all") @org.checkerframework.common.returnsreceiver.qual.This B clearNames() { if ((this.names != null)) this.names.clear(); return self(); @@ -64,7 +64,7 @@ class CheckerFrameworkSuperBuilder { private ParentBuilderImpl() { super(); } - protected @java.lang.Override @org.checkerframework.common.returnsreceiver.qual.This @org.checkerframework.dataflow.qual.Pure @java.lang.SuppressWarnings("all") CheckerFrameworkSuperBuilder.Parent.ParentBuilderImpl self() { + protected @java.lang.Override @org.checkerframework.dataflow.qual.Pure @java.lang.SuppressWarnings("all") CheckerFrameworkSuperBuilder.Parent.@org.checkerframework.common.returnsreceiver.qual.This ParentBuilderImpl self() { return this; } public @java.lang.Override @org.checkerframework.dataflow.qual.SideEffectFree @java.lang.SuppressWarnings("all") CheckerFrameworkSuperBuilder.Parent build(CheckerFrameworkSuperBuilder.Parent.@org.checkerframework.checker.calledmethods.qual.CalledMethods({"y", "z"}) ParentBuilderImpl this) { @@ -111,12 +111,12 @@ class CheckerFrameworkSuperBuilder { public ZChildBuilder() { super(); } - protected abstract @java.lang.Override @org.checkerframework.common.returnsreceiver.qual.This @org.checkerframework.dataflow.qual.Pure @java.lang.SuppressWarnings("all") B self(); + protected abstract @java.lang.Override @org.checkerframework.dataflow.qual.Pure @java.lang.SuppressWarnings("all") @org.checkerframework.common.returnsreceiver.qual.This B self(); public abstract @java.lang.Override @org.checkerframework.dataflow.qual.SideEffectFree @java.lang.SuppressWarnings("all") C build(CheckerFrameworkSuperBuilder.ZChild. @org.checkerframework.checker.calledmethods.qual.CalledMethods("b") ZChildBuilder this); /** * @return {@code this}. */ - public @org.checkerframework.common.returnsreceiver.qual.This @java.lang.SuppressWarnings("all") B a(final int a) { + public @java.lang.SuppressWarnings("all") @org.checkerframework.common.returnsreceiver.qual.This B a(final int a) { this.a$value = a; a$set = true; return self(); @@ -124,7 +124,7 @@ class CheckerFrameworkSuperBuilder { /** * @return {@code this}. */ - public @org.checkerframework.common.returnsreceiver.qual.This @java.lang.SuppressWarnings("all") B b(final int b) { + public @java.lang.SuppressWarnings("all") @org.checkerframework.common.returnsreceiver.qual.This B b(final int b) { this.b = b; return self(); } @@ -136,7 +136,7 @@ class CheckerFrameworkSuperBuilder { private ZChildBuilderImpl() { super(); } - protected @java.lang.Override @org.checkerframework.common.returnsreceiver.qual.This @org.checkerframework.dataflow.qual.Pure @java.lang.SuppressWarnings("all") CheckerFrameworkSuperBuilder.ZChild.ZChildBuilderImpl self() { + protected @java.lang.Override @org.checkerframework.dataflow.qual.Pure @java.lang.SuppressWarnings("all") CheckerFrameworkSuperBuilder.ZChild.@org.checkerframework.common.returnsreceiver.qual.This ZChildBuilderImpl self() { return this; } public @java.lang.Override @org.checkerframework.dataflow.qual.SideEffectFree @java.lang.SuppressWarnings("all") CheckerFrameworkSuperBuilder.ZChild build(CheckerFrameworkSuperBuilder.ZChild.@org.checkerframework.checker.calledmethods.qual.CalledMethods("b") ZChildBuilderImpl this) { -- cgit