diff --git a/checker-qual/src/main/java/org/checkerframework/checker/index/qual/EnsuresLTLengthOf.java b/checker-qual/src/main/java/org/checkerframework/checker/index/qual/EnsuresLTLengthOf.java index 6903a5e9f933..3c8474f49b8d 100644 --- a/checker-qual/src/main/java/org/checkerframework/checker/index/qual/EnsuresLTLengthOf.java +++ b/checker-qual/src/main/java/org/checkerframework/checker/index/qual/EnsuresLTLengthOf.java @@ -36,7 +36,7 @@ * *
{@code
  * public void useShiftIndex(@NonNegative int x) {
- *    // :: error: (argument)
+ *    // :: error: [argument]
  *    Arrays.fill(array, end, end + x, null);
  *    shiftIndex(x);
  *    Arrays.fill(array, end, end + x, null);
diff --git a/checker-qual/src/main/java/org/checkerframework/checker/units/qual/PolyUnit.java b/checker-qual/src/main/java/org/checkerframework/checker/units/qual/PolyUnit.java
index 0435cb42df4e..12801abe2ff3 100644
--- a/checker-qual/src/main/java/org/checkerframework/checker/units/qual/PolyUnit.java
+++ b/checker-qual/src/main/java/org/checkerframework/checker/units/qual/PolyUnit.java
@@ -29,7 +29,7 @@
  *   {@literal @}s int sec1 = 7 * UnitsTools.s;
  *   {@literal @}s int sec2 = triplePolyUnit(sec1);
  *
- *    // :: error: (assignment)
+ *    // :: error: [assignment]
  *   {@literal @}s int sec3 = triplePolyUnit(m1);
  *  }
  * 
diff --git a/checker/build.gradle b/checker/build.gradle index 31b8d832ec94..8454c7f33a02 100644 --- a/checker/build.gradle +++ b/checker/build.gradle @@ -465,7 +465,7 @@ tasks.register("ainferTestCheckerGenerateAjava", Test) { doLast { copyNonannotatedToAnnotatedDirectory("ainfer-testchecker") - // AinferTestCheckerAjavaValidationTest fails with "warning: (purity.methodref)", whenever + // AinferTestCheckerAjavaValidationTest fails with "warning: [purity.methodref]", whenever // there is a user-defined generic interface, and a variable of that type is assigned a // method reference. delete("tests/ainfer-testchecker/annotated/all-systems/java8/memberref/Issue946.java") diff --git a/checker/jtreg/multiplecheckers/NullnessInterning1.out b/checker/jtreg/multiplecheckers/NullnessInterning1.out index ec6620e80fb4..cf20a3bcf9d3 100644 --- a/checker/jtreg/multiplecheckers/NullnessInterning1.out +++ b/checker/jtreg/multiplecheckers/NullnessInterning1.out @@ -1,4 +1,4 @@ -NullnessInterning.java:19:14: compiler.warn.proc.messager: (assignment) -NullnessInterning.java:22:9: compiler.warn.proc.messager: (not.interned) -NullnessInterning.java:22:14: compiler.warn.proc.messager: (not.interned) +NullnessInterning.java:19:14: compiler.warn.proc.messager: [assignment] +NullnessInterning.java:22:9: compiler.warn.proc.messager: [not.interned] +NullnessInterning.java:22:14: compiler.warn.proc.messager: [not.interned] 3 warnings diff --git a/checker/jtreg/multiplecheckers/NullnessInterning2.out b/checker/jtreg/multiplecheckers/NullnessInterning2.out index 1100bacdcd76..0719f3ee3968 100644 --- a/checker/jtreg/multiplecheckers/NullnessInterning2.out +++ b/checker/jtreg/multiplecheckers/NullnessInterning2.out @@ -1,3 +1,3 @@ -NullnessInterning.java:22:9: compiler.warn.proc.messager: (not.interned) -NullnessInterning.java:22:14: compiler.warn.proc.messager: (not.interned) +NullnessInterning.java:22:9: compiler.warn.proc.messager: [not.interned] +NullnessInterning.java:22:14: compiler.warn.proc.messager: [not.interned] 2 warnings diff --git a/checker/jtreg/multiplecheckers/NullnessInterning3.out b/checker/jtreg/multiplecheckers/NullnessInterning3.out index 991309029a06..8ca13863a600 100644 --- a/checker/jtreg/multiplecheckers/NullnessInterning3.out +++ b/checker/jtreg/multiplecheckers/NullnessInterning3.out @@ -1,2 +1,2 @@ -NullnessInterning.java:19:14: compiler.warn.proc.messager: (assignment) +NullnessInterning.java:19:14: compiler.warn.proc.messager: [assignment] 1 warning diff --git a/checker/jtreg/nullness/issue1582/Foo.out b/checker/jtreg/nullness/issue1582/Foo.out index a28aa9cc3cfe..f4d3a7e589b2 100644 --- a/checker/jtreg/nullness/issue1582/Foo.out +++ b/checker/jtreg/nullness/issue1582/Foo.out @@ -1,2 +1,2 @@ -Foo.java:15:18: compiler.err.proc.messager: (flowexpr.parse.error) +Foo.java:15:18: compiler.err.proc.messager: [flowexpr.parse.error] 1 error diff --git a/checker/jtreg/nullness/issue1582/JavaExpressionParseError.out b/checker/jtreg/nullness/issue1582/JavaExpressionParseError.out index 32abfa84f5d3..e98e234dd83b 100644 --- a/checker/jtreg/nullness/issue1582/JavaExpressionParseError.out +++ b/checker/jtreg/nullness/issue1582/JavaExpressionParseError.out @@ -1,2 +1,2 @@ -JavaExpressionParseError.java:8:25: compiler.err.proc.messager: (flowexpr.parse.error.postcondition) +JavaExpressionParseError.java:8:25: compiler.err.proc.messager: [flowexpr.parse.error.postcondition] 1 error diff --git a/checker/jtreg/nullness/issue1929/Issue1929.java b/checker/jtreg/nullness/issue1929/Issue1929.java index db65d8942cf4..caaecf3aa3b1 100644 --- a/checker/jtreg/nullness/issue1929/Issue1929.java +++ b/checker/jtreg/nullness/issue1929/Issue1929.java @@ -25,7 +25,7 @@ String[] fails2(Collection c) { String[] fails3(Collection c) { // We don't determine field types from initialization expressions. - // :: error: (return) + // :: error: [return] return c.toArray(EMPTY_STRING_ARRAY_3); } } diff --git a/checker/jtreg/nullness/issue1958/NPE2Test.out b/checker/jtreg/nullness/issue1958/NPE2Test.out index d047b653f5d0..60b1a0390b55 100644 --- a/checker/jtreg/nullness/issue1958/NPE2Test.out +++ b/checker/jtreg/nullness/issue1958/NPE2Test.out @@ -1,5 +1,5 @@ -NPE2Test.java:3:39: compiler.err.proc.messager: (assignment) -NPE2Test.java:8:42: compiler.err.proc.messager: (assignment) -NPE2Test.java:13:42: compiler.err.proc.messager: (assignment) -NPE2Test.java:16:40: compiler.err.proc.messager: (assignment) +NPE2Test.java:3:39: compiler.err.proc.messager: [assignment] +NPE2Test.java:8:42: compiler.err.proc.messager: [assignment] +NPE2Test.java:13:42: compiler.err.proc.messager: [assignment] +NPE2Test.java:16:40: compiler.err.proc.messager: [assignment] 4 errors diff --git a/checker/jtreg/nullness/issue2173/View.out b/checker/jtreg/nullness/issue2173/View.out index 2fd6dd235b47..b90cd765d61c 100644 --- a/checker/jtreg/nullness/issue2173/View.out +++ b/checker/jtreg/nullness/issue2173/View.out @@ -1,3 +1,3 @@ -- compiler.warn.proc.messager: (invalid.annotation.location.bytecode) -- compiler.warn.proc.messager: (invalid.annotation.location.bytecode) +- compiler.warn.proc.messager: [invalid.annotation.location.bytecode] +- compiler.warn.proc.messager: [invalid.annotation.location.bytecode] 2 warnings diff --git a/checker/jtreg/nullness/issue820/AnonymousClass.out b/checker/jtreg/nullness/issue820/AnonymousClass.out index e329aef1760c..c9f2c4737d55 100644 --- a/checker/jtreg/nullness/issue820/AnonymousClass.out +++ b/checker/jtreg/nullness/issue820/AnonymousClass.out @@ -1,2 +1,2 @@ -AnonymousClass.java:4:27: compiler.err.proc.messager: (assignment) +AnonymousClass.java:4:27: compiler.err.proc.messager: [assignment] 1 error diff --git a/checker/jtreg/nullness/issue820/Class1Class2-err.out b/checker/jtreg/nullness/issue820/Class1Class2-err.out index 6c887808fb5a..07be6fea4e3b 100644 --- a/checker/jtreg/nullness/issue820/Class1Class2-err.out +++ b/checker/jtreg/nullness/issue820/Class1Class2-err.out @@ -1,3 +1,3 @@ -Class1.java:29:22: compiler.err.proc.messager: (contracts.postcondition) -Class2.java:15:20: compiler.err.proc.messager: (contracts.precondition) +Class1.java:29:22: compiler.err.proc.messager: [contracts.postcondition] +Class2.java:15:20: compiler.err.proc.messager: [contracts.precondition] 2 errors diff --git a/checker/jtreg/nullness/issue820/Class1MinClass2Min-err.out b/checker/jtreg/nullness/issue820/Class1MinClass2Min-err.out index bd23cfc40736..994660a3b796 100644 --- a/checker/jtreg/nullness/issue820/Class1MinClass2Min-err.out +++ b/checker/jtreg/nullness/issue820/Class1MinClass2Min-err.out @@ -1,2 +1,2 @@ -Class2Min.java:6:25: compiler.err.proc.messager: (assignment) +Class2Min.java:6:25: compiler.err.proc.messager: [assignment] 1 error diff --git a/checker/jtreg/nullness/issue820/Class2Class1-err.out b/checker/jtreg/nullness/issue820/Class2Class1-err.out index 77212490e5a3..f5780376cd70 100644 --- a/checker/jtreg/nullness/issue820/Class2Class1-err.out +++ b/checker/jtreg/nullness/issue820/Class2Class1-err.out @@ -1,3 +1,3 @@ -Class2.java:15:20: compiler.err.proc.messager: (contracts.precondition) -Class1.java:29:22: compiler.err.proc.messager: (contracts.postcondition) +Class2.java:15:20: compiler.err.proc.messager: [contracts.precondition] +Class1.java:29:22: compiler.err.proc.messager: [contracts.postcondition] 2 errors diff --git a/checker/jtreg/nullness/issue820/ErrorAnonymousClass.out b/checker/jtreg/nullness/issue820/ErrorAnonymousClass.out index d38d36ffb9e4..95ca04ab31d7 100644 --- a/checker/jtreg/nullness/issue820/ErrorAnonymousClass.out +++ b/checker/jtreg/nullness/issue820/ErrorAnonymousClass.out @@ -1,3 +1,3 @@ -Error.java:13:23: compiler.err.proc.messager: (assignment) -AnonymousClass.java:4:27: compiler.err.proc.messager: (assignment) +Error.java:13:23: compiler.err.proc.messager: [assignment] +AnonymousClass.java:4:27: compiler.err.proc.messager: [assignment] 2 errors diff --git a/checker/jtreg/nullness/issue824/Class2.out b/checker/jtreg/nullness/issue824/Class2.out index d569cb189583..54703a0b76de 100644 --- a/checker/jtreg/nullness/issue824/Class2.out +++ b/checker/jtreg/nullness/issue824/Class2.out @@ -1,9 +1,9 @@ -Class2.java:14:39: compiler.err.proc.messager: (type.argument) -Class2.java:15:20: compiler.err.proc.messager: (type.argument) -Class2.java:15:45: compiler.err.proc.messager: (type.argument) -Class2.java:16:27: compiler.err.proc.messager: (type.arguments.not.inferred) -Class2.java:19:27: compiler.err.proc.messager: (type.arguments.not.inferred) -Class2.java:20:26: compiler.err.proc.messager: (argument) -Class2.java:24:14: compiler.err.proc.messager: (override.return) -Class2.java:25:33: compiler.err.proc.messager: (type.arguments.not.inferred) +Class2.java:14:39: compiler.err.proc.messager: [type.argument] +Class2.java:15:20: compiler.err.proc.messager: [type.argument] +Class2.java:15:45: compiler.err.proc.messager: [type.argument] +Class2.java:16:27: compiler.err.proc.messager: [type.arguments.not.inferred] +Class2.java:19:27: compiler.err.proc.messager: [type.arguments.not.inferred] +Class2.java:20:26: compiler.err.proc.messager: [argument] +Class2.java:24:14: compiler.err.proc.messager: [override.return] +Class2.java:25:33: compiler.err.proc.messager: [type.arguments.not.inferred] 8 errors diff --git a/checker/jtreg/nullness/preciseErrorMsg/Class1.out b/checker/jtreg/nullness/preciseErrorMsg/Class1.out index 24cf78a29506..83c90db97a42 100644 --- a/checker/jtreg/nullness/preciseErrorMsg/Class1.out +++ b/checker/jtreg/nullness/preciseErrorMsg/Class1.out @@ -1,2 +1,2 @@ -Class1.java:15:22: compiler.err.proc.messager: (flowexpr.parse.error) +Class1.java:15:22: compiler.err.proc.messager: [flowexpr.parse.error] 1 error diff --git a/checker/jtreg/rawtypes/RawTypeFail.out b/checker/jtreg/rawtypes/RawTypeFail.out index 474a23916ebf..b0fdb604c6d6 100644 --- a/checker/jtreg/rawtypes/RawTypeFail.out +++ b/checker/jtreg/rawtypes/RawTypeFail.out @@ -1,6 +1,6 @@ RawTypeFail.java:14:30: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), java.util.Map, java.util.Map RawTypeFail.java:15:31: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), java.util.HashMap, java.util.Map -RawTypeFail.java:14:30: compiler.err.proc.messager: (assignment) -RawTypeFail.java:15:31: compiler.err.proc.messager: (assignment) +RawTypeFail.java:14:30: compiler.err.proc.messager: [assignment] +RawTypeFail.java:15:31: compiler.err.proc.messager: [assignment] 2 errors 2 warnings \ No newline at end of file diff --git a/checker/jtreg/stubs/annotatedFor/WithStub.out b/checker/jtreg/stubs/annotatedFor/WithStub.out index fa606268c807..2ce7fa51e828 100644 --- a/checker/jtreg/stubs/annotatedFor/WithStub.out +++ b/checker/jtreg/stubs/annotatedFor/WithStub.out @@ -1,3 +1,3 @@ -UseTest.java:18:18: compiler.err.proc.messager: (argument) -UseTest.java:19:18: compiler.err.proc.messager: (argument) +UseTest.java:18:18: compiler.err.proc.messager: [argument] +UseTest.java:19:18: compiler.err.proc.messager: [argument] 2 errors diff --git a/checker/jtreg/stubs/annotatedFor/WithoutStub.out b/checker/jtreg/stubs/annotatedFor/WithoutStub.out index 990374473b10..63ff4fe9d629 100644 --- a/checker/jtreg/stubs/annotatedFor/WithoutStub.out +++ b/checker/jtreg/stubs/annotatedFor/WithoutStub.out @@ -1,2 +1,2 @@ -UseTest.java:18:18: compiler.err.proc.messager: (argument) +UseTest.java:18:18: compiler.err.proc.messager: [argument] 1 error diff --git a/checker/jtreg/stubs/annotatedFor/WithoutStubConservative.out b/checker/jtreg/stubs/annotatedFor/WithoutStubConservative.out index 68ab1deea1cd..068ed8ad1e8b 100644 --- a/checker/jtreg/stubs/annotatedFor/WithoutStubConservative.out +++ b/checker/jtreg/stubs/annotatedFor/WithoutStubConservative.out @@ -1,3 +1,3 @@ -UseTest.java:18:18: compiler.err.proc.messager: (argument) -UseTest.java:20:37: compiler.err.proc.messager: (assignment) +UseTest.java:18:18: compiler.err.proc.messager: [argument] +UseTest.java:20:37: compiler.err.proc.messager: [assignment] 2 errors diff --git a/checker/jtreg/stubs/issue1456/WithStub.out b/checker/jtreg/stubs/issue1456/WithStub.out index 12bd6656d362..26603238213a 100644 --- a/checker/jtreg/stubs/issue1456/WithStub.out +++ b/checker/jtreg/stubs/issue1456/WithStub.out @@ -1,2 +1,2 @@ -Main.java:26:13: compiler.err.proc.messager: (type.arguments.not.inferred) +Main.java:26:13: compiler.err.proc.messager: [type.arguments.not.inferred] 1 error diff --git a/checker/jtreg/stubs/issue1456/WithoutStub.out b/checker/jtreg/stubs/issue1456/WithoutStub.out index e40a24bc036b..39a2054c2e6c 100644 --- a/checker/jtreg/stubs/issue1456/WithoutStub.out +++ b/checker/jtreg/stubs/issue1456/WithoutStub.out @@ -1,8 +1,8 @@ -Main.java:16:30: compiler.err.proc.messager: (assignment) -Main.java:17:42: compiler.err.proc.messager: (assignment) -Main.java:18:31: compiler.err.proc.messager: (assignment) -Main.java:19:31: compiler.err.proc.messager: (assignment) -Main.java:20:29: compiler.err.proc.messager: (assignment) -Main.java:21:43: compiler.err.proc.messager: (assignment) -Main.java:22:46: compiler.err.proc.messager: (assignment) +Main.java:16:30: compiler.err.proc.messager: [assignment] +Main.java:17:42: compiler.err.proc.messager: [assignment] +Main.java:18:31: compiler.err.proc.messager: [assignment] +Main.java:19:31: compiler.err.proc.messager: [assignment] +Main.java:20:29: compiler.err.proc.messager: [assignment] +Main.java:21:43: compiler.err.proc.messager: [assignment] +Main.java:22:46: compiler.err.proc.messager: [assignment] 7 errors diff --git a/checker/tests/README.md b/checker/tests/README.md index 07a5095ca3b0..6c9f75a50f79 100644 --- a/checker/tests/README.md +++ b/checker/tests/README.md @@ -146,7 +146,7 @@ So the final test case would be: public class MyNullnessTest { void method() { Object nullable = null; - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] nullable.toString(); } } @@ -163,7 +163,7 @@ You can indicate an expected warning (as opposed to error) by using "warning:" instead of "error:", as in ```java - // :: warning: (nulltest.redundant) + // :: warning: [nulltest.redundant] assert val != null; ``` @@ -173,7 +173,7 @@ a warning from the same line of code: ```java @Regex String s1 = null; - // :: error: (assignment) :: warning: (cast.unsafe) + // :: error: [assignment] :: warning: [cast.unsafe] @Regex(3) String s2 = (@Regex(2) String) s; ``` @@ -182,7 +182,7 @@ syntax, expected errors can be specified in a separate file using the .out file extension. These files contain lines of the following format: ```output -:19: error: (dereference.of.nullable) +:19: error: [dereference.of.nullable] ``` The number between the colons is the line number of the expected error diff --git a/checker/tests/aggregate/NullnessAndRegex.java b/checker/tests/aggregate/NullnessAndRegex.java index 92394e7ce222..eb90cff2479a 100644 --- a/checker/tests/aggregate/NullnessAndRegex.java +++ b/checker/tests/aggregate/NullnessAndRegex.java @@ -4,17 +4,17 @@ import org.checkerframework.checker.regex.qual.Regex; public class NullnessAndRegex { - // :: error: (assignment) + // :: error: [assignment] @Regex String s1 = "De(mo"; - // :: error: (assignment) + // :: error: [assignment] Object f = null; - // :: error: (assignment) + // :: error: [assignment] @Regex String s2 = "De(mo"; void localized(@Localized String s) {} void method() { - // :: error: (argument) + // :: error: [argument] localized("ldskjfldj"); // error } } diff --git a/checker/tests/ainfer-index/non-annotated/DependentTypesViewpointAdaptationTest.java b/checker/tests/ainfer-index/non-annotated/DependentTypesViewpointAdaptationTest.java index 93d925e3b4c3..cd126fc136a9 100644 --- a/checker/tests/ainfer-index/non-annotated/DependentTypesViewpointAdaptationTest.java +++ b/checker/tests/ainfer-index/non-annotated/DependentTypesViewpointAdaptationTest.java @@ -59,13 +59,13 @@ public static void testThisInference( public void compute5( DependentTypesViewpointAdaptationTest this, DependentTypesViewpointAdaptationTest other) { - // :: warning: (assignment) + // :: warning: [assignment] @SameLen("this") DependentTypesViewpointAdaptationTest myOther = other; } // Same as compute5, but without an explicit this parameter. public void compute6(DependentTypesViewpointAdaptationTest other) { - // :: warning: (assignment) + // :: warning: [assignment] @SameLen("this") DependentTypesViewpointAdaptationTest myOther = other; } } diff --git a/checker/tests/ainfer-nullness/non-annotated/MonotonicNonNullInferenceTest.java b/checker/tests/ainfer-nullness/non-annotated/MonotonicNonNullInferenceTest.java index 13342f2d65ee..5f4751809b52 100644 --- a/checker/tests/ainfer-nullness/non-annotated/MonotonicNonNullInferenceTest.java +++ b/checker/tests/ainfer-nullness/non-annotated/MonotonicNonNullInferenceTest.java @@ -2,27 +2,27 @@ public class MonotonicNonNullInferenceTest { - // :: warning: (initialization.static.field.uninitialized) + // :: warning: [initialization.static.field.uninitialized] static String staticString1; - // :: warning: (assignment) + // :: warning: [assignment] static String staticString2 = null; static String staticString3; String instanceString1; - // :: warning: (assignment) + // :: warning: [assignment] String instanceString2 = null; String instanceString3; static { - // :: warning: (assignment) + // :: warning: [assignment] staticString3 = null; } - // :: warning: (initialization.fields.uninitialized) + // :: warning: [initialization.fields.uninitialized] MonotonicNonNullInferenceTest() { String instanceString3 = "hello"; } diff --git a/checker/tests/ainfer-nullness/non-annotated/NullTypeVarTest.java b/checker/tests/ainfer-nullness/non-annotated/NullTypeVarTest.java index 50dbad362fd2..37d6c6fab242 100644 --- a/checker/tests/ainfer-nullness/non-annotated/NullTypeVarTest.java +++ b/checker/tests/ainfer-nullness/non-annotated/NullTypeVarTest.java @@ -8,7 +8,7 @@ public class NullTypeVarTest { - // :: warning: (assignment) + // :: warning: [assignment] private String indentString = null; private List indentStrings; diff --git a/checker/tests/ainfer-nullness/non-annotated/TwoCtorGenericAbstract.java b/checker/tests/ainfer-nullness/non-annotated/TwoCtorGenericAbstract.java index d8dd140126a0..9c70e8086456 100644 --- a/checker/tests/ainfer-nullness/non-annotated/TwoCtorGenericAbstract.java +++ b/checker/tests/ainfer-nullness/non-annotated/TwoCtorGenericAbstract.java @@ -6,7 +6,7 @@ public abstract class TwoCtorGenericAbstract implements Set protected T value; protected TwoCtorGenericAbstract() { - // :: warning: (assignment) + // :: warning: [assignment] this.value = null; } diff --git a/checker/tests/ainfer-nullness/non-annotated/TypeVarPlumeUtil.java b/checker/tests/ainfer-nullness/non-annotated/TypeVarPlumeUtil.java index afeb3f4a149d..53b24af85832 100644 --- a/checker/tests/ainfer-nullness/non-annotated/TypeVarPlumeUtil.java +++ b/checker/tests/ainfer-nullness/non-annotated/TypeVarPlumeUtil.java @@ -13,7 +13,7 @@ public V merge(@NonNull V value) { } public V mergeNullable(@Nullable V value) { - // :: warning: (return) + // :: warning: [return] return value; } } diff --git a/checker/tests/ainfer-resourceleak/non-annotated/AddNotOwning.java b/checker/tests/ainfer-resourceleak/non-annotated/AddNotOwning.java index 83321766e00d..de0ff4c3e2bb 100644 --- a/checker/tests/ainfer-resourceleak/non-annotated/AddNotOwning.java +++ b/checker/tests/ainfer-resourceleak/non-annotated/AddNotOwning.java @@ -15,7 +15,7 @@ static class NonEmptyMustCallFinalField { final Foo f; // expect owning annotation for this field NonEmptyMustCallFinalField() { - // :: warning: (required.method.not.called) + // :: warning: [required.method.not.called] f = new Foo(); } @@ -32,12 +32,12 @@ Foo getFieldOnSomePath() { } void testNotOwningOnFinal() { - // :: warning: (required.method.not.called) + // :: warning: [required.method.not.called] Foo f = getField(); } void testNotOwningOnGetFieldOnSomePath() { - // :: warning: (required.method.not.called) + // :: warning: [required.method.not.called] Foo f = getFieldOnSomePath(); } @@ -56,7 +56,7 @@ static class NonEmptyMustCallNonFinalField { @SuppressWarnings("missing.creates.mustcall.for") void initialyzeFoo() { f.a(); - // :: warning: (required.method.not.called) + // :: warning: [required.method.not.called] f = new Foo(); } @@ -73,12 +73,12 @@ Foo getFieldOnSomePath() { } void testNotOwningOnNonFinal() { - // :: warning: (required.method.not.called) + // :: warning: [required.method.not.called] Foo f = getField(); } void testNotOwningOnGetFieldOnSomePath() { - // :: warning: (required.method.not.called) + // :: warning: [required.method.not.called] Foo f = getFieldOnSomePath(); } diff --git a/checker/tests/ainfer-resourceleak/non-annotated/ClassWithTwoOwningFieldsTest.java b/checker/tests/ainfer-resourceleak/non-annotated/ClassWithTwoOwningFieldsTest.java index 6b011244f118..c741a08482fc 100644 --- a/checker/tests/ainfer-resourceleak/non-annotated/ClassWithTwoOwningFieldsTest.java +++ b/checker/tests/ainfer-resourceleak/non-annotated/ClassWithTwoOwningFieldsTest.java @@ -12,9 +12,9 @@ void a() {} @InheritableMustCall("close") private class ClassWithTwoOwningFields { - // :: warning: (required.method.not.called) + // :: warning: [required.method.not.called] final @Owning Foo foo1; - // :: warning: (required.method.not.called) + // :: warning: [required.method.not.called] final @Owning Foo foo2; public ClassWithTwoOwningFields(Foo f1, Foo f2) { @@ -29,9 +29,9 @@ void close() { } void testTwoOwning() { - // :: warning: (required.method.not.called) + // :: warning: [required.method.not.called] Foo f1 = new Foo(); - // :: warning: (required.method.not.called) + // :: warning: [required.method.not.called] Foo f2 = new Foo(); ClassWithTwoOwningFields ff = new ClassWithTwoOwningFields(f1, f2); diff --git a/checker/tests/ainfer-resourceleak/non-annotated/ECMInference.java b/checker/tests/ainfer-resourceleak/non-annotated/ECMInference.java index 7fecb377aa4a..ca0bb6413857 100644 --- a/checker/tests/ainfer-resourceleak/non-annotated/ECMInference.java +++ b/checker/tests/ainfer-resourceleak/non-annotated/ECMInference.java @@ -12,7 +12,7 @@ void doStuff() { void clientA1() { doStuff(); - // :: warning: (assignment) + // :: warning: [assignment] @CalledMethods("toString") A1 a1 = this; } } @@ -25,7 +25,7 @@ void doStuff() { void clientB1() { doStuff(); - // :: warning: (assignment) + // :: warning: [assignment] @CalledMethods("toString") B1 b1 = this; } } @@ -37,7 +37,7 @@ void doStuff() { void clientA2() { doStuff(); - // :: warning: (assignment) + // :: warning: [assignment] @CalledMethods("toString") A2 a2 = this; } } @@ -51,7 +51,7 @@ void doStuff() { void clientB2() { doStuff(); - // :: warning: (assignment) + // :: warning: [assignment] @CalledMethods({"toString", "hashCode"}) B2 b2 = this; } } diff --git a/checker/tests/ainfer-resourceleak/non-annotated/EnsuresCalledMethodsTest.java b/checker/tests/ainfer-resourceleak/non-annotated/EnsuresCalledMethodsTest.java index 65c1fb5cf4bd..2a37e0d00a86 100644 --- a/checker/tests/ainfer-resourceleak/non-annotated/EnsuresCalledMethodsTest.java +++ b/checker/tests/ainfer-resourceleak/non-annotated/EnsuresCalledMethodsTest.java @@ -9,7 +9,7 @@ void a() {} @InheritableMustCall("close") class ECM { - // :: warning: (required.method.not.called) + // :: warning: [required.method.not.called] @Owning Foo foo; private void closePrivate() { diff --git a/checker/tests/ainfer-resourceleak/non-annotated/EnsuresCalledMethodsVarargsTest.java b/checker/tests/ainfer-resourceleak/non-annotated/EnsuresCalledMethodsVarargsTest.java index a6862f18c62c..13596324c7d2 100644 --- a/checker/tests/ainfer-resourceleak/non-annotated/EnsuresCalledMethodsVarargsTest.java +++ b/checker/tests/ainfer-resourceleak/non-annotated/EnsuresCalledMethodsVarargsTest.java @@ -24,7 +24,7 @@ private class ECMVA { final Foo foo; ECMVA() { - // :: warning: (required.method.not.called) + // :: warning: [required.method.not.called] foo = new Foo(); } @@ -47,7 +47,7 @@ void owningParam(Foo f) { } void testOwningParamOnOwningParam() { - // :: warning: (required.method.not.called) + // :: warning: [required.method.not.called] Foo f = new Foo(); owningParam(f); } diff --git a/checker/tests/ainfer-resourceleak/non-annotated/MustCallAliasOnReceiver.java b/checker/tests/ainfer-resourceleak/non-annotated/MustCallAliasOnReceiver.java index c3c0190b3f2d..a73f1624c1dc 100644 --- a/checker/tests/ainfer-resourceleak/non-annotated/MustCallAliasOnReceiver.java +++ b/checker/tests/ainfer-resourceleak/non-annotated/MustCallAliasOnReceiver.java @@ -17,7 +17,7 @@ MustCallAliasOnReceiver returnReceiver(MustCallAliasOnReceiver this) { return this; } - // :: warning: (required.method.not.called) + // :: warning: [required.method.not.called] void testReceiverMCAAnnotation(@Owning InputStream inputStream) throws IOException { MustCallAliasOnReceiver mcar = new MustCallAliasOnReceiver(is, false); mcar.returnReceiver().close(); @@ -32,7 +32,7 @@ public static MustCallAliasOnReceiver mcaneFactory(InputStream is) { return new MustCallAliasOnReceiver(is, false); } - // :: warning: (required.method.not.called) + // :: warning: [required.method.not.called] public static void testUse(@Owning InputStream inputStream) throws Exception { MustCallAliasOnReceiver mcane = mcaneFactory(inputStream); mcane.close(); diff --git a/checker/tests/ainfer-resourceleak/non-annotated/MustCallAliasOnRegularExits.java b/checker/tests/ainfer-resourceleak/non-annotated/MustCallAliasOnRegularExits.java index a5c40ba80c4b..3bec2506c9c8 100644 --- a/checker/tests/ainfer-resourceleak/non-annotated/MustCallAliasOnRegularExits.java +++ b/checker/tests/ainfer-resourceleak/non-annotated/MustCallAliasOnRegularExits.java @@ -42,7 +42,7 @@ public void a() { void testMCAOnMCAConstructor() { Foo f = new Foo(); try { - // :: warning: (required.method.not.called) + // :: warning: [required.method.not.called] MCAConstructor mcaf = new MCAConstructor(f); } catch (IOException e) { } finally { diff --git a/checker/tests/ainfer-resourceleak/non-annotated/MustCallAliasParams.java b/checker/tests/ainfer-resourceleak/non-annotated/MustCallAliasParams.java index fbf6b29df9f8..4a62c9e3848f 100644 --- a/checker/tests/ainfer-resourceleak/non-annotated/MustCallAliasParams.java +++ b/checker/tests/ainfer-resourceleak/non-annotated/MustCallAliasParams.java @@ -31,7 +31,7 @@ public void a() { } void testMCAConstructor() { - // :: warning: (required.method.not.called) + // :: warning: [required.method.not.called] Foo f = new Foo(); MCAConstructor mcac = new MCAConstructor(f); mcac.a(); @@ -65,7 +65,7 @@ private class MCASuperCall extends MCASuperClass { } void mCASuperCallTest() { - // :: warning: (required.method.not.called) + // :: warning: [required.method.not.called] Foo f = new Foo(); MCASuperCall mcaSuperCall = new MCASuperCall(f); mcaSuperCall.a(); @@ -82,7 +82,7 @@ private class MCAThisCall extends MCASuperClass { } void mCAThisCallTest() { - // :: warning: (required.method.not.called) + // :: warning: [required.method.not.called] Foo f = new Foo(); MCAThisCall mcaThisCall = new MCAThisCall(f, true); mcaThisCall.a(); @@ -94,7 +94,7 @@ Foo returnFoo(Foo foo) { } void returnFooTest() { - // :: warning: (required.method.not.called) + // :: warning: [required.method.not.called] Foo f = new Foo(); Foo foo = returnFoo(f); foo.a(); @@ -111,14 +111,14 @@ MCASuperClass returnAliasFoo2(Foo foo, int i) { } void testReturnAliasFoo2() { - // :: warning: (required.method.not.called) + // :: warning: [required.method.not.called] Foo foo = new Foo(); MCASuperClass f = returnAliasFoo2(foo, 0); f.a(); } void returnAliasFooTest() { - // :: warning: (required.method.not.called) + // :: warning: [required.method.not.called] Foo f = new Foo(); Foo foo = returnAliasFoo(f); foo.a(); @@ -134,7 +134,7 @@ Foo returnFooAllPaths(Foo foo) { } void returnFooAllPathsTest() { - // :: warning: (required.method.not.called) + // :: warning: [required.method.not.called] Foo f = new Foo(); Foo foo = returnFooAllPaths(f); foo.a(); diff --git a/checker/tests/ainfer-resourceleak/non-annotated/OwnershipTransferOnConstructor.java b/checker/tests/ainfer-resourceleak/non-annotated/OwnershipTransferOnConstructor.java index 96b4382db38b..bdd924bf6975 100644 --- a/checker/tests/ainfer-resourceleak/non-annotated/OwnershipTransferOnConstructor.java +++ b/checker/tests/ainfer-resourceleak/non-annotated/OwnershipTransferOnConstructor.java @@ -19,7 +19,7 @@ void baz(Socket s) { Foo f = new Foo(s); } - // :: warning: (required.method.not.called) + // :: warning: [required.method.not.called] void testOwningOnBaz(@Owning Socket s) { Socket s2 = s; baz(s2); diff --git a/checker/tests/ainfer-resourceleak/non-annotated/OwningField.java b/checker/tests/ainfer-resourceleak/non-annotated/OwningField.java index 027715510463..144e517038a4 100644 --- a/checker/tests/ainfer-resourceleak/non-annotated/OwningField.java +++ b/checker/tests/ainfer-resourceleak/non-annotated/OwningField.java @@ -12,7 +12,7 @@ static class FinalOwningField { final Foo f; FinalOwningField() { - // :: warning: (required.method.not.called) + // :: warning: [required.method.not.called] f = new Foo(); } diff --git a/checker/tests/ainfer-resourceleak/non-annotated/OwningFieldIndirectCall.java b/checker/tests/ainfer-resourceleak/non-annotated/OwningFieldIndirectCall.java index 7c2c542e9b71..7bb343df70be 100644 --- a/checker/tests/ainfer-resourceleak/non-annotated/OwningFieldIndirectCall.java +++ b/checker/tests/ainfer-resourceleak/non-annotated/OwningFieldIndirectCall.java @@ -21,7 +21,7 @@ static class DisposeFieldUsingECM { final Foo f; // expect owning annotation for this field DisposeFieldUsingECM() { - // :: warning: (required.method.not.called) + // :: warning: [required.method.not.called] f = new Foo(); } diff --git a/checker/tests/ainfer-resourceleak/non-annotated/OwningParams.java b/checker/tests/ainfer-resourceleak/non-annotated/OwningParams.java index 1c1cd29eeef2..9846832adfbc 100644 --- a/checker/tests/ainfer-resourceleak/non-annotated/OwningParams.java +++ b/checker/tests/ainfer-resourceleak/non-annotated/OwningParams.java @@ -13,7 +13,7 @@ void passOwnership(Foo f) { } void passOwnershipTest() { - // :: warning: (required.method.not.called) + // :: warning: [required.method.not.called] Foo f = new Foo(); passOwnership(f); } @@ -44,15 +44,15 @@ void checkAlias(Foo f1) { } void checkAliasTest() { - // :: warning: (required.method.not.called) + // :: warning: [required.method.not.called] Foo f = new Foo(); checkAlias(f); } void passOwnershipTest() { - // :: warning: (required.method.not.called) + // :: warning: [required.method.not.called] Foo f1 = new Foo(); - // :: warning: (required.method.not.called) + // :: warning: [required.method.not.called] Foo f2 = new Foo(); passOwnership(f1, f2); } diff --git a/checker/tests/ainfer-resourceleak/non-annotated/ReplaceMustCallAliasAnnotation.java b/checker/tests/ainfer-resourceleak/non-annotated/ReplaceMustCallAliasAnnotation.java index b0599501ff3d..58d4c1609417 100644 --- a/checker/tests/ainfer-resourceleak/non-annotated/ReplaceMustCallAliasAnnotation.java +++ b/checker/tests/ainfer-resourceleak/non-annotated/ReplaceMustCallAliasAnnotation.java @@ -34,7 +34,7 @@ public void a() { void testOwningAnnotations() { Foo f1 = new Foo(); - // :: warning: (required.method.not.called) + // :: warning: [required.method.not.called] Foo f2 = new Foo(); TwoOwningFields t = new TwoOwningFields(f1, f2); t.a(); diff --git a/checker/tests/ainfer-testchecker/non-annotated/AnnotationWithFieldTest.java b/checker/tests/ainfer-testchecker/non-annotated/AnnotationWithFieldTest.java index b8b60bd5a108..44d8f82f7431 100644 --- a/checker/tests/ainfer-testchecker/non-annotated/AnnotationWithFieldTest.java +++ b/checker/tests/ainfer-testchecker/non-annotated/AnnotationWithFieldTest.java @@ -8,13 +8,13 @@ public class AnnotationWithFieldTest { void testAnnotationWithFields() { fields = getAinferSiblingWithFields(); - // :: warning: (argument) + // :: warning: [argument] expectsAinferSiblingWithFields(fields); } void testAnnotationWithEmptyFields() { emptyFields = getAinferSiblingWithFieldsEmpty(); - // :: warning: (argument) + // :: warning: [argument] expectsAinferSiblingWithEmptyFields(emptyFields); } diff --git a/checker/tests/ainfer-testchecker/non-annotated/Anonymous.java b/checker/tests/ainfer-testchecker/non-annotated/Anonymous.java index 5b0ba6ef35f1..7fbd41a90141 100644 --- a/checker/tests/ainfer-testchecker/non-annotated/Anonymous.java +++ b/checker/tests/ainfer-testchecker/non-annotated/Anonymous.java @@ -13,11 +13,11 @@ public Anonymous() { } void testPublicInference() { - // :: warning: (argument) + // :: warning: [argument] expectsAinferSibling2(field2); - // :: warning: (argument) + // :: warning: [argument] expectsParent(field1); - // :: warning: (argument) + // :: warning: [argument] expectsParent(field2); } diff --git a/checker/tests/ainfer-testchecker/non-annotated/AnonymousClassWithField.java b/checker/tests/ainfer-testchecker/non-annotated/AnonymousClassWithField.java index f7a59e06f9be..b9084443925b 100644 --- a/checker/tests/ainfer-testchecker/non-annotated/AnonymousClassWithField.java +++ b/checker/tests/ainfer-testchecker/non-annotated/AnonymousClassWithField.java @@ -14,12 +14,12 @@ public void test() { @Override public void testX() { - // :: warning: (argument) + // :: warning: [argument] requireAinferSibling1(s1); } public void testY() { - // :: warning: (argument) + // :: warning: [argument] requireAinferSibling1(toaster); } }); diff --git a/checker/tests/ainfer-testchecker/non-annotated/CompoundTypeTest.java b/checker/tests/ainfer-testchecker/non-annotated/CompoundTypeTest.java index dc03c80ad4be..54265ff3f5e8 100644 --- a/checker/tests/ainfer-testchecker/non-annotated/CompoundTypeTest.java +++ b/checker/tests/ainfer-testchecker/non-annotated/CompoundTypeTest.java @@ -10,7 +10,7 @@ void assign() { } void test() { - // :: warning: (argument) + // :: warning: [argument] expectsCompoundType(field); } diff --git a/checker/tests/ainfer-testchecker/non-annotated/ConflictingAnnotationsTest.java b/checker/tests/ainfer-testchecker/non-annotated/ConflictingAnnotationsTest.java index 867133d1ae12..ee82703b837e 100644 --- a/checker/tests/ainfer-testchecker/non-annotated/ConflictingAnnotationsTest.java +++ b/checker/tests/ainfer-testchecker/non-annotated/ConflictingAnnotationsTest.java @@ -16,7 +16,7 @@ int getWPINamespaceAinferSibling1() { } void test() { - // :: warning: (argument) + // :: warning: [argument] expectsAinferSibling1(getWPINamespaceAinferSibling1()); } diff --git a/checker/tests/ainfer-testchecker/non-annotated/ConstructorTest.java b/checker/tests/ainfer-testchecker/non-annotated/ConstructorTest.java index 66ab605e6947..1b44667b5c0b 100644 --- a/checker/tests/ainfer-testchecker/non-annotated/ConstructorTest.java +++ b/checker/tests/ainfer-testchecker/non-annotated/ConstructorTest.java @@ -6,7 +6,7 @@ public ConstructorTest(int top) {} void test() { @AinferTop int top = (@AinferTop int) 0; - // :: warning: (argument) + // :: warning: [argument] new ConstructorTest(top); } } diff --git a/checker/tests/ainfer-testchecker/non-annotated/EnsuresQualifierParamsTest.java b/checker/tests/ainfer-testchecker/non-annotated/EnsuresQualifierParamsTest.java index 40e1c58da74b..5caa42916649 100644 --- a/checker/tests/ainfer-testchecker/non-annotated/EnsuresQualifierParamsTest.java +++ b/checker/tests/ainfer-testchecker/non-annotated/EnsuresQualifierParamsTest.java @@ -112,73 +112,73 @@ void noEnsures() {} void client1(Object arg) { argIsParent(arg); - // :: warning: (assignment) + // :: warning: [assignment] @AinferParent Object p = arg; } void client2(Object arg) { argIsParent_2(arg, true); - // :: warning: (assignment) + // :: warning: [assignment] @AinferParent Object p = arg; } void client3(Object arg) { argIsAinferSibling2(arg); - // :: warning: (assignment) + // :: warning: [assignment] @AinferSibling2 Object x = arg; } void client4(Object arg) { argIsAinferSibling2_2(arg, true); - // :: warning: (assignment) + // :: warning: [assignment] @AinferSibling2 Object x = arg; } void clientThis1() { thisIsParent(); - // :: warning: (assignment) + // :: warning: [assignment] @AinferParent Object o = this; } void clientThis2() { thisIsParent_2(true); - // :: warning: (assignment) + // :: warning: [assignment] @AinferParent Object o = this; } void clientThis2_2() { thisIsParent_2(false); - // :: warning: (assignment) + // :: warning: [assignment] @AinferParent Object o = this; } void clientThis2_3() { thisIsParent_3(false); - // :: warning: (assignment) + // :: warning: [assignment] @AinferParent Object o = this; } void clientThis3() { thisIsAinferSibling2(); - // :: warning: (assignment) + // :: warning: [assignment] @AinferSibling2 Object o = this; } void clientThis4() { thisIsAinferSibling2_2(true); - // :: warning: (assignment) + // :: warning: [assignment] @AinferSibling2 Object o = this; } void clientThis5() { thisIsAinferSibling2_2_2(true); - // :: warning: (assignment) + // :: warning: [assignment] @AinferSibling2 Object o = this; } void clientThis6() { thisIsParent_2_2(true); - // :: warning: (assignment) + // :: warning: [assignment] @AinferParent Object o = this; } } diff --git a/checker/tests/ainfer-testchecker/non-annotated/EnsuresQualifierTest.java b/checker/tests/ainfer-testchecker/non-annotated/EnsuresQualifierTest.java index f0eb12ac84a3..26351c093723 100644 --- a/checker/tests/ainfer-testchecker/non-annotated/EnsuresQualifierTest.java +++ b/checker/tests/ainfer-testchecker/non-annotated/EnsuresQualifierTest.java @@ -52,31 +52,31 @@ void noEnsures() {} void client1() { field1IsParent(); - // :: warning: (assignment) + // :: warning: [assignment] @AinferParent int p = field1; } void client2() { field1IsParent_2(true); - // :: warning: (assignment) + // :: warning: [assignment] @AinferParent int p = field1; } void client3() { field1IsAinferSibling2(); - // :: warning: (assignment) + // :: warning: [assignment] @AinferSibling2 int x = field1; } void client4() { field1IsAinferSibling2_2(true); - // :: warning: (assignment) + // :: warning: [assignment] @AinferSibling2 int x = field1; } void client5() { parentIsAinferSibling1(); - // :: warning: (assignment) + // :: warning: [assignment] @AinferSibling1 int x = parent; } } diff --git a/checker/tests/ainfer-testchecker/non-annotated/EnumConstants.java b/checker/tests/ainfer-testchecker/non-annotated/EnumConstants.java index ffdfc511cb2b..f3ac7cfc3aeb 100644 --- a/checker/tests/ainfer-testchecker/non-annotated/EnumConstants.java +++ b/checker/tests/ainfer-testchecker/non-annotated/EnumConstants.java @@ -15,7 +15,7 @@ enum MyEnum { void requiresS1(@AinferSibling1 MyEnum e) {} void test() { - // :: warning: (argument) + // :: warning: [argument] requiresS1(MyEnum.ONE); } } diff --git a/checker/tests/ainfer-testchecker/non-annotated/EnumWithInnerClass.java b/checker/tests/ainfer-testchecker/non-annotated/EnumWithInnerClass.java index 3c33beff3eda..99002925d5ed 100644 --- a/checker/tests/ainfer-testchecker/non-annotated/EnumWithInnerClass.java +++ b/checker/tests/ainfer-testchecker/non-annotated/EnumWithInnerClass.java @@ -14,7 +14,7 @@ int getAinferSibling1() { void requireAinferSibling1(@AinferSibling1 int x) {} void test() { - // :: warning: (argument) + // :: warning: [argument] requireAinferSibling1(getAinferSibling1()); } } diff --git a/checker/tests/ainfer-testchecker/non-annotated/ExpectedErrors.java b/checker/tests/ainfer-testchecker/non-annotated/ExpectedErrors.java index f104269b1cca..fd90105d12d1 100644 --- a/checker/tests/ainfer-testchecker/non-annotated/ExpectedErrors.java +++ b/checker/tests/ainfer-testchecker/non-annotated/ExpectedErrors.java @@ -24,9 +24,9 @@ void assignFieldsToAinferSibling1() { } void testFields() { - // :: warning: (argument) + // :: warning: [argument] expectsAinferSibling1(privateDeclaredField); - // :: warning: (argument) + // :: warning: [argument] expectsAinferSibling1(publicDeclaredField); } @@ -36,9 +36,9 @@ void testFields() { // The refinement cannot happen and an assignemnt type incompatible error occurs. void assignFieldsToAinferTop() { - // :: warning: (assignment) + // :: warning: [assignment] privateDeclaredField2 = getAinferTop(); - // :: warning: (assignment) + // :: warning: [assignment] publicDeclaredField2 = getAinferTop(); } @@ -70,16 +70,16 @@ void assignLubFieldsToAinferSibling1() { } void testLUBFields1() { - // :: warning: (argument) + // :: warning: [argument] expectsAinferSibling1(lubPrivateField); - // :: warning: (argument) + // :: warning: [argument] expectsAinferSibling1(lubPublicField); } void testLUBFields2() { - // :: warning: (argument) + // :: warning: [argument] expectsAinferSibling2(lubPrivateField); - // :: warning: (argument) + // :: warning: [argument] expectsAinferSibling2(lubPublicField); } @@ -95,13 +95,13 @@ public static int lubTest() { public @AinferSibling1 int getAinferSibling1Wrong() { int x = lubTest(); - // :: warning: (return) + // :: warning: [return] return x; } public @AinferSibling2 int getAinferSibling2Wrong() { int x = lubTest(); - // :: warning: (return) + // :: warning: [return] return x; } @@ -140,7 +140,7 @@ void test(Field f) throws Exception { } void setBoolean(Object o, boolean b) { - // :: warning: (assignment) + // :: warning: [assignment] @AinferBottom Object bot = o; } @@ -161,15 +161,15 @@ public void suppressWarningsTest2() { } public void suppressWarningsValidation() { - // :: warning: (argument) + // :: warning: [argument] expectsAinferSibling1(i); - // :: warning: (argument) + // :: warning: [argument] expectsAinferSibling1(i2); - // :: warning: (argument) + // :: warning: [argument] expectsAinferSibling1(SuppressWarningsInner.i); - // :: warning: (argument) + // :: warning: [argument] expectsAinferSibling1(SuppressWarningsInner.i2); - // :: warning: (argument) + // :: warning: [argument] expectsAinferSibling1(suppressWarningsMethodReturn()); suppressWarningsMethodParams(getAinferSibling1()); @@ -210,9 +210,9 @@ void assignFieldsToBottom() { // Testing the refinement above. void testFields() { - // :: warning: (argument) + // :: warning: [argument] expectsBottom(privateField); - // :: warning: (argument) + // :: warning: [argument] expectsBottom(publicField); } } @@ -227,16 +227,16 @@ void foo() { } void test() { - // :: warning: (argument) + // :: warning: [argument] expectsAinferSibling1(field); - // :: warning: (argument) + // :: warning: [argument] expectsAinferSibling1(field2); } } class AssignParam { public void f(@AinferBottom Object param) { - // :: warning: (assignment) + // :: warning: [assignment] param = ((@AinferTop Object) null); } } diff --git a/checker/tests/ainfer-testchecker/non-annotated/FromReceiver.java b/checker/tests/ainfer-testchecker/non-annotated/FromReceiver.java index 1e1984892b04..c647380c6352 100644 --- a/checker/tests/ainfer-testchecker/non-annotated/FromReceiver.java +++ b/checker/tests/ainfer-testchecker/non-annotated/FromReceiver.java @@ -14,22 +14,22 @@ public void source(@AinferSibling1 FromReceiver this) { } public void sinkNoThis() { - // :: warning: (assignment) + // :: warning: [assignment] @AinferSibling1 FromReceiver f = this; } public void sinkExplicitThis(FromReceiver this) { - // :: warning: (assignment) + // :: warning: [assignment] @AinferSibling1 FromReceiver f = this; } public void sinkNoThis2() { - // :: warning: (assignment) + // :: warning: [assignment] @AinferSibling1 FromReceiver f = this; } public void sinkExplicitThis2(FromReceiver this) { - // :: warning: (assignment) + // :: warning: [assignment] @AinferSibling1 FromReceiver f = this; } @@ -39,12 +39,12 @@ public static void source2(@AinferSibling1 FromReceiver f1) { } public void sinkNoThis3() { - // :: warning: (assignment) + // :: warning: [assignment] @AinferSibling1 FromReceiver f = this; } public void sinkExplicitThis3(FromReceiver this) { - // :: warning: (assignment) + // :: warning: [assignment] @AinferSibling1 FromReceiver f = this; } } diff --git a/checker/tests/ainfer-testchecker/non-annotated/IShouldBeSibling1.java b/checker/tests/ainfer-testchecker/non-annotated/IShouldBeSibling1.java index 289783b8da67..cbfaa7b44a04 100644 --- a/checker/tests/ainfer-testchecker/non-annotated/IShouldBeSibling1.java +++ b/checker/tests/ainfer-testchecker/non-annotated/IShouldBeSibling1.java @@ -8,7 +8,7 @@ @SuppressWarnings("super.invocation") // Intentional. public class IShouldBeSibling1 { public static void test(IShouldBeSibling1 s1) { - // :: warning: (assignment) + // :: warning: [assignment] @AinferSibling1 IShouldBeSibling1 s = s1; } } diff --git a/checker/tests/ainfer-testchecker/non-annotated/IgnoreMetaAnnotationTest1.java b/checker/tests/ainfer-testchecker/non-annotated/IgnoreMetaAnnotationTest1.java index a38657e98508..68154899c909 100644 --- a/checker/tests/ainfer-testchecker/non-annotated/IgnoreMetaAnnotationTest1.java +++ b/checker/tests/ainfer-testchecker/non-annotated/IgnoreMetaAnnotationTest1.java @@ -10,7 +10,7 @@ void foo() { } void test() { - // :: warning: (argument) + // :: warning: [argument] expectsAinferSibling1(field2); } diff --git a/checker/tests/ainfer-testchecker/non-annotated/InheritanceTest.java b/checker/tests/ainfer-testchecker/non-annotated/InheritanceTest.java index 85e58e3a9785..33350110f323 100644 --- a/checker/tests/ainfer-testchecker/non-annotated/InheritanceTest.java +++ b/checker/tests/ainfer-testchecker/non-annotated/InheritanceTest.java @@ -5,9 +5,9 @@ class IParent { int field; public void expectsBotNoSignature(int t) { - // :: warning: (argument) + // :: warning: [argument] expectsBot(t); - // :: warning: (argument) + // :: warning: [argument] expectsBot(field); } diff --git a/checker/tests/ainfer-testchecker/non-annotated/InnerClassFieldDeclAnno.java b/checker/tests/ainfer-testchecker/non-annotated/InnerClassFieldDeclAnno.java index fb1d985d8b0a..eb97415eea0c 100644 --- a/checker/tests/ainfer-testchecker/non-annotated/InnerClassFieldDeclAnno.java +++ b/checker/tests/ainfer-testchecker/non-annotated/InnerClassFieldDeclAnno.java @@ -16,7 +16,7 @@ static class Inner {} @AinferTreatAsSibling1 public Outer.Inner preAnnotated = null; public static void test(InnerClassFieldDeclAnno a) { - // :: warning: (assignment) + // :: warning: [assignment] @AinferSibling1 Object obj = a.iShouldBeTreatedAsSibling1; // Test that the annotation works as expected. @AinferSibling1 Object obj2 = a.preAnnotated; diff --git a/checker/tests/ainfer-testchecker/non-annotated/LUBAssignmentTest.java b/checker/tests/ainfer-testchecker/non-annotated/LUBAssignmentTest.java index c2fb31ccc2b0..3fd4210ead09 100644 --- a/checker/tests/ainfer-testchecker/non-annotated/LUBAssignmentTest.java +++ b/checker/tests/ainfer-testchecker/non-annotated/LUBAssignmentTest.java @@ -20,9 +20,9 @@ void assignFieldsToAinferSibling1() { // LUB between @AinferSibling1 and @AinferSibling2 is @AinferParent, therefore the assignments // above refine the type of privateField to @AinferParent. void testFields() { - // :: warning: (argument) + // :: warning: [argument] expectsParent(privateField); - // :: warning: (argument) + // :: warning: [argument] expectsParent(publicField); } diff --git a/checker/tests/ainfer-testchecker/non-annotated/MethodDefinedInSupertype.java b/checker/tests/ainfer-testchecker/non-annotated/MethodDefinedInSupertype.java index f8580e2d7f93..415471c981e8 100644 --- a/checker/tests/ainfer-testchecker/non-annotated/MethodDefinedInSupertype.java +++ b/checker/tests/ainfer-testchecker/non-annotated/MethodDefinedInSupertype.java @@ -4,7 +4,7 @@ abstract class MethodDefinedInSupertype { void test() { - // :: warning: (argument) + // :: warning: [argument] expectsAinferSibling1(shouldReturnAinferSibling1()); } @@ -13,7 +13,7 @@ public void expectsAinferSibling1(@AinferSibling1 int t) {} public abstract int shouldReturnAinferSibling1(); void testMultipleOverrides() { - // :: warning: (argument) + // :: warning: [argument] expectsParent(shouldReturnParent()); } diff --git a/checker/tests/ainfer-testchecker/non-annotated/MethodReturnTest.java b/checker/tests/ainfer-testchecker/non-annotated/MethodReturnTest.java index eff127c7752d..390e30e2f851 100644 --- a/checker/tests/ainfer-testchecker/non-annotated/MethodReturnTest.java +++ b/checker/tests/ainfer-testchecker/non-annotated/MethodReturnTest.java @@ -9,7 +9,7 @@ static int getAinferSibling1NotAnnotated() { } static @AinferSibling1 int getAinferSibling1() { - // :: warning: (return) + // :: warning: [return] return getAinferSibling1NotAnnotated(); } @@ -25,7 +25,7 @@ public static int lubTest() { public static @AinferParent int getParent() { int x = lubTest(); - // :: warning: (return) + // :: warning: [return] return x; } @@ -38,7 +38,7 @@ int getParent2() { } void receivesAinferSibling1(int i) { - // :: warning: (argument) + // :: warning: [argument] expectsAinferSibling1(i); } diff --git a/checker/tests/ainfer-testchecker/non-annotated/MultiDimensionalArrays.java b/checker/tests/ainfer-testchecker/non-annotated/MultiDimensionalArrays.java index d818fc6bc43a..7fd39da3b31e 100644 --- a/checker/tests/ainfer-testchecker/non-annotated/MultiDimensionalArrays.java +++ b/checker/tests/ainfer-testchecker/non-annotated/MultiDimensionalArrays.java @@ -18,7 +18,7 @@ void requiresS1S2(@AinferSibling1 int @AinferSibling2 [] x) {} int[] twoDimArray; void testField() { - // :: warning: (argument) + // :: warning: [argument] requiresS1S2(twoDimArray); } @@ -27,7 +27,7 @@ void useField(@AinferSibling1 int @AinferSibling2 [] x) { } void testParam(int[] x) { - // :: warning: (argument) + // :: warning: [argument] requiresS1S2(x); } @@ -41,9 +41,9 @@ int[] useReturn(@AinferSibling1 int @AinferSibling2 [] x) { void testReturn() { requiresS1S2( - // :: warning: (argument) + // :: warning: [argument] useReturn( - // :: warning: (argument) + // :: warning: [argument] twoDimArray)); } @@ -54,7 +54,7 @@ void requiresS1S2S1(@AinferSibling1 int @AinferSibling2 [] @AinferSibling1 [] x) int[][] threeDimArray; void testField2() { - // :: warning: (argument) + // :: warning: [argument] requiresS1S2S1(threeDimArray); } @@ -63,7 +63,7 @@ void useField2(@AinferSibling1 int @AinferSibling2 [] @AinferSibling1 [] x) { } void testParam2(int[][] x) { - // :: warning: (argument) + // :: warning: [argument] requiresS1S2S1(x); } @@ -76,7 +76,7 @@ int[][] useReturn2(@AinferSibling1 int @AinferSibling2 [] @AinferSibling1 [] x) } void testReturn2() { - // :: warning: (argument) + // :: warning: [argument] requiresS1S2S1(useReturn2(threeDimArray)); } @@ -87,7 +87,7 @@ void requiresS1S2N(@AinferSibling1 int @AinferSibling2 [][] x) {} int[][] threeDimArray2; void testField3() { - // :: warning: (argument) + // :: warning: [argument] requiresS1S2N(threeDimArray2); } @@ -96,7 +96,7 @@ void useField3(@AinferSibling1 int @AinferSibling2 [][] x) { } void testParam3(int[][] x) { - // :: warning: (argument) + // :: warning: [argument] requiresS1S2N(x); } @@ -109,7 +109,7 @@ int[][] useReturn3(@AinferSibling1 int @AinferSibling2 [][] x) { } void testReturn3() { - // :: warning: (argument) + // :: warning: [argument] requiresS1S2N(useReturn3(threeDimArray2)); } @@ -120,7 +120,7 @@ void requiresS2S1(int @AinferSibling2 [] @AinferSibling1 [] x) {} int[][] threeDimArray3; void testField4() { - // :: warning: (argument) + // :: warning: [argument] requiresS2S1(threeDimArray3); } @@ -129,7 +129,7 @@ void useField4(int @AinferSibling2 [] @AinferSibling1 [] x) { } void testParam4(int[][] x) { - // :: warning: (argument) + // :: warning: [argument] requiresS2S1(x); } @@ -142,7 +142,7 @@ int[][] useReturn4(int @AinferSibling2 [] @AinferSibling1 [] x) { } void testReturn4() { - // :: warning: (argument) + // :: warning: [argument] requiresS2S1(useReturn4(threeDimArray3)); } @@ -156,7 +156,7 @@ void requiresSf1Sf2Sf3( int[][] threeDimArray4; void testField5() { - // :: warning: (argument) + // :: warning: [argument] requiresSf1Sf2Sf3(threeDimArray4); } @@ -168,7 +168,7 @@ void useField5( } void testParam5(int[][] x) { - // :: warning: (argument) + // :: warning: [argument] requiresSf1Sf2Sf3(x); } @@ -187,7 +187,7 @@ int[][] useReturn5( } void testReturn5() { - // :: warning: (argument) + // :: warning: [argument] requiresSf1Sf2Sf3(useReturn5(threeDimArray4)); } @@ -196,7 +196,7 @@ void testReturn5() { int[][] threeDimArray5; void testField6() { - // :: warning: (argument) + // :: warning: [argument] requiresS1S2S1(threeDimArray5); } @@ -206,7 +206,7 @@ void useField6( } void testParam6(int[][] x) { - // :: warning: (argument) + // :: warning: [argument] requiresS1S2S1(x); } @@ -221,7 +221,7 @@ int[][] useReturn6( } void testReturn6() { - // :: warning: (argument) + // :: warning: [argument] requiresS1S2S1(useReturn6(threeDimArray)); } @@ -231,7 +231,7 @@ void testReturn6() { List[] arrayofListsOfStringArrays; void testField7() { - // :: warning: (argument) + // :: warning: [argument] requiresS1S2L(arrayofListsOfStringArrays); } @@ -244,7 +244,7 @@ void useField7( } void testParam7(List[] x) { - // :: warning: (argument) + // :: warning: [argument] requiresS1S2L(x); } @@ -259,7 +259,7 @@ List[] useReturn7( } void testReturn7() { - // :: warning: (argument) + // :: warning: [argument] requiresS1S2L(useReturn7(arrayofListsOfStringArrays)); } } diff --git a/checker/tests/ainfer-testchecker/non-annotated/OtherAnnotations.java b/checker/tests/ainfer-testchecker/non-annotated/OtherAnnotations.java index 0ad71bb1dcd2..45fe157cabd7 100644 --- a/checker/tests/ainfer-testchecker/non-annotated/OtherAnnotations.java +++ b/checker/tests/ainfer-testchecker/non-annotated/OtherAnnotations.java @@ -14,12 +14,12 @@ void assignX(@AinferSibling1 int y) { } void useX() { - // :: warning: (argument) + // :: warning: [argument] requireAinferSibling1(x); } void methodWithAnnotatedParam(@Unique int z) { - // :: warning: (argument) + // :: warning: [argument] requireAinferSibling1(z); } @@ -36,7 +36,7 @@ void useMethodWithAnnotatedParam(@AinferSibling1 int w) { } void useGetIntVal5() { - // :: warning: (argument) + // :: warning: [argument] requireAinferSibling1(getIntVal5()); } } diff --git a/checker/tests/ainfer-testchecker/non-annotated/OverriddenMethodsTest.java b/checker/tests/ainfer-testchecker/non-annotated/OverriddenMethodsTest.java index e97d15a3a3a9..c2821282cd96 100644 --- a/checker/tests/ainfer-testchecker/non-annotated/OverriddenMethodsTest.java +++ b/checker/tests/ainfer-testchecker/non-annotated/OverriddenMethodsTest.java @@ -11,12 +11,12 @@ public void barz( @AinferSibling1 OverriddenMethodsTestParent this, @AinferSibling2 Object obj) {} public void qux(Object obj1, Object obj2) { - // :: warning: (argument) + // :: warning: [argument] foo(obj1, obj2); } public void thud(Object obj1, Object obj2) { - // :: warning: (argument) + // :: warning: [argument] foo(obj1, obj2); } } @@ -24,17 +24,17 @@ public void thud(Object obj1, Object obj2) { class OverriddenMethodsTestChild extends OverriddenMethodsTestParent { @Override public void foo(Object obj, Object obj2) { - // :: warning: (assignment) + // :: warning: [assignment] @AinferSibling1 Object o = obj; - // :: warning: (assignment) + // :: warning: [assignment] @AinferSibling2 Object o2 = obj2; } @Override public void bar(Object obj) { - // :: warning: (assignment) + // :: warning: [assignment] @AinferSibling1 OverriddenMethodsTestChild child = this; - // :: warning: (assignment) + // :: warning: [assignment] @AinferSibling2 Object o = obj; } diff --git a/checker/tests/ainfer-testchecker/non-annotated/ParameterInferenceTest.java b/checker/tests/ainfer-testchecker/non-annotated/ParameterInferenceTest.java index 7e0f33b66a55..32541e87382d 100644 --- a/checker/tests/ainfer-testchecker/non-annotated/ParameterInferenceTest.java +++ b/checker/tests/ainfer-testchecker/non-annotated/ParameterInferenceTest.java @@ -9,13 +9,13 @@ void test1() { } void expectsParentNoSignature(int t) { - // :: warning: (assignment) + // :: warning: [assignment] @AinferParent int parent = t; } void test2() { @AinferTop int top = (@AinferTop int) 0; - // :: warning: (argument) + // :: warning: [argument] expectsAinferTopNoSignature(top); } diff --git a/checker/tests/ainfer-testchecker/non-annotated/Planet.java b/checker/tests/ainfer-testchecker/non-annotated/Planet.java index c2a8e80e5b4b..31df57797635 100644 --- a/checker/tests/ainfer-testchecker/non-annotated/Planet.java +++ b/checker/tests/ainfer-testchecker/non-annotated/Planet.java @@ -50,7 +50,7 @@ void test(@AinferSibling1 int x) { } void test2() { - // :: warning: (argument) + // :: warning: [argument] test(foo); } } diff --git a/checker/tests/ainfer-testchecker/non-annotated/PublicFieldTest.java b/checker/tests/ainfer-testchecker/non-annotated/PublicFieldTest.java index 0b48ef3a3598..ddde7811a094 100644 --- a/checker/tests/ainfer-testchecker/non-annotated/PublicFieldTest.java +++ b/checker/tests/ainfer-testchecker/non-annotated/PublicFieldTest.java @@ -13,11 +13,11 @@ public PublicFieldTest() { } void testPublicInference() { - // :: warning: (argument) + // :: warning: [argument] expectsAinferSibling2(field2); - // :: warning: (argument) + // :: warning: [argument] expectsParent(field1); - // :: warning: (argument) + // :: warning: [argument] expectsParent(field2); } @@ -46,7 +46,7 @@ public AnotherClass() { } void innerFieldTest() { - // :: warning: (argument) + // :: warning: [argument] expectsAinferSibling2(innerField); } diff --git a/checker/tests/ainfer-testchecker/non-annotated/Purity.java b/checker/tests/ainfer-testchecker/non-annotated/Purity.java index f2193ce6d16d..752e987427c1 100644 --- a/checker/tests/ainfer-testchecker/non-annotated/Purity.java +++ b/checker/tests/ainfer-testchecker/non-annotated/Purity.java @@ -23,7 +23,7 @@ static String myPureMethod() { void context() { PureFunc f1 = TestPure1::myPureMethod; - // :: warning: (purity.methodref) + // :: warning: [purity.methodref] PureFunc f2 = TestPure1::myMethod; } } diff --git a/checker/tests/ainfer-testchecker/non-annotated/RequiresQualifierTest.java b/checker/tests/ainfer-testchecker/non-annotated/RequiresQualifierTest.java index 893a5b44d44e..cd0b768736bb 100644 --- a/checker/tests/ainfer-testchecker/non-annotated/RequiresQualifierTest.java +++ b/checker/tests/ainfer-testchecker/non-annotated/RequiresQualifierTest.java @@ -16,17 +16,17 @@ class RequiresQualifierTest { @AinferBottom int bottom; void field1IsParent() { - // :: warning: (assignment) + // :: warning: [assignment] @AinferParent int x = field1; } void field1IsAinferSibling2() { - // :: warning: (assignment) + // :: warning: [assignment] @AinferSibling2 int x = field1; } void parentIsAinferSibling1() { - // :: warning: (assignment) + // :: warning: [assignment] @AinferSibling1 int x = parent; } diff --git a/checker/tests/ainfer-testchecker/non-annotated/StringConcatenationTest.java b/checker/tests/ainfer-testchecker/non-annotated/StringConcatenationTest.java index 4b5ebd233cf6..ddbe4763d186 100644 --- a/checker/tests/ainfer-testchecker/non-annotated/StringConcatenationTest.java +++ b/checker/tests/ainfer-testchecker/non-annotated/StringConcatenationTest.java @@ -16,7 +16,7 @@ void foo() { } void test() { - // :: warning: (argument) + // :: warning: [argument] expectsAinferSibling1(options_str); } diff --git a/checker/tests/ainfer-testchecker/non-annotated/TreatAsSibling1InferenceTest.java b/checker/tests/ainfer-testchecker/non-annotated/TreatAsSibling1InferenceTest.java index d7a32a59ffcf..1cd9a10e8ba9 100644 --- a/checker/tests/ainfer-testchecker/non-annotated/TreatAsSibling1InferenceTest.java +++ b/checker/tests/ainfer-testchecker/non-annotated/TreatAsSibling1InferenceTest.java @@ -7,7 +7,7 @@ public class TreatAsSibling1InferenceTest { public void test(Object iShouldBeTreatedAsSibling1) { - // :: warning: (assignment) + // :: warning: [assignment] @AinferSibling1 Object x = iShouldBeTreatedAsSibling1; } } diff --git a/checker/tests/ainfer-testchecker/non-annotated/TwoMethodsSameName.java b/checker/tests/ainfer-testchecker/non-annotated/TwoMethodsSameName.java index 45f71b5ab420..2ca3209bd286 100644 --- a/checker/tests/ainfer-testchecker/non-annotated/TwoMethodsSameName.java +++ b/checker/tests/ainfer-testchecker/non-annotated/TwoMethodsSameName.java @@ -7,14 +7,14 @@ public class TwoMethodsSameName { void test(int x, int y) { - // :: warning: (assignment) + // :: warning: [assignment] @AinferSibling1 int x1 = x; - // :: warning: (assignment) + // :: warning: [assignment] @AinferSibling2 int y1 = y; } void test(int z) { - // :: warning: (assignment) + // :: warning: [assignment] @AinferSibling2 int z1 = z; } diff --git a/checker/tests/ainfer-testchecker/non-annotated/TypeVariablesTest3.java b/checker/tests/ainfer-testchecker/non-annotated/TypeVariablesTest3.java index 80decf4e9d72..6fb4a461caff 100644 --- a/checker/tests/ainfer-testchecker/non-annotated/TypeVariablesTest3.java +++ b/checker/tests/ainfer-testchecker/non-annotated/TypeVariablesTest3.java @@ -8,7 +8,7 @@ public class TypeVariablesTest3<@AinferSibling1 T extends @AinferSibling1 Object public T tField; void foo(T param) { - // :: warning: (assignment) + // :: warning: [assignment] param = sibling2; } @@ -17,7 +17,7 @@ void baz(T param) { } void bar(@AinferSibling2 T param) { - // :: warning: (assignment) + // :: warning: [assignment] tField = param; } } diff --git a/checker/tests/ainfer-testchecker/non-annotated/UsesAnonymous.java b/checker/tests/ainfer-testchecker/non-annotated/UsesAnonymous.java index 8f30e8f7ebca..a23c9d352f3e 100644 --- a/checker/tests/ainfer-testchecker/non-annotated/UsesAnonymous.java +++ b/checker/tests/ainfer-testchecker/non-annotated/UsesAnonymous.java @@ -15,7 +15,7 @@ public void method2() { } void innerFieldTest() { - // :: warning: (argument) + // :: warning: [argument] expectsAinferSibling2(innerField); } diff --git a/checker/tests/ainfer-testchecker/non-annotated/ValueCheck.java b/checker/tests/ainfer-testchecker/non-annotated/ValueCheck.java index e8eb25bc6fbb..857293c26d9d 100644 --- a/checker/tests/ainfer-testchecker/non-annotated/ValueCheck.java +++ b/checker/tests/ainfer-testchecker/non-annotated/ValueCheck.java @@ -18,9 +18,9 @@ void requireIntVal5(@IntVal(5) int x) {} void test() { int x = getAinferSibling1withValue5(); - // :: warning: (argument) + // :: warning: [argument] requireAinferSibling1(x); - // :: warning: (argument) + // :: warning: [argument] requireIntVal5(x); } } diff --git a/checker/tests/calledmethods-autovalue/Animal.java b/checker/tests/calledmethods-autovalue/Animal.java index 67d975e1ed53..d60853015106 100644 --- a/checker/tests/calledmethods-autovalue/Animal.java +++ b/checker/tests/calledmethods-autovalue/Animal.java @@ -45,7 +45,7 @@ abstract static class Builder { public static void buildSomethingWrong() { Builder b = builder(); b.setName("Frank"); - // :: error: (finalizer.invocation) + // :: error: [finalizer.invocation] b.build(); } @@ -65,7 +65,7 @@ public static void buildSomethingRightIncludeOptional() { } public static void buildSomethingWrongFluent() { - // :: error: (finalizer.invocation) + // :: error: [finalizer.invocation] builder().setName("Frank").build(); } diff --git a/checker/tests/calledmethods-autovalue/AnimalNoSet.java b/checker/tests/calledmethods-autovalue/AnimalNoSet.java index 14802b351528..0c5ca00ea514 100644 --- a/checker/tests/calledmethods-autovalue/AnimalNoSet.java +++ b/checker/tests/calledmethods-autovalue/AnimalNoSet.java @@ -37,7 +37,7 @@ abstract static class Builder { public static void buildSomethingWrong() { Builder b = builder(); b.name("Frank"); - // :: error: (finalizer.invocation) + // :: error: [finalizer.invocation] b.build(); } @@ -57,7 +57,7 @@ public static void buildSomethingRightIncludeOptional() { } public static void buildSomethingWrongFluent() { - // :: error: (finalizer.invocation) + // :: error: [finalizer.invocation] builder().name("Frank").build(); } diff --git a/checker/tests/calledmethods-autovalue/BuilderGetter.java b/checker/tests/calledmethods-autovalue/BuilderGetter.java index 8d29ac9a4cc9..2640174e25c3 100644 --- a/checker/tests/calledmethods-autovalue/BuilderGetter.java +++ b/checker/tests/calledmethods-autovalue/BuilderGetter.java @@ -30,7 +30,7 @@ static void correct() { static void wrong() { Builder b = builder(); b.name(); - // :: error: (finalizer.invocation) + // :: error: [finalizer.invocation] b.build(); } } diff --git a/checker/tests/calledmethods-autovalue/FooParcelable.java b/checker/tests/calledmethods-autovalue/FooParcelable.java index 8416e6c2dd0e..0eb998860d64 100644 --- a/checker/tests/calledmethods-autovalue/FooParcelable.java +++ b/checker/tests/calledmethods-autovalue/FooParcelable.java @@ -24,7 +24,7 @@ abstract static class Builder { public static void buildSomethingWrong() { Builder b = builder(); - // :: error: (finalizer.invocation) + // :: error: [finalizer.invocation] b.build(); } diff --git a/checker/tests/calledmethods-autovalue/GetAndIs.java b/checker/tests/calledmethods-autovalue/GetAndIs.java index c7f76c877db5..a1e3233e249a 100644 --- a/checker/tests/calledmethods-autovalue/GetAndIs.java +++ b/checker/tests/calledmethods-autovalue/GetAndIs.java @@ -25,7 +25,7 @@ abstract static class Builder { public static void buildSomethingWrong() { Builder b = builder(); b.setGet("Frank"); - // :: error: (finalizer.invocation) + // :: error: [finalizer.invocation] b.build(); } @@ -37,7 +37,7 @@ public static void buildSomethingRight() { } public static void buildSomethingWrongFluent() { - // :: error: (finalizer.invocation) + // :: error: [finalizer.invocation] builder().setGet("Frank").build(); } diff --git a/checker/tests/calledmethods-autovalue/GetAnimal.java b/checker/tests/calledmethods-autovalue/GetAnimal.java index d6a73e18b8c6..a6905c67d0f4 100644 --- a/checker/tests/calledmethods-autovalue/GetAnimal.java +++ b/checker/tests/calledmethods-autovalue/GetAnimal.java @@ -37,7 +37,7 @@ abstract static class Builder { public static void buildSomethingWrong() { Builder b = builder(); b.setName("Frank"); - // :: error: (finalizer.invocation) + // :: error: [finalizer.invocation] b.build(); } @@ -59,7 +59,7 @@ public static void buildSomethingRightIncludeOptional() { } public static void buildSomethingWrongFluent() { - // :: error: (finalizer.invocation) + // :: error: [finalizer.invocation] builder().setName("Frank").build(); } diff --git a/checker/tests/calledmethods-autovalue/GuavaImmutable.java b/checker/tests/calledmethods-autovalue/GuavaImmutable.java index d3de07343be8..3b0d82b16e64 100644 --- a/checker/tests/calledmethods-autovalue/GuavaImmutable.java +++ b/checker/tests/calledmethods-autovalue/GuavaImmutable.java @@ -21,7 +21,7 @@ abstract static class Builder { } public static void buildSomethingWrong() { - // :: error: (finalizer.invocation) + // :: error: [finalizer.invocation] builder().build(); } diff --git a/checker/tests/calledmethods-autovalue/Inheritance.java b/checker/tests/calledmethods-autovalue/Inheritance.java index 25c3a04f0a44..ce6f06fa8bbc 100644 --- a/checker/tests/calledmethods-autovalue/Inheritance.java +++ b/checker/tests/calledmethods-autovalue/Inheritance.java @@ -41,7 +41,7 @@ static void correct() { static void wrong() { PropHolder.Builder b = PropHolder.builder(); - // :: error: (finalizer.invocation) + // :: error: [finalizer.invocation] b.size(1).build(); } } diff --git a/checker/tests/calledmethods-autovalue/NonBuildName.java b/checker/tests/calledmethods-autovalue/NonBuildName.java index de6a6d7dd8fa..04638e1bd4a6 100644 --- a/checker/tests/calledmethods-autovalue/NonBuildName.java +++ b/checker/tests/calledmethods-autovalue/NonBuildName.java @@ -27,7 +27,7 @@ static void correct() { static void wrong() { Builder b = builder(); - // :: error: (finalizer.invocation) + // :: error: [finalizer.invocation] b.makeIt(); } } diff --git a/checker/tests/calledmethods-autovalue/SetInsideBuild.java b/checker/tests/calledmethods-autovalue/SetInsideBuild.java index c1bf32ed4e8c..4eea4ebf8dc5 100644 --- a/checker/tests/calledmethods-autovalue/SetInsideBuild.java +++ b/checker/tests/calledmethods-autovalue/SetInsideBuild.java @@ -28,7 +28,7 @@ public SetInsideBuild build(@CalledMethods({"setName"}) Builder this) { public static void buildSomethingWrong() { Builder b = builder(); - // :: error: (finalizer.invocation) + // :: error: [finalizer.invocation] b.build(); } diff --git a/checker/tests/calledmethods-autovalue/SetInsideBuildWithCM.java b/checker/tests/calledmethods-autovalue/SetInsideBuildWithCM.java index 741f2f8679e9..78a6a3933cf3 100644 --- a/checker/tests/calledmethods-autovalue/SetInsideBuildWithCM.java +++ b/checker/tests/calledmethods-autovalue/SetInsideBuildWithCM.java @@ -34,7 +34,7 @@ public static void buildSomethingCorrect() { public static void buildSomethingWrong() { Builder b = builder(); - // :: error: (finalizer.invocation) + // :: error: [finalizer.invocation] b.build(); } } diff --git a/checker/tests/calledmethods-autovalue/Validation.java b/checker/tests/calledmethods-autovalue/Validation.java index 7f6efc9eddbc..3f67148d57e5 100644 --- a/checker/tests/calledmethods-autovalue/Validation.java +++ b/checker/tests/calledmethods-autovalue/Validation.java @@ -35,7 +35,7 @@ static void correct() { static void wrong() { Builder b = builder(); - // :: error: (finalizer.invocation) + // :: error: [finalizer.invocation] b.build(); } } diff --git a/checker/tests/calledmethods-disablereturnsreceiver/SimpleFluentInference.java b/checker/tests/calledmethods-disablereturnsreceiver/SimpleFluentInference.java index 4bd407c40f7e..56897184014b 100644 --- a/checker/tests/calledmethods-disablereturnsreceiver/SimpleFluentInference.java +++ b/checker/tests/calledmethods-disablereturnsreceiver/SimpleFluentInference.java @@ -33,7 +33,7 @@ static void doStuffCorrect() { new SimpleFluentInference() .a() .b() - // :: error: (finalizer.invocation) + // :: error: [finalizer.invocation] .build(); } @@ -41,7 +41,7 @@ static void doStuffWrong() { SimpleFluentInference s = new SimpleFluentInference() .a() - // :: error: (finalizer.invocation) + // :: error: [finalizer.invocation] .build(); } @@ -49,7 +49,7 @@ static void doStuffRightWeak() { SimpleFluentInference s = new SimpleFluentInference() .a() - // :: error: (finalizer.invocation) + // :: error: [finalizer.invocation] .weakbuild(); } @@ -59,7 +59,7 @@ static void noReturnsReceiverAnno() { .a() .b() .c() - // :: error: (finalizer.invocation) + // :: error: [finalizer.invocation] .build(); } @@ -67,7 +67,7 @@ static void fluentLoop() { SimpleFluentInference s = new SimpleFluentInference().a(); int i = 10; while (i > 0) { - // :: error: (finalizer.invocation) + // :: error: [finalizer.invocation] s.b().build(); i--; s = new SimpleFluentInference(); diff --git a/checker/tests/calledmethods-lombok/BuilderTest.java b/checker/tests/calledmethods-lombok/BuilderTest.java index c166b05d5b59..694b330c2a48 100644 --- a/checker/tests/calledmethods-lombok/BuilderTest.java +++ b/checker/tests/calledmethods-lombok/BuilderTest.java @@ -11,7 +11,7 @@ public static void test_simplePattern() { BuilderTest.builder().x(0).y(0).build(); // good builder BuilderTest.builder().y(0).build(); // good builder BuilderTest.builder().y(0).z(5).build(); // good builder - // :: error: (finalizer.invocation) + // :: error: [finalizer.invocation] BuilderTest.builder().x(0).build(); // bad builder } @@ -21,7 +21,7 @@ public static void test_builderVar() { goodBuilder.y(0); goodBuilder.build(); final BuilderTest.BuilderTestBuilder badBuilder = new BuilderTestBuilder(); - // :: error: (finalizer.invocation) + // :: error: [finalizer.invocation] badBuilder.build(); } } diff --git a/checker/tests/calledmethods-lombok/CheckerFrameworkBuilder.java b/checker/tests/calledmethods-lombok/CheckerFrameworkBuilder.java index a921ac540ebe..94a1b419fbc1 100644 --- a/checker/tests/calledmethods-lombok/CheckerFrameworkBuilder.java +++ b/checker/tests/calledmethods-lombok/CheckerFrameworkBuilder.java @@ -27,7 +27,7 @@ public static void testOldCalledMethodsGood( public static void testOldCalledMethodsBad( @org.checkerframework.checker.calledmethods.qual.CalledMethods({"y"}) CheckerFrameworkBuilderBuilder pb) { - // :: error: (finalizer.invocation) + // :: error: [finalizer.invocation] pb.build(); // pb requires y, z } @@ -37,7 +37,7 @@ public static void testOldRRGood() { public static void testOldRRBad() { CheckerFrameworkBuilder b = - // :: error: (finalizer.invocation) + // :: error: [finalizer.invocation] CheckerFrameworkBuilder.builder().z(6).build(); // also needs to call y } diff --git a/checker/tests/calledmethods-lombok/LombokBuilderExample.java b/checker/tests/calledmethods-lombok/LombokBuilderExample.java index 16fbe6b1b9bc..3572ed1367c6 100644 --- a/checker/tests/calledmethods-lombok/LombokBuilderExample.java +++ b/checker/tests/calledmethods-lombok/LombokBuilderExample.java @@ -8,7 +8,7 @@ public class LombokBuilderExample { @lombok.NonNull Object bar; static void test() { - // :: error: (finalizer.invocation) + // :: error: [finalizer.invocation] builder().build(); } } diff --git a/checker/tests/calledmethods-lombok/LombokNoSingularButClearMethodExample.java b/checker/tests/calledmethods-lombok/LombokNoSingularButClearMethodExample.java index dad9e04eb51e..e96ab5a8016c 100644 --- a/checker/tests/calledmethods-lombok/LombokNoSingularButClearMethodExample.java +++ b/checker/tests/calledmethods-lombok/LombokNoSingularButClearMethodExample.java @@ -8,7 +8,7 @@ public class LombokNoSingularButClearMethodExample { // This one should throw an error, because the field isn't // automatically initialized. public static void testNoItems() { - // :: error: (finalizer.invocation) + // :: error: [finalizer.invocation] LombokNoSingularButClearMethodExample.builder().build(); } diff --git a/checker/tests/calledmethods-lombok/LombokToBuilderExample.java b/checker/tests/calledmethods-lombok/LombokToBuilderExample.java index 79d8e402aacf..293be92f7b38 100644 --- a/checker/tests/calledmethods-lombok/LombokToBuilderExample.java +++ b/checker/tests/calledmethods-lombok/LombokToBuilderExample.java @@ -11,7 +11,7 @@ static void test(LombokToBuilderExample foo) { } static void ensureThatErrorIssued() { - // :: error: (finalizer.invocation) + // :: error: [finalizer.invocation] LombokToBuilderExample.builder().build(); } } diff --git a/checker/tests/calledmethods-lombok/OldInherited.java b/checker/tests/calledmethods-lombok/OldInherited.java index 1bce8de8be53..eff5f43bbac0 100644 --- a/checker/tests/calledmethods-lombok/OldInherited.java +++ b/checker/tests/calledmethods-lombok/OldInherited.java @@ -33,13 +33,13 @@ public static void testGoodChild() { public static void testBadParent() { OldInherited o = new OldInherited(); - // :: error: (finalizer.invocation) + // :: error: [finalizer.invocation] o.requiresGetThis(); } public static void testBadChild() { OldInheritedChild o = new OldInheritedChild(); - // :: error: (finalizer.invocation) + // :: error: [finalizer.invocation] o.requiresGetThis(); } } diff --git a/checker/tests/calledmethods-nodelombok/UnsoundnessTest.java b/checker/tests/calledmethods-nodelombok/UnsoundnessTest.java index f20b84a5f72a..d37bdd8278fb 100644 --- a/checker/tests/calledmethods-nodelombok/UnsoundnessTest.java +++ b/checker/tests/calledmethods-nodelombok/UnsoundnessTest.java @@ -11,7 +11,7 @@ static void test() { // If the CF and Lombok are ever able to work in the same invocation of javac // (i.e. without delomboking first), then this error should be changed back to an // expected error by re-adding the leading "::". - // error: (finalizer.invocation) + // error: [finalizer.invocation] builder().build(); } diff --git a/checker/tests/calledmethods-usevaluechecker/Cve.java b/checker/tests/calledmethods-usevaluechecker/Cve.java index a076a4c12d23..d1634dfdf3fb 100644 --- a/checker/tests/calledmethods-usevaluechecker/Cve.java +++ b/checker/tests/calledmethods-usevaluechecker/Cve.java @@ -14,7 +14,7 @@ public static void onlyNames(AmazonEC2 client) { DescribeImagesResult result = client.describeImages( new DescribeImagesRequest() - // :: error: (argument) + // :: error: [argument] .withFilters(new Filter("name").withValues(IMG_NAME))); } @@ -42,7 +42,7 @@ public static void onlyNamesImpl(AmazonEC2Client client) { DescribeImagesResult result = client.describeImages( new DescribeImagesRequest() - // :: error: (argument) + // :: error: [argument] .withFilters(new Filter("name").withValues(IMG_NAME))); } @@ -65,7 +65,7 @@ public static void onlyNamesAsync(AmazonEC2AsyncClient client) { DescribeImagesResult result = client.describeImages( new DescribeImagesRequest() - // :: error: (argument) + // :: error: [argument] .withFilters(new Filter("name").withValues(IMG_NAME))); } @@ -88,7 +88,7 @@ public static void onlyNamesAsync2(AmazonEC2AsyncClient client) { Object result = client.describeImagesAsync( new DescribeImagesRequest() - // :: error: (argument) + // :: error: [argument] .withFilters(new Filter("name").withValues(IMG_NAME))); } diff --git a/checker/tests/calledmethods-usevaluechecker/Cve2.java b/checker/tests/calledmethods-usevaluechecker/Cve2.java index 976b5a8dc2c9..7ceaeaa0da18 100644 --- a/checker/tests/calledmethods-usevaluechecker/Cve2.java +++ b/checker/tests/calledmethods-usevaluechecker/Cve2.java @@ -13,7 +13,7 @@ public static void onlyNames(AmazonEC2 client) { DescribeImagesRequest request = new DescribeImagesRequest(); request.withFilters(new Filter("name").withValues(IMG_NAME)); - // :: error: (argument) + // :: error: [argument] DescribeImagesResult result = client.describeImages(request); } diff --git a/checker/tests/calledmethods-usevaluechecker/GenerateDataKeyRequestExamples.java b/checker/tests/calledmethods-usevaluechecker/GenerateDataKeyRequestExamples.java index 22f79b1d68fb..e44ca18aafaa 100644 --- a/checker/tests/calledmethods-usevaluechecker/GenerateDataKeyRequestExamples.java +++ b/checker/tests/calledmethods-usevaluechecker/GenerateDataKeyRequestExamples.java @@ -36,7 +36,7 @@ void incorrect1(AWSKMS client) { GenerateDataKeyRequest request = new GenerateDataKeyRequest(); request.setKeySpec(DataKeySpec.AES_256); request.setNumberOfBytes(32); - // :: error: (argument) + // :: error: [argument] client.generateDataKey(request); } @@ -44,7 +44,7 @@ void incorrect2(AWSKMS client) { GenerateDataKeyRequest request = new GenerateDataKeyRequest(); request.withKeySpec(DataKeySpec.AES_256); request.setNumberOfBytes(32); - // :: error: (argument) + // :: error: [argument] client.generateDataKey(request); } @@ -52,7 +52,7 @@ void incorrect3(AWSKMS client) { GenerateDataKeyRequest request = new GenerateDataKeyRequest(); request.setKeySpec(DataKeySpec.AES_256); request.withNumberOfBytes(32); - // :: error: (argument) + // :: error: [argument] client.generateDataKey(request); } @@ -60,14 +60,14 @@ void incorrect4(AWSKMS client) { GenerateDataKeyRequest request = new GenerateDataKeyRequest(); request.withKeySpec(DataKeySpec.AES_256); request.withNumberOfBytes(32); - // :: error: (argument) + // :: error: [argument] client.generateDataKey(request); } // This example is "neither" void incorrect5(AWSKMS client) { GenerateDataKeyRequest request = new GenerateDataKeyRequest(); - // :: error: (argument) + // :: error: [argument] client.generateDataKey(request); } diff --git a/checker/tests/calledmethods-usevaluechecker/MorePreciseFilters.java b/checker/tests/calledmethods-usevaluechecker/MorePreciseFilters.java index e315df006543..10f34a53e530 100644 --- a/checker/tests/calledmethods-usevaluechecker/MorePreciseFilters.java +++ b/checker/tests/calledmethods-usevaluechecker/MorePreciseFilters.java @@ -42,7 +42,7 @@ void withName(AmazonEC2 ec2Client) { void withName2(AmazonEC2 ec2Client) { DescribeImagesRequest request = new DescribeImagesRequest(); request.withFilters(new Filter().withName("image-id").withName("foo").withValues("12345")); - // :: error: (argument) + // :: error: [argument] DescribeImagesResult result = ec2Client.describeImages(request); } diff --git a/checker/tests/calledmethods-usevaluechecker/SpecialNames.java b/checker/tests/calledmethods-usevaluechecker/SpecialNames.java index d6635727f26e..640a11538cf7 100644 --- a/checker/tests/calledmethods-usevaluechecker/SpecialNames.java +++ b/checker/tests/calledmethods-usevaluechecker/SpecialNames.java @@ -30,24 +30,24 @@ void setFilters(SpecialNames f) {} SpecialNames(String x) {} static void test(SpecialNames s) { - // :: error: (assignment) + // :: error: [assignment] @CalledMethods("withOwners") SpecialNames x = s.withFilters(new SpecialNames().withName("owner")); } static void test2(SpecialNames s) { s.setFilters(new SpecialNames("owner")); - // :: error: (assignment) + // :: error: [assignment] @CalledMethods("withOwners") SpecialNames x = s; } static void test3(SpecialNames s) { - // :: error: (assignment) + // :: error: [assignment] @CalledMethods("withOwners") SpecialNames x = s.withFilters(new SpecialNames().withName("owner")); } static void test4(SpecialNames s) { s.setFilters(new SpecialNames("owner")); - // :: error: (assignment) + // :: error: [assignment] @CalledMethods("withOwners") SpecialNames x = s; } diff --git a/checker/tests/calledmethods/CmPredicate.java b/checker/tests/calledmethods/CmPredicate.java index 8e6d6c5a1c68..319c42505d96 100644 --- a/checker/tests/calledmethods/CmPredicate.java +++ b/checker/tests/calledmethods/CmPredicate.java @@ -5,7 +5,7 @@ public class CmPredicate { void testOr1() { MyClass m1 = new MyClass(); - // :: error: (method.invocation) + // :: error: [method.invocation] m1.c(); } @@ -26,7 +26,7 @@ void testOr3() { void testAnd1() { MyClass m1 = new MyClass(); - // :: error: (method.invocation) + // :: error: [method.invocation] m1.d(); } @@ -34,7 +34,7 @@ void testAnd2() { MyClass m1 = new MyClass(); m1.a(); - // :: error: (method.invocation) + // :: error: [method.invocation] m1.d(); } @@ -42,7 +42,7 @@ void testAnd3() { MyClass m1 = new MyClass(); m1.b(); - // :: error: (method.invocation) + // :: error: [method.invocation] m1.d(); } @@ -51,7 +51,7 @@ void testAnd4() { m1.a(); m1.c(); - // :: error: (method.invocation) + // :: error: [method.invocation] m1.d(); } @@ -75,7 +75,7 @@ void testAnd6() { void testAndOr1() { MyClass m1 = new MyClass(); - // :: error: (method.invocation) + // :: error: [method.invocation] m1.e(); } @@ -90,7 +90,7 @@ void testAndOr3() { MyClass m1 = new MyClass(); m1.b(); - // :: error: (method.invocation) + // :: error: [method.invocation] m1.e(); } @@ -115,7 +115,7 @@ void testAndOr5() { void testPrecedence1() { MyClass m1 = new MyClass(); - // :: error: (method.invocation) + // :: error: [method.invocation] m1.f(); } @@ -123,7 +123,7 @@ void testPrecedence2() { MyClass m1 = new MyClass(); m1.a(); - // :: error: (method.invocation) + // :: error: [method.invocation] m1.f(); } @@ -131,7 +131,7 @@ void testPrecedence3() { MyClass m1 = new MyClass(); m1.b(); - // :: error: (method.invocation) + // :: error: [method.invocation] m1.f(); } @@ -201,23 +201,23 @@ void f(@CalledMethodsPredicate("a && b || c") MyClass this) {} static void testAssignability1(@CalledMethodsPredicate("a || b") MyClass cAble) { cAble.c(); - // :: error: (method.invocation) + // :: error: [method.invocation] cAble.d(); - // :: error: (method.invocation) + // :: error: [method.invocation] cAble.e(); - // :: error: (method.invocation) + // :: error: [method.invocation] cAble.f(); } static void testAssignability2(@CalledMethodsPredicate("a && b") MyClass dAble) { // These calls would work if subtyping between predicates was by implication. They issue // errors, because it is not. - // :: error: (method.invocation) + // :: error: [method.invocation] dAble.c(); dAble.d(); - // :: error: (method.invocation) + // :: error: [method.invocation] dAble.e(); - // :: error: (method.invocation) + // :: error: [method.invocation] dAble.f(); } @@ -239,367 +239,367 @@ void testAllAssignability() { cmALocal = cmA; cmALocal = cmpA; - // :: error: (assignment) + // :: error: [assignment] cmALocal = aOrB; cmALocal = aB; // The next line would not fail if predicate subtyping was decided by implication. - // :: error: (assignment) + // :: error: [assignment] cmALocal = aAndB; - // :: error: (assignment) + // :: error: [assignment] cmALocal = bAndCOrA; - // :: error: (assignment) + // :: error: [assignment] cmALocal = bAndCOrAParens; - // :: error: (assignment) + // :: error: [assignment] cmALocal = aAndBOrC; - // :: error: (assignment) + // :: error: [assignment] cmALocal = aAndBOrCParens; - // :: error: (assignment) + // :: error: [assignment] cmALocal = aOrBAndC; // The next line would not fail if predicate subtyping was decided by implication. - // :: error: (assignment) + // :: error: [assignment] cmALocal = bOrCAndA; - // :: error: (assignment) + // :: error: [assignment] cmALocal = bAndC; - // :: error: (assignment) + // :: error: [assignment] cmALocal = bAndCParens; cmpALocal = cmA; cmpALocal = cmpA; - // :: error: (assignment) + // :: error: [assignment] cmpALocal = aOrB; cmpALocal = aB; // The next line would not fail if predicate subtyping was decided by implication. - // :: error: (assignment) + // :: error: [assignment] cmpALocal = aAndB; - // :: error: (assignment) + // :: error: [assignment] cmpALocal = bAndCOrA; - // :: error: (assignment) + // :: error: [assignment] cmpALocal = bAndCOrAParens; - // :: error: (assignment) + // :: error: [assignment] cmpALocal = aAndBOrC; - // :: error: (assignment) + // :: error: [assignment] cmpALocal = aAndBOrCParens; - // :: error: (assignment) + // :: error: [assignment] cmpALocal = aOrBAndC; // The next line would not fail if predicate subtyping was decided by implication. - // :: error: (assignment) + // :: error: [assignment] cmpALocal = bOrCAndA; - // :: error: (assignment) + // :: error: [assignment] cmpALocal = bAndC; - // :: error: (assignment) + // :: error: [assignment] cmpALocal = bAndCParens; aOrBLocal = cmA; // The next line would not fail if predicate subtyping was decided by implication. - // :: error: (assignment) + // :: error: [assignment] aOrBLocal = cmpA; aOrBLocal = aOrB; aOrBLocal = aB; // The next line would not fail if predicate subtyping was decided by implication. - // :: error: (assignment) + // :: error: [assignment] aOrBLocal = aAndB; // The next line would not fail if predicate subtyping was decided by implication. - // :: error: (assignment) + // :: error: [assignment] aOrBLocal = bAndCOrA; // The next line would not fail if predicate subtyping was decided by implication. - // :: error: (assignment) + // :: error: [assignment] aOrBLocal = bAndCOrAParens; - // :: error: (assignment) + // :: error: [assignment] aOrBLocal = aAndBOrC; - // :: error: (assignment) + // :: error: [assignment] aOrBLocal = aAndBOrCParens; // The next line would not fail if predicate subtyping was decided by implication. - // :: error: (assignment) + // :: error: [assignment] aOrBLocal = aOrBAndC; // The next line would not fail if predicate subtyping was decided by implication. - // :: error: (assignment) + // :: error: [assignment] aOrBLocal = bOrCAndA; // The next line would not fail if predicate subtyping was decided by implication. - // :: error: (assignment) + // :: error: [assignment] aOrBLocal = bAndC; // The next line would not fail if predicate subtyping was decided by implication. - // :: error: (assignment) + // :: error: [assignment] aOrBLocal = bAndCParens; - // :: error: (assignment) + // :: error: [assignment] aBLocal = cmA; - // :: error: (assignment) + // :: error: [assignment] aBLocal = cmpA; - // :: error: (assignment) + // :: error: [assignment] aBLocal = aOrB; aBLocal = aB; aBLocal = aAndB; - // :: error: (assignment) + // :: error: [assignment] aBLocal = bAndCOrA; - // :: error: (assignment) + // :: error: [assignment] aBLocal = bAndCOrAParens; - // :: error: (assignment) + // :: error: [assignment] aBLocal = aAndBOrC; - // :: error: (assignment) + // :: error: [assignment] aBLocal = aAndBOrCParens; - // :: error: (assignment) + // :: error: [assignment] aBLocal = aOrBAndC; - // :: error: (assignment) + // :: error: [assignment] aBLocal = bOrCAndA; - // :: error: (assignment) + // :: error: [assignment] aBLocal = bAndC; - // :: error: (assignment) + // :: error: [assignment] aBLocal = bAndCParens; - // :: error: (assignment) + // :: error: [assignment] aAndBLocal = cmA; - // :: error: (assignment) + // :: error: [assignment] aAndBLocal = cmpA; - // :: error: (assignment) + // :: error: [assignment] aAndBLocal = aOrB; aAndBLocal = aB; aAndBLocal = aAndB; - // :: error: (assignment) + // :: error: [assignment] aAndBLocal = bAndCOrA; - // :: error: (assignment) + // :: error: [assignment] aAndBLocal = bAndCOrAParens; - // :: error: (assignment) + // :: error: [assignment] aAndBLocal = aAndBOrC; - // :: error: (assignment) + // :: error: [assignment] aAndBLocal = aAndBOrCParens; - // :: error: (assignment) + // :: error: [assignment] aAndBLocal = aOrBAndC; - // :: error: (assignment) + // :: error: [assignment] aAndBLocal = bOrCAndA; - // :: error: (assignment) + // :: error: [assignment] aAndBLocal = bAndC; - // :: error: (assignment) + // :: error: [assignment] aAndBLocal = bAndCParens; bAndCOrALocal = cmA; // The next line would not fail if predicate subtyping was decided by implication. - // :: error: (assignment) + // :: error: [assignment] bAndCOrALocal = cmpA; - // :: error: (assignment) + // :: error: [assignment] bAndCOrALocal = aOrB; bAndCOrALocal = aB; // The next line would not fail if predicate subtyping was decided by implication. - // :: error: (assignment) + // :: error: [assignment] bAndCOrALocal = aAndB; bAndCOrALocal = bAndCOrA; // The next line would not fail if predicate subtyping was decided by implication. - // :: error: (assignment) + // :: error: [assignment] bAndCOrALocal = bAndCOrAParens; - // :: error: (assignment) + // :: error: [assignment] bAndCOrALocal = aAndBOrC; - // :: error: (assignment) + // :: error: [assignment] bAndCOrALocal = aAndBOrCParens; // The next line would not fail if predicate subtyping was decided by implication. - // :: error: (assignment) + // :: error: [assignment] bAndCOrALocal = aOrBAndC; // The next line would not fail if predicate subtyping was decided by implication. - // :: error: (assignment) + // :: error: [assignment] bAndCOrALocal = bOrCAndA; // The next line would not fail if predicate subtyping was decided by implication. - // :: error: (assignment) + // :: error: [assignment] bAndCOrALocal = bAndC; // The next line would not fail if predicate subtyping was decided by implication. - // :: error: (assignment) + // :: error: [assignment] bAndCOrALocal = bAndCParens; bAndCOrAParensLocal = cmA; // The next line would not fail if predicate subtyping was decided by implication. - // :: error: (assignment) + // :: error: [assignment] bAndCOrAParensLocal = cmpA; - // :: error: (assignment) + // :: error: [assignment] bAndCOrAParensLocal = aOrB; bAndCOrAParensLocal = aB; // The next line would not fail if predicate subtyping was decided by implication. - // :: error: (assignment) + // :: error: [assignment] bAndCOrAParensLocal = aAndB; // The next line would not fail if predicate subtyping was decided by implication. - // :: error: (assignment) + // :: error: [assignment] bAndCOrAParensLocal = bAndCOrA; bAndCOrAParensLocal = bAndCOrAParens; - // :: error: (assignment) + // :: error: [assignment] bAndCOrAParensLocal = aAndBOrC; - // :: error: (assignment) + // :: error: [assignment] bAndCOrAParensLocal = aAndBOrCParens; // The next line would not fail if predicate subtyping was decided by implication. - // :: error: (assignment) + // :: error: [assignment] bAndCOrAParensLocal = aOrBAndC; // The next line would not fail if predicate subtyping was decided by implication. - // :: error: (assignment) + // :: error: [assignment] bAndCOrAParensLocal = bOrCAndA; // The next line would not fail if predicate subtyping was decided by implication. - // :: error: (assignment) + // :: error: [assignment] bAndCOrAParensLocal = bAndC; // The next line would not fail if predicate subtyping was decided by implication. - // :: error: (assignment) + // :: error: [assignment] bAndCOrAParensLocal = bAndCParens; - // :: error: (assignment) + // :: error: [assignment] aAndBOrCLocal = cmA; - // :: error: (assignment) + // :: error: [assignment] aAndBOrCLocal = cmpA; - // :: error: (assignment) + // :: error: [assignment] aAndBOrCLocal = aOrB; aAndBOrCLocal = aB; // The next line would not fail if predicate subtyping was decided by implication. - // :: error: (assignment) + // :: error: [assignment] aAndBOrCLocal = aAndB; - // :: error: (assignment) + // :: error: [assignment] aAndBOrCLocal = bAndCOrA; - // :: error: (assignment) + // :: error: [assignment] aAndBOrCLocal = bAndCOrAParens; aAndBOrCLocal = aAndBOrC; // The next line would not fail if predicate subtyping was decided by implication. - // :: error: (assignment) + // :: error: [assignment] aAndBOrCLocal = aAndBOrCParens; // The next line would not fail if predicate subtyping was decided by implication. - // :: error: (assignment) + // :: error: [assignment] aAndBOrCLocal = aOrBAndC; // The next line would not fail if predicate subtyping was decided by implication. - // :: error: (assignment) + // :: error: [assignment] aAndBOrCLocal = bOrCAndA; // The next line would not fail if predicate subtyping was decided by implication. - // :: error: (assignment) + // :: error: [assignment] aAndBOrCLocal = bAndC; // The next line would not fail if predicate subtyping was decided by implication. - // :: error: (assignment) + // :: error: [assignment] aAndBOrCLocal = bAndCParens; - // :: error: (assignment) + // :: error: [assignment] aAndBOrCParensLocal = cmA; - // :: error: (assignment) + // :: error: [assignment] aAndBOrCParensLocal = cmpA; - // :: error: (assignment) + // :: error: [assignment] aAndBOrCParensLocal = aOrB; aAndBOrCParensLocal = aB; // The next line would not fail if predicate subtyping was decided by implication. - // :: error: (assignment) + // :: error: [assignment] aAndBOrCParensLocal = aAndB; - // :: error: (assignment) + // :: error: [assignment] aAndBOrCParensLocal = bAndCOrA; - // :: error: (assignment) + // :: error: [assignment] aAndBOrCParensLocal = bAndCOrAParens; // The next line would not fail if predicate subtyping was decided by implication. - // :: error: (assignment) + // :: error: [assignment] aAndBOrCParensLocal = aAndBOrC; aAndBOrCParensLocal = aAndBOrCParens; // The next line would not fail if predicate subtyping was decided by implication. - // :: error: (assignment) + // :: error: [assignment] aAndBOrCParensLocal = aOrBAndC; // The next line would not fail if predicate subtyping was decided by implication. - // :: error: (assignment) + // :: error: [assignment] aAndBOrCParensLocal = bOrCAndA; // The next line would not fail if predicate subtyping was decided by implication. - // :: error: (assignment) + // :: error: [assignment] aAndBOrCParensLocal = bAndC; // The next line would not fail if predicate subtyping was decided by implication. - // :: error: (assignment) + // :: error: [assignment] aAndBOrCParensLocal = bAndCParens; - // :: error: (assignment) + // :: error: [assignment] aOrBAndCLocal = cmA; - // :: error: (assignment) + // :: error: [assignment] aOrBAndCLocal = cmpA; - // :: error: (assignment) + // :: error: [assignment] aOrBAndCLocal = aOrB; - // :: error: (assignment) + // :: error: [assignment] aOrBAndCLocal = aB; - // :: error: (assignment) + // :: error: [assignment] aOrBAndCLocal = aAndB; - // :: error: (assignment) + // :: error: [assignment] aOrBAndCLocal = bAndCOrA; - // :: error: (assignment) + // :: error: [assignment] aOrBAndCLocal = bAndCOrAParens; - // :: error: (assignment) + // :: error: [assignment] aOrBAndCLocal = aAndBOrC; - // :: error: (assignment) + // :: error: [assignment] aOrBAndCLocal = aAndBOrCParens; aOrBAndCLocal = aOrBAndC; - // :: error: (assignment) + // :: error: [assignment] aOrBAndCLocal = bOrCAndA; // The next line would not fail if predicate subtyping was decided by implication. - // :: error: (assignment) + // :: error: [assignment] aOrBAndCLocal = bAndC; // The next line would not fail if predicate subtyping was decided by implication. - // :: error: (assignment) + // :: error: [assignment] aOrBAndCLocal = bAndCParens; - // :: error: (assignment) + // :: error: [assignment] bOrCAndALocal = cmA; - // :: error: (assignment) + // :: error: [assignment] bOrCAndALocal = cmpA; - // :: error: (assignment) + // :: error: [assignment] bOrCAndALocal = aOrB; bOrCAndALocal = aB; // The next line would not fail if predicate subtyping was decided by implication. - // :: error: (assignment) + // :: error: [assignment] bOrCAndALocal = aAndB; - // :: error: (assignment) + // :: error: [assignment] bOrCAndALocal = bAndCOrA; - // :: error: (assignment) + // :: error: [assignment] bOrCAndALocal = bAndCOrAParens; - // :: error: (assignment) + // :: error: [assignment] bOrCAndALocal = aAndBOrC; - // :: error: (assignment) + // :: error: [assignment] bOrCAndALocal = aAndBOrCParens; - // :: error: (assignment) + // :: error: [assignment] bOrCAndALocal = aOrBAndC; bOrCAndALocal = bOrCAndA; - // :: error: (assignment) + // :: error: [assignment] bOrCAndALocal = bAndC; - // :: error: (assignment) + // :: error: [assignment] bOrCAndALocal = bAndCParens; - // :: error: (assignment) + // :: error: [assignment] bAndCLocal = cmA; - // :: error: (assignment) + // :: error: [assignment] bAndCLocal = cmpA; - // :: error: (assignment) + // :: error: [assignment] bAndCLocal = aOrB; - // :: error: (assignment) + // :: error: [assignment] bAndCLocal = aB; - // :: error: (assignment) + // :: error: [assignment] bAndCLocal = aAndB; - // :: error: (assignment) + // :: error: [assignment] bAndCLocal = bAndCOrA; - // :: error: (assignment) + // :: error: [assignment] bAndCLocal = bAndCOrAParens; - // :: error: (assignment) + // :: error: [assignment] bAndCLocal = aAndBOrC; - // :: error: (assignment) + // :: error: [assignment] bAndCLocal = aAndBOrCParens; - // :: error: (assignment) + // :: error: [assignment] bAndCLocal = aOrBAndC; - // :: error: (assignment) + // :: error: [assignment] bAndCLocal = bOrCAndA; bAndCLocal = bAndC; // The next line would not fail if predicate subtyping was decided by implication. - // :: error: (assignment) + // :: error: [assignment] bAndCLocal = bAndCParens; - // :: error: (assignment) + // :: error: [assignment] bAndCParensLocal = cmA; - // :: error: (assignment) + // :: error: [assignment] bAndCParensLocal = cmpA; - // :: error: (assignment) + // :: error: [assignment] bAndCParensLocal = aOrB; - // :: error: (assignment) + // :: error: [assignment] bAndCParensLocal = aB; - // :: error: (assignment) + // :: error: [assignment] bAndCParensLocal = aAndB; - // :: error: (assignment) + // :: error: [assignment] bAndCParensLocal = bAndCOrA; - // :: error: (assignment) + // :: error: [assignment] bAndCParensLocal = bAndCOrAParens; - // :: error: (assignment) + // :: error: [assignment] bAndCParensLocal = aAndBOrC; - // :: error: (assignment) + // :: error: [assignment] bAndCParensLocal = aAndBOrCParens; - // :: error: (assignment) + // :: error: [assignment] bAndCParensLocal = aOrBAndC; - // :: error: (assignment) + // :: error: [assignment] bAndCParensLocal = bOrCAndA; // The next line would not fail if predicate subtyping was decided by implication. - // :: error: (assignment) + // :: error: [assignment] bAndCParensLocal = bAndC; bAndCParensLocal = bAndCParens; } diff --git a/checker/tests/calledmethods/EnsuresCalledMethodsIfRepeatable.java b/checker/tests/calledmethods/EnsuresCalledMethodsIfRepeatable.java index 10b9990b3a86..b9f1372662a9 100644 --- a/checker/tests/calledmethods/EnsuresCalledMethodsIfRepeatable.java +++ b/checker/tests/calledmethods/EnsuresCalledMethodsIfRepeatable.java @@ -7,7 +7,7 @@ public class EnsuresCalledMethodsIfRepeatable { @EnsuresCalledMethodsIf(expression = "#2", result = true, methods = "close") public boolean close2MissingFirst(Closeable r1, Closeable r2) throws IOException { r1.close(); - // ::error: (contracts.conditional.postcondition) + // ::error: [contracts.conditional.postcondition] return true; } @@ -15,7 +15,7 @@ public boolean close2MissingFirst(Closeable r1, Closeable r2) throws IOException @EnsuresCalledMethodsIf(expression = "#2", result = true, methods = "close") public boolean close2MissingSecond(Closeable r1, Closeable r2) throws IOException { r2.close(); - // ::error: (contracts.conditional.postcondition) + // ::error: [contracts.conditional.postcondition] return true; } @@ -39,7 +39,7 @@ public boolean close2CorrectViaCall(Closeable r1, Closeable r2) throws IOExcepti public static class SubclassWrong extends EnsuresCalledMethodsIfRepeatable { @Override public boolean close2Correct(Closeable r1, Closeable r2) throws IOException { - // ::error: (contracts.conditional.postcondition) + // ::error: [contracts.conditional.postcondition] return true; } } diff --git a/checker/tests/calledmethods/EnsuresCalledMethodsIfSubclass.java b/checker/tests/calledmethods/EnsuresCalledMethodsIfSubclass.java index fff666b8c042..25aa5300baa8 100644 --- a/checker/tests/calledmethods/EnsuresCalledMethodsIfSubclass.java +++ b/checker/tests/calledmethods/EnsuresCalledMethodsIfSubclass.java @@ -14,7 +14,7 @@ public boolean method(Closeable x) throws IOException { public static class SubclassWrong extends Parent { @Override public boolean method(Closeable x) throws IOException { - // ::error: (contracts.conditional.postcondition) + // ::error: [contracts.conditional.postcondition] return true; } } diff --git a/checker/tests/calledmethods/EnsuresCalledMethodsOnExceptionRepeatable.java b/checker/tests/calledmethods/EnsuresCalledMethodsOnExceptionRepeatable.java index 853dcedc53d1..81f7e291a517 100644 --- a/checker/tests/calledmethods/EnsuresCalledMethodsOnExceptionRepeatable.java +++ b/checker/tests/calledmethods/EnsuresCalledMethodsOnExceptionRepeatable.java @@ -7,14 +7,14 @@ class EnsuresCalledMethodsOnExceptionRepeatable { @EnsuresCalledMethodsOnException(value = "#1", methods = "close") @EnsuresCalledMethodsOnException(value = "#2", methods = "close") - // ::error: (contracts.exceptional.postcondition) + // ::error: [contracts.exceptional.postcondition] public void close2MissingFirst(Closeable r1, Closeable r2) throws IOException { r1.close(); } @EnsuresCalledMethodsOnException(value = "#1", methods = "close") @EnsuresCalledMethodsOnException(value = "#2", methods = "close") - // ::error: (contracts.exceptional.postcondition) + // ::error: [contracts.exceptional.postcondition] public void close2MissingSecond(Closeable r1, Closeable r2) throws IOException { r2.close(); } @@ -37,7 +37,7 @@ public void close2CorrectViaCall(Closeable r1, Closeable r2) throws IOException public static class Subclass extends EnsuresCalledMethodsOnExceptionRepeatable { @Override - // ::error: (contracts.exceptional.postcondition) + // ::error: [contracts.exceptional.postcondition] public void close2Correct(Closeable r1, Closeable r2) throws IOException { throw new IOException(); } diff --git a/checker/tests/calledmethods/EnsuresCalledMethodsOnExceptionSubclass.java b/checker/tests/calledmethods/EnsuresCalledMethodsOnExceptionSubclass.java index fddf30ca8983..54d2f682a216 100644 --- a/checker/tests/calledmethods/EnsuresCalledMethodsOnExceptionSubclass.java +++ b/checker/tests/calledmethods/EnsuresCalledMethodsOnExceptionSubclass.java @@ -14,7 +14,7 @@ public void method(Closeable x) throws IOException { public static class SubclassWrong extends Parent { @Override - // ::error: (contracts.exceptional.postcondition) + // ::error: [contracts.exceptional.postcondition] public void method(Closeable x) throws IOException { throw new IOException(); } diff --git a/checker/tests/calledmethods/EnsuresCalledMethodsOnExceptionTest.java b/checker/tests/calledmethods/EnsuresCalledMethodsOnExceptionTest.java index b41db1cafccc..e3dd69f6255f 100644 --- a/checker/tests/calledmethods/EnsuresCalledMethodsOnExceptionTest.java +++ b/checker/tests/calledmethods/EnsuresCalledMethodsOnExceptionTest.java @@ -27,7 +27,7 @@ void noCall(Resource r) { } @EnsuresCalledMethodsOnException(value = "#1", methods = "a") - // :: error: (contracts.exceptional.postcondition) + // :: error: [contracts.exceptional.postcondition] void callAfterThrow(Resource r) throws Exception { if (arbitraryChoice()) { // Not OK: r.a() has not been called yet @@ -62,7 +62,7 @@ void callInCatchBlock(Resource r) throws Exception { } @EnsuresCalledMethodsOnException(value = "#1", methods = "a") - // :: error: (contracts.exceptional.postcondition) + // :: error: [contracts.exceptional.postcondition] void callInSpecificCatchBlock(Resource r) throws Exception { try { if (arbitraryChoice()) { @@ -97,7 +97,7 @@ void exploitCalledMethodsOnException(Resource r) throws Exception { } @EnsuresCalledMethods(value = "#1", methods = "a") - // :: error: (contracts.postcondition) + // :: error: [contracts.postcondition] void exceptionalCallsDoNotSatisfyNormalPaths(Resource r) throws Exception { // Not OK: this call is not enough to satisfy our contract, since it only promises something // on exceptional return. diff --git a/checker/tests/calledmethods/EnsuresCalledMethodsRepeatable.java b/checker/tests/calledmethods/EnsuresCalledMethodsRepeatable.java index 800ca64f6ef1..b9a4291110b9 100644 --- a/checker/tests/calledmethods/EnsuresCalledMethodsRepeatable.java +++ b/checker/tests/calledmethods/EnsuresCalledMethodsRepeatable.java @@ -16,14 +16,14 @@ void test(Object obj) { @EnsuresCalledMethods(value = "#1", methods = "close") @EnsuresCalledMethods(value = "#2", methods = "close") - // ::error: (contracts.postcondition) + // ::error: [contracts.postcondition] public void close2MissingFirst(Closeable r1, Closeable r2) throws IOException { r1.close(); } @EnsuresCalledMethods(value = "#1", methods = "close") @EnsuresCalledMethods(value = "#2", methods = "close") - // ::error: (contracts.postcondition) + // ::error: [contracts.postcondition] public void close2MissingSecond(Closeable r1, Closeable r2) throws IOException { r2.close(); } @@ -46,7 +46,7 @@ public void close2CorrectViaCall(Closeable r1, Closeable r2) throws IOException public static class Subclass extends EnsuresCalledMethodsRepeatable { @Override - // ::error: (contracts.postcondition) + // ::error: [contracts.postcondition] public void close2Correct(Closeable r1, Closeable r2) throws IOException {} } } diff --git a/checker/tests/calledmethods/EnsuresCalledMethodsSubclass.java b/checker/tests/calledmethods/EnsuresCalledMethodsSubclass.java index 028ba38e4289..bca877ef3ea4 100644 --- a/checker/tests/calledmethods/EnsuresCalledMethodsSubclass.java +++ b/checker/tests/calledmethods/EnsuresCalledMethodsSubclass.java @@ -12,7 +12,7 @@ public void method(Closeable x) throws IOException { public static class Subclass extends Parent { @Override - // ::error: (contracts.postcondition) + // ::error: [contracts.postcondition] public void method(Closeable x) throws IOException {} } } diff --git a/checker/tests/calledmethods/EnsuresCalledMethodsThisLub.java b/checker/tests/calledmethods/EnsuresCalledMethodsThisLub.java index f666f946acd8..04b802b35c89 100644 --- a/checker/tests/calledmethods/EnsuresCalledMethodsThisLub.java +++ b/checker/tests/calledmethods/EnsuresCalledMethodsThisLub.java @@ -26,7 +26,7 @@ void test(boolean b) { call2(this); } @CalledMethods("toString") Object obj1 = this; - // :: error: (assignment) + // :: error: [assignment] @CalledMethods({"toString", "equals"}) Object obj2 = this; } @@ -37,7 +37,7 @@ void test_arg(Object arg, boolean b) { call2(arg); } @CalledMethods("toString") Object obj1 = arg; - // :: error: (assignment) + // :: error: [assignment] @CalledMethods({"toString", "equals"}) Object obj2 = arg; } } diff --git a/checker/tests/calledmethods/EnsuresCalledMethodsVarargsSimple.java b/checker/tests/calledmethods/EnsuresCalledMethodsVarargsSimple.java index 807155773b23..9706ec5661ac 100644 --- a/checker/tests/calledmethods/EnsuresCalledMethodsVarargsSimple.java +++ b/checker/tests/calledmethods/EnsuresCalledMethodsVarargsSimple.java @@ -7,7 +7,7 @@ class EnsuresCalledMethodsVarargsSimple { - // :: error: (ensuresvarargs.unverified) + // :: error: [ensuresvarargs.unverified] @EnsuresCalledMethodsVarargs("close") void closeAll(Socket... sockets) { for (Socket s : sockets) { @@ -18,9 +18,9 @@ void closeAll(Socket... sockets) { } } - // :: error: (ensuresvarargs.unverified) + // :: error: [ensuresvarargs.unverified] @EnsuresCalledMethodsVarargs("close") - // :: error: (ensuresvarargs.invalid) + // :: error: [ensuresvarargs.invalid] void closeAllNotVA(List sockets) { for (Socket s : sockets) { try { diff --git a/checker/tests/calledmethods/ExceptionalPath2.java b/checker/tests/calledmethods/ExceptionalPath2.java index 795de45185aa..d24134621e8c 100644 --- a/checker/tests/calledmethods/ExceptionalPath2.java +++ b/checker/tests/calledmethods/ExceptionalPath2.java @@ -30,7 +30,7 @@ void test() { // threw an IOException. We no longer know whether `r.a()` // has been called, since `r.b()` might have overwritten `r` // before throwing. - // ::error: (assignment) + // ::error: [assignment] @CalledMethods({"a"}) Resource x = r; } } diff --git a/checker/tests/calledmethods/Not.java b/checker/tests/calledmethods/Not.java index 73e90290707b..85bc39626e89 100644 --- a/checker/tests/calledmethods/Not.java +++ b/checker/tests/calledmethods/Not.java @@ -27,7 +27,7 @@ void test2(Foo f) { void test3(Foo f) { f.a(); - // :: error: (method.invocation) + // :: error: [method.invocation] f.notA(); f.notB(); } @@ -35,16 +35,16 @@ void test3(Foo f) { void test4(Foo f) { f.b(); f.notA(); - // :: error: (method.invocation) + // :: error: [method.invocation] f.notB(); } void test5(Foo f) { f.a(); f.b(); - // :: error: (method.invocation) + // :: error: [method.invocation] f.notA(); - // :: error: (method.invocation) + // :: error: [method.invocation] f.notB(); } @@ -59,7 +59,7 @@ void test6(Foo f) { } void test7(@CalledMethods("a") Foo f) { - // :: error: (method.invocation) + // :: error: [method.invocation] f.notA(); } diff --git a/checker/tests/calledmethods/Postconditions.java b/checker/tests/calledmethods/Postconditions.java index 9e917934e3a2..04db4ee1eb8b 100644 --- a/checker/tests/calledmethods/Postconditions.java +++ b/checker/tests/calledmethods/Postconditions.java @@ -16,7 +16,7 @@ static void callB(Postconditions x) { } @EnsuresCalledMethods(value = "#1", methods = "b") - // :: error: (contracts.postcondition) + // :: error: [contracts.postcondition] static void doesNotCallB(Postconditions x) {} @EnsuresCalledMethods( @@ -61,7 +61,7 @@ static void invokeCallBAndC() { static void invokeCallBAndCWrong() { Postconditions y = new Postconditions(); callBAndC(y); - // :: error: (finalizer.invocation) + // :: error: [finalizer.invocation] y.build(); } @@ -83,7 +83,7 @@ static void testEnsuresCalledMethodsIf(Postconditions p, boolean b) { if (ensuresABCIfTrue(p, b)) { p.build(); } else { - // :: error: (finalizer.invocation) + // :: error: [finalizer.invocation] p.build(); } } diff --git a/checker/tests/calledmethods/RequiresCalledMethodsRepeatable.java b/checker/tests/calledmethods/RequiresCalledMethodsRepeatable.java index c24e529e5d23..0f9a774767e4 100644 --- a/checker/tests/calledmethods/RequiresCalledMethodsRepeatable.java +++ b/checker/tests/calledmethods/RequiresCalledMethodsRepeatable.java @@ -11,7 +11,7 @@ public void requires2(Closeable r1, Closeable r2) { } public void requires2Wrong(Closeable r1, Closeable r2) { - // ::error: (contracts.precondition) + // ::error: [contracts.precondition] requires2(r1, r2); } diff --git a/checker/tests/calledmethods/RequiresCalledMethodsSubclass.java b/checker/tests/calledmethods/RequiresCalledMethodsSubclass.java index 9b8eaabcc307..c1fb03c36ea0 100644 --- a/checker/tests/calledmethods/RequiresCalledMethodsSubclass.java +++ b/checker/tests/calledmethods/RequiresCalledMethodsSubclass.java @@ -8,7 +8,7 @@ public static class Parent { public void method(Closeable x) throws IOException {} public void caller(Closeable x) throws IOException { - // ::error: (contracts.precondition) + // ::error: [contracts.precondition] method(x); } } diff --git a/checker/tests/calledmethods/RequiresCalledMethodsTest.java b/checker/tests/calledmethods/RequiresCalledMethodsTest.java index 2d83efdf198d..25e5cb63ed88 100644 --- a/checker/tests/calledmethods/RequiresCalledMethodsTest.java +++ b/checker/tests/calledmethods/RequiresCalledMethodsTest.java @@ -16,7 +16,7 @@ void test_ok() { void test_bad() { // foo.toString(); - // :: error: (contracts.precondition) + // :: error: [contracts.precondition] afterFooToString(); } } diff --git a/checker/tests/calledmethods/SimpleFluentInference.java b/checker/tests/calledmethods/SimpleFluentInference.java index 48af4cf614f5..3b83bc1321c7 100644 --- a/checker/tests/calledmethods/SimpleFluentInference.java +++ b/checker/tests/calledmethods/SimpleFluentInference.java @@ -32,7 +32,7 @@ static void doStuffWrong() { SimpleFluentInference s = new SimpleFluentInference() .a() - // :: error: (finalizer.invocation) + // :: error: [finalizer.invocation] .build(); } @@ -46,7 +46,7 @@ static void noReturnsReceiverAnno() { .a() .b() .c() - // :: error: (finalizer.invocation) + // :: error: [finalizer.invocation] .build(); } @@ -54,7 +54,7 @@ static void fluentLoop() { SimpleFluentInference s = new SimpleFluentInference().a(); int i = 10; while (i > 0) { - // :: error: (finalizer.invocation) + // :: error: [finalizer.invocation] s.b().build(); i--; s = new SimpleFluentInference(); diff --git a/checker/tests/calledmethods/SimpleInference.java b/checker/tests/calledmethods/SimpleInference.java index 13611a9af6a9..765015ad2824 100644 --- a/checker/tests/calledmethods/SimpleInference.java +++ b/checker/tests/calledmethods/SimpleInference.java @@ -14,7 +14,7 @@ static void doStuffCorrect() { static void doStuffWrong() { SimpleInference s = new SimpleInference(); - // :: error: (finalizer.invocation) + // :: error: [finalizer.invocation] s.build(); } } diff --git a/checker/tests/calledmethods/SimpleInferenceMerge.java b/checker/tests/calledmethods/SimpleInferenceMerge.java index e6d00c23ac61..aa73d626f253 100644 --- a/checker/tests/calledmethods/SimpleInferenceMerge.java +++ b/checker/tests/calledmethods/SimpleInferenceMerge.java @@ -32,7 +32,7 @@ static void doStuffWrongMerge(boolean b) { s.b(); s.c(); } - // :: error: (finalizer.invocation) + // :: error: [finalizer.invocation] s.build(); } } diff --git a/checker/tests/calledmethods/Subtyping.java b/checker/tests/calledmethods/Subtyping.java index 4afbf6417e02..8d54ed62e727 100644 --- a/checker/tests/calledmethods/Subtyping.java +++ b/checker/tests/calledmethods/Subtyping.java @@ -19,7 +19,7 @@ public class Subtyping { } @CalledMethods({"a"}) Object a_top(@CalledMethods({}) Object o) { - // :: error: (return) + // :: error: [return] return o; } @@ -36,12 +36,12 @@ public class Subtyping { } @CalledMethods({"a", "b"}) Object ab_top(@CalledMethods({}) Object o) { - // :: error: (return) + // :: error: [return] return o; } @CalledMethods({"a", "b"}) Object ab_a(@CalledMethods({"a"}) Object o) { - // :: error: (return) + // :: error: [return] return o; } @@ -54,17 +54,17 @@ public class Subtyping { } @CalledMethodsBottom Object bot_top(@CalledMethods({}) Object o) { - // :: error: (return) + // :: error: [return] return o; } @CalledMethodsBottom Object bot_a(@CalledMethods({"a"}) Object o) { - // :: error: (return) + // :: error: [return] return o; } @CalledMethodsBottom Object bot_ab(@CalledMethods({"a", "b"}) Object o) { - // :: error: (return) + // :: error: [return] return o; } diff --git a/checker/tests/calledmethods/UnparsablePredicate.java b/checker/tests/calledmethods/UnparsablePredicate.java index f97c2f5b0724..e968d5254bb6 100644 --- a/checker/tests/calledmethods/UnparsablePredicate.java +++ b/checker/tests/calledmethods/UnparsablePredicate.java @@ -2,16 +2,16 @@ public class UnparsablePredicate { - // :: error: (predicate) + // :: error: [predicate] void unclosedOpen(@CalledMethodsPredicate("(foo && bar") Object x) {} - // :: error: (predicate) + // :: error: [predicate] void unopenedClose(@CalledMethodsPredicate("foo || bar)") Object x) {} - // :: error: (predicate) + // :: error: [predicate] void badKeywords1(@CalledMethodsPredicate("foo OR bar") Object x) {} - // :: error: (predicate) + // :: error: [predicate] void badKeywords2(@CalledMethodsPredicate("foo AND bar") Object x) {} // These tests check that valid Java identifiers don't cause problems diff --git a/checker/tests/calledmethods/Xor.java b/checker/tests/calledmethods/Xor.java index fd68559fa482..06693bd04e23 100644 --- a/checker/tests/calledmethods/Xor.java +++ b/checker/tests/calledmethods/Xor.java @@ -15,13 +15,13 @@ void aXorB(@CalledMethodsPredicate("(a || b) && !(a && b)") Foo this) {} } void test1(Foo f) { - // :: error: (method.invocation) + // :: error: [method.invocation] f.aXorB(); } void test2(Foo f) { f.c(); - // :: error: (method.invocation) + // :: error: [method.invocation] f.aXorB(); } @@ -38,7 +38,7 @@ void test4(Foo f) { void test5(Foo f) { f.a(); f.b(); - // :: error: (method.invocation) + // :: error: [method.invocation] f.aXorB(); } @@ -60,7 +60,7 @@ void test7(@CalledMethods("a") Foo f) { void test8(Foo f) { callA(f); // THIS IS AN UNAVOIDABLE FALSE POSITIVE - // :: error: (method.invocation) + // :: error: [method.invocation] f.aXorB(); } } diff --git a/checker/tests/command-line/issue618/TwoCheckers.java b/checker/tests/command-line/issue618/TwoCheckers.java index bdbdc4da0b00..07dd1ba5e63c 100644 --- a/checker/tests/command-line/issue618/TwoCheckers.java +++ b/checker/tests/command-line/issue618/TwoCheckers.java @@ -24,7 +24,7 @@ public class TwoCheckers { void client(String a) { - // :: error: (argument) + // :: error: [argument] requiresUntainted(a); } diff --git a/checker/tests/disbaruse-records/DisbarredClass.java b/checker/tests/disbaruse-records/DisbarredClass.java index 255084d17f6a..5c00fc053349 100644 --- a/checker/tests/disbaruse-records/DisbarredClass.java +++ b/checker/tests/disbaruse-records/DisbarredClass.java @@ -13,9 +13,9 @@ class DisbarredClass { DisbarredClass(@DisbarUse Integer param) {} DisbarredClass(@DisbarUse Long param) { - // :: error: (disbar.use) + // :: error: [disbar.use] param = 7L; - // :: error: (disbar.use) + // :: error: [disbar.use] param.toString(); } @@ -23,13 +23,13 @@ class DisbarredClass { void disbarredMethod() {} void invalid() { - // :: error: (disbar.use) + // :: error: [disbar.use] disbarredMethod(); - // :: error: (disbar.use) + // :: error: [disbar.use] new DisbarredClass(""); - // :: error: (disbar.use) + // :: error: [disbar.use] barred = ""; - // :: error: (disbar.use) + // :: error: [disbar.use] int x = barred.length(); } diff --git a/checker/tests/disbaruse-records/DisbarredRecord.java b/checker/tests/disbaruse-records/DisbarredRecord.java index 34c9cdae464e..26a6c981f7c1 100644 --- a/checker/tests/disbaruse-records/DisbarredRecord.java +++ b/checker/tests/disbaruse-records/DisbarredRecord.java @@ -3,14 +3,14 @@ record DisbarredRecord(@DisbarUse String barred, String fine) { DisbarredRecord { - // :: error: (disbar.use) + // :: error: [disbar.use] int x = barred.length(); } void invalid() { - // :: error: (disbar.use) + // :: error: [disbar.use] barred(); - // :: error: (disbar.use) + // :: error: [disbar.use] int x = barred.length(); } diff --git a/checker/tests/disbaruse-records/DisbarredRecordByStubs.java b/checker/tests/disbaruse-records/DisbarredRecordByStubs.java index 13730e728f12..e463a87b8dd5 100644 --- a/checker/tests/disbaruse-records/DisbarredRecordByStubs.java +++ b/checker/tests/disbaruse-records/DisbarredRecordByStubs.java @@ -1,14 +1,14 @@ record DisbarredRecordByStubs(String barred, String fine) { DisbarredRecordByStubs { - // :: error: (disbar.use) + // :: error: [disbar.use] int x = barred.length(); } void invalid() { - // :: error: (disbar.use) + // :: error: [disbar.use] barred(); - // :: error: (disbar.use) + // :: error: [disbar.use] int x = barred.length(); } diff --git a/checker/tests/disbaruse-records/DisbarredRecordByStubs2.java b/checker/tests/disbaruse-records/DisbarredRecordByStubs2.java index 8df03d950aaf..a332656310a3 100644 --- a/checker/tests/disbaruse-records/DisbarredRecordByStubs2.java +++ b/checker/tests/disbaruse-records/DisbarredRecordByStubs2.java @@ -3,15 +3,15 @@ record DisbarredRecordByStubs2(String barred, String fine) { // Annotation isn't copied to explicitly declared constructor parameters: DisbarredRecordByStubs2(String barred, String fine) { int x = barred.length(); - // :: error: (disbar.use) + // :: error: [disbar.use] this.barred = ""; this.fine = fine; } void invalid() { - // :: error: (disbar.use) + // :: error: [disbar.use] barred(); - // :: error: (disbar.use) + // :: error: [disbar.use] int x = barred.length(); } diff --git a/checker/tests/fenum/CastsFenum.java b/checker/tests/fenum/CastsFenum.java index f76adffc0d9d..a4cbf1c7ab68 100644 --- a/checker/tests/fenum/CastsFenum.java +++ b/checker/tests/fenum/CastsFenum.java @@ -5,7 +5,7 @@ public class CastsFenum { void m(Object p, @Fenum("A") Object a) { fa = (Object) a; - // :: error: (assignment) + // :: error: [assignment] fa = (Object) p; // TODO: How can we test the behavior for diff --git a/checker/tests/fenum/CatchFenumUnqualified.java b/checker/tests/fenum/CatchFenumUnqualified.java index d447abac7d4d..9999dfe02df6 100644 --- a/checker/tests/fenum/CatchFenumUnqualified.java +++ b/checker/tests/fenum/CatchFenumUnqualified.java @@ -4,12 +4,12 @@ public class CatchFenumUnqualified { void method() { try { } catch ( - // :: error: (exception.parameter) + // :: error: [exception.parameter] @Fenum("A") RuntimeException e) { } try { - // :: error: (exception.parameter) + // :: error: [exception.parameter] } catch (@Fenum("A") NullPointerException | @Fenum("A") ArrayIndexOutOfBoundsException e) { } diff --git a/checker/tests/fenum/TestFlow.java b/checker/tests/fenum/TestFlow.java index 317e60f7767f..6e919ec2d19d 100644 --- a/checker/tests/fenum/TestFlow.java +++ b/checker/tests/fenum/TestFlow.java @@ -12,22 +12,22 @@ class FenumUser { @Fenum("A") Object state1 = new TestFlow().ACONST1; void foo(TestFlow t) { - // :: error: (method.invocation) + // :: error: [method.invocation] state1.hashCode(); state1 = null; state1.hashCode(); m(); - // :: error: (method.invocation) + // :: error: [method.invocation] state1.hashCode(); Object o = new Object(); o = t.ACONST1; methodA(o); - // :: error: (argument) + // :: error: [argument] methodB(o); o = t.BCONST1; - // :: error: (argument) + // :: error: [argument] methodA(o); methodB(o); } diff --git a/checker/tests/fenum/TestInstance.java b/checker/tests/fenum/TestInstance.java index e8207678e1e5..e7b318627b9b 100644 --- a/checker/tests/fenum/TestInstance.java +++ b/checker/tests/fenum/TestInstance.java @@ -14,22 +14,22 @@ public class TestInstance { class FenumUserTestInstance { @Fenum("A") Object state1 = new TestInstance().ACONST1; - // :: error: (assignment) + // :: error: [assignment] @Fenum("B") Object state2 = new TestInstance().ACONST1; void foo(TestInstance t) { - // :: error: (assignment) + // :: error: [assignment] state1 = new Object(); state1 = t.ACONST2; state1 = t.ACONST3; - // :: error: (assignment) + // :: error: [assignment] state1 = t.BCONST1; - // :: error: (method.invocation) + // :: error: [method.invocation] state1.hashCode(); - // :: error: (method.invocation) + // :: error: [method.invocation] t.ACONST1.hashCode(); // sanity check: unqualified instantiation and call work. @@ -38,7 +38,7 @@ void foo(TestInstance t) { if (t.ACONST1 == t.ACONST2) {} - // :: error: (binary) + // :: error: [binary] if (t.ACONST1 == t.BCONST2) {} } } diff --git a/checker/tests/fenum/TestPrimitive.java b/checker/tests/fenum/TestPrimitive.java index 2667d40aac6d..9a438f1b7a70 100644 --- a/checker/tests/fenum/TestPrimitive.java +++ b/checker/tests/fenum/TestPrimitive.java @@ -16,31 +16,31 @@ class FenumUserTestPrimitive { @Fenum("A") int state3 = this.state1; - // :: error: (assignment) + // :: error: [assignment] @Fenum("B") int state2 = new TestPrimitive().ACONST1; void foo(TestPrimitive t) { - // :: error: (assignment) + // :: error: [assignment] state1 = 4; state1 = t.ACONST2; state1 = t.ACONST3; - // :: error: (assignment) + // :: error: [assignment] state1 = t.BCONST1; if (t.ACONST1 < t.ACONST2) { // ok } - // :: error: (binary) + // :: error: [binary] if (t.ACONST1 < t.BCONST2) {} - // :: error: (binary) + // :: error: [binary] if (t.ACONST1 == t.BCONST2) {} - // :: error: (binary) + // :: error: [binary] if (t.ACONST1 < 5) {} - // :: error: (binary) + // :: error: [binary] if (t.ACONST1 == 5) {} } } diff --git a/checker/tests/fenum/TestStatic.java b/checker/tests/fenum/TestStatic.java index 5e21ccf66701..9a4f21bd8e2d 100644 --- a/checker/tests/fenum/TestStatic.java +++ b/checker/tests/fenum/TestStatic.java @@ -14,13 +14,13 @@ public class TestStatic { class FenumUserTestStatic { @Fenum("A") int state1 = TestStatic.ACONST1; - // :: error: (assignment) + // :: error: [assignment] @Fenum("B") int state2 = TestStatic.ACONST1; void bar(@Fenum("A") int p) {} void foo() { - // :: error: (assignment) + // :: error: [assignment] state1 = 4; state1 = TestStatic.ACONST2; @@ -28,13 +28,13 @@ void foo() { state2 = TestStatic.BCONST3; - // :: error: (assignment) + // :: error: [assignment] state1 = TestStatic.BCONST1; - // :: error: (argument) + // :: error: [argument] bar(5); bar(TestStatic.ACONST1); - // :: error: (argument) + // :: error: [argument] bar(TestStatic.BCONST1); } @@ -47,7 +47,7 @@ void ignoreAll() { @SuppressWarnings("fenum:assignment") void ignoreOne() { state1 = 4; - // :: error: (argument) + // :: error: [argument] bar(5); } } diff --git a/checker/tests/fenum/TestSwitch.java b/checker/tests/fenum/TestSwitch.java index fd0e108d6e7c..348cc68ca47a 100644 --- a/checker/tests/fenum/TestSwitch.java +++ b/checker/tests/fenum/TestSwitch.java @@ -11,7 +11,7 @@ void m() { int plain = 9; // FenumUnqualified switch (plain) { - // :: error: (type.incompatible) + // :: error: [type.incompatible] case annotated: default: } @@ -24,7 +24,7 @@ void m() { } switch (annotated) { - // :: error: (type.incompatible) + // :: error: [type.incompatible] case 45: default: } diff --git a/checker/tests/fenum/UpperBoundsInByteCode.java b/checker/tests/fenum/UpperBoundsInByteCode.java index 07dab0eccbf7..6bf1dff2ba7f 100644 --- a/checker/tests/fenum/UpperBoundsInByteCode.java +++ b/checker/tests/fenum/UpperBoundsInByteCode.java @@ -6,7 +6,7 @@ public class UpperBoundsInByteCode { UncheckedByteCode<@Fenum("Bar") Object> bar; void typeVarWithNonObjectUpperBound(@Fenum("A") int a) { - // :: error: (type.arguments.not.inferred) + // :: error: [type.arguments.not.inferred] UncheckedByteCode.methodWithTypeVarBoundedByNumber(a); UncheckedByteCode.methodWithTypeVarBoundedByNumber(1); } @@ -14,11 +14,11 @@ void typeVarWithNonObjectUpperBound(@Fenum("A") int a) { void wildcardsInByteCode() { UncheckedByteCode.unboundedWildcardParam(foo); UncheckedByteCode.lowerboundedWildcardParam(bar); - // :: error: (argument) + // :: error: [argument] UncheckedByteCode.upperboundedWildcardParam(foo); } - // :: error: (type.argument) + // :: error: [type.argument] SourceCode<@Fenum("Foo") String> foo2; class SourceCode {} diff --git a/checker/tests/fenumswing/FlowBreak.java b/checker/tests/fenumswing/FlowBreak.java index 3c6e67bbf7c8..9bdb8e7dc3bf 100644 --- a/checker/tests/fenumswing/FlowBreak.java +++ b/checker/tests/fenumswing/FlowBreak.java @@ -32,7 +32,7 @@ public class FlowBreak { // 2. The normal end of the loop body [@SwingHorizontalOrientation] // 3. The path from the break to here [@SwingVerticalOrientation] // Currently, the third path is ignored and we do not get this error message. - // :: error: (return) + // :: error: [return] return o; } } diff --git a/checker/tests/fenumswing/IdentityArrayListTest.java b/checker/tests/fenumswing/IdentityArrayListTest.java index 226bb0973a0d..1687755ec464 100644 --- a/checker/tests/fenumswing/IdentityArrayListTest.java +++ b/checker/tests/fenumswing/IdentityArrayListTest.java @@ -12,14 +12,14 @@ public class IdentityArrayListTest { @SuppressWarnings("argument") public T[] toArray(T[] a) { // Warnings only with -Alint=cast:strict. - // TODO:: warning: (cast.unsafe) + // TODO:: warning: [cast.unsafe] // :: warning: [unchecked] unchecked cast return (T[]) Arrays.copyOf(null, 0, a.getClass()); } public T[] toArray2(T[] a) { wc(null, 0, new java.util.LinkedList()); - // TODO:: warning: (cast.unsafe) + // TODO:: warning: [cast.unsafe] // :: warning: [unchecked] unchecked cast return (T[]) myCopyOf(null, 0, a.getClass()); } diff --git a/checker/tests/fenumswing/PolyTest.java b/checker/tests/fenumswing/PolyTest.java index e0b1b32626d8..fe82fde2c71e 100644 --- a/checker/tests/fenumswing/PolyTest.java +++ b/checker/tests/fenumswing/PolyTest.java @@ -12,7 +12,7 @@ public class PolyTest { @FenumBottom String bot) { // Test lub with poly and a qualifier that isn't top or bottom. String y = flag ? a : x; - // :: error: (assignment) + // :: error: [assignment] @PolyFenum String y2 = flag ? a : x; // Test lub with poly and bottom. diff --git a/checker/tests/fenumswing/SwingTest.java b/checker/tests/fenumswing/SwingTest.java index 94fb270a448e..bcf810a65725 100644 --- a/checker/tests/fenumswing/SwingTest.java +++ b/checker/tests/fenumswing/SwingTest.java @@ -17,10 +17,10 @@ public static void main(String[] args) { // ok m(BOTTOM); - // :: error: (argument) + // :: error: [argument] m(5); - // :: error: (argument) + // :: error: [argument] m(NORTH); } @@ -35,7 +35,7 @@ static void ignoreAll() { static void ignoreOne() { m(NORTH); - // :: error: (assignment) + // :: error: [assignment] @SwingVerticalOrientation int b = 5; } @@ -55,7 +55,7 @@ void testNull() { } @SwingVerticalOrientation int testInference0() { - // :: error: (assignment) + // :: error: [assignment] @SwingVerticalOrientation int boxint = 5; int box = boxint; return box; @@ -72,7 +72,7 @@ Object testInference1() { } @SwingVerticalOrientation Object testInference3() { - // :: error: (assignment) + // :: error: [assignment] @SwingVerticalOrientation Object boxobj = new Object(); Object obox = boxobj; return obox; @@ -156,15 +156,15 @@ void testInference8() { } void testInference8b() { - // :: error: (assignment) + // :: error: [assignment] @SwingHorizontalOrientation int s2 = 5; - // :: error: (compound.assignment) + // :: error: [compound.assignment] s2 += 1; - // :: error: (assignment) + // :: error: [assignment] s1 = (s2 += s2); - // :: error: (assignment) + // :: error: [assignment] @SwingHorizontalOrientation String str = "abc"; // yes, somebody in the Swing API really wrote this. str += null; @@ -183,7 +183,7 @@ Object testInference9() { break; } } - // :: error: (return) + // :: error: [return] return o; } @@ -212,7 +212,7 @@ Object testInference9() { break; } } - // :: error: (return) + // :: error: [return] return o; } @@ -227,7 +227,7 @@ Object testInference9() { break; } } - // :: error: (return) + // :: error: [return] return o; } @@ -260,7 +260,7 @@ int testInferenceThrow() { @SwingVerticalOrientation Object testDefaulting0() { @org.checkerframework.framework.qual.DefaultQualifier(SwingVerticalOrientation.class) - // :: error: (assignment) + // :: error: [assignment] Object o = new String(); return o; } diff --git a/checker/tests/formatter-unchecked-defaults/TestUncheckedByteCode.java b/checker/tests/formatter-unchecked-defaults/TestUncheckedByteCode.java index 1b84161a311e..4435bc18de3f 100644 --- a/checker/tests/formatter-unchecked-defaults/TestUncheckedByteCode.java +++ b/checker/tests/formatter-unchecked-defaults/TestUncheckedByteCode.java @@ -10,9 +10,9 @@ void test(UncheckedByteCode param, Integer i) { field = param.identity("hello"); // String and Object are relevant types and must be annotated in bytecode - // :: error: (argument) + // :: error: [argument] field = param.getObject(new Object()); - // :: error: (argument) + // :: error: [argument] field = param.getString("hello"); } } diff --git a/checker/tests/formatter/ConversionBasic.java b/checker/tests/formatter/ConversionBasic.java index a84b297a7559..b602ff59ed3a 100644 --- a/checker/tests/formatter/ConversionBasic.java +++ b/checker/tests/formatter/ConversionBasic.java @@ -29,9 +29,9 @@ public static void main(String... p) { f.format("%c", Byte.valueOf((byte) 67)); f.format("%c", Short.valueOf((short) 67)); f.format("%C", Integer.valueOf(67)); - // :: error: (argument) + // :: error: [argument] f.format("%c", 7.5); - // :: error: (argument) + // :: error: [argument] f.format("%C", "Value"); // test INT @@ -42,9 +42,9 @@ public static void main(String... p) { f.format("%X", (long) 67); f.format("%d", Long.valueOf(67)); f.format("%d", BigInteger.ONE); - // :: error: (argument) + // :: error: [argument] f.format("%d", 'c'); - // :: error: (argument) + // :: error: [argument] f.format("%d", BigDecimal.ONE); // test FLOAT @@ -55,9 +55,9 @@ public static void main(String... p) { f.format("%g", Double.valueOf(42.5)); f.format("%G", 67.87); f.format("%a", BigDecimal.ONE); - // :: error: (argument) + // :: error: [argument] f.format("%A", 1325); - // :: error: (argument) + // :: error: [argument] f.format("%a", BigInteger.ONE); // test TIME @@ -65,9 +65,9 @@ public static void main(String... p) { f.format("%tD", new Date()); f.format("%TM", (long) 32165456); f.format("%TD", Calendar.getInstance()); - // :: error: (argument) + // :: error: [argument] f.format("%tD", 1321543512); - // :: error: (argument) + // :: error: [argument] f.format("%tD", new Object()); System.out.println(f.toString()); diff --git a/checker/tests/formatter/FlowFormatter.java b/checker/tests/formatter/FlowFormatter.java index 479b0b1ad342..dee167292f16 100644 --- a/checker/tests/formatter/FlowFormatter.java +++ b/checker/tests/formatter/FlowFormatter.java @@ -20,25 +20,25 @@ public static void main(String... p) { callUnqual(qual); callUnqual(wrong); callUnqual(null); - // :: error: (format.string) + // :: error: [format.string] f.format(null); @Format({ConversionCategory.GENERAL}) String nullAssign = null; - // :: error: (format.string) + // :: error: [format.string] f.format(nullAssign, "string"); if (false) { nullAssign = "%s"; } f.format(nullAssign, "string"); - // :: error: (assignment) + // :: error: [assignment] @Format({ConversionCategory.GENERAL}) String err0 = unqual; - // :: error: (assignment) + // :: error: [assignment] @Format({ConversionCategory.GENERAL}) String err2 = "%$s"; @Format({ConversionCategory.GENERAL}) String ok = "%s"; String u = "%s" + " %" + "d"; String v = FormatUtil.asFormat(u, ConversionCategory.GENERAL, ConversionCategory.INT); f.format(u, "String", 1337); - // :: error: (argument) + // :: error: [argument] f.format(u, "String", 7.4); try { @@ -51,7 +51,7 @@ public static void main(String... p) { f.format(a, "String", 1337, 7.5); String b = "Fail: %d"; - // :: error: (argument) + // :: error: [argument] f.format(b, "Wrong"); @Format({ @@ -64,11 +64,11 @@ public static void main(String... p) { f.format(s, "OK", 42, 3.14, 'c'); @Format({ConversionCategory.GENERAL, ConversionCategory.INT, ConversionCategory.FLOAT}) String t = "Fail: %s %d %f"; - // :: error: (argument) + // :: error: [argument] f.format(t, "OK", "Wrong", 3.14); call(f, "Success: %tM"); - // :: error: (argument) + // :: error: [argument] call(f, "Fail: %d"); System.out.println(f.toString()); @@ -77,7 +77,7 @@ public static void main(String... p) { public static void call(Formatter f, @Format({ConversionCategory.TIME}) String s) { f.format(s, new Date()); - // :: error: (argument) + // :: error: [argument] f.format(s, "Wrong"); } } diff --git a/checker/tests/formatter/FormatBasic.java b/checker/tests/formatter/FormatBasic.java index ccc961d3b303..e8c99e9ce3cb 100644 --- a/checker/tests/formatter/FormatBasic.java +++ b/checker/tests/formatter/FormatBasic.java @@ -20,15 +20,15 @@ public static void main(String... p) { f.format("Duke's Birthday: %2$tm %()); f.format("%d %s", 132, new Object[2]); f.format("%s %d", new Object[2], 123); - // :: error: (format.missing.arguments) + // :: error: [format.missing.arguments] f.format("%d %s %s", 132, new Object[2]); - // :: error: (argument) + // :: error: [argument] f.format("%d %d", new Object[2], 123); - // "error: (format.specifier.null)" could be a warning rather than an error, but that would + // "error: [format.specifier.null]" could be a warning rather than an error, but that would // require reasoning about the values in an array construction expression. - // :: error: (format.specifier.null) :: warning: (format.indirect.arguments) + // :: error: [format.specifier.null] :: warning: [format.indirect.arguments] f.format("%d % func) { // Needs to be @UIEffect, because the functional interface method is @UIEffect public void unsafeDoUI(UIFunctionalInterface func) { - // :: error: (call.ui) + // :: error: [call.ui] func.executeUI(this.arg); } @@ -90,11 +90,11 @@ public void doEither(@PolyUI PolymorphicFunctionalInterface func) { public static void safeContextTestCases(UIElement elem) { LambdaRunner runner = new LambdaRunner(elem); runner.doSafe(e -> e.repaint()); - // :: error: (call.ui) + // :: error: [call.ui] runner.doSafe(e -> e.dangerous()); // Not allowed in doSafe - // :: error: (call.ui) + // :: error: [call.ui] runner.doUI(e -> e.repaint()); // Not allowed in safe context - // :: error: (call.ui) + // :: error: [call.ui] runner.doUI(e -> e.dangerous()); // Not allowed in safe context runner.doEither(e -> e.repaint()); runner.doEither(e -> e.dangerous()); @@ -109,16 +109,16 @@ public void executePolymorphic(UIElement arg) { } }); @UI PolymorphicLambdaRunner uiPolymorphicLambdaRunner = new @UI PolymorphicLambdaRunner(elem); - // :: error: (call.ui) + // :: error: [call.ui] uiPolymorphicLambdaRunner.doEither( e -> e.repaint()); // Safe at runtime, but not by the type system! - // :: error: (call.ui) + // :: error: [call.ui] uiPolymorphicLambdaRunner.doEither(e -> e.dangerous()); PolymorphicFunctionalInterface func1 = e -> e.repaint(); - // :: error: (assignment) + // :: error: [assignment] PolymorphicFunctionalInterface func2 = e -> e.dangerous(); // Incompatible types! PolymorphicFunctionalInterface func2p = - // :: error: (assignment) + // :: error: [assignment] (new @UI PolymorphicFunctionalInterface() { public void executePolymorphic(UIElement arg) { arg.dangerous(); @@ -127,18 +127,18 @@ public void executePolymorphic(UIElement arg) { @UI PolymorphicFunctionalInterface func3 = e -> e.dangerous(); safePolymorphicLambdaRunner.doEither(func1); safePolymorphicLambdaRunner.doEither(func2); - // :: error: (call.ui) + // :: error: [call.ui] uiPolymorphicLambdaRunner.doEither(func1); - // :: error: (call.ui) + // :: error: [call.ui] uiPolymorphicLambdaRunner.doEither(func2); - // :: error: (call.ui) + // :: error: [call.ui] uiPolymorphicLambdaRunner.doEither(func3); } @UIEffect public static void uiContextTestCases(UIElement elem) { LambdaRunner runner = new LambdaRunner(elem); - // :: error: (call.ui) + // :: error: [call.ui] runner.doSafe(e -> e.dangerous()); runner.doUI(e -> e.repaint()); runner.doUI(e -> e.dangerous()); @@ -154,7 +154,7 @@ public static void uiContextTestCases(UIElement elem) { // This should be an error without an @UI annotation on the return type. No? public PolymorphicFunctionalInterface returnLambdasTest2() { - // :: error: (return) + // :: error: [return] return e -> { e.dangerous(); }; @@ -162,7 +162,7 @@ public PolymorphicFunctionalInterface returnLambdasTest2() { // Just to check public PolymorphicFunctionalInterface returnLambdasTest3() { - // :: error: (return) + // :: error: [return] return (new @UI PolymorphicFunctionalInterface() { public void executePolymorphic(UIElement arg) { arg.dangerous(); diff --git a/checker/tests/guieffect/Specialization.java b/checker/tests/guieffect/Specialization.java index f0db7dce1113..9fe10408c940 100644 --- a/checker/tests/guieffect/Specialization.java +++ b/checker/tests/guieffect/Specialization.java @@ -20,7 +20,7 @@ public static interface Doer { } @AlwaysSafe public static class SafeDoer implements @AlwaysSafe Doer { - // :: error: (override.param) + // :: error: [override.param] public void doStuff(@AlwaysSafe SafeDoer this, @AlwaysSafe I i) {} } @@ -33,7 +33,7 @@ public static void main(String[] args) { @AlwaysSafe Doer d = new @AlwaysSafe Doer() { @SafeEffect - // :: error: (override.param) + // :: error: [override.param] public void doStuff(@AlwaysSafe I i) { reqSafe(i); } diff --git a/checker/tests/guieffect/TestProgram.java b/checker/tests/guieffect/TestProgram.java index 2f50fe324418..f9d2efa49767 100644 --- a/checker/tests/guieffect/TestProgram.java +++ b/checker/tests/guieffect/TestProgram.java @@ -9,7 +9,7 @@ public void nonUIStuff( final UIElement e, final GenericTaskUIConsumer uicons, final GenericTaskSafeConsumer safecons) { - // :: error: (call.ui) + // :: error: [call.ui] e.dangerous(); // should be bad e.runOnUIThread( new IAsyncUITask() { @@ -35,30 +35,30 @@ public void doGenericStuff() { // Should be inst. w/ @UI eff. @Override public void doGenericStuff() { // Should be inst. w/ @AlwaysSafe - // :: error: (call.ui) + // :: error: [call.ui] e2.dangerous(); // should be an error safecons.runAsync(this); // Should be okay, this:@AlwaysSafe } }); safecons.runAsync( - // :: error: (argument) + // :: error: [argument] new @UI IGenericTask() { final UIElement e2 = e; @Override public void doGenericStuff() { // Should be inst. w/ @UI e2.dangerous(); // should be ok - // :: error: (argument) + // :: error: [argument] safecons.runAsync(this); // Should be error, this:@UI } }); // Test that the package annotation works - // :: error: (call.ui) + // :: error: [call.ui] UIByPackageDecl.implicitlyUI(); // Test that @SafeType works: SafeByDecl is inside a @UIPackage SafeByDecl.safeByTypeDespiteUIPackage(); safecons.runAsync( - // :: error: (argument) + // :: error: [argument] new IGenericTask() { @Override public void doGenericStuff() { @@ -71,7 +71,7 @@ public void doGenericStuff() { new IGenericTask() { @Override @UIEffect - // :: error: (override.effect.nonui) + // :: error: [override.effect.nonui] public void doGenericStuff() { UIByPackageDecl.implicitlyUI(); } diff --git a/checker/tests/guieffect/ThrowCatchTest.java b/checker/tests/guieffect/ThrowCatchTest.java index a4b1b32f4dec..cfb4b51d52b4 100644 --- a/checker/tests/guieffect/ThrowCatchTest.java +++ b/checker/tests/guieffect/ThrowCatchTest.java @@ -6,7 +6,7 @@ public class ThrowCatchTest { List ooo; - // :: error: (annotations.on.use) + // :: error: [annotations.on.use] List iii; class Inner {} @@ -16,15 +16,15 @@ class Inner {} // Type var test void throwTypeVarUI1(E ex1, @UI E ex2) throws PolyUIException { if (flag) { - // :: error: (throw) + // :: error: [throw] throw ex1; } - // :: error: (throw) + // :: error: [throw] throw ex2; } <@UI E extends @UI PolyUIException> void throwTypeVarUI2(E ex1) throws PolyUIException { - // :: error: (throw) + // :: error: [throw] throw ex1; } @@ -47,7 +47,7 @@ class Inner {} <@AlwaysSafe E extends @UI PolyUIException> void throwTypeVarMixed(E ex1, @AlwaysSafe E ex2) throws PolyUIException { if (flag) { - // :: error: (throw) + // :: error: [throw] throw ex1; } throw ex2; @@ -74,7 +74,7 @@ void throwNull() { void throwDeclared() { try { - // :: error: (throw) + // :: error: [throw] throw ui; } catch (@UI PolyUIException UIParam) { diff --git a/checker/tests/guieffect/TransitiveInheritance.java b/checker/tests/guieffect/TransitiveInheritance.java index a7b9bdad1d94..226eae0b5968 100644 --- a/checker/tests/guieffect/TransitiveInheritance.java +++ b/checker/tests/guieffect/TransitiveInheritance.java @@ -30,14 +30,14 @@ public static class Base extends MidLevel implements IMid { // TopLevel) @Override @UIEffect - // :: error: (override.effect) + // :: error: [override.effect] public void foo() {} // Should catch when the override is for a method originating in an interface two levels up // (here ITop) @Override @UIEffect - // :: error: (override.effect) + // :: error: [override.effect] public void bar() {} // Should catch when the override is for a method originating in an interface two levels up, @@ -45,14 +45,14 @@ public void bar() {} // MidLevel). @Override @UIEffect - // :: error: (override.effect) + // :: error: [override.effect] public void baz() {} } public static interface IBase extends IMid { @Override @UIEffect - // :: error: (override.effect) + // :: error: [override.effect] public void bar(); } } diff --git a/checker/tests/guieffect/UIChild.java b/checker/tests/guieffect/UIChild.java index f6f94c630b33..b773d60b4270 100644 --- a/checker/tests/guieffect/UIChild.java +++ b/checker/tests/guieffect/UIChild.java @@ -6,33 +6,33 @@ public class UIChild extends UIParent { @Override public void doingUIStuff() { - // :: error: (call.ui) + // :: error: [call.ui] thingy.dangerous(); } // Should be an error to make this @UI @Override @UIEffect - // :: error: (override.effect) + // :: error: [override.effect] public void doingSafeStuff() {} public void shouldNotBeUI() { - // :: error: (call.ui) + // :: error: [call.ui] thingy.dangerous(); } @UIEffect @SafeEffect - // :: error: (annotations.conflicts) + // :: error: [annotations.conflicts] public void doubleAnnot1() {} @UIEffect @PolyUIEffect - // :: error: (annotations.conflicts) :: error: (polymorphism) + // :: error: [annotations.conflicts] :: error: [polymorphism] public void doubleAnnot2() {} @PolyUIEffect @SafeEffect - // :: error: (annotations.conflicts) :: error: (polymorphism) + // :: error: [annotations.conflicts] :: error: [polymorphism] public void doubleAnnot3() {} } diff --git a/checker/tests/i18n-formatter-unchecked-defaults/TestUncheckedByteCode.java b/checker/tests/i18n-formatter-unchecked-defaults/TestUncheckedByteCode.java index 1b84161a311e..4435bc18de3f 100644 --- a/checker/tests/i18n-formatter-unchecked-defaults/TestUncheckedByteCode.java +++ b/checker/tests/i18n-formatter-unchecked-defaults/TestUncheckedByteCode.java @@ -10,9 +10,9 @@ void test(UncheckedByteCode param, Integer i) { field = param.identity("hello"); // String and Object are relevant types and must be annotated in bytecode - // :: error: (argument) + // :: error: [argument] field = param.getObject(new Object()); - // :: error: (argument) + // :: error: [argument] field = param.getString("hello"); } } diff --git a/checker/tests/i18n-formatter/ConversionCategoryTest.java b/checker/tests/i18n-formatter/ConversionCategoryTest.java index becba97a1ea4..fa49238c61b2 100644 --- a/checker/tests/i18n-formatter/ConversionCategoryTest.java +++ b/checker/tests/i18n-formatter/ConversionCategoryTest.java @@ -48,19 +48,19 @@ public static void main(String[] args) { @I18nFormat({I18nConversionCategory.DATE}) String s13 = "{0, date} {0, date}"; - // :: error: (i18nformat.excess.arguments) :: error: (assignment) + // :: error: (i18nformat.excess.arguments) :: error: [assignment] @I18nFormat({I18nConversionCategory.GENERAL}) String b1 = "{1}"; - // :: error: (assignment) + // :: error: [assignment] @I18nFormat({I18nConversionCategory.DATE}) String b2 = "{0, number}"; - // :: error: (assignment) + // :: error: [assignment] @I18nFormat({I18nConversionCategory.GENERAL}) String b3 = "{0, number}"; - // :: error: (assignment) + // :: error: [assignment] @I18nFormat({I18nConversionCategory.GENERAL}) String b4 = "{0, date}"; - // :: error: (i18nformat.excess.arguments) :: error: (assignment) + // :: error: (i18nformat.excess.arguments) :: error: [assignment] @I18nFormat({I18nConversionCategory.DATE}) String b5 = "{0, date} {1, date}"; // :: warning: (i18nformat.missing.arguments) diff --git a/checker/tests/i18n-formatter/HasFormat.java b/checker/tests/i18n-formatter/HasFormat.java index ce7172ccd40c..6cb59928deeb 100644 --- a/checker/tests/i18n-formatter/HasFormat.java +++ b/checker/tests/i18n-formatter/HasFormat.java @@ -11,7 +11,7 @@ void test1(String format) { MessageFormat.format(format, "S", 1); // :: warning: (i18nformat.missing.arguments) MessageFormat.format(format, "S"); - // :: error: (argument) + // :: error: [argument] MessageFormat.format(format, "S", "S"); // :: warning: (i18nformat.excess.arguments) MessageFormat.format(format, "S", 1, 2); @@ -51,7 +51,7 @@ void test4(String format) throws Exception { void tes5(String format) { if (I18nFormatUtil.hasFormat(format, I18nConversionCategory.NUMBER)) { - // :: error: (argument) + // :: error: [argument] MessageFormat.format(format, "S"); MessageFormat.format(format, 1); } else { diff --git a/checker/tests/i18n-formatter/I18nFormat.java b/checker/tests/i18n-formatter/I18nFormat.java index 0dd420d64ba2..19f57d25cf9c 100644 --- a/checker/tests/i18n-formatter/I18nFormat.java +++ b/checker/tests/i18n-formatter/I18nFormat.java @@ -35,18 +35,18 @@ void test() { MessageFormat.format("{0}", 1); MessageFormat.format("{0}", new Date()); - // :: error: (argument) + // :: error: [argument] MessageFormat.format("{0, number}", "S"); MessageFormat.format("{0, number}", 1); - // :: error: (argument) + // :: error: [argument] MessageFormat.format("{0, number}", new Date()); - // :: error: (argument) + // :: error: [argument] MessageFormat.format("{0, time}", "S"); MessageFormat.format("{0, time}", 1); MessageFormat.format("{0, time}", new Date()); - // :: error: (argument) + // :: error: [argument] MessageFormat.format("{0, date}", "S"); MessageFormat.format("{0, date}", 1); MessageFormat.format("{0, date}", new Date()); diff --git a/checker/tests/i18n-formatter/I18nFormatForTest.java b/checker/tests/i18n-formatter/I18nFormatForTest.java index 6402bce2c62a..7a0a86e3cbb6 100644 --- a/checker/tests/i18n-formatter/I18nFormatForTest.java +++ b/checker/tests/i18n-formatter/I18nFormatForTest.java @@ -32,7 +32,7 @@ public static void main(String[] args) { b("{0, number", new Date(12)); b("{0, number}{1}", 1, "A"); b("{0}", "a string"); - // :: error: (argument) + // :: error: [argument] b("{0, number}", "a string"); // :: error: (i18nformat.formatfor) @@ -50,7 +50,7 @@ public static void main(String[] args) { i("{0}", "a string"); j("{0}"); - // :: error: (argument) + // :: error: [argument] j("{0, number}"); } @@ -71,7 +71,7 @@ static void c(@I18nFormatFor("#-1") String f, Object... args) { } // @I18nFormatFor needs to be annotated to a string. - // :: error: (anno.on.irrelevant) + // :: error: [anno.on.irrelevant] static void e(@I18nFormatFor("#2") int f, Object... args) {} // The parameter type is not necessary to an array of objects diff --git a/checker/tests/i18n-formatter/ManualExampleI18nFormatter.java b/checker/tests/i18n-formatter/ManualExampleI18nFormatter.java index d0bfa4c18648..f124f67deca3 100644 --- a/checker/tests/i18n-formatter/ManualExampleI18nFormatter.java +++ b/checker/tests/i18n-formatter/ManualExampleI18nFormatter.java @@ -29,9 +29,9 @@ void m(boolean flag) { } @I18nFormat({NUMBER, DATE}) String f2 = f; - // :: error: (assignment) + // :: error: [assignment] f = "{0, number} {1, number}"; // error: NUMBER is stronger (more restrictive) than DATE - // :: error: (i18nformat.excess.arguments) :: error: (assignment) + // :: error: (i18nformat.excess.arguments) :: error: [assignment] f = "{0} {1} {2}"; // error: too many arguments } } diff --git a/checker/tests/i18n-unchecked-defaults/TestUncheckedByteCode.java b/checker/tests/i18n-unchecked-defaults/TestUncheckedByteCode.java index 1b84161a311e..4435bc18de3f 100644 --- a/checker/tests/i18n-unchecked-defaults/TestUncheckedByteCode.java +++ b/checker/tests/i18n-unchecked-defaults/TestUncheckedByteCode.java @@ -10,9 +10,9 @@ void test(UncheckedByteCode param, Integer i) { field = param.identity("hello"); // String and Object are relevant types and must be annotated in bytecode - // :: error: (argument) + // :: error: [argument] field = param.getObject(new Object()); - // :: error: (argument) + // :: error: [argument] field = param.getString("hello"); } } diff --git a/checker/tests/i18n/I18nCollectorsToList.java b/checker/tests/i18n/I18nCollectorsToList.java index c1dd9eb10504..fb872d7a039f 100644 --- a/checker/tests/i18n/I18nCollectorsToList.java +++ b/checker/tests/i18n/I18nCollectorsToList.java @@ -11,7 +11,7 @@ void m(List strings) { List collectedStrings1 = s.collect(Collectors.toList()); List collectedStrings = s.collect(Collectors.toList()); - // :: error: (methodref.param) + // :: error: [methodref.param] collectedStrings.forEach(System.out::println); } diff --git a/checker/tests/i18n/LocalizedMessage.java b/checker/tests/i18n/LocalizedMessage.java index 737d22c2d8f5..a863e8257bbb 100644 --- a/checker/tests/i18n/LocalizedMessage.java +++ b/checker/tests/i18n/LocalizedMessage.java @@ -10,13 +10,13 @@ void localized(@Localized String s) {} void any(String s) {} void stringLiteral() { - // :: error: (argument) + // :: error: [argument] localized("ldskjfldj"); // error any("lksjdflkjdf"); } void stringRef(String ref) { - // :: error: (argument) + // :: error: [argument] localized(ref); // error any(ref); } @@ -32,20 +32,20 @@ void methodRet(String ref) { } void concatenation(@Localized String s1, String s2) { - // :: error: (argument) + // :: error: [argument] localized(s1 + s1); // error - // :: error: (argument) :: error: (compound.assignment) + // :: error: [argument] :: error: [compound.assignment] localized(s1 += s1); // error - // :: error: (argument) + // :: error: [argument] localized(s1 + "m"); // error - // :: error: (argument) + // :: error: [argument] localized(s1 + s2); // error - // :: error: (argument) + // :: error: [argument] localized(s2 + s1); // error - // :: error: (argument) + // :: error: [argument] localized(s2 + "m"); // error - // :: error: (argument) + // :: error: [argument] localized(s2 + s2); // error any(s1 + s1); diff --git a/checker/tests/index-listindexing/GrowOnlyIteratorTest.java b/checker/tests/index-listindexing/GrowOnlyIteratorTest.java index bc083263dea9..ed54f07a743f 100644 --- a/checker/tests/index-listindexing/GrowOnlyIteratorTest.java +++ b/checker/tests/index-listindexing/GrowOnlyIteratorTest.java @@ -15,7 +15,7 @@ void testIteratorRemove(@GrowOnly List list) { list.add("test"); // Ensure list has content Iterator iter = list.iterator(); iter.next(); - // :: error: (method.invocation) + // :: error: [method.invocation] iter.remove(); } @@ -34,7 +34,7 @@ void testListIteratorAdd(@GrowOnly List list) { } void testRemoveIf(@GrowOnly List list) { - // :: error: (method.invocation) + // :: error: [method.invocation] list.removeIf(s -> s.length() > 5); } @@ -43,13 +43,13 @@ void testBulkRemovalMethods(@GrowOnly List list) { toRemove.add("item1"); toRemove.add("item2"); - // :: error: (method.invocation) + // :: error: [method.invocation] list.removeAll(toRemove); - // :: error: (method.invocation) + // :: error: [method.invocation] list.retainAll(toRemove); - // :: error: (method.invocation) + // :: error: [method.invocation] list.clear(); } @@ -96,7 +96,7 @@ void testIteratorOnGrowOnlyList() { while (iter.hasNext()) { String item = iter.next(); // But removal should not - // :: error: (method.invocation) + // :: error: [method.invocation] iter.remove(); } } diff --git a/checker/tests/index-listindexing/GrowOnlyJdk21Test.java b/checker/tests/index-listindexing/GrowOnlyJdk21Test.java index dab908c6466b..8488aa4a19f8 100644 --- a/checker/tests/index-listindexing/GrowOnlyJdk21Test.java +++ b/checker/tests/index-listindexing/GrowOnlyJdk21Test.java @@ -11,28 +11,28 @@ public class GrowOnlyJdk21Test { void testCollection(@GrowOnly List list) { // SequencedCollection was added in Java 21 and is not yet in the annotated JDK. // SequencedCollection sc = list; - // // :: error: (method.invocation) + // // :: error: [method.invocation] // sc.removeFirst("hello"); - // // :: error: (method.invocation) + // // :: error: [method.invocation] // sc.removeLast("hello"); - // // :: error: (method.invocation) + // // :: error: [method.invocation] // sc.clear(); - // // :: error: (method.invocation) + // // :: error: [method.invocation] // sc.remove("hello"); - // // :: error: (method.invocation) + // // :: error: [method.invocation] // sc.removeAll(list2); - // // :: error: (method.invocation) + // // :: error: [method.invocation] // sc.removeIf(s -> s.equals("hello")); - // // :: error: (method.invocation) + // // :: error: [method.invocation] // sc.retainAll(list2); } void testViewCollection(@GrowOnly List list) { // SequencedCollection was added in Java 21 and is not yet in the annotated JDK. // SequencedCollection sc2 = sc.reversed(); - // // :: error: (method.invocation) + // // :: error: [method.invocation] // sc2.removeFirst("hello"); - // // :: error: (method.invocation) + // // :: error: [method.invocation] // sc2.removeLast("hello"); } } diff --git a/checker/tests/index-listindexing/GrowOnlyJdkTest.java b/checker/tests/index-listindexing/GrowOnlyJdkTest.java index 917c4cf4d7e4..5e1e294afa6b 100644 --- a/checker/tests/index-listindexing/GrowOnlyJdkTest.java +++ b/checker/tests/index-listindexing/GrowOnlyJdkTest.java @@ -10,14 +10,14 @@ void testAllowedCalls(@GrowOnly List list) { } void testForbiddenCalls(@GrowOnly List list) { - // :: error: (method.invocation) + // :: error: [method.invocation] list.remove(0); } void testLocalVariable() { @GrowOnly List localList = new @GrowOnly ArrayList<>(); localList.add("hello"); - // :: error: (method.invocation) + // :: error: [method.invocation] localList.clear(); } diff --git a/checker/tests/index-listindexing/GrowOnlyPolymorphicTest.java b/checker/tests/index-listindexing/GrowOnlyPolymorphicTest.java index 9bfbc01e84f6..6375d34bc1fd 100644 --- a/checker/tests/index-listindexing/GrowOnlyPolymorphicTest.java +++ b/checker/tests/index-listindexing/GrowOnlyPolymorphicTest.java @@ -18,16 +18,16 @@ void testPolymorphicReturns(@GrowOnly List growOnlyList) { // GrowOnly iterator should not allow removal growOnlyIter.next(); - // :: error: (method.invocation) + // :: error: [method.invocation] growOnlyIter.remove(); // Test subList behavior - should preserve qualifiers List growOnlySublist = growOnlyList.subList(0, Math.min(1, growOnlyList.size())); // GrowOnly sublist should not allow shrinking operations - // :: error: (method.invocation) + // :: error: [method.invocation] growOnlySublist.clear(); - // :: error: (method.invocation) + // :: error: [method.invocation] growOnlySublist.remove("test"); // Test stream operations preserve qualifiers @@ -64,9 +64,9 @@ void testViewsAndWrappers(@GrowOnly List growOnlyList) { List checkedList = java.util.Collections.checkedList(growOnlyList, String.class); // These views should preserve the @GrowOnly property - // :: error: (method.invocation) + // :: error: [method.invocation] synchronizedList.clear(); - // :: error: (method.invocation) + // :: error: [method.invocation] checkedList.remove("test"); // Unmodifiable list should prevent all modifications (this is a special case) @@ -84,14 +84,14 @@ void testGenericPolymorphism() { @GrowOnly Iterable iterable = stringList; // All should preserve @GrowOnly restrictions - // :: error: (method.invocation) + // :: error: [method.invocation] collection.clear(); - // :: error: (method.invocation) + // :: error: [method.invocation] collection.remove("test"); Iterator iter = iterable.iterator(); iter.next(); - // :: error: (method.invocation) + // :: error: [method.invocation] iter.remove(); } @@ -101,18 +101,18 @@ void testGenericMethodPolymorphism(@GrowOnly List list) { if (iter.hasNext()) { T item = iter.next(); - // :: error: (method.invocation) + // :: error: [method.invocation] iter.remove(); } // Test sublist with generic types List sublist = list.subList(0, Math.min(1, list.size())); - // :: error: (method.invocation) + // :: error: [method.invocation] sublist.clear(); // Generic wildcards should work correctly @GrowOnly List wildcardList = list; - // :: error: (method.invocation) + // :: error: [method.invocation] wildcardList.remove(null); } @@ -123,7 +123,7 @@ void testToArrayPolymorphism(@GrowOnly List list) { String[] strArray2 = list.toArray(String[]::new); // But these don't affect the list's mutability restrictions - // :: error: (method.invocation) + // :: error: [method.invocation] list.clear(); } @@ -136,7 +136,7 @@ void testSpliteratorPolymorphism(@GrowOnly List list) { spliterator.forEachRemaining(System.out::println); // But the underlying list should still be protected - // :: error: (method.invocation) + // :: error: [method.invocation] list.remove(0); } } diff --git a/checker/tests/index-listindexing/GrowOnlySupertypeTest.java b/checker/tests/index-listindexing/GrowOnlySupertypeTest.java index d8cbb4cae779..2fd67a3ff5a8 100644 --- a/checker/tests/index-listindexing/GrowOnlySupertypeTest.java +++ b/checker/tests/index-listindexing/GrowOnlySupertypeTest.java @@ -15,104 +15,104 @@ public class GrowOnlySupertypeTest { void testList(@GrowOnly List list) { Collection c = list; - // :: error: (method.invocation) + // :: error: [method.invocation] c.remove("hello"); - // :: error: (method.invocation) + // :: error: [method.invocation] c.removeAll(list2); - // :: error: (method.invocation) + // :: error: [method.invocation] c.removeIf(s -> s.equals("hello")); - // :: error: (method.invocation) + // :: error: [method.invocation] c.retainAll(list2); - // :: error: (method.invocation) + // :: error: [method.invocation] c.clear(); Iterable ible = list; Iterator itor = ible.iterator(); itor.next(); - // :: error: (method.invocation) + // :: error: [method.invocation] itor.remove(); } void testAbstractCollection(@GrowOnly AbstractCollection ac) { - // :: error: (method.invocation) + // :: error: [method.invocation] ac.remove("hello"); - // :: error: (method.invocation) + // :: error: [method.invocation] ac.removeAll(list2); - // :: error: (method.invocation) + // :: error: [method.invocation] ac.retainAll(list2); - // :: error: (method.invocation) + // :: error: [method.invocation] ac.clear(); } void testArrayList(@GrowOnly ArrayList list) { AbstractCollection ac = list; - // :: error: (method.invocation) + // :: error: [method.invocation] ac.remove("hello"); - // :: error: (method.invocation) + // :: error: [method.invocation] ac.removeAll(list2); - // :: error: (method.invocation) + // :: error: [method.invocation] ac.retainAll(list2); - // :: error: (method.invocation) + // :: error: [method.invocation] ac.clear(); } void testDeque(@GrowOnly Deque d) { - // :: error: (method.invocation) + // :: error: [method.invocation] d.remove("hello"); - // :: error: (method.invocation) + // :: error: [method.invocation] d.removeAll(list2); - // :: error: (method.invocation) + // :: error: [method.invocation] d.removeIf(s -> s.equals("hello")); - // :: error: (method.invocation) + // :: error: [method.invocation] d.retainAll(list2); - // :: error: (method.invocation) + // :: error: [method.invocation] d.clear(); } void testLinkedList(@GrowOnly LinkedList list) { Queue q = list; - // :: error: (method.invocation) + // :: error: [method.invocation] q.remove("hello"); - // :: error: (method.invocation) + // :: error: [method.invocation] q.removeAll(list2); - // :: error: (method.invocation) + // :: error: [method.invocation] q.removeIf(s -> s.equals("hello")); - // :: error: (method.invocation) + // :: error: [method.invocation] q.retainAll(list2); - // :: error: (method.invocation) + // :: error: [method.invocation] q.clear(); - // :: error: (method.invocation) + // :: error: [method.invocation] q.poll(); Deque d = list; - // :: error: (method.invocation) + // :: error: [method.invocation] d.remove("hello"); - // :: error: (method.invocation) + // :: error: [method.invocation] d.removeAll(list2); - // :: error: (method.invocation) + // :: error: [method.invocation] d.removeIf(s -> s.equals("hello")); - // :: error: (method.invocation) + // :: error: [method.invocation] d.retainAll(list2); - // :: error: (method.invocation) + // :: error: [method.invocation] d.clear(); - // :: error: (method.invocation) + // :: error: [method.invocation] d.poll(); - // :: error: (method.invocation) + // :: error: [method.invocation] d.pollFirst(); - // :: error: (method.invocation) + // :: error: [method.invocation] d.pollLast(); - // :: error: (method.invocation) + // :: error: [method.invocation] d.pop(); - // :: error: (method.invocation) + // :: error: [method.invocation] d.remove(); - // :: error: (method.invocation) + // :: error: [method.invocation] d.removeFirst(); - // :: error: (method.invocation) + // :: error: [method.invocation] d.removeFirstOccurrence("hello"); - // :: error: (method.invocation) + // :: error: [method.invocation] d.removeLast(); - // :: error: (method.invocation) + // :: error: [method.invocation] d.removeLastOccurrence("hello"); } } diff --git a/checker/tests/index-listindexing/GrowOnlyViewTest.java b/checker/tests/index-listindexing/GrowOnlyViewTest.java index e0371266b7fe..c305cbf036da 100644 --- a/checker/tests/index-listindexing/GrowOnlyViewTest.java +++ b/checker/tests/index-listindexing/GrowOnlyViewTest.java @@ -8,28 +8,28 @@ public class GrowOnlyViewTest { void testViewCollection(@GrowOnly List list) { Collection cc = Collections.checkedCollection(list, String.class); - // :: error: (method.invocation) + // :: error: [method.invocation] cc.clear(); Collection syncC = Collections.synchronizedCollection(list); - // :: error: (method.invocation) + // :: error: [method.invocation] syncC.clear(); List subList = list.subList(2, 4); - // :: error: (method.invocation) + // :: error: [method.invocation] subList.clear(); } void testIterator(@GrowOnly Iterator itor) { itor.next(); - // :: error: (method.invocation) + // :: error: [method.invocation] itor.remove(); } void testIteratorMethod(@GrowOnly List list) { Iterator itor = list.iterator(); itor.next(); - // :: error: (method.invocation) + // :: error: [method.invocation] itor.remove(); } } diff --git a/checker/tests/index-listindexing/GrowShrinkHierarchyTest.java b/checker/tests/index-listindexing/GrowShrinkHierarchyTest.java index 24971685a827..5c0cb46516d1 100644 --- a/checker/tests/index-listindexing/GrowShrinkHierarchyTest.java +++ b/checker/tests/index-listindexing/GrowShrinkHierarchyTest.java @@ -36,42 +36,42 @@ void testHierarchy( @UnshrinkableRef Object a5 = bottom; // Assignments to @GrowOnly - // :: error: (assignment) + // :: error: [assignment] @GrowOnly Object b1 = unshrinkableRef; // ERROR: Supertype to subtype @GrowOnly Object b2 = growOnly; - // :: error: (assignment) + // :: error: [assignment] @GrowOnly Object b3 = canShrink; // ERROR: Sibling types - // :: error: (assignment) + // :: error: [assignment] @GrowOnly Object b4 = uncheckedCanShrink; // ERROR: Sibling types @GrowOnly Object b5 = bottom; // Assignments to @CanShrink - // :: error: (assignment) + // :: error: [assignment] @CanShrink Object c1 = unshrinkableRef; // ERROR: Supertype to subtype - // :: error: (assignment) + // :: error: [assignment] @CanShrink Object c2 = growOnly; // ERROR: Sibling types @CanShrink Object c3 = canShrink; @CanShrink Object c4 = uncheckedCanShrink; // Subtype to supertype @CanShrink Object c5 = bottom; // Assignments to @UncheckedCanShrink - // :: error: (assignment) + // :: error: [assignment] @UncheckedCanShrink Object d1 = unshrinkableRef; // ERROR: Supertype to subtype - // :: error: (assignment) + // :: error: [assignment] @UncheckedCanShrink Object d2 = growOnly; // ERROR: Sibling types - // :: error: (assignment) + // :: error: [assignment] @UncheckedCanShrink Object d3 = canShrink; // ERROR: Supertype to subtype @UncheckedCanShrink Object d4 = uncheckedCanShrink; @UncheckedCanShrink Object d5 = bottom; // Assignments to @BottomGrowShrink - // :: error: (assignment) + // :: error: [assignment] @BottomGrowShrink Object e1 = unshrinkableRef; // ERROR - // :: error: (assignment) + // :: error: [assignment] @BottomGrowShrink Object e2 = growOnly; // ERROR - // :: error: (assignment) + // :: error: [assignment] @BottomGrowShrink Object e3 = canShrink; // ERROR - // :: error: (assignment) + // :: error: [assignment] @BottomGrowShrink Object e4 = uncheckedCanShrink; // ERROR @BottomGrowShrink Object e5 = bottom; } diff --git a/checker/tests/index/ArrayAsList.java b/checker/tests/index/ArrayAsList.java index 5b007643053f..5213aee58336 100644 --- a/checker/tests/index/ArrayAsList.java +++ b/checker/tests/index/ArrayAsList.java @@ -12,7 +12,7 @@ public static void toList(Integer @MinLen(10) [] arg) { } public static void toList2(int @MinLen(10) [] arg2) { - // :: error: (assignment) + // :: error: [assignment] @MinLen(10) List list = Arrays.asList(arg2); System.out.println("int: " + list.size()); diff --git a/checker/tests/index/ArrayAssignmentSameLen.java b/checker/tests/index/ArrayAssignmentSameLen.java index 854ceb35e104..ece5f15ef2ca 100644 --- a/checker/tests/index/ArrayAssignmentSameLen.java +++ b/checker/tests/index/ArrayAssignmentSameLen.java @@ -15,13 +15,13 @@ void test1(int[] a, int[] b, @LTEqLengthOf("#1") int index) { @LTLengthOf( value = {"array", "b"}, offset = {"0", "-3"}) - // :: error: (assignment) + // :: error: [assignment] int i = index; } void test2(int[] a, int[] b, @LTLengthOf("#1") int i) { int[] c = a; - // :: error: (assignment) + // :: error: [assignment] @LTLengthOf(value = {"c", "b"}) int x = i; @LTLengthOf("c") int y = i; } @@ -32,7 +32,7 @@ void test3(int[] a, @LTLengthOf("#1") int i, @NonNegative int x) { @LTLengthOf( value = {"c1", "c1"}, offset = {"0", "x"}) - // :: error: (assignment) + // :: error: [assignment] int z = i; } diff --git a/checker/tests/index/ArrayCreationChecks.java b/checker/tests/index/ArrayCreationChecks.java index 636c723bea68..a9e8857e54d2 100644 --- a/checker/tests/index/ArrayCreationChecks.java +++ b/checker/tests/index/ArrayCreationChecks.java @@ -23,28 +23,28 @@ void test3(@NonNegative int x, @NonNegative int y) { } void test4(@GTENegativeOne int x, @NonNegative int y) { - // :: error: (array.length.negative) + // :: error: [array.length.negative] int[] newArray = new int[x + y]; @LTEqLengthOf("newArray") int i = x; - // :: error: (assignment) + // :: error: [assignment] @IndexOrHigh("newArray") int j = y; } void test5(@GTENegativeOne int x, @GTENegativeOne int y) { - // :: error: (array.length.negative) + // :: error: [array.length.negative] int[] newArray = new int[x + y]; - // :: error: (assignment) + // :: error: [assignment] @IndexOrHigh("newArray") int i = x; - // :: error: (assignment) + // :: error: [assignment] @IndexOrHigh("newArray") int j = y; } void test6(int x, int y) { - // :: error: (array.length.negative) + // :: error: [array.length.negative] int[] newArray = new int[x + y]; - // :: error: (assignment) + // :: error: [assignment] @IndexFor("newArray") int i = x; - // :: error: (assignment) + // :: error: [assignment] @IndexOrHigh("newArray") int j = y; } } diff --git a/checker/tests/index/ArrayIntro.java b/checker/tests/index/ArrayIntro.java index 4611c4fbfa49..a5ab41647a51 100644 --- a/checker/tests/index/ArrayIntro.java +++ b/checker/tests/index/ArrayIntro.java @@ -9,11 +9,11 @@ void test() { a -= 2; int @MinLen(12) [] arr1 = new int[a]; int @MinLen(3) [] arr2 = {1, 2, 3}; - // :: error: (assignment) + // :: error: [assignment] int @MinLen(4) [] arr3 = {4, 5, 6}; - // :: error: (assignment) + // :: error: [assignment] int @MinLen(7) [] arr4 = new int[4]; - // :: error: (assignment) + // :: error: [assignment] int @MinLen(16) [] arr5 = new int[a]; } } diff --git a/checker/tests/index/ArraysSort.java b/checker/tests/index/ArraysSort.java index a4220bc70be9..5254e95dc4ec 100644 --- a/checker/tests/index/ArraysSort.java +++ b/checker/tests/index/ArraysSort.java @@ -6,7 +6,7 @@ public class ArraysSort { void sortInt(int @MinLen(10) [] nums) { // Checks the correct handling of the toIndex parameter Arrays.sort(nums, 0, 10); - // :: error: (argument) + // :: error: [argument] Arrays.sort(nums, 0, 11); } } diff --git a/checker/tests/index/BasicSubsequence.java b/checker/tests/index/BasicSubsequence.java index 886d4109a8b6..f41e55f1093d 100644 --- a/checker/tests/index/BasicSubsequence.java +++ b/checker/tests/index/BasicSubsequence.java @@ -1,7 +1,7 @@ import org.checkerframework.checker.index.qual.*; public class BasicSubsequence { - // :: error: (not.final) + // :: error: [not.final] @HasSubsequence(subsequence = "this", from = "this.x", to = "this.y") int[] b; @@ -10,38 +10,38 @@ public class BasicSubsequence { void test2(@NonNegative @LessThan("y + 1") int x1, int[] a) { x = x1; - // :: error: (to.not.ltel) + // :: error: [to.not.ltel] b = a; } void test3(@NonNegative @LessThan("y") int x1, int[] a) { x = x1; - // :: error: (to.not.ltel) + // :: error: [to.not.ltel] b = a; } void test4(@NonNegative int x1, int[] a) { x = x1; - // :: error: (from.gt.to) :: error: (to.not.ltel) + // :: error: [from.gt.to] :: error: [to.not.ltel] b = a; } void test5(@GTENegativeOne @LessThan("y + 1") int x1, int[] a) { x = x1; - // :: error: (from.not.nonnegative) :: error: (to.not.ltel) + // :: error: [from.not.nonnegative] :: error: [to.not.ltel] b = a; } void test6(@GTENegativeOne int x1, int[] a) { x = x1; - // :: error: (from.not.nonnegative) :: error: (to.not.ltel) :: error: (from.gt.to) + // :: error: [from.not.nonnegative] :: error: [to.not.ltel] :: error: [from.gt.to] b = a; } void test7(@IndexFor("this") @LessThan("y") int x1, @IndexOrHigh("this") int y1, int[] a) { x = x1; y = y1; - // :: warning: (which.subsequence) + // :: warning: [which.subsequence] b = a; } } diff --git a/checker/tests/index/BinomialTest.java b/checker/tests/index/BinomialTest.java index ac264fb36601..a752824e64a6 100644 --- a/checker/tests/index/BinomialTest.java +++ b/checker/tests/index/BinomialTest.java @@ -18,7 +18,7 @@ public static void binomial0( public static void binomial0Error( @LTLengthOf("BinomialTest.factorials") int n, @LessThan("#1") int k) { - // :: error: (assignment) + // :: error: [assignment] @LTLengthOf(value = "factorials", offset = "2") int i = k; } @@ -34,7 +34,7 @@ public static void binomial1( public static void binomial1Error( @LTLengthOf("BinomialTest.factorials") int n, @LessThan("#1 + 1") int k) { - // :: error: (assignment) + // :: error: [assignment] @LTLengthOf(value = "factorials", offset = "1") int i = k; } @@ -45,7 +45,7 @@ public static void binomial2( public static void binomial2Error( @LTLengthOf("BinomialTest.factorials") int n, @LessThan("#1 + 2") int k) { - // :: error: (assignment) + // :: error: [assignment] @LTLengthOf(value = "factorials", offset = "0") int i = k; } @@ -56,7 +56,7 @@ public static void binomial_1( public static void binomial_1Error( @LTLengthOf("BinomialTest.factorials") int n, @LessThan("#1 - 1") int k) { - // :: error: (assignment) + // :: error: [assignment] @LTLengthOf(value = "factorials", offset = "3") int i = k; } @@ -67,7 +67,7 @@ public static void binomial_2( public static void binomial_2Error( @LTLengthOf("BinomialTest.factorials") int n, @LessThan("#1 - 2") int k) { - // :: error: (assignment) + // :: error: [assignment] @LTLengthOf(value = "factorials", offset = "4") int i = k; } } diff --git a/checker/tests/index/BitSetLowerBound.java b/checker/tests/index/BitSetLowerBound.java index a47ef7bde465..b4f57c089a6d 100644 --- a/checker/tests/index/BitSetLowerBound.java +++ b/checker/tests/index/BitSetLowerBound.java @@ -9,7 +9,7 @@ public class BitSetLowerBound { private void m(BitSet b) { b.set(b.nextClearBit(0)); // next set bit does not have to exist - // :: error: (argument) + // :: error: [argument] b.clear(b.nextSetBit(0)); @GTENegativeOne int i = b.nextSetBit(0); diff --git a/checker/tests/index/Boilerplate.java b/checker/tests/index/Boilerplate.java index 9835b691b873..9a24466ee995 100644 --- a/checker/tests/index/Boilerplate.java +++ b/checker/tests/index/Boilerplate.java @@ -3,7 +3,7 @@ public class Boilerplate { void test() { - // :: error: (assignment) + // :: error: [assignment] @Positive int a = -1; } } diff --git a/checker/tests/index/CharSequenceTest.java b/checker/tests/index/CharSequenceTest.java index e549f9866e16..5106badbf7da 100644 --- a/checker/tests/index/CharSequenceTest.java +++ b/checker/tests/index/CharSequenceTest.java @@ -12,7 +12,7 @@ public class CharSequenceTest { // StringBuilder void minLenCharSequence() { @MinLen(10) CharSequence str = "0123456789"; - // :: error: (assignment) + // :: error: [assignment] @MinLen(10) CharSequence sb = new StringBuilder("0123456789"); } @@ -21,7 +21,7 @@ void testSubSequence() { // Local variable used because of https://github.com/kelloggm/checker-framework/issues/165 String str = "0123456789"; str.subSequence(5, 8); - // :: error: (argument) + // :: error: [argument] str.subSequence(5, 13); } @@ -33,7 +33,7 @@ void argumentPassing() { String s = "0123456789"; sink(s, 8); StringBuilder sb = new StringBuilder("0123456789"); - // :: error: (argument) + // :: error: [argument] sink(sb, 8); } @@ -61,21 +61,21 @@ void getLength(CharSequence cs, int i) { void testCharAt(CharSequence cs, int i, @IndexFor("#1") int j) { cs.charAt(j); cs.subSequence(j, j); - // :: error: (argument) + // :: error: [argument] cs.charAt(i); - // :: error: (argument) + // :: error: [argument] cs.subSequence(i, j); } void testAppend(Appendable app, CharSequence cs, @IndexFor("#2") int i) throws IOException { app.append(cs, i, i); - // :: error: (argument) + // :: error: [argument] app.append(cs, 1, 2); } void testAppend(StringWriter app, CharSequence cs, @IndexFor("#2") int i) throws IOException { app.append(cs, i, i); - // :: error: (argument) + // :: error: [argument] app.append(cs, 1, 2); } } diff --git a/checker/tests/index/CombineFacts.java b/checker/tests/index/CombineFacts.java index 817eecb43862..28ea23d1780c 100644 --- a/checker/tests/index/CombineFacts.java +++ b/checker/tests/index/CombineFacts.java @@ -9,7 +9,7 @@ void test(int[] a1) { a1[len] = 1; // This access should issue an error. - // :: error: (array.access.unsafe.high) + // :: error: [array.access.unsafe.high] a2[len] = 1; } } diff --git a/checker/tests/index/ConstantArrays.java b/checker/tests/index/ConstantArrays.java index 5f606cb83cef..6e681256b9dc 100644 --- a/checker/tests/index/ConstantArrays.java +++ b/checker/tests/index/ConstantArrays.java @@ -5,12 +5,12 @@ void basic_test() { int[] b = new int[4]; @LTLengthOf("b") int[] a = {0, 1, 2, 3}; - // :: error: (array.initializer)::error: (assignment) + // :: error: [array.initializer]::error: [assignment] @LTLengthOf("b") int[] a1 = {0, 1, 2, 4}; @LTEqLengthOf("b") int[] c = {-1, 4, 3, 1}; - // :: error: (array.initializer)::error: (assignment) + // :: error: [array.initializer]::error: [assignment] @LTEqLengthOf("b") int[] c2 = {-1, 4, 5, 1}; } @@ -25,7 +25,7 @@ void offset_test() { @LTLengthOf( value = {"b", "b2"}, offset = {"-2", "5"}) - // :: error: (array.initializer)::error: (assignment) + // :: error: [array.initializer]::error: [assignment] int[] a2 = {2, 3, 5}; // Non-constant offsets don't work correctly. See kelloggm#120. diff --git a/checker/tests/index/ConstantsIndex.java b/checker/tests/index/ConstantsIndex.java index 22871601e5cf..461418f1fea0 100644 --- a/checker/tests/index/ConstantsIndex.java +++ b/checker/tests/index/ConstantsIndex.java @@ -5,7 +5,7 @@ public class ConstantsIndex { void test() { int @MinLen(3) [] arr = {1, 2, 3}; int i = arr[1]; - // :: error: (array.access.unsafe.high.constant) + // :: error: [array.access.unsafe.high.constant] int j = arr[3]; } } diff --git a/checker/tests/index/CustomContractWithArgs.java b/checker/tests/index/CustomContractWithArgs.java index 8ace86d0176c..0090b78f5b6b 100644 --- a/checker/tests/index/CustomContractWithArgs.java +++ b/checker/tests/index/CustomContractWithArgs.java @@ -53,7 +53,7 @@ void minLenContract(int[] a) { } @EnsuresMinLen(value = "#1", targetValue = 10) - // :: error: (contracts.postcondition) + // :: error: [contracts.postcondition] void minLenWrong(int[] a) { if (a.length < 9) throw new RuntimeException(); } @@ -79,7 +79,7 @@ boolean ltlPost(int[] a, int c) { } @EnsuresLTLIf(expression = "b", targetValue = "#1", targetOffset = "#3", result = true) - // :: error: (flowexpr.parse.error) + // :: error: [flowexpr.parse.error] boolean ltlPostInvalid(int[] a, int c) { return false; } @@ -98,7 +98,7 @@ void ltlUse(int[] a, int c) { ltlPre(a, c); } - // :: error: (assignment) + // :: error: [assignment] @LTLengthOf(value = "a", offset = "c+1") int j = b; } } @@ -125,7 +125,7 @@ void ltlPre(int[] a, int d) { @LTLengthOf( value = {"a", "a"}, offset = {"d+1", "-10"}) - // :: error: (assignment) + // :: error: [assignment] int i = b; } } @@ -139,9 +139,9 @@ class DerivedInvalid extends Base { targetValue = {"#1", "#1"}, targetOffset = {"#2 + 1", "9"}, result = true) - // :: error: (contracts.conditional.postcondition.true.override) + // :: error: [contracts.conditional.postcondition.true.override] boolean ltlPost(int[] a, int c) { - // :: error: (contracts.conditional.postcondition) + // :: error: [contracts.conditional.postcondition] return true; } @@ -150,7 +150,7 @@ boolean ltlPost(int[] a, int c) { value = "b ", targetValue = {"#1", "#1"}, targetOffset = {"#2 + 1", "-9"}) - // :: error: (contracts.precondition.override) + // :: error: [contracts.precondition.override] void ltlPre(int[] a, int d) { @LTLengthOf( value = {"a", "a"}, diff --git a/checker/tests/index/DefaultingForEach.java b/checker/tests/index/DefaultingForEach.java index ae9dec77ec19..e9e6631e107b 100644 --- a/checker/tests/index/DefaultingForEach.java +++ b/checker/tests/index/DefaultingForEach.java @@ -14,7 +14,7 @@ static int[] foo() { void bar() { for (Integer p : foo()) { - // :: error: (assignment) + // :: error: [assignment] @Positive int x = p; @NonNegative int y = p; } diff --git a/checker/tests/index/Dimension.java b/checker/tests/index/Dimension.java index b2ab086e61ee..16a9f98381bd 100644 --- a/checker/tests/index/Dimension.java +++ b/checker/tests/index/Dimension.java @@ -2,7 +2,7 @@ public class Dimension { void test(int expr) { int[] array = new int[expr]; - // :: error: (array.access.unsafe.high) + // :: error: [array.access.unsafe.high] array[expr] = 0; array[expr - 1] = 0; } @@ -11,7 +11,7 @@ void test(int expr) { void test2(int expr) { arrayField = new String[expr]; - // :: error: (array.access.unsafe.high) + // :: error: [array.access.unsafe.high] this.arrayField[expr] = ""; this.arrayField[expr - 1] = ""; } diff --git a/checker/tests/index/EnumValues.java b/checker/tests/index/EnumValues.java index 7a23d1f26161..eb5c7adc5f2e 100644 --- a/checker/tests/index/EnumValues.java +++ b/checker/tests/index/EnumValues.java @@ -16,7 +16,7 @@ public static void enumValues() { Direction b = arr[1]; Direction c = arr[2]; Direction d = arr[3]; - // :: error: (array.access.unsafe.high.constant) + // :: error: [array.access.unsafe.high.constant] Direction e = arr[4]; } } diff --git a/checker/tests/index/EqualToTransfer.java b/checker/tests/index/EqualToTransfer.java index b8bfac310237..f55bd7f207fd 100644 --- a/checker/tests/index/EqualToTransfer.java +++ b/checker/tests/index/EqualToTransfer.java @@ -12,7 +12,7 @@ void eq_check(int[] a) { void eq_bad_check(int[] a) { if (1 == a.length) { - // :: error: (assignment) + // :: error: [assignment] int @MinLen(2) [] b = a; } } diff --git a/checker/tests/index/ErrorMessageCheck.java b/checker/tests/index/ErrorMessageCheck.java index 9c225942e49a..8fb5c74808c8 100644 --- a/checker/tests/index/ErrorMessageCheck.java +++ b/checker/tests/index/ErrorMessageCheck.java @@ -7,7 +7,7 @@ public class ErrorMessageCheck { void method3(@NonNegative int size, @NonNegative int value) { this.size = size; this.vDown = new int[this.size]; - // :: error: (array.access.unsafe.high) + // :: error: [array.access.unsafe.high] vDown[1 + value] = 10; } } diff --git a/checker/tests/index/Errors.java b/checker/tests/index/Errors.java index d68201cd9a95..21135a845529 100644 --- a/checker/tests/index/Errors.java +++ b/checker/tests/index/Errors.java @@ -16,10 +16,10 @@ void test() { @NonNegative int nn = 0; @Positive int p = 1; - // :: error: (array.access.unsafe.low) + // :: error: [array.access.unsafe.low] int a = arr[n1p]; - // :: error: (array.access.unsafe.low) + // :: error: [array.access.unsafe.low] int b = arr[u]; int c = arr[nn]; diff --git a/checker/tests/index/ExampleUsage.java b/checker/tests/index/ExampleUsage.java index 005c1475fad2..54ff8dadd88b 100644 --- a/checker/tests/index/ExampleUsage.java +++ b/checker/tests/index/ExampleUsage.java @@ -25,7 +25,7 @@ void obviously_unsafe_loop() { int[] arr = new int[5]; int k; for (int i = -1; i < 5; i++) { - // :: error: (array.access.unsafe.low) + // :: error: [array.access.unsafe.low] k = arr[i]; } } diff --git a/checker/tests/index/GreaterThanOrEqualTransfer.java b/checker/tests/index/GreaterThanOrEqualTransfer.java index eb650a296c96..84267528f6e4 100644 --- a/checker/tests/index/GreaterThanOrEqualTransfer.java +++ b/checker/tests/index/GreaterThanOrEqualTransfer.java @@ -9,7 +9,7 @@ void gte_check(int[] a) { void gte_bad_check(int[] a) { if (a.length >= 1) { - // :: error: (assignment) + // :: error: [assignment] int @MinLen(2) [] b = a; } } diff --git a/checker/tests/index/GreaterThanTransfer.java b/checker/tests/index/GreaterThanTransfer.java index bd7394e29d83..77a5c37d8e4c 100644 --- a/checker/tests/index/GreaterThanTransfer.java +++ b/checker/tests/index/GreaterThanTransfer.java @@ -9,7 +9,7 @@ void gt_check(int[] a) { void gt_bad_check(int[] a) { if (a.length > 0) { - // :: error: (assignment) + // :: error: [assignment] int @MinLen(2) [] b = a; } } diff --git a/checker/tests/index/Index166.java b/checker/tests/index/Index166.java index 163e21f55858..f56a3e56ba84 100644 --- a/checker/tests/index/Index166.java +++ b/checker/tests/index/Index166.java @@ -7,7 +7,7 @@ public class Index166 { public void testMethodInvocation() { requiresIndex("012345", 5); - // :: error: (argument) + // :: error: [argument] requiresIndex("012345", 6); } diff --git a/checker/tests/index/Index167.java b/checker/tests/index/Index167.java index 53b456e0fe69..55548c0e49c7 100644 --- a/checker/tests/index/Index167.java +++ b/checker/tests/index/Index167.java @@ -8,15 +8,15 @@ public class Index167 { static void fn1(int[] arr, @IndexFor("#1") int i) { if (i >= 33) { - // :: error: (argument) + // :: error: [argument] fn2(arr, i); } if (i > 33) { - // :: error: (argument) + // :: error: [argument] fn2(arr, i); } if (i != 33) { - // :: error: (argument) + // :: error: [argument] fn2(arr, i); } } diff --git a/checker/tests/index/Index176.java b/checker/tests/index/Index176.java index 0c5649df61f2..0ac77a6ac5a7 100644 --- a/checker/tests/index/Index176.java +++ b/checker/tests/index/Index176.java @@ -10,7 +10,7 @@ void test(String arglist, @IndexFor("#1") int pos) { throw new Error("Malformed arglist: " + arglist); } arglist.substring(pos, semi_pos + 1); - // :: error: (argument) + // :: error: [argument] arglist.substring(pos, semi_pos + 2); } } diff --git a/checker/tests/index/IndexForAverage.java b/checker/tests/index/IndexForAverage.java index 01ac9eef128a..bbe23082453e 100644 --- a/checker/tests/index/IndexForAverage.java +++ b/checker/tests/index/IndexForAverage.java @@ -10,7 +10,7 @@ public static void bug(int[] a, @IndexFor("#1") int i, @IndexFor("#1") int j) { public static void bug2(int[] a, @IndexFor("#1") int i, @IndexFor("#1") int j) { @LTLengthOf("a") int k = ((i - 1) + j) / 2; - // :: error: (assignment) + // :: error: [assignment] @LTLengthOf("a") int h = ((i + 1) + j) / 2; } } diff --git a/checker/tests/index/IndexForTest.java b/checker/tests/index/IndexForTest.java index abd0c1f5c21b..d1cb7e53c771 100644 --- a/checker/tests/index/IndexForTest.java +++ b/checker/tests/index/IndexForTest.java @@ -10,11 +10,11 @@ void test1(@IndexFor("array") int i) { void callTest1(int x) { test1(0); - // :: error: (argument) + // :: error: [argument] test1(1); - // :: error: (argument) + // :: error: [argument] test1(2); - // :: error: (argument) + // :: error: [argument] test1(array.length); if (array.length > 0) { @@ -23,7 +23,7 @@ void callTest1(int x) { test1(array.length - 1); - // :: error: (argument) + // :: error: [argument] test1(this.array.length); if (array.length > 0) { @@ -37,7 +37,7 @@ void callTest1(int x) { } if (array.length == x) { - // :: error: (argument) + // :: error: [argument] test1(x); } } @@ -48,11 +48,11 @@ void test2(@IndexFor("this.array") int i) { void callTest2(int x) { test2(0); - // :: error: (argument) + // :: error: [argument] test2(1); - // :: error: (argument) + // :: error: [argument] test2(2); - // :: error: (argument) + // :: error: [argument] test2(array.length); if (array.length > 0) { @@ -61,7 +61,7 @@ void callTest2(int x) { test2(array.length - 1); - // :: error: (argument) + // :: error: [argument] test2(this.array.length); if (array.length > 0) { @@ -71,7 +71,7 @@ void callTest2(int x) { test2(this.array.length - 1); if (array.length == x && x >= 0) { - // :: error: (argument) + // :: error: [argument] test2(x); } } diff --git a/checker/tests/index/IndexForTestLBC.java b/checker/tests/index/IndexForTestLBC.java index f926774c9b84..e47d83bf7642 100644 --- a/checker/tests/index/IndexForTestLBC.java +++ b/checker/tests/index/IndexForTestLBC.java @@ -15,10 +15,10 @@ void callTest1(int x) { test1(1); test1(2); test1(array.length); - // :: error: (argument) + // :: error: [argument] test1(array.length - 1); if (array.length > x) { - // :: error: (argument) + // :: error: [argument] test1(x); } diff --git a/checker/tests/index/IndexForVarargs.java b/checker/tests/index/IndexForVarargs.java index c01775d77899..8ad1745c3dfc 100644 --- a/checker/tests/index/IndexForVarargs.java +++ b/checker/tests/index/IndexForVarargs.java @@ -8,12 +8,12 @@ String get(@IndexFor("#2") int i, String... varargs) { void method(@IndexFor("#2") int i, String[]... varargs) {} void m() { - // :: error: (argument) + // :: error: [argument] get(1); get(1, "a", "b"); - // :: error: (argument) + // :: error: [argument] get(2, "abc"); String[] stringArg1 = new String[] {"a", "b"}; @@ -22,12 +22,12 @@ void m() { method(1, stringArg1, stringArg2); - // :: error: (argument) + // :: error: [argument] method(2, stringArg3); get(1, stringArg1); - // :: error: (argument) + // :: error: [argument] get(3, stringArg2); } } diff --git a/checker/tests/index/IndexOrLowTests.java b/checker/tests/index/IndexOrLowTests.java index 38f9b73e8ace..d7cc3b42f8c9 100644 --- a/checker/tests/index/IndexOrLowTests.java +++ b/checker/tests/index/IndexOrLowTests.java @@ -15,12 +15,12 @@ void test() { } @IndexOrHigh("array") int y = index + 1; - // :: error: (array.access.unsafe.high) + // :: error: [array.access.unsafe.high] array[y] = 1; if (y < array.length) { array[y] = 1; } - // :: error: (assignment) + // :: error: [assignment] index = array.length; } diff --git a/checker/tests/index/IntroAdd.java b/checker/tests/index/IntroAdd.java index 8adcc7be32d4..56500944a751 100644 --- a/checker/tests/index/IntroAdd.java +++ b/checker/tests/index/IntroAdd.java @@ -3,17 +3,17 @@ public class IntroAdd { void test(int[] arr) { - // :: error: (assignment) + // :: error: [assignment] @LTLengthOf({"arr"}) int a = 3; } void test(int[] arr, @LTLengthOf({"#1"}) int a) { - // :: error: (assignment) + // :: error: [assignment] @LTLengthOf({"arr"}) int c = a + 1; @LTEqLengthOf({"arr"}) int c1 = a + 1; @LTLengthOf({"arr"}) int d = a + 0; @LTLengthOf({"arr"}) int e = a + (-7); - // :: error: (assignment) + // :: error: [assignment] @LTLengthOf({"arr"}) int f = a + 7; } } diff --git a/checker/tests/index/IntroAnd.java b/checker/tests/index/IntroAnd.java index 58519638f762..7f1cfb2d6b3c 100644 --- a/checker/tests/index/IntroAnd.java +++ b/checker/tests/index/IntroAnd.java @@ -5,7 +5,7 @@ void test() { @NonNegative int a = 1 & 0; @NonNegative int b = a & 5; - // :: error: (assignment) + // :: error: [assignment] @Positive int c = a & b; @NonNegative int d = a & b; @NonNegative int e = b & a; @@ -15,12 +15,12 @@ void test_ubc_and( @IndexFor("#2") int i, int[] a, @LTLengthOf("#2") int j, int k, @NonNegative int m) { int x = a[i & k]; int x1 = a[k & i]; - // :: error: (array.access.unsafe.low) :: error: (array.access.unsafe.high) + // :: error: [array.access.unsafe.low] :: error: [array.access.unsafe.high] int y = a[j & k]; if (j > -1) { int z = a[j & k]; } - // :: error: (array.access.unsafe.high) + // :: error: [array.access.unsafe.high] int w = a[m & k]; if (m < a.length) { int u = a[m & k]; @@ -33,7 +33,7 @@ void two_arrays(int[] a, int[] b, @IndexFor("#1") int i, @IndexFor("#2") int j) } void test_pos(@Positive int x, @Positive int y) { - // :: error: (assignment) + // :: error: [assignment] @Positive int z = x & y; } } diff --git a/checker/tests/index/IntroRules.java b/checker/tests/index/IntroRules.java index 1ac1ce52c437..1de56cc5a111 100644 --- a/checker/tests/index/IntroRules.java +++ b/checker/tests/index/IntroRules.java @@ -11,24 +11,24 @@ void test() { @GTENegativeOne int c = 8; @LowerBoundUnknown int d = 7; - // :: error: (assignment) + // :: error: [assignment] @Positive int e = 0; - // :: error: (assignment) + // :: error: [assignment] @Positive int f = -1; - // :: error: (assignment) + // :: error: [assignment] @Positive int g = -6; @NonNegative int h = 0; @GTENegativeOne int i = 0; @LowerBoundUnknown int j = 0; - // :: error: (assignment) + // :: error: [assignment] @NonNegative int k = -1; - // :: error: (assignment) + // :: error: [assignment] @NonNegative int l = -4; @GTENegativeOne int m = -1; @LowerBoundUnknown int n = -1; - // :: error: (assignment) + // :: error: [assignment] @GTENegativeOne int o = -9; } } diff --git a/checker/tests/index/IntroShift.java b/checker/tests/index/IntroShift.java index f89a9e6657a5..ef122fcf4da0 100644 --- a/checker/tests/index/IntroShift.java +++ b/checker/tests/index/IntroShift.java @@ -3,7 +3,7 @@ public class IntroShift { void test() { @NonNegative int a = 1 >> 1; - // :: error: (assignment) + // :: error: [assignment] @NonNegative int b = -1 >> 0; } } diff --git a/checker/tests/index/IntroSub.java b/checker/tests/index/IntroSub.java index bbfa2117d663..4b98317bceff 100644 --- a/checker/tests/index/IntroSub.java +++ b/checker/tests/index/IntroSub.java @@ -3,20 +3,20 @@ public class IntroSub { void test(int[] arr) { - // :: error: (assignment) + // :: error: [assignment] @LTLengthOf({"arr"}) int a = 3; } void test(int[] arr, @LTLengthOf({"#1"}) int a) { - // :: error: (assignment) + // :: error: [assignment] @LTLengthOf({"arr"}) int c = a - (-1); @LTEqLengthOf({"arr"}) int c1 = a - (-1); @LTLengthOf({"arr"}) int d = a - 0; @LTLengthOf({"arr"}) int e = a - 7; - // :: error: (assignment) + // :: error: [assignment] @LTLengthOf({"arr"}) int f = a - (-7); - // :: error: (assignment) + // :: error: [assignment] @LTEqLengthOf({"arr"}) int j = 7; } } diff --git a/checker/tests/index/InvalidSubsequence.java b/checker/tests/index/InvalidSubsequence.java index 99a2d76f24b8..c05502586093 100644 --- a/checker/tests/index/InvalidSubsequence.java +++ b/checker/tests/index/InvalidSubsequence.java @@ -4,19 +4,19 @@ import org.checkerframework.checker.index.qual.LessThan; public class InvalidSubsequence { - // :: error: (flowexpr.parse.error) :: error: (not.final) + // :: error: [flowexpr.parse.error] :: error: [not.final] @HasSubsequence(subsequence = "banana", from = "this.from", to = "this.to") int[] a; - // :: error: (flowexpr.parse.error) :: error: (not.final) + // :: error: [flowexpr.parse.error] :: error: [not.final] @HasSubsequence(subsequence = "this", from = "banana", to = "this.to") int[] b; - // :: error: (flowexpr.parse.error) :: error: (not.final) + // :: error: [flowexpr.parse.error] :: error: [not.final] @HasSubsequence(subsequence = "this", from = "this.from", to = "banana") int[] c; - // :: error: (not.final) + // :: error: [not.final] @HasSubsequence(subsequence = "this", from = "this.from", to = "10") int[] e; @@ -25,22 +25,22 @@ public class InvalidSubsequence { @IndexOrHigh("a") int to; void assignA(int[] d) { - // :: error: (to.not.ltel) + // :: error: [to.not.ltel] a = d; } void assignB(int[] d) { - // :: error: (from.gt.to) :: error: (from.not.nonnegative) :: error: (to.not.ltel) + // :: error: [from.gt.to] :: error: [from.not.nonnegative] :: error: [to.not.ltel] b = d; } void assignC(int[] d) { - // :: error: (from.gt.to) :: error: (to.not.ltel) + // :: error: [from.gt.to] :: error: [to.not.ltel] c = d; } void assignE(int[] d) { - // :: error: (from.gt.to) :: error: (to.not.ltel) + // :: error: [from.gt.to] :: error: [to.not.ltel] e = d; } } diff --git a/checker/tests/index/Issue1984.java b/checker/tests/index/Issue1984.java index 1916f000ccf3..8bb70cb805df 100644 --- a/checker/tests/index/Issue1984.java +++ b/checker/tests/index/Issue1984.java @@ -5,7 +5,7 @@ public class Issue1984 { public int m(int[] a, @IntRange(from = 0, to = 12) int i) { - // :: error: (array.access.unsafe.high.range) + // :: error: [array.access.unsafe.high.range] return a[i]; } } diff --git a/checker/tests/index/Issue2029.java b/checker/tests/index/Issue2029.java index 1753f3a2987b..c3e9eaeabecd 100644 --- a/checker/tests/index/Issue2029.java +++ b/checker/tests/index/Issue2029.java @@ -20,7 +20,7 @@ void LessThanOffsetUpperBound( @NonNegative @LessThan("#3 + 1") int index) { @NonNegative int m = n - k; int[] arr = new int[size]; - // :: error: (unary.increment) + // :: error: [unary.increment] for (; index < arr.length - 1; index++) { arr[index] = 10; } diff --git a/checker/tests/index/Issue2334.java b/checker/tests/index/Issue2334.java index 562b27608684..245a0cbaad59 100644 --- a/checker/tests/index/Issue2334.java +++ b/checker/tests/index/Issue2334.java @@ -18,7 +18,7 @@ void m1(String stringFormal) { void m2() { if (stringField.indexOf('d') != -1) { hasSideEffect(); - // :: error: (assignment) + // :: error: [assignment] @NonNegative int i = stringField.indexOf('d'); } } @@ -33,7 +33,7 @@ void m3(String stringFormal) { void m4() { if (stringField.indexOf('d') != -1) { System.out.println("hey"); - // :: error: (assignment) + // :: error: [assignment] @NonNegative int i = stringField.indexOf('d'); } } diff --git a/checker/tests/index/Issue2420.java b/checker/tests/index/Issue2420.java index d6f2f79dd01c..f02467dd80a5 100644 --- a/checker/tests/index/Issue2420.java +++ b/checker/tests/index/Issue2420.java @@ -9,9 +9,9 @@ static void str(String argStr) { if (argStr == "abc") { return; } - // :: error: (argument) + // :: error: [argument] char c = "abc".charAt(argStr.length() - 1); - // :: error: (argument) + // :: error: [argument] char c2 = "abc".charAt(argStr.length()); } } diff --git a/checker/tests/index/Issue2452.java b/checker/tests/index/Issue2452.java index e321b7dbfe0d..203977c65dbe 100644 --- a/checker/tests/index/Issue2452.java +++ b/checker/tests/index/Issue2452.java @@ -25,14 +25,14 @@ void m2() { void testMinLenSubtractPositive(String @MinLen(10) [] s) { @Positive int i1 = s.length - 9; @NonNegative int i0 = Array.getLength(s) - 10; - // :: error: (assignment) + // :: error: [assignment] @NonNegative int im1 = Array.getLength(s) - 11; } void testLessThanLength(String[] s, @IndexOrHigh("#1") int i, @IndexOrHigh("#1") int j) { if (i < Array.getLength(s)) { @IndexFor("s") int in = i; - // :: error: (assignment) + // :: error: [assignment] @IndexFor("s") int jn = j; } } diff --git a/checker/tests/index/Issue3224.java b/checker/tests/index/Issue3224.java index 1a9ad6f00b0d..82e76e5a46fb 100644 --- a/checker/tests/index/Issue3224.java +++ b/checker/tests/index/Issue3224.java @@ -29,12 +29,12 @@ public static void m4(String @MinLen(1) [] args, @IntRange(from = 10, to = 200) } public static void m5(String @MinLen(1) [] args, String[] otherArray) { - // :: error: (assignment) + // :: error: [assignment] String @MinLen(1) [] args2 = java.util.Arrays.copyOf(args, otherArray.length); } public static void m6(String @MinLen(1) [] args) { - // :: error: (assignment) + // :: error: [assignment] String @MinLen(1) [] args2 = Arrays.copyOf(args, args.length); } } diff --git a/checker/tests/index/Issue58Minimization.java b/checker/tests/index/Issue58Minimization.java index d90bae46b660..39e0fdb805fb 100644 --- a/checker/tests/index/Issue58Minimization.java +++ b/checker/tests/index/Issue58Minimization.java @@ -14,7 +14,7 @@ void test(@GTENegativeOne int x) { @NonNegative int y = z; } if ((z = x) != 1) { - // :: error: (assignment) + // :: error: [assignment] @NonNegative int y = z; } } diff --git a/checker/tests/index/LBCSubtyping.java b/checker/tests/index/LBCSubtyping.java index 0d2338adf539..22b8cd31b65f 100644 --- a/checker/tests/index/LBCSubtyping.java +++ b/checker/tests/index/LBCSubtyping.java @@ -14,7 +14,7 @@ void foo() { int k = -4; // not this one though - // :: error: (assignment) + // :: error: [assignment] @GTENegativeOne int l = k; @NonNegative int n = 0; @@ -29,17 +29,17 @@ void foo() { // error cases - // :: error: (assignment) + // :: error: [assignment] @NonNegative int p = i; - // :: error: (assignment) + // :: error: [assignment] @Positive int b = i; - // :: error: (assignment) + // :: error: [assignment] @NonNegative int r = k; - // :: error: (assignment) + // :: error: [assignment] @Positive int c = k; - // :: error: (assignment) + // :: error: [assignment] @Positive int d = r; } } diff --git a/checker/tests/index/LTLDivide.java b/checker/tests/index/LTLDivide.java index 35bb60697320..3f1938c3c1c2 100644 --- a/checker/tests/index/LTLDivide.java +++ b/checker/tests/index/LTLDivide.java @@ -16,11 +16,11 @@ void test2(int[] array) { int len = array.length; int lenM1 = array.length - 1; int lenP1 = array.length + 1; - // :: error: (assignment) + // :: error: [assignment] @LTLengthOf("array") int x = len / 2; @LTLengthOf("array") int y = lenM1 / 3; @LTEqLengthOf("array") int z = len / 1; - // :: error: (assignment) + // :: error: [assignment] @LTLengthOf("array") int w = lenP1 / 2; } } diff --git a/checker/tests/index/LTLengthOfPostcondition.java b/checker/tests/index/LTLengthOfPostcondition.java index 033d66a8ae71..842a08561497 100644 --- a/checker/tests/index/LTLengthOfPostcondition.java +++ b/checker/tests/index/LTLengthOfPostcondition.java @@ -18,7 +18,7 @@ public void shiftIndex(@NonNegative int x) { } public void useShiftIndex(@NonNegative int x) { - // :: error: (argument) + // :: error: [argument] Arrays.fill(array, end, end + x, null); shiftIndex(x); Arrays.fill(array, end, end + x, null); diff --git a/checker/tests/index/LengthOfArrayMinusOne.java b/checker/tests/index/LengthOfArrayMinusOne.java index 713002091d41..3805e80757bf 100644 --- a/checker/tests/index/LengthOfArrayMinusOne.java +++ b/checker/tests/index/LengthOfArrayMinusOne.java @@ -1,6 +1,6 @@ public class LengthOfArrayMinusOne { void test(int[] arr) { - // :: error: (array.access.unsafe.low) + // :: error: [array.access.unsafe.low] int i = arr[arr.length - 1]; if (arr.length > 0) { diff --git a/checker/tests/index/LengthOfTest.java b/checker/tests/index/LengthOfTest.java index 4e371616f1d9..448bf0331c3c 100644 --- a/checker/tests/index/LengthOfTest.java +++ b/checker/tests/index/LengthOfTest.java @@ -3,7 +3,7 @@ public class LengthOfTest { void foo(int[] a, @LengthOf("#1") int x) { @IndexOrHigh("a") int y = x; - // :: error: (assignment) + // :: error: [assignment] @IndexFor("a") int w = x; @LengthOf("a") int z = a.length; } diff --git a/checker/tests/index/LessThanBug.java b/checker/tests/index/LessThanBug.java index dd73f05be7e0..4e94d6a316b7 100644 --- a/checker/tests/index/LessThanBug.java +++ b/checker/tests/index/LessThanBug.java @@ -9,7 +9,7 @@ void call() { } void bug(@IntRange(to = 42) int a, @IntVal(1) int c) { - // :: error: (assignment) + // :: error: [assignment] @LessThan("c") int x = a; } } diff --git a/checker/tests/index/LessThanCustomCollection.java b/checker/tests/index/LessThanCustomCollection.java index 5fb5b9661eb5..dac72a9d2d8a 100644 --- a/checker/tests/index/LessThanCustomCollection.java +++ b/checker/tests/index/LessThanCustomCollection.java @@ -28,10 +28,10 @@ private LessThanCustomCollection( int[] array, @IndexOrHigh("#1") @LessThan("#3 + 1") int start, @IndexOrHigh("#1") int end) { this.array = array; // can't est. that end - start is the length of this. - // :: error: (assignment) + // :: error: [assignment] this.end = end; // start is @LessThan(end + 1) but should be @LessThan(this.end + 1) - // :: error: (assignment) + // :: error: [assignment] this.start = start; } @@ -42,11 +42,11 @@ private LessThanCustomCollection( public double get(@IndexFor("this") int index) { // TODO: This is a bug. - // :: error: (argument) + // :: error: [argument] checkElementIndex(index, length()); // Because index is an index for "this" the index + start // must be an index for array. - // :: error: (array.access.unsafe.high) + // :: error: [array.access.unsafe.high] return array[start + index]; } @@ -62,7 +62,7 @@ public double get(@IndexFor("this") int index) { for (int i = start; i < end; i++) { if (areEqual(array[i], target)) { // Don't know that it is greater than start. - // :: error: (return) + // :: error: [return] return i - start; } } diff --git a/checker/tests/index/LessThanFloat.java b/checker/tests/index/LessThanFloat.java index 519f8c9de1af..7e6028d59df9 100644 --- a/checker/tests/index/LessThanFloat.java +++ b/checker/tests/index/LessThanFloat.java @@ -11,13 +11,13 @@ public class LessThanFloat { @LessThan("bigger") long l; - // :: error: (anno.on.irrelevant) + // :: error: [anno.on.irrelevant] @LessThan("bigger") float f; - // :: error: (anno.on.irrelevant) + // :: error: [anno.on.irrelevant] @LessThan("bigger") double d; - // :: error: (anno.on.irrelevant) + // :: error: [anno.on.irrelevant] @LessThan("bigger") boolean bool; @LessThan("bigger") char c; @@ -30,13 +30,13 @@ public class LessThanFloat { @LessThan("bigger") Long lBoxed; - // :: error: (anno.on.irrelevant) + // :: error: [anno.on.irrelevant] @LessThan("bigger") Float fBoxed; - // :: error: (anno.on.irrelevant) + // :: error: [anno.on.irrelevant] @LessThan("bigger") Double dBoxed; - // :: error: (anno.on.irrelevant) + // :: error: [anno.on.irrelevant] @LessThan("bigger") Boolean boolBoxed; @LessThan("bigger") Character cBoxed; @@ -49,13 +49,13 @@ public class LessThanFloat { java.lang.@LessThan("bigger") Long lBoxed2; - // :: error: (anno.on.irrelevant) + // :: error: [anno.on.irrelevant] java.lang.@LessThan("bigger") Float fBoxed2; - // :: error: (anno.on.irrelevant) + // :: error: [anno.on.irrelevant] java.lang.@LessThan("bigger") Double dBoxed2; - // :: error: (anno.on.irrelevant) + // :: error: [anno.on.irrelevant] java.lang.@LessThan("bigger") Boolean boolBoxed2; java.lang.@LessThan("bigger") Character cBoxed2; diff --git a/checker/tests/index/LessThanFloatLiteral.java b/checker/tests/index/LessThanFloatLiteral.java index 06b901fb1b1a..3944cc64ed8c 100644 --- a/checker/tests/index/LessThanFloatLiteral.java +++ b/checker/tests/index/LessThanFloatLiteral.java @@ -5,7 +5,7 @@ void test(int x) { if (1.0 > x) { // TODO: It might be nice to handle comparisons against floats, // but an array index is not generally compared to a float. - // :: error: (assignment) + // :: error: [assignment] @LessThan("1") int y = x; } } diff --git a/checker/tests/index/LessThanLen.java b/checker/tests/index/LessThanLen.java index 4cef7eea0417..2a2f2eb73647 100644 --- a/checker/tests/index/LessThanLen.java +++ b/checker/tests/index/LessThanLen.java @@ -27,24 +27,24 @@ public static void m3(int[] shorter) { public static void m4(int @MinLen(1) [] shorter) { int[] longer = new int[shorter.length * 1]; - // :: error: (assignment) + // :: error: [assignment] @LTLengthOf("longer") int x = shorter.length; @LTEqLengthOf("longer") int y = shorter.length; } public static void m5(int[] shorter) { - // :: error: (array.length.negative) + // :: error: [array.length.negative] int[] longer = new int[shorter.length * -1]; - // :: error: (assignment) + // :: error: [assignment] @LTLengthOf("longer") int x = shorter.length; - // :: error: (assignment) + // :: error: [assignment] @LTEqLengthOf("longer") int y = shorter.length; } public static void m6(int @MinLen(1) [] shorter) { int[] longer = new int[4 * shorter.length]; // TODO: enable when https://github.com/kelloggm/checker-framework/issues/211 is fixed - // // :: error: (assignment) + // // :: error: [assignment] // @LTLengthOf("longer") int x = shorter.length; @LTEqLengthOf("longer") int y = shorter.length; } diff --git a/checker/tests/index/LessThanLenBug.java b/checker/tests/index/LessThanLenBug.java index 7d5d1157dc64..7cb6caf5ce6c 100644 --- a/checker/tests/index/LessThanLenBug.java +++ b/checker/tests/index/LessThanLenBug.java @@ -4,7 +4,7 @@ public class LessThanLenBug { public static void m1(int[] shorter) { int[] longer = new int[4 * shorter.length]; - // :: error: (assignment) + // :: error: [assignment] @LTLengthOf("longer") int x = shorter.length; int i = longer[x]; } diff --git a/checker/tests/index/LessThanOrEqualTransfer.java b/checker/tests/index/LessThanOrEqualTransfer.java index 0d6fefe98c70..c2886aa51d82 100644 --- a/checker/tests/index/LessThanOrEqualTransfer.java +++ b/checker/tests/index/LessThanOrEqualTransfer.java @@ -9,7 +9,7 @@ void lte_check(int[] a) { void lte_bad_check(int[] a) { if (1 <= a.length) { - // :: error: (assignment) + // :: error: [assignment] int @MinLen(2) [] b = a; } } diff --git a/checker/tests/index/LessThanTransferTest.java b/checker/tests/index/LessThanTransferTest.java index 80834b894955..438fec120190 100644 --- a/checker/tests/index/LessThanTransferTest.java +++ b/checker/tests/index/LessThanTransferTest.java @@ -9,7 +9,7 @@ void lt_check(int[] a) { void lt_bad_check(int[] a) { if (0 < a.length) { - // :: error: (assignment) + // :: error: [assignment] int @MinLen(2) [] b = a; } } diff --git a/checker/tests/index/LessThanValue.java b/checker/tests/index/LessThanValue.java index 4bd0047ab3f5..f3fafdbd4830 100644 --- a/checker/tests/index/LessThanValue.java +++ b/checker/tests/index/LessThanValue.java @@ -12,7 +12,7 @@ public class LessThanValue { void subtyping(int x, int y, @LessThan({"#1", "#2"}) int a, @LessThan("#1") int b) { @LessThan("x") int q = a; @LessThan({"x", "y"}) - // :: error: (assignment) + // :: error: [assignment] int r = b; } @@ -21,14 +21,14 @@ void subtyping(int x, int y, @LessThan({"#1", "#2"}) int a, @LessThan("#1") int void lub(int x, int y, @LessThan({"#1", "#2"}) int a, @LessThan("#1") int b) { @LessThan("x") int r = flag ? a : b; @LessThan({"x", "y"}) - // :: error: (assignment) + // :: error: [assignment] int s = flag ? a : b; } void transitive(int a, int b, int c) { if (a < b) { if (b < c) { - // :: error: (assignment) + // :: error: [assignment] @LessThan("c") int x = a; } } @@ -80,7 +80,7 @@ void test(int maximum, int count) { if (count > maximum) { int deleteIndex = count - maximum - 1; // TODO: shouldn't error - // :: error: (argument) + // :: error: [argument] isLessThanOrEqual(0, deleteIndex); } } @@ -91,11 +91,11 @@ void count(int count) { } else { // TODO: improve value checker - // :: error: (assignment) + // :: error: [assignment] @IntRange(from = 0) int countDivMinus = count / 2 - 1; // Reasign to update the value in the store. countDivMinus = countDivMinus; - // :: error: (argument) + // :: error: [argument] isLessThan(0, countDivMinus); isLessThanOrEqual(0, countDivMinus); } @@ -116,7 +116,7 @@ void count(int count) { newCapacity = Integer.MAX_VALUE; // guaranteed to be >= newCapacity } - // :: error: (return) + // :: error: [return] return newCapacity; } } diff --git a/checker/tests/index/ListAdd.java b/checker/tests/index/ListAdd.java index 2fd3250db155..3a5f7a35657f 100644 --- a/checker/tests/index/ListAdd.java +++ b/checker/tests/index/ListAdd.java @@ -12,14 +12,14 @@ public class ListAdd { void ListAdd(@LTLengthOf("#3") int index, @LTEqLengthOf("#3") int notIndex, List list) { list.add(index, 4); - // :: error: (list.access.unsafe.high) + // :: error: [list.access.unsafe.high] list.add(notIndex + 1, 4); } int[] arr = {0}; void ListAddWrongName(@LTLengthOf("arr") int index, List list) { - // :: error: (list.access.unsafe.high) + // :: error: [list.access.unsafe.high] list.add(index, 4); } @@ -29,13 +29,13 @@ void ListAddField() { this.listField.add(listField.size() - 1, 4); this.listField.add(this.listField.size() - 1, 4); - // :: error: (list.access.unsafe.high) + // :: error: [list.access.unsafe.high] listField.add(listField.size(), 4); - // :: error: (list.access.unsafe.high) + // :: error: [list.access.unsafe.high] listField.add(this.listField.size(), 4); - // :: error: (list.access.unsafe.high) + // :: error: [list.access.unsafe.high] this.listField.add(listField.size(), 4); - // :: error: (list.access.unsafe.high) + // :: error: [list.access.unsafe.high] this.listField.add(this.listField.size(), 4); } @@ -43,16 +43,16 @@ void ListAddFieldUserAnnotation(@IndexFor("listField") int i) { listField.add(i, 4); this.listField.add(i, 4); - // :: error: (list.access.unsafe.high) + // :: error: [list.access.unsafe.high] listField.add(i + 4, 4); - // :: error: (list.access.unsafe.high) + // :: error: [list.access.unsafe.high] this.listField.add(i + 4, 4); } void ListAddUserAnnotation(@IndexFor("#2") int i, List list) { list.add(i, 4); - // :: error: (list.access.unsafe.high) + // :: error: [list.access.unsafe.high] list.add(i + 4, 4); } @@ -67,9 +67,9 @@ void ListAddUpdateValue(List list) { void ListAddTwo(@LTEqLengthOf({"#2", "#3"}) int i, List list, List list2) { @LTEqLengthOf({"list", "list2"}) int j = i; list.add(0); - // :: error: (list.access.unsafe.high) + // :: error: [list.access.unsafe.high] list.get(i); - // :: error: (list.access.unsafe.high) + // :: error: [list.access.unsafe.high] list2.get(i); } } diff --git a/checker/tests/index/ListAddAll.java b/checker/tests/index/ListAddAll.java index b858491f62eb..8d28de6627c9 100644 --- a/checker/tests/index/ListAddAll.java +++ b/checker/tests/index/ListAddAll.java @@ -13,14 +13,14 @@ void ListAddAll( @LTLengthOf("#3") int index, @LTEqLengthOf("#3") int notIndex, List list) { list.addAll(index, coll); - // :: error: (list.access.unsafe.high) + // :: error: [list.access.unsafe.high] list.addAll(notIndex, coll); } int[] arr = {0}; void ListAddAllWrongName(@LTLengthOf("arr") int index, List list) { - // :: error: (list.access.unsafe.high) + // :: error: [list.access.unsafe.high] list.addAll(index, coll); } @@ -30,13 +30,13 @@ void ListAddAllField() { this.listField.addAll(listField.size() - 1, coll); this.listField.addAll(this.listField.size() - 1, coll); - // :: error: (list.access.unsafe.high) + // :: error: [list.access.unsafe.high] listField.addAll(listField.size(), coll); - // :: error: (list.access.unsafe.high) + // :: error: [list.access.unsafe.high] listField.addAll(this.listField.size(), coll); - // :: error: (list.access.unsafe.high) + // :: error: [list.access.unsafe.high] this.listField.addAll(listField.size(), coll); - // :: error: (list.access.unsafe.high) + // :: error: [list.access.unsafe.high] this.listField.addAll(this.listField.size(), coll); } @@ -44,16 +44,16 @@ void ListAddAllFieldUserAnnotation(@IndexFor("listField") int i) { listField.addAll(i, coll); this.listField.addAll(i, coll); - // :: error: (list.access.unsafe.high) + // :: error: [list.access.unsafe.high] listField.addAll(i + 1, coll); - // :: error: (list.access.unsafe.high) + // :: error: [list.access.unsafe.high] this.listField.addAll(i + 1, coll); } void ListAddAllUserAnnotation(@IndexFor("#2") int i, List list) { list.addAll(i, coll); - // :: error: (list.access.unsafe.high) + // :: error: [list.access.unsafe.high] list.addAll(i + 1, coll); } } diff --git a/checker/tests/index/ListGet.java b/checker/tests/index/ListGet.java index 7487ab7fa814..62c18eb8051a 100644 --- a/checker/tests/index/ListGet.java +++ b/checker/tests/index/ListGet.java @@ -12,12 +12,12 @@ public class ListGet { void ListGet(@LTLengthOf("#3") int index, @LTEqLengthOf("#3") int notIndex, List list) { list.get(index); - // :: error: (list.access.unsafe.high) + // :: error: [list.access.unsafe.high] list.get(notIndex); } void ListGetWrongName(@LTLengthOf("arr") int index, List list) { - // :: error: (list.access.unsafe.high) + // :: error: [list.access.unsafe.high] list.get(index); } @@ -27,13 +27,13 @@ void ListGetField() { this.listField.get(listField.size() - 1); this.listField.get(this.listField.size() - 1); - // :: error: (list.access.unsafe.high) + // :: error: [list.access.unsafe.high] listField.get(listField.size()); - // :: error: (list.access.unsafe.high) + // :: error: [list.access.unsafe.high] listField.get(this.listField.size()); - // :: error: (list.access.unsafe.high) + // :: error: [list.access.unsafe.high] this.listField.get(listField.size()); - // :: error: (list.access.unsafe.high) + // :: error: [list.access.unsafe.high] this.listField.get(this.listField.size()); } @@ -41,16 +41,16 @@ void ListGetFieldUserAnnotation(@IndexFor("listField") int i) { listField.get(i); this.listField.get(i); - // :: error: (list.access.unsafe.high) + // :: error: [list.access.unsafe.high] listField.get(i + 1); - // :: error: (list.access.unsafe.high) + // :: error: [list.access.unsafe.high] this.listField.get(i + 1); } void ListGetUserAnnotation(@IndexFor("#2") int i, List list) { list.get(i); - // :: error: (list.access.unsafe.high) + // :: error: [list.access.unsafe.high] list.get(i + 1); } } diff --git a/checker/tests/index/ListIterator.java b/checker/tests/index/ListIterator.java index 8e29d028c68e..b9d0fe71b537 100644 --- a/checker/tests/index/ListIterator.java +++ b/checker/tests/index/ListIterator.java @@ -12,14 +12,14 @@ void ListIterator( @LTLengthOf("#3") int index, @LTEqLengthOf("#3") int notIndex, List list) { list.listIterator(index); - // :: error: (list.access.unsafe.high) + // :: error: [list.access.unsafe.high] list.listIterator(notIndex); } int[] arr = {0}; void ListIteratorWrongName(@LTLengthOf("arr") int index, List list) { - // :: error: (list.access.unsafe.high) + // :: error: [list.access.unsafe.high] list.listIterator(index); } @@ -29,13 +29,13 @@ void ListIteratorField() { this.listField.listIterator(listField.size() - 1); this.listField.listIterator(this.listField.size() - 1); - // :: error: (list.access.unsafe.high) + // :: error: [list.access.unsafe.high] listField.listIterator(listField.size()); - // :: error: (list.access.unsafe.high) + // :: error: [list.access.unsafe.high] listField.listIterator(this.listField.size()); - // :: error: (list.access.unsafe.high) + // :: error: [list.access.unsafe.high] this.listField.listIterator(listField.size()); - // :: error: (list.access.unsafe.high) + // :: error: [list.access.unsafe.high] this.listField.listIterator(this.listField.size()); } @@ -43,16 +43,16 @@ void ListIteratorFieldUserAnnotation(@IndexFor("listField") int i) { listField.listIterator(i); this.listField.listIterator(i); - // :: error: (list.access.unsafe.high) + // :: error: [list.access.unsafe.high] listField.listIterator(i + 1); - // :: error: (list.access.unsafe.high) + // :: error: [list.access.unsafe.high] this.listField.listIterator(i + 1); } void ListIteratorUserAnnotation(@IndexFor("#2") int i, List list) { list.listIterator(i); - // :: error: (list.access.unsafe.high) + // :: error: [list.access.unsafe.high] list.listIterator(i + 1); } } diff --git a/checker/tests/index/ListLowerBound.java b/checker/tests/index/ListLowerBound.java index cec30a8727b5..511ac7c943e9 100644 --- a/checker/tests/index/ListLowerBound.java +++ b/checker/tests/index/ListLowerBound.java @@ -7,9 +7,9 @@ public class ListLowerBound { private void m(List l) { - // :: error: (argument) + // :: error: [argument] l.get(-1); - // :: error: (argument) + // :: error: [argument] ListIterator li = l.listIterator(-1); @NonNegative int ni = li.nextIndex(); diff --git a/checker/tests/index/ListRemove.java b/checker/tests/index/ListRemove.java index 8561a3316e02..db5555352b1e 100644 --- a/checker/tests/index/ListRemove.java +++ b/checker/tests/index/ListRemove.java @@ -14,12 +14,12 @@ void ListRemove( @LTLengthOf("#3") int index, @LTEqLengthOf("#3") int notIndex, List list) { list.remove(index); - // :: error: (list.access.unsafe.high) + // :: error: [list.access.unsafe.high] list.remove(notIndex); } void ListRemoveWrongName(@LTLengthOf("arr") int index, List list) { - // :: error: (list.access.unsafe.high) + // :: error: [list.access.unsafe.high] list.remove(index); } @@ -29,13 +29,13 @@ void ListRemoveField() { this.listField.remove(listField.size() - 1); this.listField.remove(this.listField.size() - 1); - // :: error: (list.access.unsafe.high) + // :: error: [list.access.unsafe.high] listField.remove(listField.size()); - // :: error: (list.access.unsafe.high) + // :: error: [list.access.unsafe.high] listField.remove(this.listField.size()); - // :: error: (list.access.unsafe.high) + // :: error: [list.access.unsafe.high] this.listField.remove(listField.size()); - // :: error: (list.access.unsafe.high) + // :: error: [list.access.unsafe.high] this.listField.remove(this.listField.size()); } @@ -43,18 +43,18 @@ void ListRemoveFieldUserAnnotation(@IndexFor("listField") int i) { listField.remove(i); this.listField.remove(i); - // :: error: (list.access.unsafe.high) + // :: error: [list.access.unsafe.high] listField.remove(i + 1); - // :: error: (list.access.unsafe.high) + // :: error: [list.access.unsafe.high] this.listField.remove(i + 1); } void ListRemoveUserAnnotation(@IndexFor("list") int i, List list) { list.remove(i); - // :: error: (list.access.unsafe.high) + // :: error: [list.access.unsafe.high] list.remove(i + 1); - // :: error: (list.access.unsafe.high) + // :: error: [list.access.unsafe.high] list.remove(i); } @@ -73,7 +73,7 @@ void RemoveUpdate(List list) { int m = list.size() - 1; list.get(m); list.remove(m); - // :: error: (list.access.unsafe.high) + // :: error: [list.access.unsafe.high] list.get(m); } } diff --git a/checker/tests/index/ListSet.java b/checker/tests/index/ListSet.java index 9b4a70c5f1fc..80a2cb83cf98 100644 --- a/checker/tests/index/ListSet.java +++ b/checker/tests/index/ListSet.java @@ -11,14 +11,14 @@ public class ListSet { void ListSet(@LTLengthOf("#3") int index, @LTEqLengthOf("#3") int notIndex, List list) { list.set(index, 4); - // :: error: (list.access.unsafe.high) + // :: error: [list.access.unsafe.high] list.set(notIndex, 4); } int[] arr = {0}; void ListSetWrongName(@LTLengthOf("arr") int index, List list) { - // :: error: (list.access.unsafe.high) + // :: error: [list.access.unsafe.high] list.set(index, 4); } @@ -28,13 +28,13 @@ void ListSetField() { this.listField.set(listField.size() - 1, 4); this.listField.set(this.listField.size() - 1, 4); - // :: error: (list.access.unsafe.high) + // :: error: [list.access.unsafe.high] listField.set(listField.size(), 4); - // :: error: (list.access.unsafe.high) + // :: error: [list.access.unsafe.high] listField.set(this.listField.size(), 4); - // :: error: (list.access.unsafe.high) + // :: error: [list.access.unsafe.high] this.listField.set(listField.size(), 4); - // :: error: (list.access.unsafe.high) + // :: error: [list.access.unsafe.high] this.listField.set(this.listField.size(), 4); } @@ -42,16 +42,16 @@ void ListSetFieldUserAnnotation(@IndexFor("listField") int i) { listField.set(i, 4); this.listField.set(i, 4); - // :: error: (list.access.unsafe.high) + // :: error: [list.access.unsafe.high] listField.set(i + 1, 4); - // :: error: (list.access.unsafe.high) + // :: error: [list.access.unsafe.high] this.listField.set(i + 1, 4); } void ListSetUserAnnotation(@IndexFor("#2") int i, List list) { list.set(i, 4); - // :: error: (list.access.unsafe.high) + // :: error: [list.access.unsafe.high] list.set(i + 1, 4); } } diff --git a/checker/tests/index/ListSupport.java b/checker/tests/index/ListSupport.java index 3f807206133d..6dd120e8c9fb 100644 --- a/checker/tests/index/ListSupport.java +++ b/checker/tests/index/ListSupport.java @@ -11,7 +11,7 @@ void indexOf(List list) { @LTLengthOf("list") int i = index; - // :: error: (assignment) + // :: error: [assignment] @UpperBoundBottom int i2 = index; } @@ -20,7 +20,7 @@ void lastIndexOf(List list) { @LTLengthOf("list") int i = index; - // :: error: (assignment) + // :: error: [assignment] @UpperBoundBottom int i2 = index; } @@ -28,11 +28,11 @@ void subList(List list, @LTLengthOf("#1") int index, @LTEqLengthOf("#1" List list2 = list.subList(index, endIndex); // start index must be strictly lessthanlength - // :: error: (argument) + // :: error: [argument] list2 = list.subList(endIndex, endIndex); // edindex must be less than or equal to Length - // :: error: (argument) + // :: error: [argument] list2 = list.subList(index, 28); } @@ -40,7 +40,7 @@ void size(List list) { int i = list.size(); @LTEqLengthOf("list") int k = i; - // :: error: (assignment) + // :: error: [assignment] @LTLengthOf("list") int m = i; } @@ -51,16 +51,16 @@ void clear(List list) { list.clear(); - // :: error: (list.access.unsafe.high) + // :: error: [list.access.unsafe.high] list.get(lessThanLength); - // :: error: (assignment) + // :: error: [assignment] @LTEqLengthOf("list") int m = lessThanLength; - // :: error: (assignment) + // :: error: [assignment] m = lessThanOrEq; - // :: error: (assignment) + // :: error: [assignment] @LTLengthOf("list") int i = lessThanLength; } } diff --git a/checker/tests/index/ListSupportLBC.java b/checker/tests/index/ListSupportLBC.java index 6d60e2ab5fb4..08f914e69d44 100644 --- a/checker/tests/index/ListSupportLBC.java +++ b/checker/tests/index/ListSupportLBC.java @@ -14,7 +14,7 @@ void testGet() { int j = 0; // try and use a negative to get, should fail - // :: error: (argument) + // :: error: [argument] Integer m = list.get(i); // try and use a nonnegative, should work @@ -28,7 +28,7 @@ void testArrayListGet() { int j = 0; // try and use a negative to get, should fail - // :: error: (argument) + // :: error: [argument] Integer m = list.get(i); // try and use a nonnegative, should work @@ -41,7 +41,7 @@ void testSet() { int j = 0; // try and use a negative to get, should fail - // :: error: (argument) + // :: error: [argument] Integer m = list.set(i, 34); // try and use a nonnegative, should work @@ -52,12 +52,12 @@ void testIndexOf() { List list = new ArrayList<>(); @GTENegativeOne int a = list.indexOf(1); - // :: error: (assignment) + // :: error: [assignment] @NonNegative int n = a; @GTENegativeOne int b = list.lastIndexOf(1); - // :: error: (assignment) + // :: error: [assignment] @NonNegative int m = b; } @@ -65,7 +65,7 @@ void testSize() { List list = new ArrayList<>(); @NonNegative int s = list.size(); - // :: error: (assignment) + // :: error: [assignment] @Positive int r = s; } @@ -74,13 +74,13 @@ void testSublist() { int i = -1; int j = 0; - // :: error: (argument) + // :: error: [argument] List k = list.subList(i, i); - // :: error: (argument) + // :: error: [argument] List a = list.subList(i, j); - // :: error: (argument) + // :: error: [argument] List b = list.subList(j, i); // should work since both are nonnegative diff --git a/checker/tests/index/ListSupportML.java b/checker/tests/index/ListSupportML.java index 89f32fbe77b9..db693d677460 100644 --- a/checker/tests/index/ListSupportML.java +++ b/checker/tests/index/ListSupportML.java @@ -8,7 +8,7 @@ public class ListSupportML { void newListMinLen() { List list = new ArrayList<>(); - // :: error: (assignment) + // :: error: [assignment] @MinLen(1) List list2 = list; @MinLen(0) List list3 = list; @@ -18,7 +18,7 @@ void listRemove(@MinLen(10) List lst) { List list = lst; list.remove(0); - // :: error: (assignment) + // :: error: [assignment] @MinLen(10) List list2 = list; @MinLen(9) List list3 = list; @@ -30,7 +30,7 @@ void listRemoveAliasing(@MinLen(10) List lst) { list2.remove(0); - // :: error: (assignment) + // :: error: [assignment] @MinLen(10) List list3 = list; @MinLen(9) List list4 = list; @@ -47,7 +47,7 @@ void listClear(@MinLen(10) List lst) { List list = lst; list.clear(); - // :: error: (assignment) + // :: error: [assignment] @MinLen(1) List list2 = list; @MinLen(0) List list3 = list; @@ -61,7 +61,7 @@ void listRemoveArrayAlter(@MinLen(10) List lst) { list2.remove(0); - // :: error: (assignment) + // :: error: [assignment] @MinLen(10) List list3 = list; int @MinLen(10) [] arr2 = arr; diff --git a/checker/tests/index/Loops.java b/checker/tests/index/Loops.java index 1f83445977c7..284fbd570e3c 100644 --- a/checker/tests/index/Loops.java +++ b/checker/tests/index/Loops.java @@ -5,21 +5,21 @@ public final class Loops { public void test1a(int[] a, @LTLengthOf("#1") int offset, @LTLengthOf("#1") int offset2) { while (flag) { - // :: error: (unary.increment) + // :: error: [unary.increment] offset++; } } public void test1b(int[] a, @LTLengthOf("#1") int offset, @LTLengthOf("#1") int offset2) { while (flag) { - // :: error: (compound.assignment) + // :: error: [compound.assignment] offset += 1; } } public void test1c(int[] a, @LTLengthOf("#1") int offset, @LTLengthOf("#1") int offset2) { while (flag) { - // :: error: (compound.assignment) + // :: error: [compound.assignment] offset2 += offset; } } @@ -32,27 +32,27 @@ public void test2(int[] a, int[] array) { offset++; offset2 += offset; } - // :: error: (assignment) + // :: error: [assignment] @LTLengthOf("array") int x = offset; - // :: error: (assignment) + // :: error: [assignment] @LTLengthOf("array") int y = offset2; } public void test3(int[] a, @LTLengthOf("#1") int offset, @LTLengthOf("#1") int offset2) { while (flag) { offset--; - // :: error: (compound.assignment) + // :: error: [compound.assignment] offset2 -= offset; } } public void test4(int[] a, @LTLengthOf("#1") int offset, @LTLengthOf("#1") int offset2) { while (flag) { - // :: error: (unary.increment) + // :: error: [unary.increment] offset++; - // :: error: (compound.assignment) + // :: error: [compound.assignment] offset += 1; - // :: error: (compound.assignment) + // :: error: [compound.assignment] offset2 += offset; } } @@ -70,14 +70,14 @@ public void test5( int otherOffset = offset; while (flag) { otherOffset += 1; - // :: error: (unary.increment) + // :: error: [unary.increment] offset++; - // :: error: (compound.assignment) + // :: error: [compound.assignment] offset += 1; - // :: error: (compound.assignment) + // :: error: [compound.assignment] offset2 += offset; } - // :: error: (assignment) + // :: error: [assignment] @LTLengthOf(value = "#1", offset = "-1000") int x = otherOffset; } } diff --git a/checker/tests/index/LubIndex.java b/checker/tests/index/LubIndex.java index 0cc87b653985..4e3706c8b00b 100644 --- a/checker/tests/index/LubIndex.java +++ b/checker/tests/index/LubIndex.java @@ -10,10 +10,10 @@ public static void MinLen(int @MinLen(10) [] arg, int @MinLen(4) [] arg2) { } else { arr = arg2; } - // :: error: (assignment) + // :: error: [assignment] int @MinLen(10) [] res = arr; int @MinLen(4) [] res2 = arr; - // :: error: (assignment) + // :: error: [assignment] int @BottomVal [] res3 = arr; } @@ -24,10 +24,10 @@ public static void Bottom(int @BottomVal [] arg, int @MinLen(4) [] arg2) { } else { arr = arg2; } - // :: error: (assignment) + // :: error: [assignment] int @MinLen(10) [] res = arr; int @MinLen(4) [] res2 = arr; - // :: error: (assignment) + // :: error: [assignment] int @BottomVal [] res3 = arr; } diff --git a/checker/tests/index/MethodOverrides.java b/checker/tests/index/MethodOverrides.java index 5cbf69b29eb3..b25401133da8 100644 --- a/checker/tests/index/MethodOverrides.java +++ b/checker/tests/index/MethodOverrides.java @@ -13,7 +13,7 @@ public class MethodOverrides { } class MethodOverrides2 extends MethodOverrides { - // :: error: (override.return) + // :: error: [override.return] int read() { return -1; } diff --git a/checker/tests/index/MinLenFieldInvar.java b/checker/tests/index/MinLenFieldInvar.java index 1794052b2fbd..b554ce19794e 100644 --- a/checker/tests/index/MinLenFieldInvar.java +++ b/checker/tests/index/MinLenFieldInvar.java @@ -14,7 +14,7 @@ public Super(int @MinLen(2) [] minlen2) { } } - // :: error: (field.invariant.not.subtype) + // :: error: [field.invariant.not.subtype] @MinLenFieldInvariant(field = "minlen2", minLen = 1) class InvalidSub extends Super { public InvalidSub() { @@ -32,7 +32,7 @@ public ValidSub(int[] validSubField) { } } - // :: error: (field.invariant.not.found.superclass) + // :: error: [field.invariant.not.found.superclass] @MinLenFieldInvariant(field = "validSubField", minLen = 3) class InvalidSubSub1 extends ValidSub { public InvalidSubSub1() { @@ -40,7 +40,7 @@ public InvalidSubSub1() { } } - // :: error: (field.invariant.not.subtype.superclass) + // :: error: [field.invariant.not.subtype.superclass] @MinLenFieldInvariant(field = "minlen2", minLen = 3) class InvalidSubSub2 extends ValidSub { public InvalidSubSub2() { diff --git a/checker/tests/index/MinLenFromPositive.java b/checker/tests/index/MinLenFromPositive.java index 2dc1a095e1c7..b1e9c4617b45 100644 --- a/checker/tests/index/MinLenFromPositive.java +++ b/checker/tests/index/MinLenFromPositive.java @@ -15,7 +15,7 @@ void foo(int x) { } void foo2(int x) { - // :: error: (argument) + // :: error: [argument] test(x); } @@ -37,7 +37,7 @@ void test_lub2(boolean flag, @Positive int x, @IntRange(from = -1, to = 11) int } else { z = y; } - // :: error: (assignment) + // :: error: [assignment] @Positive int q = z; @IntRange(from = -1) int w = z; } @@ -51,7 +51,7 @@ void test_id(int param) { @IntRange(from = 1) int y = id(5); int @MinLen(1) [] a = new int[id(100)]; - // :: error: (assignment) + // :: error: [assignment] int @MinLen(10) [] c = new int[id(100)]; int q = id(10); diff --git a/checker/tests/index/MinLenIndexFor.java b/checker/tests/index/MinLenIndexFor.java index 9cdd5fc3af5c..166600eb5d8e 100644 --- a/checker/tests/index/MinLenIndexFor.java +++ b/checker/tests/index/MinLenIndexFor.java @@ -13,9 +13,9 @@ void test(@IndexFor("this.arrayLen2") int i) { void callTest(int x) { test(0); test(1); - // :: error: (argument) + // :: error: [argument] test(2); - // :: error: (argument) + // :: error: [argument] test(3); test(arrayLen2.length - 1); } @@ -34,7 +34,7 @@ void callTest2(int x) { test2(1); test2(2); test2(4); - // :: error: (argument) + // :: error: [argument] test2(5); test2(arrayLen4.length); } diff --git a/checker/tests/index/MinLenOneAndLength.java b/checker/tests/index/MinLenOneAndLength.java index 5cb6811ca25b..7aeeb8da5cf4 100644 --- a/checker/tests/index/MinLenOneAndLength.java +++ b/checker/tests/index/MinLenOneAndLength.java @@ -4,7 +4,7 @@ public class MinLenOneAndLength { public void m1(int @MinLen(1) [] a, int[] b) { @IndexFor("a") int i = a.length / 2; - // :: error: (assignment) + // :: error: [assignment] @IndexFor("b") int j = b.length / 2; } } diff --git a/checker/tests/index/MinMaxIndex.java b/checker/tests/index/MinMaxIndex.java index 62220df3c534..adfe07241a84 100644 --- a/checker/tests/index/MinMaxIndex.java +++ b/checker/tests/index/MinMaxIndex.java @@ -22,14 +22,14 @@ void indexOrHigh(String str, @IndexOrHigh("#1") int i1, @IndexOrHigh("#1") int i void indexForOrHigh(String str, @IndexFor("#1") int i1, @IndexOrHigh("#1") int i2) { str.substring(Math.max(i1, i2)); str.substring(Math.min(i1, i2)); - // :: error: (argument) + // :: error: [argument] str.charAt(Math.max(i1, i2)); str.charAt(Math.min(i1, i2)); } // max does not work with different sequences, min does void twoSequences(String str1, String str2, @IndexFor("#1") int i1, @IndexFor("#2") int i2) { - // :: error: (argument) + // :: error: [argument] str1.charAt(Math.max(i1, i2)); str1.charAt(Math.min(i1, i2)); } diff --git a/checker/tests/index/NegativeArray.java b/checker/tests/index/NegativeArray.java index 7335ce6af514..c986912f063b 100644 --- a/checker/tests/index/NegativeArray.java +++ b/checker/tests/index/NegativeArray.java @@ -3,7 +3,7 @@ public class NegativeArray { public static void negativeArray(@GTENegativeOne int len) { - // :: error: (array.length.negative) + // :: error: [array.length.negative] int[] arr = new int[len]; } } diff --git a/checker/tests/index/NotEnoughOffsets.java b/checker/tests/index/NotEnoughOffsets.java index d311537a5fea..cb8bf45694ab 100644 --- a/checker/tests/index/NotEnoughOffsets.java +++ b/checker/tests/index/NotEnoughOffsets.java @@ -7,14 +7,14 @@ public class NotEnoughOffsets { int c, d; void badParam( - // :: error: (different.length.sequences.offsets) + // :: error: [different.length.sequences.offsets] @LTLengthOf( value = {"a", "b"}, offset = {"c"}) int x) {} void badParam2( - // :: error: (different.length.sequences.offsets) + // :: error: [different.length.sequences.offsets] @LTLengthOf( value = {"a"}, offset = {"c", "d"}) diff --git a/checker/tests/index/NotEqualTransfer.java b/checker/tests/index/NotEqualTransfer.java index cedf58fa80cd..add45a631aec 100644 --- a/checker/tests/index/NotEqualTransfer.java +++ b/checker/tests/index/NotEqualTransfer.java @@ -13,7 +13,7 @@ void neq_bad_check(int[] a) { if (1 != a.length) { int x = 1; // do nothing. } else { - // :: error: (assignment) + // :: error: [assignment] int @MinLen(2) [] b = a; } } diff --git a/checker/tests/index/OffsetAnnotations.java b/checker/tests/index/OffsetAnnotations.java index 8150f5de2134..8190c697a02c 100644 --- a/checker/tests/index/OffsetAnnotations.java +++ b/checker/tests/index/OffsetAnnotations.java @@ -4,14 +4,14 @@ public class OffsetAnnotations { public static void OffsetAnnotationsReader() throws IOException { BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in)); char[] buffer = new char[10]; - // :: error: (argument) + // :: error: [argument] bufferedReader.read(buffer, 5, 7); } public static void OffsetAnnotationsWriter() throws IOException { BufferedWriter bufferedWriter = new BufferedWriter(new OutputStreamWriter(System.out)); char[] buffer = new char[10]; - // :: error: (argument) + // :: error: [argument] bufferedWriter.write(buffer, 5, 7); } } diff --git a/checker/tests/index/OffsetExample.java b/checker/tests/index/OffsetExample.java index 5adf3724d610..3c9b2088706b 100644 --- a/checker/tests/index/OffsetExample.java +++ b/checker/tests/index/OffsetExample.java @@ -24,7 +24,7 @@ void example2(int @MinLen(2) [] a) { a[j + i] = 1; a[i + 0] = 1; a[i - 1] = 1; - // ::error: (array.access.unsafe.high) + // ::error: [array.access.unsafe.high] a[i + 2 + j] = 1; } } @@ -53,7 +53,7 @@ void test(@IndexFor("#3") int start, @IndexOrHigh("#3") int end, int[] a) { if (end > start) { // If start == 0, then end - start is end. end might be equal to the length of a. So // the array access might be too high. - // ::error: (array.access.unsafe.high) + // ::error: [array.access.unsafe.high] a[end - start] = 0; } diff --git a/checker/tests/index/OffsetsAndConstants.java b/checker/tests/index/OffsetsAndConstants.java index c9d01e44f8f9..9a105b29f510 100644 --- a/checker/tests/index/OffsetsAndConstants.java +++ b/checker/tests/index/OffsetsAndConstants.java @@ -21,10 +21,10 @@ public static void main(String[] args) { read(a, 5, 5); - // :: error: (argument) + // :: error: [argument] read(a, 5, 6); - // :: error: (argument) + // :: error: [argument] read(a, 5, 7); } } diff --git a/checker/tests/index/OneOrTwo.java b/checker/tests/index/OneOrTwo.java index 7718be27a387..3ea47e460c4c 100644 --- a/checker/tests/index/OneOrTwo.java +++ b/checker/tests/index/OneOrTwo.java @@ -7,7 +7,7 @@ public class OneOrTwo { void test(@BottomVal int x) { int[] a = new int[Integer.valueOf(getOneOrTwo())]; - // :: error: (array.length.negative) + // :: error: [array.length.negative] int[] b = new int[Integer.valueOf(x)]; } diff --git a/checker/tests/index/OnlyCheckSubsequenceWhenAssigningToArray.java b/checker/tests/index/OnlyCheckSubsequenceWhenAssigningToArray.java index f228b29e85a3..9cac68c67f39 100644 --- a/checker/tests/index/OnlyCheckSubsequenceWhenAssigningToArray.java +++ b/checker/tests/index/OnlyCheckSubsequenceWhenAssigningToArray.java @@ -21,7 +21,7 @@ void testAssignmentToArrayElement(@IndexFor("this") int x, int y) { } void testAssignmentToArray(int[] a) { - // :: error: (to.not.ltel) :: error: (from.gt.to) + // :: error: [to.not.ltel] :: error: [from.gt.to] array = a; } } diff --git a/checker/tests/index/OuterThisJavaExpression.java b/checker/tests/index/OuterThisJavaExpression.java index ef997895b411..af2d208f76ba 100644 --- a/checker/tests/index/OuterThisJavaExpression.java +++ b/checker/tests/index/OuterThisJavaExpression.java @@ -25,7 +25,7 @@ final class Inner { } @SameLen("s") String f3() { - // :: error: (return) + // :: error: [return] return OuterThisJavaExpression.this.s; } @@ -38,17 +38,17 @@ final class Inner { } @SameLen("this.s") String f6() { - // :: error: (return) + // :: error: [return] return OuterThisJavaExpression.this.s; } @SameLen("OuterThisJavaExpression.this.s") String f7() { - // :: error: (return) + // :: error: [return] return s; } @SameLen("OuterThisJavaExpression.this.s") String f8() { - // :: error: (return) + // :: error: [return] return this.s; } diff --git a/checker/tests/index/ParserOffsetTest.java b/checker/tests/index/ParserOffsetTest.java index 1305fd42b805..f860848acea4 100644 --- a/checker/tests/index/ParserOffsetTest.java +++ b/checker/tests/index/ParserOffsetTest.java @@ -47,10 +47,10 @@ public void subtraction3(String[] a, @NonNegative int k) { public void subtraction4(String[] a, @IndexFor("#1") int i) { if (1 - i < a.length) { // The error on this assignment is a false positive. - // :: error: (assignment) + // :: error: [assignment] @IndexFor("a") int j = 1 - i; - // :: error: (assignment) + // :: error: [assignment] @LTLengthOf(value = "a", offset = "1") int k = i; } } @@ -58,7 +58,7 @@ public void subtraction4(String[] a, @IndexFor("#1") int i) { @SuppressWarnings("lowerbound") public void subtraction5(String[] a, int i) { if (1 - i < a.length) { - // :: error: (assignment) + // :: error: [assignment] @IndexFor("a") int j = i; } } @@ -67,16 +67,16 @@ public void subtraction5(String[] a, int i) { public void subtraction6(String[] a, int i, int j) { if (i - j < a.length - 1) { @IndexFor("a") int k = i - j; - // :: error: (assignment) + // :: error: [assignment] @IndexFor("a") int k1 = i; } } public void multiplication1(String[] a, int i, @Positive int j) { if ((i * j) < (a.length + j)) { - // :: error: (assignment) + // :: error: [assignment] @IndexFor("a") int k = i; - // :: error: (assignment) + // :: error: [assignment] @IndexFor("a") int k1 = j; } } @@ -84,9 +84,9 @@ public void multiplication1(String[] a, int i, @Positive int j) { public void multiplication2(String @ArrayLen(5) [] a, @IntVal(-2) int i, @IntVal(20) int j) { if ((i * j) < (a.length - 20)) { @LTLengthOf("a") int k1 = i; - // :: error: (assignment) + // :: error: [assignment] @LTLengthOf(value = "a", offset = "20") int k2 = i; - // :: error: (assignment) + // :: error: [assignment] @LTLengthOf("a") int k3 = j; } } diff --git a/checker/tests/index/PlusPlusBug.java b/checker/tests/index/PlusPlusBug.java index ca9317020be3..11b234803d0d 100644 --- a/checker/tests/index/PlusPlusBug.java +++ b/checker/tests/index/PlusPlusBug.java @@ -4,11 +4,11 @@ public class PlusPlusBug { int[] array = {}; void test(@LTLengthOf("array") int x) { - // :: error: (unary.increment) + // :: error: [unary.increment] x++; - // :: error: (unary.increment) + // :: error: [unary.increment] ++x; - // :: error: (assignment) + // :: error: [assignment] x = x + 1; } } diff --git a/checker/tests/index/Polymorphic.java b/checker/tests/index/Polymorphic.java index d462c9a7e1ab..d8a26a946b42 100644 --- a/checker/tests/index/Polymorphic.java +++ b/checker/tests/index/Polymorphic.java @@ -29,7 +29,7 @@ public class Polymorphic { void samelen_id(int @SameLen("#2") [] a, int[] a2) { int[] banana; int @SameLen("a2") [] b = samelen_identity(a); - // :: error: (assignment) + // :: error: [assignment] int @SameLen("banana") [] c = samelen_identity(b); } @@ -44,30 +44,30 @@ void ubc_id( int[] c; @LTLengthOf("a") int ai1 = ubc_identity(ai); - // :: error: (assignment) + // :: error: [assignment] @LTLengthOf("b") int ai2 = ubc_identity(ai); @LTEqLengthOf("a") int al1 = ubc_identity(al); - // :: error: (assignment) + // :: error: [assignment] @LTLengthOf("a") int al2 = ubc_identity(al); @LTLengthOf({"a", "b"}) int abi1 = ubc_identity(abi); - // :: error: (assignment) + // :: error: [assignment] @LTLengthOf({"a", "b", "c"}) int abi2 = ubc_identity(abi); @LTEqLengthOf({"a", "b"}) int abl1 = ubc_identity(abl); - // :: error: (assignment) + // :: error: [assignment] @LTEqLengthOf({"a", "b", "c"}) int abl2 = ubc_identity(abl); } // LowerBound tests void lbc_id(@NonNegative int n, @Positive int p, @GTENegativeOne int g) { @NonNegative int an = lbc_identity(n); - // :: error: (assignment) + // :: error: [assignment] @Positive int bn = lbc_identity(n); @GTENegativeOne int ag = lbc_identity(g); - // :: error: (assignment) + // :: error: [assignment] @NonNegative int bg = lbc_identity(g); @Positive int ap = lbc_identity(p); diff --git a/checker/tests/index/Polymorphic2.java b/checker/tests/index/Polymorphic2.java index 91bdb505e654..f681047cd32a 100644 --- a/checker/tests/index/Polymorphic2.java +++ b/checker/tests/index/Polymorphic2.java @@ -19,7 +19,7 @@ public class Polymorphic2 { void testSameLen(int @SameLen("array1") [] a, int @SameLen("array2") [] b) { int[] x = mergeSameLen(a, b); - // :: error: (assignment) + // :: error: [assignment] int @SameLen("array1") [] y = mergeSameLen(a, b); } @@ -30,13 +30,13 @@ void testSameLen(int @SameLen("array1") [] a, int @SameLen("array2") [] b) { // UpperBound tests void testUpperBound(@LTLengthOf("array1") int a, @LTLengthOf("array2") int b) { int z = mergeUpperBound(a, b); - // :: error: (assignment) + // :: error: [assignment] @LTLengthOf("array1") int zz = mergeUpperBound(a, b); } void testUpperBound2(@LTLengthOf("array1") int a, @LTEqLengthOf("array1") int b) { @LTEqLengthOf("array1") int z = mergeUpperBound(a, b); - // :: error: (assignment) + // :: error: [assignment] @LTLengthOf("array1") int zz = mergeUpperBound(a, b); } @@ -47,7 +47,7 @@ void testUpperBound2(@LTLengthOf("array1") int a, @LTEqLengthOf("array1") int b) // LowerBound tests void lbc_id(@NonNegative int n, @Positive int p) { @NonNegative int z = mergeLowerBound(n, p); - // :: error: (assignment) + // :: error: [assignment] @Positive int zz = mergeLowerBound(n, p); } } diff --git a/checker/tests/index/Polymorphic3.java b/checker/tests/index/Polymorphic3.java index 7ed315a3163f..378dbb4620aa 100644 --- a/checker/tests/index/Polymorphic3.java +++ b/checker/tests/index/Polymorphic3.java @@ -19,30 +19,30 @@ void ubc_id( int[] c; @LTLengthOf("a") int ai1 = identity(ai); - // :: error: (assignment) + // :: error: [assignment] @LTLengthOf("b") int ai2 = identity(ai); @LTEqLengthOf("a") int al1 = identity(al); - // :: error: (assignment) + // :: error: [assignment] @LTLengthOf("a") int al2 = identity(al); @LTLengthOf({"a", "b"}) int abi1 = identity(abi); - // :: error: (assignment) + // :: error: [assignment] @LTLengthOf({"a", "b", "c"}) int abi2 = identity(abi); @LTEqLengthOf({"a", "b"}) int abl1 = identity(abl); - // :: error: (assignment) + // :: error: [assignment] @LTEqLengthOf({"a", "b", "c"}) int abl2 = identity(abl); } // LowerBound tests void lbc_id(@NonNegative int n, @Positive int p, @GTENegativeOne int g) { @NonNegative int an = identity(n); - // :: error: (assignment) + // :: error: [assignment] @Positive int bn = identity(n); @GTENegativeOne int ag = identity(g); - // :: error: (assignment) + // :: error: [assignment] @NonNegative int bg = identity(g); @Positive int ap = identity(p); diff --git a/checker/tests/index/PreAndPostDec.java b/checker/tests/index/PreAndPostDec.java index ff876162a71d..1178ae66411d 100644 --- a/checker/tests/index/PreAndPostDec.java +++ b/checker/tests/index/PreAndPostDec.java @@ -3,7 +3,7 @@ public class PreAndPostDec { void pre1(int[] args) { int ii = 0; while ((ii < args.length)) { - // :: error: (array.access.unsafe.high) + // :: error: [array.access.unsafe.high] int m = args[++ii]; } } @@ -12,7 +12,7 @@ void pre2(int[] args) { int ii = 0; while ((ii < args.length)) { ii++; - // :: error: (array.access.unsafe.high) + // :: error: [array.access.unsafe.high] int m = args[ii]; } } diff --git a/checker/tests/index/RandomTest.java b/checker/tests/index/RandomTest.java index 14e3aa274765..7e043e24d3d7 100644 --- a/checker/tests/index/RandomTest.java +++ b/checker/tests/index/RandomTest.java @@ -5,7 +5,7 @@ public class RandomTest { void test() { Random rand = new Random(); int[] a = new int[8]; - // :: error: (anno.on.irrelevant) + // :: error: [anno.on.irrelevant] @LTLengthOf("a") double d1 = Math.random() * a.length; @LTLengthOf("a") int deref = (int) (Math.random() * a.length); @LTLengthOf("a") int deref2 = (int) (rand.nextDouble() * a.length); diff --git a/checker/tests/index/RandomTestLBC.java b/checker/tests/index/RandomTestLBC.java index 9c149115ea41..b1b620c4bdf5 100644 --- a/checker/tests/index/RandomTestLBC.java +++ b/checker/tests/index/RandomTestLBC.java @@ -7,11 +7,11 @@ void test() { int[] a = new int[8]; // Math.random() and Math.nextDouble() are always non-negative, but the Index Checker // does not reason about floating-point values. - // :: error: (anno.on.irrelevant) + // :: error: [anno.on.irrelevant] @NonNegative double d1 = Math.random() * a.length; - // :: error: (assignment) + // :: error: [assignment] @NonNegative int deref = (int) (Math.random() * a.length); - // :: error: (assignment) + // :: error: [assignment] @NonNegative int deref2 = (int) (rand.nextDouble() * a.length); @NonNegative int deref3 = rand.nextInt(a.length); } diff --git a/checker/tests/index/RangeIndex.java b/checker/tests/index/RangeIndex.java index ba1740e62498..7b5d2a2e5017 100644 --- a/checker/tests/index/RangeIndex.java +++ b/checker/tests/index/RangeIndex.java @@ -2,7 +2,7 @@ public class RangeIndex { void foo(@IntRange(from = 0, to = 11) int x, int @MinLen(10) [] a) { - // :: error: (array.access.unsafe.high.range) + // :: error: [array.access.unsafe.high.range] int y = a[x]; } } diff --git a/checker/tests/index/Reassignment.java b/checker/tests/index/Reassignment.java index fbec46c6466d..d8074c0d4755 100644 --- a/checker/tests/index/Reassignment.java +++ b/checker/tests/index/Reassignment.java @@ -6,7 +6,7 @@ public class Reassignment { void test(int[] arr, int i) { if (i > 0 && i < arr.length) { arr = new int[0]; - // :: error: (array.access.unsafe.high) + // :: error: [array.access.unsafe.high] int j = arr[i]; } } diff --git a/checker/tests/index/RefineEq.java b/checker/tests/index/RefineEq.java index 256a9b3fafec..70fe8e988df6 100644 --- a/checker/tests/index/RefineEq.java +++ b/checker/tests/index/RefineEq.java @@ -5,7 +5,7 @@ public class RefineEq { int[] arr = {1}; void testLTL(@LTLengthOf("arr") int test) { - // :: error: (assignment) + // :: error: [assignment] @LTLengthOf("arr") int a = Integer.parseInt("1"); int b = 1; @@ -13,15 +13,15 @@ void testLTL(@LTLengthOf("arr") int test) { @LTLengthOf("arr") int c = b; } else { - // :: error: (assignment) + // :: error: [assignment] @LTLengthOf("arr") int e = b; } - // :: error: (assignment) + // :: error: [assignment] @LTLengthOf("arr") int d = b; } void testLTEL(@LTEqLengthOf("arr") int test) { - // :: error: (assignment) + // :: error: [assignment] @LTEqLengthOf("arr") int a = Integer.parseInt("1"); int b = 1; @@ -30,10 +30,10 @@ void testLTEL(@LTEqLengthOf("arr") int test) { @LTLengthOf("arr") int g = b; } else { - // :: error: (assignment) + // :: error: [assignment] @LTEqLengthOf("arr") int e = b; } - // :: error: (assignment) + // :: error: [assignment] @LTEqLengthOf("arr") int d = b; } } diff --git a/checker/tests/index/RefineGT.java b/checker/tests/index/RefineGT.java index cdb66e955072..b902620f456a 100644 --- a/checker/tests/index/RefineGT.java +++ b/checker/tests/index/RefineGT.java @@ -8,45 +8,45 @@ void testLTL(@LTLengthOf("arr") int test) { // The reason for the parsing is so that the Value Checker // can't figure it out but normal humans can. - // :: error: (assignment) + // :: error: [assignment] @LTLengthOf("arr") int a = Integer.parseInt("1"); - // :: error: (assignment) + // :: error: [assignment] @LTLengthOf("arr") int a3 = Integer.parseInt("3"); int b = 2; if (test > b) { @LTLengthOf("arr") int c = b; } - // :: error: (assignment) + // :: error: [assignment] @LTLengthOf("arr") int c1 = b; if (a > b) { int potato = 7; } else { - // :: error: (assignment) + // :: error: [assignment] @LTLengthOf("arr") int d = b; } } void testLTEL(@LTEqLengthOf("arr") int test) { - // :: error: (assignment) + // :: error: [assignment] @LTEqLengthOf("arr") int a = Integer.parseInt("1"); - // :: error: (assignment) + // :: error: [assignment] @LTEqLengthOf("arr") int a3 = Integer.parseInt("3"); int b = 2; if (test > b) { @LTLengthOf("arr") int c = b; } - // :: error: (assignment) + // :: error: [assignment] @LTLengthOf("arr") int c1 = b; if (a > b) { int potato = 7; } else { - // :: error: (assignment) + // :: error: [assignment] @LTLengthOf("arr") int d = b; } } diff --git a/checker/tests/index/RefineGTE.java b/checker/tests/index/RefineGTE.java index a03bf893c41e..3a6e24a34396 100644 --- a/checker/tests/index/RefineGTE.java +++ b/checker/tests/index/RefineGTE.java @@ -8,45 +8,45 @@ void testLTL(@LTLengthOf("arr") int test) { // The reason for the parsing is so that the Value Checker // can't figure it out but normal humans can. - // :: error: (assignment) + // :: error: [assignment] @LTLengthOf("arr") int a = Integer.parseInt("1"); - // :: error: (assignment) + // :: error: [assignment] @LTLengthOf("arr") int a3 = Integer.parseInt("3"); int b = 2; if (test >= b) { @LTLengthOf("arr") int c = b; } - // :: error: (assignment) + // :: error: [assignment] @LTLengthOf("arr") int c1 = b; if (a >= b) { int potato = 7; } else { - // :: error: (assignment) + // :: error: [assignment] @LTLengthOf("arr") int d = b; } } void testLTEL(@LTEqLengthOf("arr") int test) { - // :: error: (assignment) + // :: error: [assignment] @LTEqLengthOf("arr") int a = Integer.parseInt("1"); - // :: error: (assignment) + // :: error: [assignment] @LTEqLengthOf("arr") int a3 = Integer.parseInt("3"); int b = 2; if (test >= b) { @LTEqLengthOf("arr") int c = b; } - // :: error: (assignment) + // :: error: [assignment] @LTEqLengthOf("arr") int c1 = b; if (a >= b) { int potato = 7; } else { - // :: error: (assignment) + // :: error: [assignment] @LTEqLengthOf("arr") int d = b; } } diff --git a/checker/tests/index/RefineLT.java b/checker/tests/index/RefineLT.java index 9b3098d59e70..93919c873b8a 100644 --- a/checker/tests/index/RefineLT.java +++ b/checker/tests/index/RefineLT.java @@ -9,35 +9,35 @@ void testLTL(@LTLengthOf("arr") int test, @LTLengthOf("arr") int a, @LTLengthOf( if (b < test) { @LTLengthOf("arr") int c = b; } - // :: error: (assignment) + // :: error: [assignment] @LTLengthOf("arr") int c1 = b; if (b < a3) { int potato = 7; } else { - // :: error: (assignment) + // :: error: [assignment] @LTLengthOf("arr") int d = b; } } void testLTEL(@LTLengthOf("arr") int test) { - // :: error: (assignment) + // :: error: [assignment] @LTEqLengthOf("arr") int a = Integer.parseInt("1"); - // :: error: (assignment) + // :: error: [assignment] @LTEqLengthOf("arr") int a3 = Integer.parseInt("3"); int b = 2; if (b < test) { @LTEqLengthOf("arr") int c = b; } - // :: error: (assignment) + // :: error: [assignment] @LTEqLengthOf("arr") int c1 = b; if (b < a) { int potato = 7; } else { - // :: error: (assignment) + // :: error: [assignment] @LTEqLengthOf("arr") int d = b; } } diff --git a/checker/tests/index/RefineLTE.java b/checker/tests/index/RefineLTE.java index 14c37ac4b1da..8cadd8057462 100644 --- a/checker/tests/index/RefineLTE.java +++ b/checker/tests/index/RefineLTE.java @@ -8,45 +8,45 @@ void testLTL(@LTLengthOf("arr") int test) { // The reason for the parsing is so that the Value Checker // can't figure it out but normal humans can. - // :: error: (assignment) + // :: error: [assignment] @LTLengthOf("arr") int a = Integer.parseInt("1"); - // :: error: (assignment) + // :: error: [assignment] @LTLengthOf("arr") int a3 = Integer.parseInt("3"); int b = 2; if (b <= test) { @LTLengthOf("arr") int c = b; } - // :: error: (assignment) + // :: error: [assignment] @LTLengthOf("arr") int c1 = b; if (b <= a) { int potato = 7; } else { - // :: error: (assignment) + // :: error: [assignment] @LTLengthOf("arr") int d = b; } } void testLTEL(@LTEqLengthOf("arr") int test) { - // :: error: (assignment) + // :: error: [assignment] @LTEqLengthOf("arr") int a = Integer.parseInt("1"); - // :: error: (assignment) + // :: error: [assignment] @LTEqLengthOf("arr") int a3 = Integer.parseInt("3"); int b = 2; if (b <= test) { @LTEqLengthOf("arr") int c = b; } - // :: error: (assignment) + // :: error: [assignment] @LTLengthOf("arr") int c1 = b; if (b <= a) { int potato = 7; } else { - // :: error: (assignment) + // :: error: [assignment] @LTLengthOf("arr") int d = b; } } diff --git a/checker/tests/index/RefineLTE2.java b/checker/tests/index/RefineLTE2.java index ddef6c67cc31..3d5797def1be 100644 --- a/checker/tests/index/RefineLTE2.java +++ b/checker/tests/index/RefineLTE2.java @@ -14,7 +14,7 @@ public class RefineLTE2 { public void add(int elt) { if (num_values == values.length) { values = null; - // :: error: (unary.increment) + // :: error: [unary.increment] num_values++; return; } diff --git a/checker/tests/index/RefineNeq.java b/checker/tests/index/RefineNeq.java index 3a007aa259c2..1051ec52aec9 100644 --- a/checker/tests/index/RefineNeq.java +++ b/checker/tests/index/RefineNeq.java @@ -5,36 +5,36 @@ public class RefineNeq { int[] arr = {1}; void testLTL(@LTLengthOf("arr") int test) { - // :: error: (assignment) + // :: error: [assignment] @LTLengthOf("arr") int a = Integer.parseInt("1"); int b = 1; if (test != b) { - // :: error: (assignment) + // :: error: [assignment] @LTLengthOf("arr") int e = b; } else { @LTLengthOf("arr") int c = b; } - // :: error: (assignment) + // :: error: [assignment] @LTLengthOf("arr") int d = b; } void testLTEL(@LTEqLengthOf("arr") int test) { - // :: error: (assignment) + // :: error: [assignment] @LTEqLengthOf("arr") int a = Integer.parseInt("1"); int b = 1; if (test != b) { - // :: error: (assignment) + // :: error: [assignment] @LTEqLengthOf("arr") int e = b; } else { @LTEqLengthOf("arr") int c = b; @LTLengthOf("arr") int g = b; } - // :: error: (assignment) + // :: error: [assignment] @LTEqLengthOf("arr") int d = b; } } diff --git a/checker/tests/index/RefineNeqLength.java b/checker/tests/index/RefineNeqLength.java index e360e26c2be2..5f7aa4db5332 100644 --- a/checker/tests/index/RefineNeqLength.java +++ b/checker/tests/index/RefineNeqLength.java @@ -16,7 +16,7 @@ void refineNeqLength(int[] array, @IndexOrHigh("#1") int i) { } // No refinement if (i != array.length - 1) { - // :: error: (argument) + // :: error: [argument] refineNeqLengthMOne(array, i); } } @@ -25,7 +25,7 @@ void refineNeqLengthMOne(int[] array, @IndexFor("#1") int i) { // Refines i < array.length to i < array.length - 1 if (i != array.length - 1) { refineNeqLengthMTwo(array, i); - // :: error: (argument) + // :: error: [argument] refineNeqLengthMThree(array, i); } } @@ -37,7 +37,7 @@ void refineNeqLengthMTwo(int[] array, @NonNegative @LTOMLengthOf("#1") int i) { } // No refinement if (i != array.length - 1) { - // :: error: (argument) + // :: error: [argument] refineNeqLengthMThree(array, i); } } @@ -53,7 +53,7 @@ void refineNeqLengthMTwoNonLiteral( } // No refinement if (i != array.length - c23) { - // :: error: (argument) + // :: error: [argument] refineNeqLengthMThree(array, i); } } @@ -64,7 +64,7 @@ void refineNeqLengthMTwoNonLiteral( if (i != array.length - 3) { return i; } - // :: error: (return) + // :: error: [return] return i; } @@ -75,7 +75,7 @@ void refineNeqLengthMTwoNonLiteral( if (i != str.length() - 3) { return i; } - // :: error: (return) + // :: error: [return] return i; } } diff --git a/checker/tests/index/RefineSubtrahend.java b/checker/tests/index/RefineSubtrahend.java index ded8a7ef890b..3557d0f37f9e 100644 --- a/checker/tests/index/RefineSubtrahend.java +++ b/checker/tests/index/RefineSubtrahend.java @@ -12,7 +12,7 @@ void withConstant(int[] a, @NonNegative int l) { int x = a[l + 10]; } if (a.length - l >= 10) { - // :: error: (array.access.unsafe.high) + // :: error: [array.access.unsafe.high] int x = a[l + 10]; int x1 = a[l + 9]; } @@ -31,9 +31,9 @@ void withVariable(int[] a, @NonNegative int l, @NonNegative int j, @NonNegative } if (a.length - j >= l) { if (k <= j) { - // :: error: (array.access.unsafe.high) + // :: error: [array.access.unsafe.high] int x = a[l + k]; - // :: error: (array.access.unsafe.low) + // :: error: [array.access.unsafe.low] int x1 = a[l + k - 1]; } } diff --git a/checker/tests/index/RefinementEq.java b/checker/tests/index/RefinementEq.java index 48fbbb7f70b4..55383622d0d1 100644 --- a/checker/tests/index/RefinementEq.java +++ b/checker/tests/index/RefinementEq.java @@ -9,21 +9,21 @@ void test_equal(int a, int j, int s) { if (-1 == a) { @GTENegativeOne int b = a; } else { - // :: error: (assignment) + // :: error: [assignment] @GTENegativeOne int c = a; } if (0 == j) { @NonNegative int k = j; } else { - // :: error: (assignment) + // :: error: [assignment] @NonNegative int l = j; } if (1 == s) { @Positive int t = s; } else { - // :: error: (assignment) + // :: error: [assignment] @Positive int u = s; } } diff --git a/checker/tests/index/RefinementGT.java b/checker/tests/index/RefinementGT.java index 967ad440e652..06537426f0a8 100644 --- a/checker/tests/index/RefinementGT.java +++ b/checker/tests/index/RefinementGT.java @@ -6,13 +6,13 @@ public class RefinementGT { void test_forward(int a, int j, int s) { /** forwards greater than */ - // :: error: (assignment) + // :: error: [assignment] @NonNegative int aa = a; if (a > -1) { /** a is NN now */ @NonNegative int b = a; } else { - // :: error: (assignment) + // :: error: [assignment] @NonNegative int c = a; } @@ -20,38 +20,38 @@ void test_forward(int a, int j, int s) { /** j is POS now */ @Positive int k = j; } else { - // :: error: (assignment) + // :: error: [assignment] @Positive int l = j; } if (s > 1) { @Positive int t = s; } else { - // :: error: (assignment) + // :: error: [assignment] @Positive int u = s; } } void test_backwards(int a, int j, int s) { /** backwards greater than */ - // :: error: (assignment) + // :: error: [assignment] @NonNegative int aa = a; if (-1 > a) { - // :: error: (assignment) + // :: error: [assignment] @GTENegativeOne int b = a; } else { @GTENegativeOne int c = a; } if (0 > j) { - // :: error: (assignment) + // :: error: [assignment] @NonNegative int k = j; } else { @NonNegative int l = j; } if (1 > s) { - // :: error: (assignment) + // :: error: [assignment] @Positive int t = s; } else { @Positive int u = s; diff --git a/checker/tests/index/RefinementGTE.java b/checker/tests/index/RefinementGTE.java index 8932b48df55e..5b6ff50b62ef 100644 --- a/checker/tests/index/RefinementGTE.java +++ b/checker/tests/index/RefinementGTE.java @@ -6,43 +6,43 @@ public class RefinementGTE { void test_forward(int a, int j, int s) { /** forwards greater than or equals */ - // :: error: (assignment) + // :: error: [assignment] @GTENegativeOne int aa = a; if (a >= -1) { @GTENegativeOne int b = a; } else { - // :: error: (assignment) + // :: error: [assignment] @GTENegativeOne int c = a; } if (j >= 0) { @NonNegative int k = j; } else { - // :: error: (assignment) + // :: error: [assignment] @NonNegative int l = j; } } void test_backwards(int a, int j, int s) { /** backwards greater than or equal */ - // :: error: (assignment) + // :: error: [assignment] @NonNegative int aa = a; if (-1 >= a) { - // :: error: (assignment) + // :: error: [assignment] @NonNegative int b = a; } else { @NonNegative int c = a; } if (0 >= j) { - // :: error: (assignment) + // :: error: [assignment] @Positive int k = j; } else { @Positive int l = j; } if (1 >= s) { - // :: error: (assignment) + // :: error: [assignment] @Positive int t = s; } else { @Positive int u = s; diff --git a/checker/tests/index/RefinementLT.java b/checker/tests/index/RefinementLT.java index b1a5da5afbc1..91c4172d8b0c 100644 --- a/checker/tests/index/RefinementLT.java +++ b/checker/tests/index/RefinementLT.java @@ -6,50 +6,50 @@ public class RefinementLT { void test_backwards(int a, int j, int s) { /** backwards less than */ - // :: error: (assignment) + // :: error: [assignment] @NonNegative int aa = a; if (-1 < a) { @NonNegative int b = a; } else { - // :: error: (assignment) + // :: error: [assignment] @NonNegative int c = a; } if (0 < j) { @Positive int k = j; } else { - // :: error: (assignment) + // :: error: [assignment] @Positive int l = j; } if (1 < s) { @Positive int t = s; } else { - // :: error: (assignment) + // :: error: [assignment] @Positive int u = s; } } void test_forwards(int a, int j, int s) { /** forwards less than */ - // :: error: (assignment) + // :: error: [assignment] @NonNegative int aa = a; if (a < -1) { - // :: error: (assignment) + // :: error: [assignment] @GTENegativeOne int b = a; } else { @GTENegativeOne int c = a; } if (j < 0) { - // :: error: (assignment) + // :: error: [assignment] @NonNegative int k = j; } else { @NonNegative int l = j; } if (s < 1) { - // :: error: (assignment) + // :: error: [assignment] @Positive int t = s; } else { @Positive int u = s; diff --git a/checker/tests/index/RefinementLTE.java b/checker/tests/index/RefinementLTE.java index 19c1aea5358f..51806e5adc00 100644 --- a/checker/tests/index/RefinementLTE.java +++ b/checker/tests/index/RefinementLTE.java @@ -6,50 +6,50 @@ public class RefinementLTE { void test_backwards(int a, int j, int s) { /** backwards less than or equals */ - // :: error: (assignment) + // :: error: [assignment] @GTENegativeOne int aa = a; if (-1 <= a) { @GTENegativeOne int b = a; } else { - // :: error: (assignment) + // :: error: [assignment] @GTENegativeOne int c = a; } if (0 <= j) { @NonNegative int k = j; } else { - // :: error: (assignment) + // :: error: [assignment] @NonNegative int l = j; } if (1 <= s) { @Positive int t = s; } else { - // :: error: (assignment) + // :: error: [assignment] @Positive int u = s; } } void test_forwards(int a, int j, int s) { /** forwards less than or equal */ - // :: error: (assignment) + // :: error: [assignment] @NonNegative int aa = a; if (a <= -1) { - // :: error: (assignment) + // :: error: [assignment] @NonNegative int b = a; } else { @NonNegative int c = a; } if (j <= 0) { - // :: error: (assignment) + // :: error: [assignment] @Positive int k = j; } else { @Positive int l = j; } if (s <= 1) { - // :: error: (assignment) + // :: error: [assignment] @Positive int t = s; } else { @Positive int u = s; diff --git a/checker/tests/index/RefinementNEq.java b/checker/tests/index/RefinementNEq.java index 0a13772aec6b..c65a304d4879 100644 --- a/checker/tests/index/RefinementNEq.java +++ b/checker/tests/index/RefinementNEq.java @@ -6,24 +6,24 @@ public class RefinementNEq { void test_not_equal(int a, int j, int s) { - // :: error: (assignment) + // :: error: [assignment] @NonNegative int aa = a; if (-1 != a) { - // :: error: (assignment) + // :: error: [assignment] @GTENegativeOne int b = a; } else { @GTENegativeOne int c = a; } if (0 != j) { - // :: error: (assignment) + // :: error: [assignment] @NonNegative int k = j; } else { @NonNegative int l = j; } if (1 != s) { - // :: error: (assignment) + // :: error: [assignment] @Positive int t = s; } else { @Positive int u = s; diff --git a/checker/tests/index/ReflectArray.java b/checker/tests/index/ReflectArray.java index e2ff0e4be721..76f89da313a1 100644 --- a/checker/tests/index/ReflectArray.java +++ b/checker/tests/index/ReflectArray.java @@ -4,7 +4,7 @@ public class ReflectArray { void testNewInstance(int i) { - // :: error: (argument) + // :: error: [argument] Array.newInstance(Object.class, i); if (i >= 0) { Array.newInstance(Object.class, i); @@ -19,7 +19,7 @@ void testFor(Object a) { void testMinLen(Object @MinLen(1) [] a) { Array.get(a, 0); - // :: error: (argument) + // :: error: [argument] Array.get(a, 1); } } diff --git a/checker/tests/index/RegexMatcher.java b/checker/tests/index/RegexMatcher.java index 45078197a72f..27eea254282d 100644 --- a/checker/tests/index/RegexMatcher.java +++ b/checker/tests/index/RegexMatcher.java @@ -16,9 +16,9 @@ static void m(String p, String s) { @NonNegative int i; i = matcher.start(); i = matcher.end(); - // :: error: (assignment) + // :: error: [assignment] i = matcher.start(1); - // :: error: (assignment) + // :: error: [assignment] i = matcher.end(1); } } diff --git a/checker/tests/index/RepeatLTLengthOfWithError.java b/checker/tests/index/RepeatLTLengthOfWithError.java index 3ad3a4752b25..ba16aed0ec85 100644 --- a/checker/tests/index/RepeatLTLengthOfWithError.java +++ b/checker/tests/index/RepeatLTLengthOfWithError.java @@ -58,7 +58,7 @@ public boolean client4() { @EnsuresLTLengthOf(value = "v1", targetValue = "value1", offset = "3") @EnsuresLTLengthOf(value = "v2", targetValue = "value2", offset = "2") @EnsuresLTLengthOf(value = "v3", targetValue = "value3", offset = "1") - // :: error: (contracts.postcondition) + // :: error: [contracts.postcondition] public void withpostconditionsfunc1() { v1 = value1.length() - 3; // condition not satisfied here v2 = value2.length() - 3; @@ -72,7 +72,7 @@ public boolean withcondpostconditionsfunc2() { v1 = value1.length() - 3; // condition not satisfied here v2 = value2.length() - 3; v3 = value3.length() - 3; - // :: error: (contracts.conditional.postcondition) + // :: error: [contracts.conditional.postcondition] return true; } @@ -81,7 +81,7 @@ public boolean withcondpostconditionsfunc2() { @EnsuresLTLengthOf(value = "v2", targetValue = "value2", offset = "2") }) @EnsuresLTLengthOf(value = "v3", targetValue = "value3", offset = "1") - // :: error: (contracts.postcondition) + // :: error: [contracts.postcondition] public void withpostconditionfunc1() { v1 = value1.length() - 3; // condition not satisfied here v2 = value2.length() - 3; @@ -97,7 +97,7 @@ public boolean withcondpostconditionfunc2() { v1 = value1.length() - 3; // condition not satisfied here v2 = value2.length() - 3; v3 = value3.length() - 3; - // :: error: (contracts.conditional.postcondition) + // :: error: [contracts.conditional.postcondition] return true; } } diff --git a/checker/tests/index/SLSubtyping.java b/checker/tests/index/SLSubtyping.java index efba98559d58..75e0d19d674e 100644 --- a/checker/tests/index/SLSubtyping.java +++ b/checker/tests/index/SLSubtyping.java @@ -8,11 +8,11 @@ public class SLSubtyping { void subtype(int @SameLen("#2") [] a, int[] b) { int @SameLen({"a", "b"}) [] c = a; - // :: error: (assignment) + // :: error: [assignment] int @SameLen("c") [] q = {1, 2}; int @SameLen("c") [] d = q; - // :: error: (assignment) + // :: error: [assignment] int @SameLen("f") [] e = a; } diff --git a/checker/tests/index/SameLenFormalParameter2.java b/checker/tests/index/SameLenFormalParameter2.java index 46a1012e4cd0..87f9e42d2509 100644 --- a/checker/tests/index/SameLenFormalParameter2.java +++ b/checker/tests/index/SameLenFormalParameter2.java @@ -5,7 +5,7 @@ public class SameLenFormalParameter2 { void lib(Object @SameLen({"#1", "#2"}) [] valsArg, int @SameLen({"#1", "#2"}) [] modsArg) {} void client(Object[] myvals, int[] mymods) { - // :: error: (argument) + // :: error: [argument] lib(myvals, mymods); } } diff --git a/checker/tests/index/SameLenIrrelevant.java b/checker/tests/index/SameLenIrrelevant.java index c59ceefe46af..9531d5100aa6 100644 --- a/checker/tests/index/SameLenIrrelevant.java +++ b/checker/tests/index/SameLenIrrelevant.java @@ -8,17 +8,17 @@ import org.checkerframework.checker.index.qual.SameLen; public class SameLenIrrelevant { - // NO :: error: (anno.on.irrelevant) + // NO :: error: [anno.on.irrelevant] public void test(@SameLen("#2") int x, int y) { // do nothing } - // NO :: error: (anno.on.irrelevant) + // NO :: error: [anno.on.irrelevant] public void test(@SameLen("#2") double x, double y) { // do nothing } - // NO :: error: (anno.on.irrelevant) + // NO :: error: [anno.on.irrelevant] public void test(@SameLen("#2") char x, char y) { // do nothing } diff --git a/checker/tests/index/SameLenLUBStrangeness.java b/checker/tests/index/SameLenLUBStrangeness.java index b90ca09701d4..077bde855af1 100644 --- a/checker/tests/index/SameLenLUBStrangeness.java +++ b/checker/tests/index/SameLenLUBStrangeness.java @@ -6,7 +6,7 @@ void test(int[] a, boolean cond) { if (cond) { b = a; } - // :: error: (assignment) + // :: error: [assignment] int @SameLen({"a", "b"}) [] c = a; } } diff --git a/checker/tests/index/SearchIndexTests.java b/checker/tests/index/SearchIndexTests.java index 9b7d22fd5d3d..e0c488f36afe 100644 --- a/checker/tests/index/SearchIndexTests.java +++ b/checker/tests/index/SearchIndexTests.java @@ -5,7 +5,7 @@ public class SearchIndexTests { public void test(short[] a, short instant) { int i = Arrays.binarySearch(a, instant); @SearchIndexFor("a") int z = i; - // :: error: (assignment) + // :: error: [assignment] @SearchIndexFor("a") int y = 7; @LTLengthOf("a") int x = i; } @@ -44,11 +44,11 @@ void test5(int[] a, @SearchIndexFor("#1") int xyz) { void subtyping1( @SearchIndexFor({"#3", "#4"}) int x, @NegativeIndexFor("#3") int y, int[] a, int[] b) { - // :: error: (assignment) + // :: error: [assignment] @SearchIndexFor({"a", "b"}) int z = y; @SearchIndexFor("a") int w = y; @SearchIndexFor("b") int p = x; - // :: error: (assignment) + // :: error: [assignment] @NegativeIndexFor({"a", "b"}) int q = x; } } diff --git a/checker/tests/index/ShiftRight.java b/checker/tests/index/ShiftRight.java index 7cc510931c09..ac4412738520 100644 --- a/checker/tests/index/ShiftRight.java +++ b/checker/tests/index/ShiftRight.java @@ -15,13 +15,13 @@ void indexOrHigh(Object[] a, @IndexOrHigh("#1") int i) { @IndexOrHigh("a") int o = i >> 2; @IndexOrHigh("a") int p = i >>> 2; // Not true if a.length == 0 - // :: error: (assignment) + // :: error: [assignment] @IndexFor("a") int q = i >> 2; } void negative(Object[] a, @LTLengthOf(value = "#1", offset = "100") int i) { // Not true for some negative i - // :: error: (assignment) + // :: error: [assignment] @LTLengthOf(value = "#1", offset = "100") int q = i >> 2; } } diff --git a/checker/tests/index/ShiftRightAverage.java b/checker/tests/index/ShiftRightAverage.java index 9b945bcb113b..7206fdeb0eb9 100644 --- a/checker/tests/index/ShiftRightAverage.java +++ b/checker/tests/index/ShiftRightAverage.java @@ -10,7 +10,7 @@ public static void m(Object[] a, @IndexFor("#1") int i, @IndexFor("#1") int j) { } public static void m2(int[] a, @IndexFor("#1") int i, @IndexFor("#1") int j) { - // :: error: (assignment) + // :: error: [assignment] @LTLengthOf("a") int h = ((i + 1) + j) >> 1; } } diff --git a/checker/tests/index/SimpleTransferAdd.java b/checker/tests/index/SimpleTransferAdd.java index 25a90dd1afff..acfbfa95da7e 100644 --- a/checker/tests/index/SimpleTransferAdd.java +++ b/checker/tests/index/SimpleTransferAdd.java @@ -4,12 +4,12 @@ public class SimpleTransferAdd { void test() { int bs = -1; - // :: error: (assignment) + // :: error: [assignment] @NonNegative int es = bs; // @NonNegative int ds = 2 + bs; int ds = 0; - // :: error: (assignment) + // :: error: [assignment] @Positive int cs = ds++; @Positive int fs = ds; } diff --git a/checker/tests/index/SimpleTransferSub.java b/checker/tests/index/SimpleTransferSub.java index 94c8c77db42d..1c1c4c9c94da 100644 --- a/checker/tests/index/SimpleTransferSub.java +++ b/checker/tests/index/SimpleTransferSub.java @@ -4,7 +4,7 @@ public class SimpleTransferSub { void test() { // shows a bug in the Checker Framework. I don't think we can get around this bit... int bs = 0; - // :: error: (assignment) + // :: error: [assignment] @Positive int ds = bs--; } } diff --git a/checker/tests/index/SkipBufferedReader.java b/checker/tests/index/SkipBufferedReader.java index d083903c9921..765a9d37b91b 100644 --- a/checker/tests/index/SkipBufferedReader.java +++ b/checker/tests/index/SkipBufferedReader.java @@ -6,7 +6,7 @@ public class SkipBufferedReader { public static void method() throws IOException { BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in)); - // :: error: (argument) + // :: error: [argument] bufferedReader.skip(-1); bufferedReader.skip(1); diff --git a/checker/tests/index/StartsEndsWith.java b/checker/tests/index/StartsEndsWith.java index d0971d178769..e7a2df591da5 100644 --- a/checker/tests/index/StartsEndsWith.java +++ b/checker/tests/index/StartsEndsWith.java @@ -11,7 +11,7 @@ public class StartsEndsWith { } String expectedError(String methodName) { - // :: error: (argument) + // :: error: [argument] return methodName.substring(prefix.length()); } @@ -19,14 +19,14 @@ String startsWithTest(String methodName) { if (methodName.startsWith(prefix)) { return methodName.substring(prefix.length()); } else { - // :: error: (argument) + // :: error: [argument] return methodName.substring(prefix.length()); } } String notStartsWithTest(String methodName) { if (!methodName.startsWith(prefix)) { - // :: error: (argument) + // :: error: [argument] return methodName.substring(prefix.length()); } else { String result = methodName.substring(prefix.length()); @@ -38,14 +38,14 @@ String endsWithTest(String methodName) { if (methodName.endsWith(prefix)) { return methodName.substring(prefix.length()); } else { - // :: error: (argument) + // :: error: [argument] return methodName.substring(prefix.length()); } } String notEndsWithTest(String methodName) { if (!methodName.endsWith(prefix)) { - // :: error: (argument) + // :: error: [argument] return methodName.substring(prefix.length()); } else { String result = methodName.substring(prefix.length()); @@ -65,7 +65,7 @@ String removeSuffix(String methodName, String suffix) { if (methodName.endsWith(suffix)) { // TODO: Refinement establishes suffix.length() <= methodName.length(), but // the checker cannot (yet) verify the complex arithmetic in substring(0, length - length). - // :: error: (argument) + // :: error: [argument] String result = methodName.substring(0, methodName.length() - suffix.length()); return result; } else { diff --git a/checker/tests/index/StringBuilderOffset.java b/checker/tests/index/StringBuilderOffset.java index c2354c961877..8f33b1ca3ec3 100644 --- a/checker/tests/index/StringBuilderOffset.java +++ b/checker/tests/index/StringBuilderOffset.java @@ -3,7 +3,7 @@ public static void OffsetStringBuilder() { StringBuilder stringBuilder = new StringBuilder(); char[] chars = new char[10]; - // :: error: (argument) + // :: error: [argument] stringBuilder.append(chars, 5, 7); stringBuilder.append(chars, 5, 4); diff --git a/checker/tests/index/StringIndexOf.java b/checker/tests/index/StringIndexOf.java index abb2d24cd975..6a7f5fd4fad8 100644 --- a/checker/tests/index/StringIndexOf.java +++ b/checker/tests/index/StringIndexOf.java @@ -12,7 +12,7 @@ public static String remove(String l, String s) { public static String nocheck(String l, String s) { int i = l.indexOf(s); - // :: error: (argument) + // :: error: [argument] return l.substring(0, i) + l.substring(i + s.length()); } @@ -29,7 +29,7 @@ public static String stringLiteral(String l) { if (i != -1) { return l.substring(0, i) + l.substring(i + "constant".length()); } - // :: error: (argument) + // :: error: [argument] return l.substring(0, i) + l.substring(i + "constant".length()); } @@ -38,7 +38,7 @@ public static char character(String l, char c) { if (i > -1) { return l.charAt(i); } - // :: error: (argument) + // :: error: [argument] return l.charAt(i); } } diff --git a/checker/tests/index/StringLength.java b/checker/tests/index/StringLength.java index 34f239db2cd7..97685d6b2292 100644 --- a/checker/tests/index/StringLength.java +++ b/checker/tests/index/StringLength.java @@ -13,19 +13,19 @@ public class StringLength { void testMinLenSubtractPositive(@MinLen(10) String s) { @Positive int i1 = s.length() - 9; @NonNegative int i0 = s.length() - 10; - // :: error: (assignment) + // :: error: [assignment] @NonNegative int im1 = s.length() - 11; } void testNewArraySameLen(String s) { int @SameLen("s") [] array = new int[s.length()]; - // :: error: (assignment) + // :: error: [assignment] int @SameLen("s") [] array1 = new int[s.length() + 1]; } void testStringAssignSameLen(String s, String r) { @SameLen("s") String t = s; - // :: error: (assignment) + // :: error: [assignment] @SameLen("s") String tN = r; } @@ -48,7 +48,7 @@ void testOffsetRemoval( @LTLengthOf(value = "#2") int j, int k) { @LTLengthOf("s") int ij = i + j; - // :: error: (assignment) + // :: error: [assignment] @LTLengthOf("s") int ik = i + k; } @@ -68,7 +68,7 @@ void testRandomMultiply(@MinLen(1) String s, Random r) { void testNotEqualLength(String s, @IndexOrHigh("#1") int i, @IndexOrHigh("#1") int j) { if (i != s.length()) { @IndexFor("s") int in = i; - // :: error: (assignment) + // :: error: [assignment] @IndexFor("s") int jn = j; } } diff --git a/checker/tests/index/StringMethods.java b/checker/tests/index/StringMethods.java index 3ab1a04548ee..c175cf874982 100644 --- a/checker/tests/index/StringMethods.java +++ b/checker/tests/index/StringMethods.java @@ -3,9 +3,9 @@ public class StringMethods { void testCharAt(String s, int i) { - // :: error: (argument) + // :: error: [argument] s.charAt(i); - // :: error: (argument) + // :: error: [argument] s.codePointAt(i); if (i >= 0 && i < s.length()) { @@ -15,7 +15,7 @@ void testCharAt(String s, int i) { } void testCodePointBefore(String s) { - // :: error: (argument) + // :: error: [argument] s.codePointBefore(0); if (s.length() > 0) { @@ -29,9 +29,9 @@ void testSubstring(String s) { s.substring(s.length()); s.substring(s.length(), s.length()); s.substring(0, s.length()); - // :: error: (argument) + // :: error: [argument] s.substring(1); - // :: error: (argument) + // :: error: [argument] s.substring(0, 1); } diff --git a/checker/tests/index/StringOffsetTest.java b/checker/tests/index/StringOffsetTest.java index bff578061427..dcd6434cba70 100644 --- a/checker/tests/index/StringOffsetTest.java +++ b/checker/tests/index/StringOffsetTest.java @@ -2,7 +2,7 @@ public class StringOffsetTest { public static void OffsetString() { char[] chars = new char[10]; - // :: error: (argument) + // :: error: [argument] String string2 = new String(chars, 5, 7); String string3 = new String(chars, 5, 4); diff --git a/checker/tests/index/TransferAdd.java b/checker/tests/index/TransferAdd.java index cd3a8d8c4106..bddbc0984f39 100644 --- a/checker/tests/index/TransferAdd.java +++ b/checker/tests/index/TransferAdd.java @@ -18,7 +18,7 @@ void test() { @GTENegativeOne int d = a + 0; @GTENegativeOne int e = 0 + a; - // :: error: (assignment) + // :: error: [assignment] @Positive int f = a + 1; @NonNegative int g = b + 0; @@ -31,19 +31,19 @@ void test() { // adding values @Positive int k = i + j; - // :: error: (assignment) + // :: error: [assignment] @Positive int l = b + c; - // :: error: (assignment) + // :: error: [assignment] @Positive int m = d + c; - // :: error: (assignment) + // :: error: [assignment] @Positive int n = d + e; @Positive int o = h + g; - // :: error: (assignment) + // :: error: [assignment] @Positive int p = h + d; @NonNegative int q = b + c; - // :: error: (assignment) + // :: error: [assignment] @NonNegative int r = q + d; @NonNegative int s = k + d; @@ -51,7 +51,7 @@ void test() { // increments - // :: error: (assignment) + // :: error: [assignment] @Positive int u = b++; @Positive int u1 = b; @@ -66,19 +66,19 @@ void test() { @NonNegative int w1 = n1p1; - // :: error: (assignment) + // :: error: [assignment] @Positive int w2 = n1p1; - // :: error: (assignment) + // :: error: [assignment] @Positive int w3 = n1p1++; - // :: error: (assignment) + // :: error: [assignment] @NonNegative int x = n1p2++; @NonNegative int x1 = n1p2; - // :: error: (assignment) + // :: error: [assignment] @Positive int y = ++d; - // :: error: (assignment) + // :: error: [assignment] @Positive int z = e++; } } diff --git a/checker/tests/index/TransferDivide.java b/checker/tests/index/TransferDivide.java index b52ab902ac73..ef580cbfeaa5 100644 --- a/checker/tests/index/TransferDivide.java +++ b/checker/tests/index/TransferDivide.java @@ -26,28 +26,28 @@ void test() { /** pos / pos -> nn */ @NonNegative int l = d / c; @NonNegative int m = c / d; - // :: error: (assignment) + // :: error: [assignment] @Positive int n = c / d; /** nn / pos -> nn */ @NonNegative int o = b / c; - // :: error: (assignment) + // :: error: [assignment] @Positive int p = b / d; /** pos / nn -> nn */ @NonNegative int q = d / l; - // :: error: (assignment) + // :: error: [assignment] @Positive int r = c / l; /** nn / nn -> nn */ @NonNegative int s = b / q; - // :: error: (assignment) + // :: error: [assignment] @Positive int t = b / q; /** n1p / pos -> n1p */ @GTENegativeOne int u = a / d; @GTENegativeOne int v = a / c; - // :: error: (assignment) + // :: error: [assignment] @NonNegative int w = a / c; /** n1p / nn -> n1p */ diff --git a/checker/tests/index/TransferSub.java b/checker/tests/index/TransferSub.java index 216ed893f0ac..517a9a13b8cf 100644 --- a/checker/tests/index/TransferSub.java +++ b/checker/tests/index/TransferSub.java @@ -9,30 +9,30 @@ void test() { int a = 1; @NonNegative int b = a - 1; - // :: error: (assignment) + // :: error: [assignment] @Positive int c = a - 1; @GTENegativeOne int d = a - 2; - // :: error: (assignment) + // :: error: [assignment] @NonNegative int e = a - 2; @GTENegativeOne int f = b - 1; - // :: error: (assignment) + // :: error: [assignment] @NonNegative int g = b - 1; - // :: error: (assignment) + // :: error: [assignment] @GTENegativeOne int h = f - 1; @GTENegativeOne int i = f - 0; @NonNegative int j = b - 0; @Positive int k = a - 0; - // :: error: (assignment) + // :: error: [assignment] @Positive int l = j - 0; - // :: error: (assignment) + // :: error: [assignment] @NonNegative int m = i - 0; - // :: error: (assignment) + // :: error: [assignment] @Positive int n = a - k; // this would be an error if the values of b and j (both zero) weren't known at compile time @NonNegative int o = b - j; @@ -42,34 +42,34 @@ void test() { // decrements - // :: error: (unary.decrement) :: error: (assignment) + // :: error: [unary.decrement] :: error: [assignment] @Positive int q = --k; // k = 0 - // :: error: (unary.decrement) + // :: error: [unary.decrement] @NonNegative int r = k--; // after this k = -1 int k1 = 0; @NonNegative int s = k1--; - // :: error: (assignment) + // :: error: [assignment] @NonNegative int s1 = k1; // transferred to SimpleTransferSub.java // this section is failing due to CF bug // int k2 = 0; - // // :: error: (assignment) + // // :: error: [assignment] // @Positive int s2 = k2--; k1 = 1; @NonNegative int t = --k1; k1 = 1; - // :: error: (assignment) + // :: error: [assignment] @Positive int t1 = --k1; int u1 = -1; @GTENegativeOne int x = u1--; - // :: error: (assignment) + // :: error: [assignment] @GTENegativeOne int x1 = u1; } } diff --git a/checker/tests/index/TransferTimes.java b/checker/tests/index/TransferTimes.java index a368a359d107..2b0ef03e1f08 100644 --- a/checker/tests/index/TransferTimes.java +++ b/checker/tests/index/TransferTimes.java @@ -8,14 +8,14 @@ void test() { @Positive int b = a * 1; @Positive int c = 1 * a; @NonNegative int d = 0 * a; - // :: error: (assignment) + // :: error: [assignment] @NonNegative int e = -1 * a; int g = -1; @NonNegative int h = g * 0; - // :: error: (assignment) + // :: error: [assignment] @Positive int i = g * 0; - // :: error: (assignment) + // :: error: [assignment] @Positive int j = g * a; int k = 0; diff --git a/checker/tests/index/UBLiteralFlow.java b/checker/tests/index/UBLiteralFlow.java index 61dc8a6f8477..ce7a0d4fcc93 100644 --- a/checker/tests/index/UBLiteralFlow.java +++ b/checker/tests/index/UBLiteralFlow.java @@ -34,7 +34,7 @@ public class UBLiteralFlow { } else { result = lineStart; } - // :: error: (return) + // :: error: [return] return result; } @@ -124,12 +124,12 @@ public class UBLiteralFlow { */ private static @LTLengthOf(value = "#1", offset = "1") int lineStartIndex3(String s, int start) { if (s.length() == 0) { - // :: error: (return) + // :: error: [return] return -1; } if (start == 0) { // It doesn't make sense to call this routine with 0, but return 0 anyway. - // :: error: (return) + // :: error: [return] return 0; } if (start > s.length()) { @@ -146,7 +146,7 @@ public class UBLiteralFlow { if (lineStart >= s.length()) { return -1; } else { - // :: error: (return) + // :: error: [return] return lineStart; } } diff --git a/checker/tests/index/UBPoly.java b/checker/tests/index/UBPoly.java index c16b4f74304d..6228ace76f7f 100644 --- a/checker/tests/index/UBPoly.java +++ b/checker/tests/index/UBPoly.java @@ -11,7 +11,7 @@ public static void main(String[] args) { } public static void poly(char[] a, @NonNegative @PolyUpperBound int i) { - // :: error: (argument) + // :: error: [argument] access(a, i); } diff --git a/checker/tests/index/UBSubtyping.java b/checker/tests/index/UBSubtyping.java index aad087d0567b..377cdcec8c12 100644 --- a/checker/tests/index/UBSubtyping.java +++ b/checker/tests/index/UBSubtyping.java @@ -8,19 +8,19 @@ public class UBSubtyping { int[] arr3 = {1}; void test(@LTEqLengthOf({"arr", "arr2", "arr3"}) int test) { - // :: error: (assignment) + // :: error: [assignment] @LTEqLengthOf({"arr"}) int a = 1; - // :: error: (assignment) + // :: error: [assignment] @LTLengthOf({"arr"}) int a1 = 1; - // :: error: (assignment) + // :: error: [assignment] @LTLengthOf({"arr"}) int b = a; @UpperBoundUnknown int d = a; - // :: error: (assignment) + // :: error: [assignment] @LTLengthOf({"arr2"}) int g = a; - // :: error: (assignment) + // :: error: [assignment] @LTEqLengthOf({"arr", "arr2", "arr3"}) int h = 2; @LTEqLengthOf({"arr", "arr2"}) int h2 = test; diff --git a/checker/tests/index/UncheckedMinLen.java b/checker/tests/index/UncheckedMinLen.java index 944d161664ff..01fc3afcf097 100644 --- a/checker/tests/index/UncheckedMinLen.java +++ b/checker/tests/index/UncheckedMinLen.java @@ -7,19 +7,19 @@ public class UncheckedMinLen { void addToNonNegative(@NonNegative int l, Object v) { - // :: error: (assignment) + // :: error: [assignment] Object @MinLen(100) [] o = new Object[l + 1]; o[99] = v; } void addToPositive(@Positive int l, Object v) { - // :: error: (assignment) + // :: error: [assignment] Object @MinLen(100) [] o = new Object[l + 1]; o[99] = v; } void addToUnboundedIntRange(@IntRange(from = 0) int l, Object v) { - // :: error: (assignment) + // :: error: [assignment] Object @MinLen(100) [] o = new Object[l + 1]; o[99] = v; } @@ -27,18 +27,18 @@ void addToUnboundedIntRange(@IntRange(from = 0) int l, Object v) { // Similar code that correctly gives warnings void addToPositiveOK(@NonNegative int l, Object v) { Object[] o = new Object[l + 1]; - // :: error: (array.access.unsafe.high.constant) + // :: error: [array.access.unsafe.high.constant] o[99] = v; } void addToBoundedIntRangeOK(@IntRange(from = 0, to = 1) int l, Object v) { - // :: error: (assignment) + // :: error: [assignment] Object @MinLen(100) [] o = new Object[l + 1]; o[99] = v; } void subtractFromPositiveOK(@Positive int l, Object v) { - // :: error: (assignment) + // :: error: [assignment] Object @MinLen(100) [] o = new Object[l - 1]; o[99] = v; } diff --git a/checker/tests/index/ViewpointAdaptTest.java b/checker/tests/index/ViewpointAdaptTest.java index c3440ea79362..96b2b93438aa 100644 --- a/checker/tests/index/ViewpointAdaptTest.java +++ b/checker/tests/index/ViewpointAdaptTest.java @@ -7,10 +7,10 @@ public class ViewpointAdaptTest { void ListGet( @LTLengthOf("list") int index, @LTEqLengthOf("list") int notIndex, List list) { - // :: error: (argument) + // :: error: [argument] list.get(index); - // :: error: (argument) + // :: error: [argument] list.get(notIndex); } } diff --git a/checker/tests/index/ZeroMinLen.java b/checker/tests/index/ZeroMinLen.java index d89255eb18ab..0342a02f72ca 100644 --- a/checker/tests/index/ZeroMinLen.java +++ b/checker/tests/index/ZeroMinLen.java @@ -12,7 +12,7 @@ public class ZeroMinLen { void test() { current_index = 0; - // :: error: (assignment) + // :: error: [assignment] current_index2 = 0; } } diff --git a/checker/tests/initialization/CastInit.java b/checker/tests/initialization/CastInit.java index 15587ba8802e..dbe70d88df5f 100644 --- a/checker/tests/initialization/CastInit.java +++ b/checker/tests/initialization/CastInit.java @@ -5,7 +5,7 @@ public class CastInit { public CastInit() { @UnknownInitialization CastInit t1 = (@UnknownInitialization CastInit) this; - // :: warning: (cast.unsafe) + // :: warning: [cast.unsafe] @Initialized CastInit t2 = (@Initialized CastInit) this; } } diff --git a/checker/tests/initialization/Commitment.java b/checker/tests/initialization/Commitment.java index 62bc87993437..57ad2a9f1067 100644 --- a/checker/tests/initialization/Commitment.java +++ b/checker/tests/initialization/Commitment.java @@ -8,28 +8,28 @@ public class Commitment { @NonNull String t; - // :: error: (initialization.field.type) + // :: error: [initialization.field.type] @NonNull @UnderInitialization String a; - // :: error: (initialization.field.type) + // :: error: [initialization.field.type] @Initialized String b; @UnknownInitialization @Nullable String c; - // :: error: (initialization.constructor.return.type) + // :: error: [initialization.constructor.return.type] public @UnderInitialization Commitment(int i) { a = ""; t = ""; b = ""; } - // :: error: (initialization.constructor.return.type) + // :: error: [initialization.constructor.return.type] public @Initialized Commitment(int i, int j) { a = ""; t = ""; b = ""; } - // :: error: (initialization.constructor.return.type) - // :: error: (nullness.on.constructor) + // :: error: [initialization.constructor.return.type] + // :: error: [nullness.on.constructor] public @Initialized @NonNull Commitment(boolean i) { a = ""; t = ""; @@ -37,16 +37,16 @@ public class Commitment { } public - // :: error: (nullness.on.constructor) + // :: error: [nullness.on.constructor] @Nullable Commitment(char i) { a = ""; t = ""; b = ""; } - // :: error: (initialization.fields.uninitialized) + // :: error: [initialization.fields.uninitialized] public Commitment() { - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] t.toLowerCase(); t = ""; @@ -55,23 +55,23 @@ public Commitment() { @UnknownInitialization @NonNull Commitment c1 = this; - // :: error: (assignment) + // :: error: [assignment] @Initialized @NonNull Commitment c2 = this; } - // :: error: (initialization.fields.uninitialized) + // :: error: [initialization.fields.uninitialized] public Commitment(@UnknownInitialization Commitment arg) { t = ""; - // :: error: (argument) + // :: error: [argument] @UnderInitialization Commitment t = new Commitment(this, 1); - // :: error: (assignment) + // :: error: [assignment] @Initialized Commitment t1 = new Commitment(this); @UnderInitialization Commitment t2 = new Commitment(this); } - // :: error: (initialization.fields.uninitialized) + // :: error: [initialization.fields.uninitialized] public Commitment(Commitment arg, int i) {} } diff --git a/checker/tests/initialization/Commitment2.java b/checker/tests/initialization/Commitment2.java index 1e7a06872bb3..bf14e5219918 100644 --- a/checker/tests/initialization/Commitment2.java +++ b/checker/tests/initialization/Commitment2.java @@ -4,7 +4,7 @@ public class Commitment2 { - // :: error: (assignment) + // :: error: [assignment] Commitment2 g = create(); Commitment2 h; @@ -14,7 +14,7 @@ public class Commitment2 { @NotOnlyInitialized Commitment2 f; public void test(@UnderInitialization Commitment2 c) { - // :: error: (initialization.field.write.initialized) + // :: error: [initialization.field.write.initialized] f = c; } @@ -22,12 +22,12 @@ public void test(@UnderInitialization Commitment2 c) { return new Commitment2(); } - // :: error: (initialization.fields.uninitialized) + // :: error: [initialization.fields.uninitialized] public Commitment2() {} - // :: error: (initialization.fields.uninitialized) + // :: error: [initialization.fields.uninitialized] public Commitment2(@UnderInitialization Commitment2 likeAnEagle) { - // :: error: (assignment) + // :: error: [assignment] h = likeAnEagle; c = likeAnEagle; diff --git a/checker/tests/initialization/CommitmentFlow.java b/checker/tests/initialization/CommitmentFlow.java index e1bc4157ba7e..1d69d024ff9e 100644 --- a/checker/tests/initialization/CommitmentFlow.java +++ b/checker/tests/initialization/CommitmentFlow.java @@ -15,7 +15,7 @@ void foo( CommitmentFlow local = null; local = mystery; - // :: error: (method.invocation) + // :: error: [method.invocation] local.hashCode(); local = triedAndTrue; diff --git a/checker/tests/initialization/FieldSuppressWarnings.java b/checker/tests/initialization/FieldSuppressWarnings.java index 38b5498f535c..fb5942e3ce40 100644 --- a/checker/tests/initialization/FieldSuppressWarnings.java +++ b/checker/tests/initialization/FieldSuppressWarnings.java @@ -1,7 +1,7 @@ public class FieldSuppressWarnings { static class FieldSuppressWarnings1 { - // :: error: (initialization.field.uninitialized) + // :: error: [initialization.field.uninitialized] private Object notInitialized; } diff --git a/checker/tests/initialization/FlowFbc.java b/checker/tests/initialization/FlowFbc.java index eab3672e2a84..0d382917101b 100644 --- a/checker/tests/initialization/FlowFbc.java +++ b/checker/tests/initialization/FlowFbc.java @@ -9,15 +9,15 @@ public class FlowFbc { @NotOnlyInitialized @NonNull String g; public FlowFbc(String arg) { - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] f.toLowerCase(); - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] g.toLowerCase(); f = arg; g = arg; foo(); f.toLowerCase(); - // :: error: (method.invocation) + // :: error: [method.invocation] g.toLowerCase(); f = arg; } diff --git a/checker/tests/initialization/Issue556a.java b/checker/tests/initialization/Issue556a.java index 8321eb067863..40a4585aa052 100644 --- a/checker/tests/initialization/Issue556a.java +++ b/checker/tests/initialization/Issue556a.java @@ -11,7 +11,7 @@ public class Issue556a { private static final Object OBJ = new Object(); private Issue556a() { - // :: error: (assignment) + // :: error: [assignment] @NonNull Object o = OBJ; } } diff --git a/checker/tests/initialization/Issue556b.java b/checker/tests/initialization/Issue556b.java index 418082f58023..8e355a67f606 100644 --- a/checker/tests/initialization/Issue556b.java +++ b/checker/tests/initialization/Issue556b.java @@ -36,7 +36,7 @@ private Child() { // This call should not be legal, because at the time that the call occurs, the static // initializers of Child have not yet finished executing and therefore CHILD and OBJ are // not necessarily initialized and are not necessarily non-null. - // :: error: (method.invocation) + // :: error: [method.invocation] super(OBJ); } } @@ -54,7 +54,7 @@ private Child2() { // This call should not be legal, because at the time that the call occurs, the static // initializers of Child have not yet finished executing and therefore CHILD and OBJ are // not necessarily initialized and are not necessarily non-null. - // :: error: (method.invocation) + // :: error: [method.invocation] super(OBJ); } } diff --git a/checker/tests/initialization/Issue574.java b/checker/tests/initialization/Issue574.java index e002324e78dc..de31e0a21319 100644 --- a/checker/tests/initialization/Issue574.java +++ b/checker/tests/initialization/Issue574.java @@ -35,9 +35,9 @@ void testLubOfClasses(boolean flag) { @UnderInitialization(Number.class) Object l5 = flag ? o4 : o5; @UnderInitialization(Number.class) Object l6 = flag ? o4 : o6; - // :: error: (assignment) + // :: error: [assignment] @UnderInitialization(Character.class) Object l7 = flag ? o1 : o2; - // :: error: (assignment) + // :: error: [assignment] @UnderInitialization(Integer.class) Object l8 = flag ? o4 : o5; } @@ -47,7 +47,7 @@ void testLubOfClassesAndInterfaces(boolean flag) { @UnderInitialization(Object.class) Object l2 = flag ? o1 : i1; @UnderInitialization(Object.class) Object l3 = flag ? o1 : o3; - // :: error: (assignment) + // :: error: [assignment] @UnderInitialization(Character.class) Object l4 = flag ? o1 : i1; } } diff --git a/checker/tests/initialization/Issue905.java b/checker/tests/initialization/Issue905.java index aacafe89f2c7..54d44d7d9dcc 100644 --- a/checker/tests/initialization/Issue905.java +++ b/checker/tests/initialization/Issue905.java @@ -8,7 +8,7 @@ public class Issue905 { Issue905() { // this should be @UnderInitialization(Object.class), so this call should be forbidden. - // :: error: (method.invocation) + // :: error: [method.invocation] baz(); mBar = ""; } diff --git a/checker/tests/initialization/NotOnlyInitializedTest.java b/checker/tests/initialization/NotOnlyInitializedTest.java index 9ac57f7b9fea..4db5850a8dcf 100644 --- a/checker/tests/initialization/NotOnlyInitializedTest.java +++ b/checker/tests/initialization/NotOnlyInitializedTest.java @@ -14,7 +14,7 @@ public NotOnlyInitializedTest() { public NotOnlyInitializedTest(char i) { // we can store something that is under initialization (like this) in f, but not in g f = this; - // :: error: (assignment) + // :: error: [assignment] g = this; } @@ -26,9 +26,9 @@ static void testDeref(NotOnlyInitializedTest o) { static void testDeref2(@UnderInitialization NotOnlyInitializedTest o) { // o is not fully iniatlized, so we cannot dereference its fields - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] o.f.toString(); - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] o.g.toString(); } } diff --git a/checker/tests/initialization/ReceiverSuperInvocation.java b/checker/tests/initialization/ReceiverSuperInvocation.java index d744d474ffe7..64112e5eecd9 100644 --- a/checker/tests/initialization/ReceiverSuperInvocation.java +++ b/checker/tests/initialization/ReceiverSuperInvocation.java @@ -10,7 +10,7 @@ void foo(@UnderInitialization(ReceiverSuperInvocation.class) ReceiverSuperInvoca class ReceiverSuperInvocationSubclass extends ReceiverSuperInvocation { @Override void foo(@UnderInitialization(Object.class) ReceiverSuperInvocationSubclass this) { - // :: error: (method.invocation) + // :: error: [method.invocation] super.foo(); } } diff --git a/checker/tests/initialization/SimpleFbc.java b/checker/tests/initialization/SimpleFbc.java index eca5860dfe85..acdf1db9d2b9 100644 --- a/checker/tests/initialization/SimpleFbc.java +++ b/checker/tests/initialization/SimpleFbc.java @@ -15,19 +15,19 @@ int pure() { return 1; } - // :: error: (initialization.fields.uninitialized) + // :: error: [initialization.fields.uninitialized] public SimpleFbc(String arg) {} void test() { @NonNull String s = "234"; - // :: error: (assignment) + // :: error: [assignment] s = null; System.out.println(s); } void test2(@UnknownInitialization @NonNull SimpleFbc t) { - // :: error: (assignment) + // :: error: [assignment] @NonNull SimpleFbc a = t.f; } @@ -35,17 +35,17 @@ void test2(@UnknownInitialization @NonNull SimpleFbc t) { void test3(@UnknownInitialization @NonNull SimpleFbc t) { @Initialized @Nullable SimpleFbc a = t.f; - // :: error: (assignment) + // :: error: [assignment] @Initialized @Nullable SimpleFbc b = t.g; } void simplestTestEver() { @NonNull String a = "abc"; - // :: error: (assignment) + // :: error: [assignment] a = null; - // :: error: (assignment) + // :: error: [assignment] @NonNull String b = null; } diff --git a/checker/tests/initialization/Subtyping.java b/checker/tests/initialization/Subtyping.java index 9158f60722da..a249acc7cf1f 100644 --- a/checker/tests/initialization/Subtyping.java +++ b/checker/tests/initialization/Subtyping.java @@ -7,10 +7,10 @@ void test1( @UnderInitialization(Object.class) Object underObject, @UnknownInitialization(Subtyping.class) Object unknownSubtyping, @UnderInitialization(Subtyping.class) Object underSubtyping) { - // ::error: (assignment) + // ::error: [assignment] underObject = unknownObject; underObject = underSubtyping; - // ::error: (assignment) + // ::error: [assignment] underObject = unknownSubtyping; } @@ -29,11 +29,11 @@ void test3( @UnderInitialization(Object.class) Object underObject, @UnknownInitialization(Subtyping.class) Object unknownSubtyping, @UnderInitialization(Subtyping.class) Object underSubtyping) { - // ::error: (assignment) + // ::error: [assignment] underSubtyping = unknownObject; - // ::error: (assignment) + // ::error: [assignment] underSubtyping = unknownSubtyping; - // ::error: (assignment) + // ::error: [assignment] underSubtyping = underObject; } @@ -42,10 +42,10 @@ void test4( @UnderInitialization(Object.class) Object underObject, @UnknownInitialization(Subtyping.class) Object unknownSubtyping, @UnderInitialization(Subtyping.class) Object underSubtyping) { - // ::error: (assignment) + // ::error: [assignment] unknownSubtyping = unknownObject; unknownSubtyping = underSubtyping; - // ::error: (assignment) + // ::error: [assignment] unknownSubtyping = underObject; } } diff --git a/checker/tests/initialization/TryFinally.java b/checker/tests/initialization/TryFinally.java index ff5d973fc6f7..40769399c715 100644 --- a/checker/tests/initialization/TryFinally.java +++ b/checker/tests/initialization/TryFinally.java @@ -251,7 +251,7 @@ static String getFoo() { private String foo; - // :: error: (initialization.fields.uninitialized) + // :: error: [initialization.fields.uninitialized] public TestCtnoactionFabsentNonfinal() { try { this.foo = getFoo(); @@ -268,7 +268,7 @@ static String getFoo() { private String foo; - // :: error: (initialization.fields.uninitialized) + // :: error: [initialization.fields.uninitialized] public TestCtnoactionFnoactionNonfinal() { try { this.foo = getFoo(); @@ -355,7 +355,7 @@ static String getFoo() { private String foo; - // :: error: (initialization.fields.uninitialized) + // :: error: [initialization.fields.uninitialized] public TestCenoactionFabsentNonfinal() { try { this.foo = getFoo(); @@ -372,7 +372,7 @@ static String getFoo() { private String foo; - // :: error: (initialization.fields.uninitialized) + // :: error: [initialization.fields.uninitialized] public TestCenoactionFnoactionNonfinal() { try { this.foo = getFoo(); diff --git a/checker/tests/initialization/TryFinallyBreak.java b/checker/tests/initialization/TryFinallyBreak.java index a348f9c351d4..004dda1be892 100644 --- a/checker/tests/initialization/TryFinallyBreak.java +++ b/checker/tests/initialization/TryFinallyBreak.java @@ -11,7 +11,7 @@ String testWhile1() { ans = null; } } - // :: error: (return) + // :: error: [return] return ans; } @@ -25,7 +25,7 @@ String testWhile2() { ans = null; } } - // :: error: (return) + // :: error: [return] return ans; } @@ -41,7 +41,7 @@ String testWhile3() { } ans = "x"; } - // :: error: (return) + // :: error: [return] return ans; } @@ -58,7 +58,7 @@ String testWhile4() { } ans = "x"; } - // :: error: (return) + // :: error: [return] return ans; } @@ -94,7 +94,7 @@ String testWhile6(boolean cond) { } ans = "x"; } - // :: error: (return) + // :: error: [return] return ans; } @@ -137,7 +137,7 @@ String testWhile8(boolean cond) { ans = null; } } - // :: error: (return) + // :: error: [return] return ans; } @@ -150,7 +150,7 @@ String testDoWhile1() { ans = null; } } while (this.hashCode() > 10000); - // :: error: (return) + // :: error: [return] return ans; } @@ -164,7 +164,7 @@ String testDoWhile2() { ans = null; } } while (true); - // :: error: (return) + // :: error: [return] return ans; } @@ -180,7 +180,7 @@ String testDoWhile3() { } ans = "x"; } while (true); - // :: error: (return) + // :: error: [return] return ans; } @@ -197,7 +197,7 @@ String testDoWhile4() { } ans = "x"; } while (true); - // :: error: (return) + // :: error: [return] return ans; } @@ -233,7 +233,7 @@ String testDoWhile6(boolean cond) { } while (cond); ans = "x"; } while (cond); - // :: error: (return) + // :: error: [return] return ans; } @@ -276,7 +276,7 @@ String testDoWhile8(boolean cond) { ans = null; } } while (cond); - // :: error: (return) + // :: error: [return] return ans; } @@ -289,7 +289,7 @@ String testFor1() { ans = null; } } - // :: error: (return) + // :: error: [return] return ans; } @@ -303,7 +303,7 @@ String testFor2() { ans = null; } } - // :: error: (return) + // :: error: [return] return ans; } @@ -319,7 +319,7 @@ String testFor3() { } ans = "x"; } - // :: error: (return) + // :: error: [return] return ans; } @@ -336,7 +336,7 @@ String testFor4() { } ans = "x"; } - // :: error: (return) + // :: error: [return] return ans; } @@ -372,7 +372,7 @@ String testFor6(boolean cond) { } ans = "x"; } - // :: error: (return) + // :: error: [return] return ans; } @@ -415,7 +415,7 @@ String testFor8(boolean cond) { ans = null; } } - // :: error: (return) + // :: error: [return] return ans; } @@ -429,7 +429,7 @@ String testIf1() { ans = null; } } - // :: error: (return) + // :: error: [return] return ans; } @@ -448,7 +448,7 @@ String testIf2(boolean cond) { } ans = "x"; } - // :: error: (return) + // :: error: [return] return ans; } @@ -491,7 +491,7 @@ String testIf4(boolean cond) { ans = null; } } - // :: error: (return) + // :: error: [return] return ans; } @@ -505,7 +505,7 @@ String testSwitch1() { ans = null; } } - // :: error: (return) + // :: error: [return] return ans; } @@ -523,7 +523,7 @@ String testSwitch2(boolean cond) { } } } - // :: error: (return) + // :: error: [return] return ans; } @@ -566,7 +566,7 @@ String testSwitch4(boolean cond) { ans = null; } } - // :: error: (return) + // :: error: [return] return ans; } } diff --git a/checker/tests/initialization/TryFinallyContinue.java b/checker/tests/initialization/TryFinallyContinue.java index aecf8ce67521..934c68e25ae3 100644 --- a/checker/tests/initialization/TryFinallyContinue.java +++ b/checker/tests/initialization/TryFinallyContinue.java @@ -6,7 +6,7 @@ String testWhile1() { String ans = "x"; while (true) { if (true) { - // :: error: (return) + // :: error: [return] return ans; } if (true) { @@ -41,7 +41,7 @@ String testWhile3(boolean cond) { OUTER: while (true) { if (true) { - // :: error: (return) + // :: error: [return] return ans; } @@ -66,7 +66,7 @@ String testFor1() { String ans = "x"; for (; ; ) { if (true) { - // :: error: (return) + // :: error: [return] return ans; } if (true) { @@ -101,7 +101,7 @@ String testFor3(boolean cond) { OUTER: for (; ; ) { if (true) { - // :: error: (return) + // :: error: [return] return ans; } diff --git a/checker/tests/initialization/TypeFrames.java b/checker/tests/initialization/TypeFrames.java index acadf9c1e9a0..ab03c149a98a 100644 --- a/checker/tests/initialization/TypeFrames.java +++ b/checker/tests/initialization/TypeFrames.java @@ -8,7 +8,7 @@ class A { public A() { @UnderInitialization A l1 = this; - // :: error: (assignment) + // :: error: [assignment] @UnderInitialization(A.class) A l2 = this; a = ""; @UnderInitialization(A.class) A l3 = this; @@ -23,7 +23,7 @@ class B extends A implements I { public B() { super(); @UnderInitialization(A.class) A l1 = this; - // :: error: (assignment) + // :: error: [assignment] @UnderInitialization(B.class) A l2 = this; b = ""; @UnderInitialization(B.class) A l3 = this; @@ -34,7 +34,7 @@ public B() { void t1(@UnderInitialization(A.class) B b1, @UnderInitialization(B.class) B b2) { @UnderInitialization(A.class) B l1 = b1; @UnderInitialization(A.class) B l2 = b2; - // :: error: (assignment) + // :: error: [assignment] @UnderInitialization(B.class) B l3 = b1; } } diff --git a/checker/tests/initialization/TypeFrames2.java b/checker/tests/initialization/TypeFrames2.java index 148905e0a8e5..b56de1b72758 100644 --- a/checker/tests/initialization/TypeFrames2.java +++ b/checker/tests/initialization/TypeFrames2.java @@ -7,7 +7,7 @@ class A { @NonNull String a; public A() { - // :: error: (method.invocation) + // :: error: [method.invocation] this.foo(); a = ""; this.foo(); @@ -22,7 +22,7 @@ class B extends A { public B() { super(); this.foo(); - // :: error: (method.invocation) + // :: error: [method.invocation] this.bar(); b = ""; this.bar(); diff --git a/checker/tests/interning/Arrays.java b/checker/tests/interning/Arrays.java index 2f7631abda1a..ea9264fb7625 100644 --- a/checker/tests/interning/Arrays.java +++ b/checker/tests/interning/Arrays.java @@ -17,11 +17,11 @@ public static Integer[] arrayclone_simple(Integer[] a_old) { public static void test(@Interned Integer i, @Interned String s) { String @Interned [] iarray1 = new String @Interned [2]; String @Interned [] iarray2 = new String @Interned [] {"foo", "bar"}; - // :: error: (assignment) + // :: error: [assignment] s = iarray1[1]; // error String[] sa = new String[22]; - // :: error: (assignment) + // :: error: [assignment] iarray1 = sa; // error sa = iarray1; // OK diff --git a/checker/tests/interning/Autoboxing.java b/checker/tests/interning/Autoboxing.java index b1c2c7451c58..043f27dfe41e 100644 --- a/checker/tests/interning/Autoboxing.java +++ b/checker/tests/interning/Autoboxing.java @@ -36,13 +36,13 @@ public void test() { Byte b2 = -126; Byte b3 = Byte.valueOf((byte) -126); System.out.println(b1 == b2); - // :: warning: (unnecessary.equals) + // :: warning: [unnecessary.equals] System.out.println(b1.equals(b2)); - // :: warning: (unnecessary.equals) + // :: warning: [unnecessary.equals] System.out.println(b3.equals(b2)); System.out.println(b.equals(b2)); System.out.println(b == -126); - // :: warning: (unnecessary.equals) + // :: warning: [unnecessary.equals] System.out.println(b1.equals(126)); System.out.println(); @@ -50,7 +50,7 @@ public void test() { Short s1 = 32000; Short s2 = 32000; Short s3 = Short.valueOf((short) 32000); - // :: error: (not.interned) + // :: error: [not.interned] System.out.println(s1 == s2); System.out.println(s1.equals(s2)); System.out.println(s3.equals(s2)); @@ -60,11 +60,11 @@ public void test() { // Short s2interned = 32; // Short s3interned = Short.valueOf((short) 32); // System.out.println(s1interned==s2interned); - // // :: warning: (unnecessary.equals) + // // :: warning: [unnecessary.equals] // System.out.println(s1interned.equals(s2interned)); - // // :: warning: (unnecessary.equals) + // // :: warning: [unnecessary.equals] // System.out.println(s3interned.equals(s2interned)); - // // :: warning: (unnecessary.equals) + // // :: warning: [unnecessary.equals] // System.out.println(sInterned.equals(s2interned)); System.out.println(); @@ -72,7 +72,7 @@ public void test() { Integer i1 = 1234567; Integer i2 = 1234567; Integer i3 = Integer.valueOf(1234567); - // :: error: (not.interned) + // :: error: [not.interned] System.out.println(i1 == i2); System.out.println(i1.equals(i2)); System.out.println(i3.equals(i2)); @@ -85,16 +85,16 @@ public void test() { // TODO: // Would be legal to use ==, but Interning Checker does not check the // actual int value when deciding whether to warn for unnecessary.equals. - // // :: warning: (unnecessary.equals) + // // :: warning: [unnecessary.equals] // System.out.println(i1interned==i2interned); - // // :: warning: (unnecessary.equals) + // // :: warning: [unnecessary.equals] // System.out.println(i1interned.equals(i2interned)); - // // :: warning: (unnecessary.equals) + // // :: warning: [unnecessary.equals] // System.out.println(i3interned.equals(i2interned)); - // // :: warning: (unnecessary.equals) + // // :: warning: [unnecessary.equals] // System.out.println(iInterned.equals(i2interned)); // System.out.println(i1interned==123); // ok - // // :: warning: (unnecessary.equals) + // // :: warning: [unnecessary.equals] // System.out.println(i1interned.equals(123)); System.out.println(); @@ -102,7 +102,7 @@ public void test() { Long l1 = 1234567L; Long l2 = 1234567L; Long l3 = Long.valueOf(1234567L); - // :: error: (not.interned) + // :: error: [not.interned] System.out.println(l1 == l2); System.out.println(l1.equals(l2)); System.out.println(l3.equals(l2)); @@ -113,7 +113,7 @@ public void test() { Float f1 = 3.14f; Float f2 = 3.14f; Float f3 = Float.valueOf(3.14f); - // :: error: (not.interned) + // :: error: [not.interned] System.out.println(f1 == f2); System.out.println(f1.equals(f2)); System.out.println(f3.equals(f2)); @@ -124,7 +124,7 @@ public void test() { Double d1 = 3.14; Double d2 = 3.14; Double d3 = Double.valueOf(3.14); - // :: error: (not.interned) + // :: error: [not.interned] System.out.println(d1 == d2); System.out.println(d1.equals(d2)); System.out.println(d3.equals(d2)); @@ -136,13 +136,13 @@ public void test() { Boolean z2 = true; Boolean z3 = Boolean.valueOf(true); System.out.println(z1 == z2); - // :: warning: (unnecessary.equals) + // :: warning: [unnecessary.equals] System.out.println(z1.equals(z2)); - // :: warning: (unnecessary.equals) + // :: warning: [unnecessary.equals] System.out.println(z3.equals(z2)); System.out.println(z.equals(z2)); System.out.println(z1 == true); // ok - // :: warning: (unnecessary.equals) + // :: warning: [unnecessary.equals] System.out.println(z1.equals(true)); System.out.println(); @@ -150,7 +150,7 @@ public void test() { Character c1 = 65000; Character c2 = 65000; Character c3 = Character.valueOf((char) 65000); - // :: error: (not.interned) + // :: error: [not.interned] System.out.println(c1 == c2); System.out.println(c1.equals(c2)); System.out.println(c3.equals(c2)); @@ -160,11 +160,11 @@ public void test() { // Character c2interned = 65; // Character c3interned = Character.valueOf((char) 65); // System.out.println(c1interned==c2interned); - // // :: warning: (unnecessary.equals) + // // :: warning: [unnecessary.equals] // System.out.println(c1interned.equals(c2interned)); - // // :: warning: (unnecessary.equals) + // // :: warning: [unnecessary.equals] // System.out.println(c3interned.equals(c2interned)); - // // :: warning: (unnecessary.equals) + // // :: warning: [unnecessary.equals] // System.out.println(cInterned.equals(c2interned)); } } diff --git a/checker/tests/interning/Comparison.java b/checker/tests/interning/Comparison.java index cf9d84bbad3a..99265855e115 100644 --- a/checker/tests/interning/Comparison.java +++ b/checker/tests/interning/Comparison.java @@ -25,14 +25,14 @@ void testNotInterned() { String c = new String("foo"); String d = new String("bar"); - // :: error: (not.interned) + // :: error: [not.interned] if (c == d) { System.out.println("yes"); } else { System.out.println("no"); } - // :: error: (not.interned) + // :: error: [not.interned] if (c != d) { System.out.println("no"); } else { diff --git a/checker/tests/interning/CompileTimeConstants2.java b/checker/tests/interning/CompileTimeConstants2.java index efa5ae1dfffb..dcca37aa1475 100644 --- a/checker/tests/interning/CompileTimeConstants2.java +++ b/checker/tests/interning/CompileTimeConstants2.java @@ -10,6 +10,6 @@ public class CompileTimeConstants2 { @Interned String s4 = "" + Math.PI; // To make sure that we would get an error if the RHS is not interned - // :: error: (assignment) + // :: error: [assignment] @Interned String err = "" + new Object(); } diff --git a/checker/tests/interning/ComplexComparison.java b/checker/tests/interning/ComplexComparison.java index d50c80487965..b627f744b94b 100644 --- a/checker/tests/interning/ComplexComparison.java +++ b/checker/tests/interning/ComplexComparison.java @@ -32,7 +32,7 @@ void testNotInterned() { String e = new String("foo"); String f = new String("bar"); - // :: error: (not.interned) + // :: error: [not.interned] if (e != null && f != null && e == f) { System.out.println("yes"); } else { diff --git a/checker/tests/interning/ConstantsInterning.java b/checker/tests/interning/ConstantsInterning.java index 6a5cdb489cbb..fecfd90cb200 100644 --- a/checker/tests/interning/ConstantsInterning.java +++ b/checker/tests/interning/ConstantsInterning.java @@ -20,14 +20,14 @@ void foo() { is = AC; is = A + "C"; is = A + B + "C"; - // :: error: (assignment) + // :: error: [assignment] is = D; - // :: error: (assignment) + // :: error: [assignment] is = A + E; - // :: error: (assignment) + // :: error: [assignment] is = is + is; is = Constants2.E; - // :: error: (assignment) + // :: error: [assignment] is = (String) F; } } diff --git a/checker/tests/interning/Creation.java b/checker/tests/interning/Creation.java index 7bd63969acb2..6a2c3505966b 100644 --- a/checker/tests/interning/Creation.java +++ b/checker/tests/interning/Creation.java @@ -9,12 +9,12 @@ class Foo {} @Interned Foo[] fa_field2 = new @Interned Foo[22]; // valid public void test() { - // :: error: (assignment) + // :: error: [assignment] @Interned Foo f = new Foo(); // error Foo g = new Foo(); // valid - // :: warning: (cast.unsafe.constructor.invocation) + // :: warning: [cast.unsafe.constructor.invocation] @Interned Foo h = new @Interned Foo(); // valid - // :: error: (not.interned) + // :: error: [not.interned] boolean b = (f == g); // error @Interned Foo[] fa1 = new @Interned Foo[22]; // valid @@ -22,27 +22,27 @@ public void test() { } public @Interned Object read_data_0() { - // :: error: (return) + // :: error: [return] return new Object(); } public @Interned Object read_data_1() { - // :: error: (return) + // :: error: [return] return Integer.valueOf(22); } public @Interned Integer read_data_2() { - // :: error: (return) + // :: error: [return] return Integer.valueOf(22); } public @Interned Object read_data_3() { - // :: error: (return) + // :: error: [return] return new String("hello"); } public @Interned String read_data_4() { - // :: error: (return) + // :: error: [return] return new String("hello"); } } diff --git a/checker/tests/interning/Distinct.java b/checker/tests/interning/Distinct.java index 91bbf47abddf..d93c6fc8091d 100644 --- a/checker/tests/interning/Distinct.java +++ b/checker/tests/interning/Distinct.java @@ -13,12 +13,12 @@ class Foo {} @InternedDistinct Foo d2; public void testEquals() { - // :: error: (not.interned) + // :: error: [not.interned] if (f1 == f2) {} - // :: error: (not.interned) + // :: error: [not.interned] if (f1 == i2) {} if (f1 == d2) {} - // :: error: (not.interned) + // :: error: [not.interned] if (i1 == f2) {} if (i1 == i2) {} if (i1 == d2) {} @@ -40,7 +40,7 @@ public void testAssignment3() { } public void testAssignment4() { - // :: error: (assignment) + // :: error: [assignment] i1 = f2; } @@ -53,12 +53,12 @@ public void testAssignment6() { } public void testAssignment7() { - // :: error: (assignment) + // :: error: [assignment] d1 = f2; } public void testAssignment8() { - // :: error: (assignment) + // :: error: [assignment] d1 = i2; } diff --git a/checker/tests/interning/ExpressionsInterning.java b/checker/tests/interning/ExpressionsInterning.java index 4c4f1857f35d..2a433635434f 100644 --- a/checker/tests/interning/ExpressionsInterning.java +++ b/checker/tests/interning/ExpressionsInterning.java @@ -37,7 +37,7 @@ class Foo { } } - // :: warning: (cast.unsafe.constructor.invocation) + // :: warning: [cast.unsafe.constructor.invocation] public @Interned Foo THEONE = new @Interned Foo(); public boolean isItTheOne(Foo f) { @@ -48,7 +48,7 @@ public boolean isItTheOne(Foo f) { // is a good idea to convert a given class or reference to @Interned -- I can see whether there // are places that it is compared with .equals, which I might need to examine. public boolean dontUseEqualsMethod(@Interned Foo f1, @Interned Foo f2) { - // :: warning: (unnecessary.equals) + // :: warning: [unnecessary.equals] return f1.equals(f2); } } diff --git a/checker/tests/interning/FieldsImplicits.java b/checker/tests/interning/FieldsImplicits.java index e46a07e377d8..32b4e2cb9376 100644 --- a/checker/tests/interning/FieldsImplicits.java +++ b/checker/tests/interning/FieldsImplicits.java @@ -7,7 +7,7 @@ public class FieldsImplicits { void test() { boolean a = finalField == "asdf"; boolean b = finalStaticField == "asdf"; - // :: error: (not.interned) + // :: error: [not.interned] boolean c = nonFinalField == "asdf"; } } diff --git a/checker/tests/interning/FindDistinctTest.java b/checker/tests/interning/FindDistinctTest.java index 7baa2734b073..57e6fce0fee4 100644 --- a/checker/tests/interning/FindDistinctTest.java +++ b/checker/tests/interning/FindDistinctTest.java @@ -20,12 +20,12 @@ public void useOk1(Object notinterned, @Interned Object interned) { } public void bad1(Object o) { - // :: error: (assignment) + // :: error: [assignment] @InternedDistinct Object o2 = o; } public void bad2(Object findIt, Object other) { - // :: error: (not.interned) + // :: error: [not.interned] boolean b = findIt == other; } } diff --git a/checker/tests/interning/Generics.java b/checker/tests/interning/Generics.java index c4a39b433575..e8b951d2687a 100644 --- a/checker/tests/interning/Generics.java +++ b/checker/tests/interning/Generics.java @@ -21,7 +21,7 @@ void testGenerics() { @Interned String interned; map.put(a, b); // valid - // :: error: (argument) + // :: error: [argument] map.put(b, a); // error notInterned = map.get(a); // valid @@ -31,10 +31,10 @@ void testGenerics() { Collection notInternedSet; notInternedSet = map.keySet(); // valid - // :: error: (assignment) + // :: error: [assignment] internedSet = map.keySet(); // error - // :: error: (assignment) + // :: error: [assignment] notInternedSet = map.values(); // error internedSet = map.values(); // valid @@ -58,13 +58,13 @@ boolean equals(CellOfImm other) { void testGenerics2() { istrings.add(istring); - // :: error: (argument) + // :: error: [argument] istrings.add(string); // invalid strings.add(istring); strings.add(string); istring = istrings.get(0); string = istrings.get(0); - // :: error: (assignment) + // :: error: [assignment] istring = strings.get(0); // invalid string = strings.get(0); } @@ -78,7 +78,7 @@ void testCollections() { class MyList extends ArrayList<@Interned String> { // Correct return value is Iterator<@Interned String> - // :: error: (override.return) + // :: error: [override.return] public Iterator iterator() { return null; } diff --git a/checker/tests/interning/HeuristicsTest.java b/checker/tests/interning/HeuristicsTest.java index bda33b5599cb..4c5df41dd591 100644 --- a/checker/tests/interning/HeuristicsTest.java +++ b/checker/tests/interning/HeuristicsTest.java @@ -24,7 +24,7 @@ public boolean equals(Object o) { return true; } // Not the first statement in the method. - // :: error: (not.interned) + // :: error: [not.interned] if (o == this) { return true; } @@ -40,7 +40,7 @@ public boolean equals2(Object o) { return true; } // Not the first statement in the method. - // :: error: (not.interned) + // :: error: [not.interned] if (o == this) { return true; } @@ -50,12 +50,12 @@ public boolean equals2(Object o) { @org.checkerframework.dataflow.qual.Pure public boolean equals3(Object o) { // Not equals() or annotated as @EqualsMethod. - // :: error: (not.interned) + // :: error: [not.interned] if (this == o) { return true; } // Not the first statement in the method. - // :: error: (not.interned) + // :: error: [not.interned] if (o == this) { return true; } @@ -71,7 +71,7 @@ public static boolean equals4(Object thisOne, Object o) { return true; } // Not the first statement in the method. - // :: error: (not.interned) + // :: error: [not.interned] if (o == thisOne) { return true; } @@ -81,12 +81,12 @@ public static boolean equals4(Object thisOne, Object o) { @org.checkerframework.dataflow.qual.Pure public static boolean equals5(Object thisOne, Object o) { // Not equals() or annotated as @EqualsMethod. - // :: error: (not.interned) + // :: error: [not.interned] if (thisOne == o) { return true; } // Not the first statement in the method. - // :: error: (not.interned) + // :: error: [not.interned] if (o == thisOne) { return true; } @@ -94,13 +94,13 @@ public static boolean equals5(Object thisOne, Object o) { } @EqualsMethod - // :: error: (invalid.method.annotation) + // :: error: [invalid.method.annotation] public boolean equals6() { return true; } @EqualsMethod - // :: error: (invalid.method.annotation) + // :: error: [invalid.method.annotation] public boolean equals7(int a, int b, int c) { return true; } @@ -115,7 +115,7 @@ public int compareTo(HeuristicsTest o) { return 0; } // Not the first statement in the method. - // :: error: (not.interned) + // :: error: [not.interned] if (this == o) { return 0; } @@ -132,7 +132,7 @@ public int compareTo2(HeuristicsTest o) { return 0; } // Not the first statement in the method. - // :: error: (not.interned) + // :: error: [not.interned] if (this == o) { return 0; } @@ -142,12 +142,12 @@ public int compareTo2(HeuristicsTest o) { @org.checkerframework.dataflow.qual.Pure public int compareTo3(HeuristicsTest o) { // Not compareTo or annotated as @CompareToMethod - // :: error: (not.interned) + // :: error: [not.interned] if (o == this) { return 0; } // Not the first statement in the method. - // :: error: (not.interned) + // :: error: [not.interned] if (this == o) { return 0; } @@ -164,7 +164,7 @@ public static int compareTo4(HeuristicsTest thisOne, HeuristicsTest o) { return 0; } // Not the first statement in the method. - // :: error: (not.interned) + // :: error: [not.interned] if (thisOne == o) { return 0; } @@ -174,12 +174,12 @@ public static int compareTo4(HeuristicsTest thisOne, HeuristicsTest o) { @org.checkerframework.dataflow.qual.Pure public static int compareTo5(HeuristicsTest thisOne, HeuristicsTest o) { // Not compareTo or annotated as @CompareToMethod - // :: error: (not.interned) + // :: error: [not.interned] if (o == thisOne) { return 0; } // Not the first statement in the method. - // :: error: (not.interned) + // :: error: [not.interned] if (thisOne == o) { return 0; } @@ -187,13 +187,13 @@ public static int compareTo5(HeuristicsTest thisOne, HeuristicsTest o) { } @EqualsMethod - // :: error: (invalid.method.annotation) + // :: error: [invalid.method.annotation] public boolean compareTo6() { return true; } @EqualsMethod - // :: error: (invalid.method.annotation) + // :: error: [invalid.method.annotation] public boolean compareTo7(int a, int b, int c) { return true; } diff --git a/checker/tests/interning/InternedClass.java b/checker/tests/interning/InternedClass.java index 4bc92bce7ed9..31dbabe4cec9 100644 --- a/checker/tests/interning/InternedClass.java +++ b/checker/tests/interning/InternedClass.java @@ -20,7 +20,7 @@ InternedClass factory(int i) { private InternedClass(int i) { value = i; // "this" in the constructor is not interned. - // :: error: (assignment) + // :: error: [assignment] @Interned InternedClass that = this; } @@ -63,7 +63,7 @@ public void myMethod(InternedClass ic, InternedClass[] ica) { boolean b2 = (this == returnInternedObject()); // valid boolean b3 = (this == ica[0]); // valid InternedClass ic2 = returnArray()[0]; // valid - // :: error: (interned.object.creation) + // :: error: [interned.object.creation] ica[0] = new InternedClass(22); InternedClass[] arr1 = returnArray(); // valid InternedClass[] arr2 = new InternedClass[22]; // valid @@ -95,7 +95,7 @@ public static InternedClass[] arrayclone_simple(InternedClass[] a_old) { int len = a_old.length; InternedClass[] a_new = new InternedClass[len]; for (int i = 0; i < len; i++) { - // :: error: (interned.object.creation) + // :: error: [interned.object.creation] a_new[i] = new InternedClass(a_old[i]); } return a_new; @@ -139,7 +139,7 @@ public static void arrayOfClass() throws Exception { Class[] getSuperClasses(Class c) { Vector> v = new Vector<>(); while (true) { - // :: warning: (unnecessary.equals) + // :: warning: [unnecessary.equals] if (c.getSuperclass().equals((new Object()).getClass())) { break; } diff --git a/checker/tests/interning/InternedClass2.java b/checker/tests/interning/InternedClass2.java index e9c648cf0f60..5030d03deaee 100644 --- a/checker/tests/interning/InternedClass2.java +++ b/checker/tests/interning/InternedClass2.java @@ -9,13 +9,13 @@ // @UnknownInterned is the default annotation on constructor results even for @Interned classes. private InternedClass2(int i) { // Type of "this" inside a constructor of an @Interned class is @UnknownInterned. - // :: error: (assignment) + // :: error: [assignment] @Interned InternedClass2 that = this; this.i = i; } InternedClass2 factory(int i) { - // :: error: (interned.object.creation) :: error: (method.invocation) + // :: error: [interned.object.creation] :: error: [method.invocation] new InternedClass2(i).someMethod(); // error, call to constructor on for @Interned class. (new InternedClass2(i)).intern(); // ok, call to constructor receiver to @InternMethod ((((new InternedClass2(i))))).intern(); // ok, call to constructor receiver to @InternMethod @@ -33,7 +33,7 @@ void someMethod() { @InternMethod public InternedClass2 intern() { // Type of "this" inside an @InternMethod is @UnknownInterned - // :: error: (assignment) + // :: error: [assignment] @Interned InternedClass2 that = this; if (!pool.containsKey(this.i)) { // The above check proves "this" is interned. diff --git a/checker/tests/interning/Issue2809.java b/checker/tests/interning/Issue2809.java index 90a7f67024b9..bb2bc08f2cb3 100644 --- a/checker/tests/interning/Issue2809.java +++ b/checker/tests/interning/Issue2809.java @@ -19,7 +19,7 @@ void new3(MyType<@Interned MyType> t, @Interned MyType non) { } void newFail(MyType t, int @UnknownInterned [] non) { - // :: error: (type.arguments.not.inferred) + // :: error: [type.arguments.not.inferred] t.self(new MyType<>(non)); } diff --git a/checker/tests/interning/MethodInvocation.java b/checker/tests/interning/MethodInvocation.java index d0cf6acef397..e40c0e9e2ec9 100644 --- a/checker/tests/interning/MethodInvocation.java +++ b/checker/tests/interning/MethodInvocation.java @@ -6,18 +6,18 @@ public class MethodInvocation { void nonInternedMethod() { nonInternedMethod(); - // :: error: (method.invocation) + // :: error: [method.invocation] internedMethod(); // should emit error this.nonInternedMethod(); - // :: error: (method.invocation) + // :: error: [method.invocation] this.internedMethod(); // should emit error interned.nonInternedMethod(); interned.internedMethod(); nonInterned.nonInternedMethod(); - // :: error: (method.invocation) + // :: error: [method.invocation] nonInterned.internedMethod(); // should emit error } @@ -32,7 +32,7 @@ void internedMethod(@Interned MethodInvocation this) { interned.internedMethod(); nonInterned.nonInternedMethod(); - // :: error: (method.invocation) + // :: error: [method.invocation] nonInterned.internedMethod(); // should emit error } @@ -41,13 +41,13 @@ void internedCharacterParameter(@Interned Character a) {} // See https://github.com/typetools/checker-framework/issues/84 void internedCharacterParametersClient() { - // TODO: autoboxing from char to Character // :: error: (argument) + // TODO: autoboxing from char to Character // :: error: [argument] internedCharacterParameter('\u00E4'); // lowercase a with umlaut - // TODO: autoboxing from char to Character // :: error: (argument) + // TODO: autoboxing from char to Character // :: error: [argument] internedCharacterParameter('a'); - // :: error: (argument) + // :: error: [argument] internedCharacterParameter(Character.valueOf('a')); - // :: error: (argument) + // :: error: [argument] internedCharacterParameter(Character.valueOf('a')); } } diff --git a/checker/tests/interning/Options.java b/checker/tests/interning/Options.java index cc392fda477a..d0036b4a8ca5 100644 --- a/checker/tests/interning/Options.java +++ b/checker/tests/interning/Options.java @@ -9,7 +9,7 @@ public void minimal(String s) { String arg = ""; // interned here @Interned String arg2 = arg; arg += s; // no longer interned - // :: error: (assignment) + // :: error: [assignment] arg2 = arg; } @@ -17,7 +17,7 @@ public void minimal2(char c) { String arg = ""; // interned here @Interned String arg2 = arg; arg += c; // no longer interned - // :: error: (assignment) + // :: error: [assignment] arg2 = arg; } @@ -36,7 +36,7 @@ public String[] otherparse(String args) { arg += ch; // } // } - // :: error: (assignment) + // :: error: [assignment] @Interned String arg2 = arg; if (!arg.equals("")) { @@ -77,7 +77,7 @@ public String[] parse(String args) { arg += ch; } } - // :: error: (assignment) + // :: error: [assignment] @Interned String arg2 = arg; if (!arg.equals("")) { diff --git a/checker/tests/interning/OverrideInterned.java b/checker/tests/interning/OverrideInterned.java index 3148424e5016..a5cf1e8912a5 100644 --- a/checker/tests/interning/OverrideInterned.java +++ b/checker/tests/interning/OverrideInterned.java @@ -38,12 +38,12 @@ public abstract class TwoSequenceString { /* Changing the array component type in the overriding method is illegal. */ public class PairwiseStringEqualBad extends TwoSequenceString { - // TODOINVARR:: error: (override.param) + // TODOINVARR:: error: [override.param] public Object check_modified1(String @Interned [] a1) { return new Object(); } - // :: error: (override.param) + // :: error: [override.param] public Object check_modified2(@Interned String @Interned [] a1) { return new Object(); } diff --git a/checker/tests/interning/Polymorphism.java b/checker/tests/interning/Polymorphism.java index 9864e434c8f1..c986d7fc34ff 100644 --- a/checker/tests/interning/Polymorphism.java +++ b/checker/tests/interning/Polymorphism.java @@ -15,7 +15,7 @@ void testParam() { @Interned String interned = "interned"; interned = identity(interned); - // :: error: (assignment) + // :: error: [assignment] interned = identity(notInterned); // invalid } @@ -29,7 +29,7 @@ void testReceiver() { @Interned Polymorphism interned = null; interned = interned.getSelf(); - // :: error: (assignment) + // :: error: [assignment] interned = notInterned.getSelf(); // invalid } @@ -38,10 +38,10 @@ void testReceiver() { if (s.equals("n")) { // This code type-checkd when the hierarchy contained just @UnknownInterned and // @Interned, but no longer does because of @InternedDistinct. - // :: error: (return) + // :: error: [return] return "m"; } else { - // :: error: (return) + // :: error: [return] return new String("m"); // invalid } } diff --git a/checker/tests/interning/Raw3.java b/checker/tests/interning/Raw3.java index 0d95a668c515..5f426c64fb63 100644 --- a/checker/tests/interning/Raw3.java +++ b/checker/tests/interning/Raw3.java @@ -30,7 +30,7 @@ List foo2() { // no raw types List foo3() { List<@Interned String> sl = new ArrayList<>(); - // :: error: (return) + // :: error: [return] return (List<@Interned String>) sl; } @@ -44,7 +44,7 @@ List foo4() { // no raw types List<@Interned String> foo5() { List sl = new ArrayList<>(); - // :: error: (return) + // :: error: [return] return (List) sl; } diff --git a/checker/tests/interning/SequenceAndIndices.java b/checker/tests/interning/SequenceAndIndices.java index e5c4e3b39d4c..5d5c3c3c3dac 100644 --- a/checker/tests/interning/SequenceAndIndices.java +++ b/checker/tests/interning/SequenceAndIndices.java @@ -28,7 +28,7 @@ public SequenceAndIndices(T seqpar, int start, int end) { public boolean equals(Object other) { if (other instanceof SequenceAndIndices) { // Warning only with -AcheckCastElementType. - // TODO:: warning: (cast.unsafe) + // TODO:: warning: [cast.unsafe] return equals((SequenceAndIndices) other); // unchecked } else { return false; diff --git a/checker/tests/interning/StringIntern.java b/checker/tests/interning/StringIntern.java index ae1a97e2a228..eb4cbf2291b3 100644 --- a/checker/tests/interning/StringIntern.java +++ b/checker/tests/interning/StringIntern.java @@ -36,15 +36,15 @@ public void test(@Interned String arg) { String notInternedStr = new String("foo"); @Interned String internedStr = notInternedStr.intern(); internedStr = finalStringInitializedToInterned; // OK - // :: error: (assignment) + // :: error: [assignment] internedStr = finalString2; // error - // :: error: (assignment) + // :: error: [assignment] @Interned Foo internedFoo = finalFooInitializedToInterned; if (arg == finalStringStatic1) {} // OK - // :: error: (not.interned) + // :: error: [not.interned] if (arg == finalStringStatic2) {} // error if (arg == HasFields.finalStringStatic3) {} // OK - // :: error: (not.interned) + // :: error: [not.interned] if (arg == HasFields.finalStringStatic4) {} // error } diff --git a/checker/tests/interning/UsesObjectEqualsTest.java b/checker/tests/interning/UsesObjectEqualsTest.java index 8a713ad9ce44..24e2664598e1 100644 --- a/checker/tests/interning/UsesObjectEqualsTest.java +++ b/checker/tests/interning/UsesObjectEqualsTest.java @@ -12,7 +12,7 @@ public A() {} @UsesObjectEquals class B extends A {} - // :: error: (overrides.equals) + // :: error: [overrides.equals] class B2 extends A { @Override public boolean equals(Object o) { @@ -42,11 +42,11 @@ class C extends A {} class D {} @UsesObjectEquals - // :: error: (superclass.notannotated) + // :: error: [superclass.notannotated] class E extends D {} @UsesObjectEquals - // :: error: (overrides.equals) + // :: error: [overrides.equals] class TestEquals { @org.checkerframework.dataflow.qual.Pure diff --git a/checker/tests/lock-records/LockRecord.java b/checker/tests/lock-records/LockRecord.java index c9f179e6bfaa..d2bbfcfec397 100644 --- a/checker/tests/lock-records/LockRecord.java +++ b/checker/tests/lock-records/LockRecord.java @@ -3,9 +3,9 @@ public record LockRecord(String s, ReentrantLock lock) { @LockingFree - // :: error: (method.guarantee.violated) + // :: error: [method.guarantee.violated] public LockRecord { - // :: error: (method.guarantee.violated) + // :: error: [method.guarantee.violated] lock.lock(); } } diff --git a/checker/tests/lock-safedefaults/BasicLockTest.java b/checker/tests/lock-safedefaults/BasicLockTest.java index 6dd44593a2ce..05887f75110b 100644 --- a/checker/tests/lock-safedefaults/BasicLockTest.java +++ b/checker/tests/lock-safedefaults/BasicLockTest.java @@ -38,11 +38,11 @@ void testFields() { // The first way is more durable as cannot.dereference is tied specifically to // @GuardedByUnknown (and @GuardedByBottom, but it is unlikely to become the default for // return values on unannotated methods). - // :: error: (lock.not.held) :: error: (argument) + // :: error: [lock.not.held] :: error: [argument] myUnannotatedMethod(o1).field = someValue; // The second way is less durable because the default for fields is currently @GuardedBy({}) // but could be changed to @GuardedByUnknown. - // :: error: (assignment) :: error: (argument) + // :: error: [assignment] :: error: [argument] p1 = myUnannotatedMethod(o1); // Now test that an unannotated method behaves as if it's annotated with @MayReleaseLocks @@ -50,7 +50,7 @@ void testFields() { myAnnotatedMethod2(); m.field = someValue; myUnannotatedMethod2(); - // :: error: (lock.not.held) + // :: error: [lock.not.held] m.field = someValue; } @@ -62,7 +62,7 @@ void unannotatedReleaseLock(ReentrantLock lock) { @MayReleaseLocks void testLocalVariables1() { MyClass o2 = new MyClass(), p2; - // :: error: (argument) + // :: error: [argument] p2 = myUnannotatedMethod(o2); MyClass o3 = new MyClass(); myAnnotatedMethod(o3); @@ -81,7 +81,7 @@ void testLocalVariables2() { // Should behave as @MayReleaseLocks, and *should* reset @LockHeld assumption about local // variable lock. myUnannotatedMethod2(); - // :: error: (lock.not.held) + // :: error: [lock.not.held] q.field = someValue; } @@ -95,9 +95,9 @@ void testLocalVariables3() { lock.lock(); // Should behave as @MayReleaseLocks, and *should* reset @LockHeld assumption about local // variable lock. - // :: error: (argument) + // :: error: [argument] unannotatedReleaseLock(lock); - // :: error: (lock.not.held) + // :: error: [lock.not.held] q.field = someValue; } } diff --git a/checker/tests/lock/ChapterExamples.java b/checker/tests/lock/ChapterExamples.java index 3208b65d4531..b96d8bd04268 100644 --- a/checker/tests/lock/ChapterExamples.java +++ b/checker/tests/lock/ChapterExamples.java @@ -84,16 +84,16 @@ class GuardedByUnknownTest { T m; void test() { - // :: error: (method.invocation) + // :: error: [method.invocation] m.method(); @GuardedByUnknown MyClass local = new @GuardedByUnknown MyClass(); - // :: error: (lock.not.held) + // :: error: [lock.not.held] local.field = new Object(); - // :: error: (method.invocation) + // :: error: [method.invocation] local.method(); - // :: error: (lock.not.held) + // :: error: [lock.not.held] m.field = new Object(); } } @@ -115,7 +115,7 @@ Object method(@GuardSatisfied MyClass this) { final Object myLock = new Object(); void testCallToMethod(@GuardedBy("myLock") MyClass this) { - // :: error: (lock.not.held) + // :: error: [lock.not.held] this.method(); // method()'s receiver is annotated as @GuardSatisfied } } @@ -132,24 +132,24 @@ void guardedByItselfOnReceiver(@GuardedBy("") ChapterExamples this) { this.myField = new MyClass(); this.myField.toString(); } - // :: error: (lock.not.held) + // :: error: [lock.not.held] myField = new MyClass(); - // :: error: (lock.not.held) + // :: error: [lock.not.held] myField.toString(); - // :: error: (lock.not.held) + // :: error: [lock.not.held] this.myField = new MyClass(); - // :: error: (lock.not.held) + // :: error: [lock.not.held] this.myField.toString(); } void guardedByThisOnReceiver(@GuardedBy("this") ChapterExamples this) { - // :: error: (lock.not.held) + // :: error: [lock.not.held] myField = new MyClass(); - // :: error: (lock.not.held) + // :: error: [lock.not.held] myField.toString(); - // :: error: (lock.not.held) + // :: error: [lock.not.held] this.myField = new MyClass(); - // :: error: (lock.not.held) + // :: error: [lock.not.held] this.myField.toString(); synchronized (this) { myField = new MyClass(); @@ -161,24 +161,24 @@ void guardedByThisOnReceiver(@GuardedBy("this") ChapterExamples this) { void testDereferenceOfReceiverAndParameter( @GuardedBy("lock") ChapterExamples this, @GuardedBy("lock") MyClass m) { - // :: error: (lock.not.held) + // :: error: [lock.not.held] myField = new MyClass(); - // :: error: (lock.not.held) + // :: error: [lock.not.held] myField.toString(); - // :: error: (lock.not.held) + // :: error: [lock.not.held] this.myField = new MyClass(); - // :: error: (lock.not.held) + // :: error: [lock.not.held] this.myField.toString(); - // :: error: (lock.not.held) + // :: error: [lock.not.held] m.field = new Object(); - // :: error: (lock.not.held) + // :: error: [lock.not.held] m.field.toString(); // The following error is due to the fact that you cannot access "this.lock" without first // having acquired "lock". The right fix in a user scenario would be to not guard "this" // with "this.lock". The current object could instead be guarded by "" or by some // other lock expression that is not one of its fields. We are keeping this test case here // to make sure this scenario issues a warning. - // :: error: (lock.not.held) + // :: error: [lock.not.held] synchronized (lock) { myField = new MyClass(); myField.toString(); @@ -201,18 +201,18 @@ void testDereferenceOfReceiverAndParameter( } void myMethod8() { - // :: error: (lock.not.held) + // :: error: [lock.not.held] boolean b4 = compare(p1, myMethod()); // An error is issued indicating that p2 might be dereferenced without // "lock" being held. The method call need not be modified, since // @GuardedBy({}) <: @GuardedByUnknown and @GuardedBy("lock") <: @GuardedByUnknown, // but the lock must be acquired prior to the method call. - // :: error: (lock.not.held) + // :: error: [lock.not.held] boolean b2 = compare(p1, p2); - // :: error: (lock.not.held) + // :: error: [lock.not.held] boolean b3 = compare(p1, this.p2); - // :: error: (lock.not.held) + // :: error: [lock.not.held] boolean b5 = compare(p1, this.myMethod()); synchronized (lock) { boolean b6 = compare(p1, p2); // OK @@ -230,13 +230,13 @@ void myMethod8() { // myMethod().method() void myMethod7() { - // :: error: (lock.not.held) + // :: error: [lock.not.held] Object f = myObj.field; - // :: error: (lock.not.held) + // :: error: [lock.not.held] Object f2 = myMethodReturningMyObj().field; - // :: error: (lock.not.held) + // :: error: [lock.not.held] myObj.method(); // method()'s receiver is annotated as @GuardSatisfied - // :: error: (lock.not.held) + // :: error: [lock.not.held] myMethodReturningMyObj().method(); // method()'s receiver is annotated as @GuardSatisfied synchronized (lock) { @@ -246,9 +246,9 @@ void myMethod7() { myMethodReturningMyObj().method(); } - // :: error: (lock.not.held) + // :: error: [lock.not.held] myMethodReturningMyObj().field = new Object(); - // :: error: (lock.not.held) + // :: error: [lock.not.held] x.field = new Object(); synchronized (lock) { myMethod().field = new Object(); @@ -266,7 +266,7 @@ void myMethod7() { @GuardedBy("lock") MyClass y = x; // OK, because dereferences of y will require "lock" to be held. - // :: error: (assignment) + // :: error: [assignment] @GuardedBy({}) MyClass z = x; // ILLEGAL because dereferences of z do not require "lock" to be held. @LockingFree @@ -275,11 +275,11 @@ void myMethod7() { } void exampleMethod() { - // :: error: (lock.not.held) + // :: error: [lock.not.held] x.field = new Object(); // ILLEGAL because the lock is not known to be held - // :: error: (lock.not.held) + // :: error: [lock.not.held] y.field = new Object(); // ILLEGAL because the lock is not known to be held - // :: error: (lock.not.held) + // :: error: [lock.not.held] myMethod().field = new Object(); // ILLEGAL because the lock is not known to be held synchronized (lock) { x.field = new Object(); // OK: the lock is known to be held @@ -296,11 +296,11 @@ void exampleMethod() { @GuardedBy({"a", "b"}) MyClass y5 = new MyClass(); void myMethod2() { - // :: error: (assignment) + // :: error: [assignment] y5 = x5; // ILLEGAL } - // :: error: (immutable.type.guardedby) + // :: error: [immutable.type.guardedby] @GuardedBy("a") String s = "string"; @GuardedBy({}) MyClass o1; @@ -312,9 +312,9 @@ void myMethod2() { void someMethod() { o3 = o2; // OK, since o2 and o3 are guarded by exactly the same lock set. - // :: error: (assignment) + // :: error: [assignment] o1 = o2; // Assignment type incompatible errors are issued for both assignments, since - // :: error: (assignment) + // :: error: [assignment] o2 = o1; // {"lock"} and {} are not identical sets. } @@ -337,7 +337,7 @@ void someMethod2() { @GuardedBy("ChapterExamples.myLock") MyClass y2 = x2; void myMethod4() { - // :: error: (lock.not.held) + // :: error: [lock.not.held] x2.field = new Object(); // ILLEGAL because the lock is not held synchronized (ChapterExamples.myLock) { y2.field = new Object(); // OK: the lock is held @@ -345,7 +345,7 @@ void myMethod4() { } void myMethod5(@GuardedBy("ChapterExamples.myLock") MyClass a) { - // :: error: (lock.not.held) + // :: error: [lock.not.held] a.field = new Object(); // ILLEGAL: the lock is not held synchronized (ChapterExamples.myLock) { a.field = new Object(); // OK: the lock is held @@ -366,18 +366,18 @@ void myMethod6() { synchronized (lock) { boolean b1 = compare(p1, p2); // OK. No error issued. } - // :: error: (lock.not.held) + // :: error: [lock.not.held] p2.field = new Object(); // An error is issued indicating that p2 might be dereferenced without "lock" being held. // The method call need not be modified, since @GuardedBy({}) <: @GuardedByUnknown and // @GuardedBy("lock") <: @GuardedByUnknown, but the lock must be acquired prior to the // method call. - // :: error: (lock.not.held) + // :: error: [lock.not.held] boolean b2 = compare(p1, p2); } void helper1(@GuardedBy("ChapterExamples.myLock") MyClass a) { - // :: error: (lock.not.held) + // :: error: [lock.not.held] a.field = new Object(); // ILLEGAL: the lock is not held synchronized (ChapterExamples.myLock) { a.field = new Object(); // OK: the lock is held @@ -397,7 +397,7 @@ void helper3(@GuardSatisfied MyClass c) { @LockingFree void helper4(@GuardedBy("ChapterExamples.myLock") MyClass d) { - // :: error: (lock.not.held) + // :: error: [lock.not.held] d.field = new Object(); // ILLEGAL: the lock is not held } @@ -409,11 +409,11 @@ void helper6() {} void myMethod2(@GuardedBy("ChapterExamples.myLock") MyClass e) { helper1(e); // OK to pass to another routine without holding the lock. - // :: error: (lock.not.held) + // :: error: [lock.not.held] e.field = new Object(); // ILLEGAL: the lock is not held - // :: error: (contracts.precondition) + // :: error: [contracts.precondition] helper2(e); - // :: error: (lock.not.held) + // :: error: [lock.not.held] helper3(e); synchronized (ChapterExamples.myLock) { helper2(e); @@ -433,14 +433,14 @@ void myMethod2(@GuardedBy("ChapterExamples.myLock") MyClass e) { @SuppressWarnings({"deprecation", "removal"}) // new Integer void unboxing() { int a = someInt; - // :: error: (immutable.type.guardedby) + // :: error: [immutable.type.guardedby] @GuardedBy("lock") Integer c; synchronized (lock) { - // :: error: (assignment) + // :: error: [assignment] c = a; } - // :: error: (immutable.type.guardedby) + // :: error: [immutable.type.guardedby] @GuardedBy("lock") Integer b = 1; int d; synchronized (lock) { @@ -502,19 +502,19 @@ void boxingUnboxing() { @GuardedBy("lock2") MyClass extension; void method0() { - // :: error: (lock.not.held) :: error: (lock.not.held) + // :: error: [lock.not.held] :: error: [lock.not.held] filename = filename.append(extension); } void method1() { lock1.lock(); - // :: error: (lock.not.held) + // :: error: [lock.not.held] filename = filename.append(extension); } void method2() { lock2.lock(); - // :: error: (lock.not.held) + // :: error: [lock.not.held] filename = filename.append(extension); } @@ -523,9 +523,9 @@ void method3() { lock2.lock(); filename = filename.append(extension); filename = filename.append(null); - // :: error: (assignment) + // :: error: [assignment] filename = extension.append(extension); - // :: error: (assignment) + // :: error: [assignment] filename = extension.append(filename); } @@ -572,7 +572,7 @@ public boolean compare(T[] a1, T[] a2) { } public void assignmentOfGSWithNoIndex(@GuardSatisfied Object a, @GuardSatisfied Object b) { - // :: error: (guardsatisfied.assignment.disallowed) + // :: error: [guardsatisfied.assignment.disallowed] a = b; } diff --git a/checker/tests/lock/ClassLiterals.java b/checker/tests/lock/ClassLiterals.java index 6024614f8495..49fdfa7fb943 100644 --- a/checker/tests/lock/ClassLiterals.java +++ b/checker/tests/lock/ClassLiterals.java @@ -10,7 +10,7 @@ static Object method1() { // a class literal may not terminate a JavaExpression string @Holding("ClassLiterals") - // :: error: (flowexpr.parse.error) + // :: error: [flowexpr.parse.error] static void method2() {} @Holding("ClassLiterals.method1()") @@ -21,7 +21,7 @@ static void method4() {} // a class literal may not terminate a JavaExpression string @Holding("testpackage.ClassLiterals") - // :: error: (flowexpr.parse.error) + // :: error: [flowexpr.parse.error] static void method5() {} @Holding("testpackage.ClassLiterals.method1()") diff --git a/checker/tests/lock/ConstructorReturnNPE.java b/checker/tests/lock/ConstructorReturnNPE.java index e07da5305373..8fb72293fc1d 100644 --- a/checker/tests/lock/ConstructorReturnNPE.java +++ b/checker/tests/lock/ConstructorReturnNPE.java @@ -3,8 +3,8 @@ import org.checkerframework.checker.lock.qual.*; -// :: error: (expression.unparsable) +// :: error: [expression.unparsable] @GuardedBy("lock") class ConstructorReturnNPE { - // :: error: (expression.unparsable) + // :: error: [expression.unparsable] @GuardedBy("lock") ConstructorReturnNPE() {} } diff --git a/checker/tests/lock/ConstructorsLock.java b/checker/tests/lock/ConstructorsLock.java index 41fa7ae27b1c..a165959dea1d 100644 --- a/checker/tests/lock/ConstructorsLock.java +++ b/checker/tests/lock/ConstructorsLock.java @@ -18,31 +18,31 @@ static class MyClass { @GuardedBy("unlockedStatic") MyClass nonstaticGuardedByStatic = new MyClass(); - // :: error: (expression.unparsable) + // :: error: [expression.unparsable] static @GuardedBy("unlocked") MyClass staticGuardedByNonStatic = new MyClass(); static @GuardedBy("unlockedStatic") MyClass staticGuardedByStatic = new MyClass(); Object initializedObject1 = unlocked.field; Object initializedObject2 = guardedThis.field; - // :: error: (lock.not.held) + // :: error: [lock.not.held] Object initializedObject3 = guardedOther.field; - // :: error: (expression.unparsable) + // :: error: [expression.unparsable] Object initializedObject4 = staticGuardedByNonStatic.field; - // :: error: (lock.not.held) + // :: error: [lock.not.held] Object initializedObject5 = nonstaticGuardedByStatic.field; - // :: error: (lock.not.held) + // :: error: [lock.not.held] Object initializedObject6 = staticGuardedByStatic.field; ConstructorsLock() { unlocked.field.toString(); guardedThis.field.toString(); - // :: error: (lock.not.held) + // :: error: [lock.not.held] guardedOther.field.toString(); - // :: error: (expression.unparsable) + // :: error: [expression.unparsable] staticGuardedByNonStatic.field.toString(); - // :: error: (lock.not.held) + // :: error: [lock.not.held] nonstaticGuardedByStatic.field.toString(); - // :: error: (lock.not.held) + // :: error: [lock.not.held] staticGuardedByStatic.field.toString(); } } diff --git a/checker/tests/lock/Fields.java b/checker/tests/lock/Fields.java index 27c6c44dbe1c..ca81f8c55716 100644 --- a/checker/tests/lock/Fields.java +++ b/checker/tests/lock/Fields.java @@ -17,14 +17,14 @@ static synchronized void ssMethod() { synchronized void wrongLock1() { // locking over wrong lock - // :: error: (lock.not.held) + // :: error: [lock.not.held] locked.field = new Object(); // error } synchronized void wrongLock2() { // locking over wrong lock synchronized (this) { - // :: error: (lock.not.held) + // :: error: [lock.not.held] locked.field = new Object(); // error } } @@ -35,7 +35,7 @@ void rightLock() { } // accessing after the synchronized object - // :: error: (lock.not.held) + // :: error: [lock.not.held] locked.field = new Object(); // error } @@ -48,11 +48,11 @@ void usingHolding() { void wrongLocksb() { // without locking - // :: error: (lock.not.held) + // :: error: [lock.not.held] lockedByThis.field = new Object(); // error synchronized (Fields.class) { - // :: error: (lock.not.held) + // :: error: [lock.not.held] lockedByThis.field = new Object(); // error } } @@ -63,7 +63,7 @@ void rightLockb() { } // accessing after the synchronized object - // :: error: (lock.not.held) + // :: error: [lock.not.held] lockedByThis.field = new Object(); // error } @@ -78,24 +78,24 @@ void test() { synchronized (this) { lockedByThis.field = new Object(); - // :: error: (lock.not.held) + // :: error: [lock.not.held] a.lockedByThis.field = new Object(); // error - // :: error: (lock.not.held) + // :: error: [lock.not.held] b.lockedByThis.field = new Object(); // error } synchronized (a) { - // :: error: (lock.not.held) + // :: error: [lock.not.held] lockedByThis.field = new Object(); // error a.lockedByThis.field = new Object(); - // :: error: (lock.not.held) + // :: error: [lock.not.held] b.lockedByThis.field = new Object(); // error } synchronized (b) { - // :: error: (lock.not.held) + // :: error: [lock.not.held] lockedByThis.field = new Object(); // error - // :: error: (lock.not.held) + // :: error: [lock.not.held] a.lockedByThis.field = new Object(); // error b.lockedByThis.field = new Object(); } diff --git a/checker/tests/lock/GuardSatisfiedTest.java b/checker/tests/lock/GuardSatisfiedTest.java index d49b32a486a6..9d3323105619 100644 --- a/checker/tests/lock/GuardSatisfiedTest.java +++ b/checker/tests/lock/GuardSatisfiedTest.java @@ -11,9 +11,9 @@ void testGuardSatisfiedIndexMatching( @GuardSatisfied Object q) { methodToCall1(o, o); methodToCall1(p, p); - // :: error: (guardsatisfied.parameters.must.match) + // :: error: [guardsatisfied.parameters.must.match] methodToCall1(o, p); - // :: error: (guardsatisfied.parameters.must.match) + // :: error: [guardsatisfied.parameters.must.match] methodToCall1(p, o); } @@ -21,7 +21,7 @@ void testGuardSatisfiedIndexMatching( void testDefaulting(Object mustDefaultToGuardedByNothing, @GuardSatisfied Object p) { // Must assign in this direction to test the defaulting because assigning a RHS of // @GuardedBy({}) to a LHS @GuardSatisfied is legal. - // :: error: (assignment) + // :: error: [assignment] mustDefaultToGuardedByNothing = p; @GuardedBy({}) Object q = mustDefaultToGuardedByNothing; } @@ -33,21 +33,21 @@ void testMethodCall( @GuardSatisfied Object q) { // Test matching parameters - // :: error: (lock.not.held) + // :: error: [lock.not.held] methodToCall1(o, o); - // :: error: (lock.not.held) :: error: (guardsatisfied.parameters.must.match) + // :: error: [lock.not.held] :: error: [guardsatisfied.parameters.must.match] methodToCall1(o, p); - // :: error: (lock.not.held) + // :: error: [lock.not.held] methodToCall1(p, p); synchronized (lock2) { - // :: error: (lock.not.held) + // :: error: [lock.not.held] methodToCall1(o, o); - // :: error: (guardsatisfied.parameters.must.match) :: error: (lock.not.held) + // :: error: [guardsatisfied.parameters.must.match] :: error: [lock.not.held] methodToCall1(o, p); methodToCall1(p, p); synchronized (lock1) { methodToCall1(o, o); - // :: error: (guardsatisfied.parameters.must.match) + // :: error: [guardsatisfied.parameters.must.match] methodToCall1(o, p); methodToCall1(p, p); } @@ -55,53 +55,53 @@ void testMethodCall( // Test a return type matching a parameter. - // :: error: (lock.not.held) + // :: error: [lock.not.held] o = methodToCall2(o); - // :: error: (lock.not.held) :: error: (assignment) + // :: error: [lock.not.held] :: error: [assignment] p = methodToCall2(o); - // :: error: (lock.not.held) + // :: error: [lock.not.held] methodToCall2(o); - // :: error: (lock.not.held) + // :: error: [lock.not.held] methodToCall2(p); synchronized (lock2) { - // :: error: (lock.not.held) + // :: error: [lock.not.held] o = methodToCall2(o); - // :: error: (lock.not.held) :: error: (assignment) + // :: error: [lock.not.held] :: error: [assignment] p = methodToCall2(o); - // :: error: (lock.not.held) + // :: error: [lock.not.held] methodToCall2(o); methodToCall2(p); } synchronized (lock1) { o = methodToCall2(o); - // :: error: (assignment) + // :: error: [assignment] p = methodToCall2(o); methodToCall2(o); - // :: error: (lock.not.held) + // :: error: [lock.not.held] methodToCall2(p); } // Test the receiver type matching a parameter // Two @GS parameters with no index are incomparable (as is the case for 'this' and 'q'). - // :: error: (guardsatisfied.parameters.must.match) + // :: error: [guardsatisfied.parameters.must.match] methodToCall3(q); - // :: error: (guardsatisfied.parameters.must.match) :: error: (lock.not.held) + // :: error: [guardsatisfied.parameters.must.match] :: error: [lock.not.held] methodToCall3(p); synchronized (lock1) { // Two @GS parameters with no index are incomparable (as is the case for 'this' and // 'q'). - // :: error: (guardsatisfied.parameters.must.match) + // :: error: [guardsatisfied.parameters.must.match] methodToCall3(q); - // :: error: (guardsatisfied.parameters.must.match) :: error: (lock.not.held) + // :: error: [guardsatisfied.parameters.must.match] :: error: [lock.not.held] methodToCall3(p); synchronized (lock2) { // Two @GS parameters with no index are incomparable (as is the case for 'this' and // 'q'). - // :: error: (guardsatisfied.parameters.must.match) + // :: error: [guardsatisfied.parameters.must.match] methodToCall3(q); - // :: error: (guardsatisfied.parameters.must.match) + // :: error: [guardsatisfied.parameters.must.match] methodToCall3(p); } } @@ -114,14 +114,14 @@ void testMethodCall( // Test the return type NOT matching the receiver type void testMethodCall(@GuardedBy("lock1") GuardSatisfiedTest this) { @GuardedBy("lock2") Object g; - // :: error: (lock.not.held) + // :: error: [lock.not.held] methodToCall4(); // TODO: lock.not.held is getting swallowed below // error (assignment) error (lock.not.held) // g = methodToCall4(); // Separate the above test case into two for now - // :: error: (lock.not.held) + // :: error: [lock.not.held] methodToCall4(); // The following error is due to the fact that you cannot access "this.lock1" without first @@ -129,17 +129,17 @@ void testMethodCall(@GuardedBy("lock1") GuardSatisfiedTest this) { // with "this.lock1". The current object could instead be guarded by "" or by some // other lock expression that is not one of its fields. We are keeping this test case here // to make sure this scenario issues a warning. - // :: error: (lock.not.held) + // :: error: [lock.not.held] synchronized (lock1) { - // :: error: (assignment) + // :: error: [assignment] g = methodToCall4(); } } - // :: error: (guardsatisfied.return.must.have.index) + // :: error: [guardsatisfied.return.must.have.index] @GuardSatisfied Object testReturnTypesMustMatchAndMustHaveAnIndex1(@GuardSatisfied Object o) { // If the two @GuardSatisfied had an index, this error would not be issued: - // :: error: (guardsatisfied.assignment.disallowed) + // :: error: [guardsatisfied.assignment.disallowed] return o; } @@ -152,26 +152,26 @@ void testMethodCall(@GuardedBy("lock1") GuardSatisfiedTest this) { } // @GuardSatisfied is equivalent to @GuardSatisfied(-1). - // :: error: (guardsatisfied.return.must.have.index) + // :: error: [guardsatisfied.return.must.have.index] @GuardSatisfied Object testReturnTypesMustMatchAndMustHaveAnIndex4(@GuardSatisfied(-1) Object o) { // If the two @GuardSatisfied had an index, this error would not be issued: - // :: error: (guardsatisfied.assignment.disallowed) + // :: error: [guardsatisfied.assignment.disallowed] return o; } @GuardSatisfied(1) Object testReturnTypesMustMatchAndMustHaveAnIndex5(@GuardSatisfied(2) Object o) { - // :: error: (return) + // :: error: [return] return o; } - // :: error: (guardsatisfied.return.must.have.index) + // :: error: [guardsatisfied.return.must.have.index] @GuardSatisfied Object testReturnTypesMustMatchAndMustHaveAnIndex6(@GuardSatisfied(2) Object o) { - // :: error: (return) + // :: error: [return] return o; } void testParamsMustMatch(@GuardSatisfied(1) Object o, @GuardSatisfied(2) Object p) { - // :: error: (assignment) + // :: error: [assignment] o = p; } @@ -200,10 +200,10 @@ void methodToCall3(@GuardSatisfied(1) GuardSatisfiedTest this, @GuardSatisfied(1 void testAssignment(@GuardSatisfied Object o) { @GuardedBy({"lock1", "lock2"}) Object p = guardedByLock1Lock2(); - // :: error: (lock.not.held) + // :: error: [lock.not.held] o = p; synchronized (lock1) { - // :: error: (lock.not.held) + // :: error: [lock.not.held] o = p; synchronized (lock2) { o = p; @@ -218,16 +218,16 @@ void testAssignment(@GuardSatisfied Object o) { // definition, fields and non-parameter local variables cannot be in one of these locations on a // method declaration, but other locations can be. - // :: error: (guardsatisfied.location.disallowed) + // :: error: [guardsatisfied.location.disallowed] @GuardSatisfied Object field; - // :: error: (guardsatisfied.location.disallowed) + // :: error: [guardsatisfied.location.disallowed] void testGuardSatisfiedOnArrayElementAndLocalVariable(@GuardSatisfied Object[] array) { - // :: error: (guardsatisfied.location.disallowed) + // :: error: [guardsatisfied.location.disallowed] @GuardSatisfied Object local; } - // :: error: (guardsatisfied.location.disallowed) + // :: error: [guardsatisfied.location.disallowed] T testGuardSatisfiedOnBound(T t) { return t; } @@ -240,16 +240,16 @@ void testGuardSatisfiedOnArrayOfParameterizedType( MyParameterizedClass1 @GuardSatisfied [] array) {} void testGuardSatisfiedOnArrayComponentOfParameterizedType( - // :: error: (guardsatisfied.location.disallowed) + // :: error: [guardsatisfied.location.disallowed] @GuardSatisfied MyParameterizedClass1[] array) {} } void testGuardSatisfiedOnWildCardExtendsBound( - // :: error: (guardsatisfied.location.disallowed) + // :: error: [guardsatisfied.location.disallowed] MyParameterizedClass1 l) {} void testGuardSatisfiedOnWildCardSuperBound( - // :: error: (guardsatisfied.location.disallowed) + // :: error: [guardsatisfied.location.disallowed] MyParameterizedClass1 l) {} @GuardSatisfied(1) Object testGuardSatisfiedOnParameters( @@ -262,13 +262,13 @@ void testGuardSatisfiedOnWildCardSuperBound( void testGuardSatisfiedOnArray1(Object @GuardSatisfied [][][] array) {} - // :: error: (guardsatisfied.location.disallowed) + // :: error: [guardsatisfied.location.disallowed] void testGuardSatisfiedOnArray2(@GuardSatisfied Object[][][] array) {} - // :: error: (guardsatisfied.location.disallowed) + // :: error: [guardsatisfied.location.disallowed] void testGuardSatisfiedOnArray3(Object[] @GuardSatisfied [][] array) {} - // :: error: (guardsatisfied.location.disallowed) + // :: error: [guardsatisfied.location.disallowed] void testGuardSatisfiedOnArray4(Object[][] @GuardSatisfied [] array) {} } @@ -277,9 +277,9 @@ class Foo { void m1() {} @MayReleaseLocks - // :: error: (guardsatisfied.with.mayreleaselocks) + // :: error: [guardsatisfied.with.mayreleaselocks] void m2(@GuardSatisfied Foo f) { - // :: error: (method.invocation) + // :: error: [method.invocation] f.m1(); } @@ -289,7 +289,7 @@ void m2_2(Foo f) { } void m3(@GuardSatisfied Foo f) { - // :: error: (method.guarantee.violated) :: error: (method.invocation) + // :: error: [method.guarantee.violated] :: error: [method.invocation] f.m1(); } diff --git a/checker/tests/lock/GuardedByLocalVariable.java b/checker/tests/lock/GuardedByLocalVariable.java index 1567a23042a6..16bf5fea222f 100644 --- a/checker/tests/lock/GuardedByLocalVariable.java +++ b/checker/tests/lock/GuardedByLocalVariable.java @@ -8,7 +8,7 @@ public class GuardedByLocalVariable { public static void localVariableShadowing() { - // :: error: (expression.unparsable) + // :: error: [expression.unparsable] @GuardedBy("m0") Object kk; { @SuppressWarnings("assignment") // prevent flow-sensitive type refinement @@ -28,7 +28,7 @@ public static void localVariableShadowing() { } public static void invalidLocalVariable() { - // :: error: (expression.unparsable) + // :: error: [expression.unparsable] @GuardedBy("foobar") Object kk; } diff --git a/checker/tests/lock/Issue152.java b/checker/tests/lock/Issue152.java index a287984d8a7a..0c30149ca8f0 100644 --- a/checker/tests/lock/Issue152.java +++ b/checker/tests/lock/Issue152.java @@ -17,7 +17,7 @@ static class SubClass extends SuperClass { private @GuardedBy("myLock") Object locked; void method() { - // :: error: (assignment) + // :: error: [assignment] this.locked = super.locked; } } @@ -30,7 +30,7 @@ class OuterClass { class InnerClass { private final Object lock = new Object(); - // :: error: (assignment) + // :: error: [assignment] @GuardedBy("this.lock") Object field2 = field; } } diff --git a/checker/tests/lock/Issue2163Lock.java b/checker/tests/lock/Issue2163Lock.java index 5a842bc85cc3..76406133369c 100644 --- a/checker/tests/lock/Issue2163Lock.java +++ b/checker/tests/lock/Issue2163Lock.java @@ -4,7 +4,7 @@ public class Issue2163Lock { @GuardedBy Issue2163Lock() {} void test() { - // :: error: (constructor.invocation) :: error: (guardsatisfied.location.disallowed) + // :: error: [constructor.invocation] :: error: [guardsatisfied.location.disallowed] new @GuardSatisfied Issue2163Lock(); } } diff --git a/checker/tests/lock/Issue524.java b/checker/tests/lock/Issue524.java index 98392284aa73..0b181f5188a3 100644 --- a/checker/tests/lock/Issue524.java +++ b/checker/tests/lock/Issue524.java @@ -30,14 +30,14 @@ void testLocalVariables() { { @SuppressWarnings("assignment") // prevent flow-sensitive type refinement - // :: error: (lock.expression.not.final) + // :: error: [lock.expression.not.final] @GuardedBy("localLock") MyClass q = someValue(); localLock.lock(); localLock.lock(); // Without a fix for issue 524 in place, the error lock.not.held // (unguarded access to field, variable or parameter 'q' guarded by 'localLock') is // issued for the following line. - // :: error: (expression.unparsable) + // :: error: [expression.unparsable] q.field.toString(); } } diff --git a/checker/tests/lock/Issue804.java b/checker/tests/lock/Issue804.java index be279ca80ba2..cef6ffd9bd32 100644 --- a/checker/tests/lock/Issue804.java +++ b/checker/tests/lock/Issue804.java @@ -15,7 +15,7 @@ void bar() { @MayReleaseLocks void method() { bar(); - // :: error: (contracts.precondition) + // :: error: [contracts.precondition] bar(); } } diff --git a/checker/tests/lock/Issue805.java b/checker/tests/lock/Issue805.java index 301212d83fea..2a51b24db05d 100644 --- a/checker/tests/lock/Issue805.java +++ b/checker/tests/lock/Issue805.java @@ -5,7 +5,7 @@ public class Issue805 { @Holding("this.Issue805.class") - // :: error: (flowexpr.parse.error) + // :: error: [flowexpr.parse.error] void method() {} @Holding("Issue805.class") diff --git a/checker/tests/lock/ItselfExpressionCases.java b/checker/tests/lock/ItselfExpressionCases.java index e2a0e0f6fe0b..fdf0f02f3770 100644 --- a/checker/tests/lock/ItselfExpressionCases.java +++ b/checker/tests/lock/ItselfExpressionCases.java @@ -20,18 +20,18 @@ public class ItselfExpressionCases { private @GuardedBy({""}) MyClass getm2(@GuardedBy("") ItselfExpressionCases this) { // The following error is due to the precondition of the this.m field dereference not being // satisfied. - // :: error: (lock.not.held) + // :: error: [lock.not.held] return m; } @Pure private Object getmfield() { - // :: error: (lock.not.held) + // :: error: [lock.not.held] return getm().field; } public void arrayTest(final Object @GuardedBy("") [] a1) { - // :: error: (lock.not.held) + // :: error: [lock.not.held] Object a = a1[0]; synchronized (a1) { a = a1[0]; @@ -46,7 +46,7 @@ public void arrayTest(final Object @GuardedBy("") [] a1) { } public void arrayTest() { - // :: error: (lock.not.held) + // :: error: [lock.not.held] Object a = geta2()[0]; synchronized (geta2()) { a = geta2()[0]; @@ -57,49 +57,49 @@ public void testCheckPreconditions( final @GuardedBy("") MyClass o, @GuardSatisfied Object gs, @GuardSatisfied MyClass gsMyClass) { - // :: error: (lock.not.held) + // :: error: [lock.not.held] getm().field = new Object(); synchronized (getm()) { getm().field = new Object(); } - // :: error: (lock.not.held) + // :: error: [lock.not.held] m.field = new Object(); synchronized (m) { m.field = new Object(); } - // :: error: (lock.not.held) + // :: error: [lock.not.held] gs = m.field; synchronized (m) { gs = m.field; } - // :: error: (lock.not.held) + // :: error: [lock.not.held] gs = getm().field; synchronized (getm()) { gs = getm().field; } - // :: error: (lock.not.held) + // :: error: [lock.not.held] gsMyClass = getm(); synchronized (getm()) { gsMyClass = getm(); } - // :: error: (lock.not.held) :: error: (contracts.precondition) + // :: error: [lock.not.held] :: error: [contracts.precondition] o.foo(); synchronized (o) { - // :: error: (contracts.precondition) + // :: error: [contracts.precondition] o.foo(); synchronized (somelock) { // o.foo() requires o.somelock is held, not this.somelock. - // :: error: (contracts.precondition) + // :: error: [contracts.precondition] o.foo(); } } - // :: error: (lock.not.held) + // :: error: [lock.not.held] o.foo2(); synchronized (o) { o.foo2(); @@ -115,15 +115,15 @@ void foo(@GuardSatisfied MyClass this) {} void foo2(@GuardSatisfied MyClass this) {} void method(@GuardedBy("") MyClass this) { - // :: error: (lock.not.held) :: error: (contracts.precondition) + // :: error: [lock.not.held] :: error: [contracts.precondition] this.foo(); - // :: error: (lock.not.held):: error: (contracts.precondition) + // :: error: [lock.not.held]:: error: [contracts.precondition] foo(); - // :: error: (lock.not.held) + // :: error: [lock.not.held] synchronized (somelock) { - // :: error: (lock.not.held) + // :: error: [lock.not.held] this.foo(); - // :: error: (lock.not.held) + // :: error: [lock.not.held] foo(); synchronized (this) { this.foo(); @@ -131,9 +131,9 @@ void method(@GuardedBy("") MyClass this) { } } - // :: error: (lock.not.held) + // :: error: [lock.not.held] this.foo2(); - // :: error: (lock.not.held) + // :: error: [lock.not.held] foo2(); synchronized (this) { this.foo2(); diff --git a/checker/tests/lock/JCIPAnnotations.java b/checker/tests/lock/JCIPAnnotations.java index faed7d99bc11..d1ea4685dfc2 100644 --- a/checker/tests/lock/JCIPAnnotations.java +++ b/checker/tests/lock/JCIPAnnotations.java @@ -29,24 +29,24 @@ void methodWithGuardSatisfiedReceiver(@GuardSatisfied MyClass this) {} // Tests that Javax and JCIP @GuardedBy(...) typecheck against the Lock Checker @GuardedBy on a // receiver. void testReceivers() { - // :: error: (method.invocation) + // :: error: [method.invocation] jcipGuardedField.methodWithUnguardedReceiver(); - // :: error: (method.invocation) + // :: error: [method.invocation] jcipGuardedField.methodWithGuardedReceiver(); - // :: error: (lock.not.held) + // :: error: [lock.not.held] jcipGuardedField.methodWithGuardSatisfiedReceiver(); - // :: error: (method.invocation) + // :: error: [method.invocation] javaxGuardedField.methodWithUnguardedReceiver(); - // :: error: (method.invocation) + // :: error: [method.invocation] javaxGuardedField.methodWithGuardedReceiver(); - // :: error: (lock.not.held) + // :: error: [lock.not.held] javaxGuardedField.methodWithGuardSatisfiedReceiver(); } void testDereferences() { - // :: error: (lock.not.held) + // :: error: [lock.not.held] this.jcipGuardedField.field.toString(); - // :: error: (lock.not.held) + // :: error: [lock.not.held] this.javaxGuardedField.field.toString(); synchronized (lock) { this.jcipGuardedField.field.toString(); @@ -73,42 +73,42 @@ void testGuardedByAsHolding3() { synchronized (lock) { testGuardedByAsHolding(); } - // :: error: (contracts.precondition) + // :: error: [contracts.precondition] testGuardedByAsHolding(); } @Holding("lock") @GuardedBy("lock") - // :: error: (multiple.lock.precondition.annotations) + // :: error: [multiple.lock.precondition.annotations] void testMultipleMethodAnnotations1() {} @Holding("lock") @javax.annotation.concurrent.GuardedBy("lock") - // :: error: (multiple.lock.precondition.annotations) + // :: error: [multiple.lock.precondition.annotations] void testMultipleMethodAnnotations2() {} @GuardedBy("lock") @javax.annotation.concurrent.GuardedBy("lock") - // :: error: (multiple.lock.precondition.annotations) + // :: error: [multiple.lock.precondition.annotations] void testMultipleMethodAnnotations3() {} @Holding("lock") @GuardedBy("lock") @javax.annotation.concurrent.GuardedBy("lock") - // :: error: (multiple.lock.precondition.annotations) + // :: error: [multiple.lock.precondition.annotations] void testMultipleMethodAnnotations4() {} @GuardedBy("lock") @org.checkerframework.checker.lock.qual.GuardedBy("lock") - // :: error: (multiple.guardedby.annotations) + // :: error: [multiple.guardedby.annotations] Object fieldWithMultipleGuardedByAnnotations1; @javax.annotation.concurrent.GuardedBy("lock") @org.checkerframework.checker.lock.qual.GuardedBy("lock") - // :: error: (multiple.guardedby.annotations) + // :: error: [multiple.guardedby.annotations] Object fieldWithMultipleGuardedByAnnotations2; @GuardedBy("lock") @javax.annotation.concurrent.GuardedBy("lock") - // :: error: (multiple.guardedby.annotations) + // :: error: [multiple.guardedby.annotations] Object fieldWithMultipleGuardedByAnnotations3; @GuardedBy("lock") @javax.annotation.concurrent.GuardedBy("lock") @org.checkerframework.checker.lock.qual.GuardedBy("lock") - // :: error: (multiple.guardedby.annotations) + // :: error: [multiple.guardedby.annotations] Object fieldWithMultipleGuardedByAnnotations4; } diff --git a/checker/tests/lock/JavaExpressionsTest.java b/checker/tests/lock/JavaExpressionsTest.java index b0720d331e59..f35ae0f9a8aa 100644 --- a/checker/tests/lock/JavaExpressionsTest.java +++ b/checker/tests/lock/JavaExpressionsTest.java @@ -20,9 +20,9 @@ class MyClass { } public void method() { - // :: error: (lock.not.held) + // :: error: [lock.not.held] getm().field = new Object(); - // :: error: (lock.not.held) + // :: error: [lock.not.held] m.field = new Object(); // TODO: fix the Lock Checker code so that a flowexpr.parse.error is issued (due to the // guard of "nonexistentfield" on m2) diff --git a/checker/tests/lock/LockEffectAnnotations.java b/checker/tests/lock/LockEffectAnnotations.java index 8107d6a4481d..b9100abf36c3 100644 --- a/checker/tests/lock/LockEffectAnnotations.java +++ b/checker/tests/lock/LockEffectAnnotations.java @@ -40,11 +40,11 @@ void myUnlockingMethod() { void myReleaseLocksEmptyMethod() {} @MayReleaseLocks - // :: error: (guardsatisfied.with.mayreleaselocks) + // :: error: [guardsatisfied.with.mayreleaselocks] void methodGuardSatisfiedReceiver(@GuardSatisfied LockEffectAnnotations this) {} @MayReleaseLocks - // :: error: (guardsatisfied.with.mayreleaselocks) + // :: error: [guardsatisfied.with.mayreleaselocks] void methodGuardSatisfiedParameter(@GuardSatisfied Object o) {} @MayReleaseLocks @@ -57,13 +57,13 @@ void myOtherMethod() { x3.field = new Object(); // OK: the lock is still held since mySideEffectFreeMethod is // side-effect-free myUnlockingMethod(); - // :: error: (lock.not.held) + // :: error: [lock.not.held] x3.field = new Object(); // ILLEGAL: myLockingMethod is not locking-free } if (myLock2.tryLock()) { x3.field = new Object(); // OK: the lock is held myReleaseLocksEmptyMethod(); - // :: error: (lock.not.held) + // :: error: [lock.not.held] x3.field = new Object(); // ILLEGAL: even though myUnannotatedEmptyMethod is empty, since // myReleaseLocksEmptyMethod() is annotated with @MayReleaseLocks and the Lock Checker // no longer knows the state of the lock. @@ -81,7 +81,7 @@ void innerClassMethod() {} } InnerClass ic = new InnerClass(); - // :: error: (method.guarantee.violated) + // :: error: [method.guarantee.violated] ic.innerClassMethod(); } @@ -92,15 +92,15 @@ synchronized void mayReleaseLocksSynchronizedMethod() {} synchronized void releasesNoLocksSynchronizedMethod() {} @LockingFree - // :: error: (lockingfree.synchronized.method) + // :: error: [lockingfree.synchronized.method] synchronized void lockingFreeSynchronizedMethod() {} @SideEffectFree - // :: error: (lockingfree.synchronized.method) + // :: error: [lockingfree.synchronized.method] synchronized void sideEffectFreeSynchronizedMethod() {} @Pure - // :: error: (lockingfree.synchronized.method) + // :: error: [lockingfree.synchronized.method] synchronized void pureSynchronizedMethod() {} @MayReleaseLocks @@ -117,36 +117,36 @@ void releasesNoLocksMethodWithSynchronizedBlock() { @LockingFree void lockingFreeMethodWithSynchronizedBlock() { - // :: error: (synchronized.block.in.lockingfree.method) + // :: error: [synchronized.block.in.lockingfree.method] synchronized (this) { } } @SideEffectFree void sideEffectFreeMethodWithSynchronizedBlock() { - // :: error: (synchronized.block.in.lockingfree.method) + // :: error: [synchronized.block.in.lockingfree.method] synchronized (this) { } } @Pure void pureMethodWithSynchronizedBlock() { - // :: error: (synchronized.block.in.lockingfree.method) + // :: error: [synchronized.block.in.lockingfree.method] synchronized (this) { } } - // :: warning: (inconsistent.constructor.type) + // :: warning: [inconsistent.constructor.type] @GuardedByUnknown class MyClass2 {} - // :: error: (expression.unparsable) + // :: error: [expression.unparsable] @GuardedBy("lock") class MyClass3 {} @GuardedBy({}) class MyClass4 {} - // :: error: (guardsatisfied.location.disallowed) + // :: error: [guardsatisfied.location.disallowed] @GuardSatisfied class MyClass5 {} - // :: error: (super.invocation) :: warning: (inconsistent.constructor.type) + // :: error: [super.invocation] :: warning: [inconsistent.constructor.type] @GuardedByBottom class MyClass6 {} } diff --git a/checker/tests/lock/LockExpressionIsFinal.java b/checker/tests/lock/LockExpressionIsFinal.java index 521ad88a6dfb..a5b3a934caf8 100644 --- a/checker/tests/lock/LockExpressionIsFinal.java +++ b/checker/tests/lock/LockExpressionIsFinal.java @@ -48,7 +48,7 @@ void testSynchronizedExpressionIsFinal(boolean b) { Object o2 = new Object(); // o2 is reassigned later - it is not effectively final synchronized (o1) { } - // :: error: (lock.expression.not.final) + // :: error: [lock.expression.not.final] synchronized (o2) { } @@ -59,7 +59,7 @@ void testSynchronizedExpressionIsFinal(boolean b) { } // Test a tree that is not supported by LockVisitor.ensureExpressionIsEffectivelyFinal - // :: error: (lock.expression.possibly.not.final) + // :: error: [lock.expression.possibly.not.final] synchronized (c1.getFieldPure(b ? c1 : o1, c1)) { } @@ -73,14 +73,14 @@ void testSynchronizedExpressionIsFinal(boolean b) { // in each. synchronized ( - // :: error: (lock.expression.not.final) + // :: error: [lock.expression.not.final] c1.field.field2.field.getFieldPure( c1.field, c1.getFieldDeterministic().getFieldPure(c1, c1.field)) .field) { } synchronized ( c1.field.field.field.getFieldPure( - // :: error: (lock.expression.not.final) + // :: error: [lock.expression.not.final] c1.field, c1.getField().getFieldPure(c1, c1.field)) .field) { } @@ -119,18 +119,18 @@ void testExplicitLockExpressionIsFinal(boolean b) { new ReentrantLock(); // rl2 is reassigned later - it is not effectively final rl1.lock(); rl1.unlock(); - // :: error: (lock.expression.not.final) + // :: error: [lock.expression.not.final] rl2.lock(); - // :: error: (lock.expression.not.final) + // :: error: [lock.expression.not.final] rl2.unlock(); rl2 = new ReentrantLock(); // Reassignment that makes rl2 not have been effectively final // earlier. // Test a tree that is not supported by LockVisitor.ensureExpressionIsEffectivelyFinal - // :: error: (lock.expression.possibly.not.final) + // :: error: [lock.expression.possibly.not.final] c2.getFieldPure(b ? c2 : rl1, c2).lock(); - // :: error: (lock.expression.possibly.not.final) + // :: error: [lock.expression.possibly.not.final] c2.getFieldPure(b ? c2 : rl1, c2).unlock(); c2.field @@ -150,14 +150,14 @@ void testExplicitLockExpressionIsFinal(boolean b) { // in each. c2.field - // :: error: (lock.expression.not.final) + // :: error: [lock.expression.not.final] .field2 .field .getFieldPure(c2.field, c2.getFieldDeterministic().getFieldPure(c2, c2.field)) .field .lock(); c2.field - // :: error: (lock.expression.not.final) + // :: error: [lock.expression.not.final] .field2 .field .getFieldPure(c2.field, c2.getFieldDeterministic().getFieldPure(c2, c2.field)) @@ -167,14 +167,14 @@ void testExplicitLockExpressionIsFinal(boolean b) { c2.field .field .field - // :: error: (lock.expression.not.final) + // :: error: [lock.expression.not.final] .getFieldPure(c2.field, c2.getField().getFieldPure(c2, c2.field)) .field .lock(); c2.field .field .field - // :: error: (lock.expression.not.final) + // :: error: [lock.expression.not.final] .getFieldPure(c2.field, c2.getField().getFieldPure(c2, c2.field)) .field .unlock(); @@ -191,12 +191,12 @@ void testGuardedByExpressionIsFinal() { o2 = new Object(); @GuardedBy("o1") Object guarded2 = new Object(); - // :: error: (lock.expression.not.final) + // :: error: [lock.expression.not.final] @GuardedBy("o2") Object guarded3 = new Object(); // Test expressions that are not supported by LockVisitor.ensureExpressionIsEffectivelyFinal @GuardedBy("java.lang.String.class") Object guarded4; - // :: error: (expression.unparsable) + // :: error: [expression.unparsable] @GuardedBy("c1.getFieldPure(b ? c1 : o1, c1)") Object guarded5; @GuardedBy( @@ -209,45 +209,45 @@ void testGuardedByExpressionIsFinal() { // The following negative test cases are the same as the one above but with one modification // in each. - // :: error: (lock.expression.not.final) + // :: error: [lock.expression.not.final] @GuardedBy("c1.field.field2.field.getFieldPure2().getFieldDeterministic().field") Object guarded8; - // :: error: (lock.expression.not.final) + // :: error: [lock.expression.not.final] @GuardedBy("c1.field.field.field.getField().getFieldDeterministic().field") Object guarded9; // Additional test cases to test that method parameters (in this case the parameters to // getFieldPure) are parsed. @GuardedBy("c1.field.field.field.getFieldPure(c1, c1).getFieldDeterministic().field") Object guarded10; @GuardedBy("c1.field.field.field.getFieldPure(c1, o1).getFieldDeterministic().field") Object guarded11; - // :: error: (lock.expression.not.final) + // :: error: [lock.expression.not.final] @GuardedBy("c1.field.field.field.getFieldPure(c1, o2).getFieldDeterministic().field") Object guarded12; // Test that @GuardedBy annotations on various tree kinds inside a method are visited Object guarded13 = (@GuardedBy("o1") Object) guarded2; - // :: error: (lock.expression.not.final) + // :: error: [lock.expression.not.final] Object guarded14 = (@GuardedBy("o2") Object) guarded3; @GuardedBy("o1") Object guarded15[] = new @GuardedBy("o1") MyClass[3]; - // :: error: (lock.expression.not.final) + // :: error: [lock.expression.not.final] @GuardedBy("o2") Object guarded16[] = new @GuardedBy("o2") MyClass[3]; // Tests that the location of the @GB annotation inside a VariableTree does not matter (i.e. // it does not need to be the leftmost subtree). Object guarded17 @GuardedBy("o1") []; - // :: error: (lock.expression.not.final) + // :: error: [lock.expression.not.final] Object guarded18 @GuardedBy("o2") []; @GuardedBy("o1") Object guarded19[]; - // :: error: (lock.expression.not.final) + // :: error: [lock.expression.not.final] @GuardedBy("o2") Object guarded20[]; MyParameterizedClass1<@GuardedBy("o1") Object> m1; - // :: error: (lock.expression.not.final) + // :: error: [lock.expression.not.final] MyParameterizedClass1<@GuardedBy("o2") Object> m2; boolean b = c1 instanceof @GuardedBy("o1") Object; // instanceof expression have not effect on the type. - // // :: error: (lock.expression.not.final) + // // :: error: [lock.expression.not.final] b = c1 instanceof @GuardedBy("o2") Object; // Additional tests just outside of this method below: @@ -265,7 +265,7 @@ void testGuardedByExpressionIsFinal() { return null; } - // :: error: (lock.expression.not.final) + // :: error: [lock.expression.not.final] @GuardedBy("nonFinalField") Object testGuardedByExprIsFinal2() { return null; } @@ -274,7 +274,7 @@ void testGuardedByExpressionIsFinal() { return t; } - // :: error: (lock.expression.not.final) + // :: error: [lock.expression.not.final] T myMethodThatReturnsT_2(T t) { return t; } @@ -282,11 +282,11 @@ void testGuardedByExpressionIsFinal() { class MyParameterizedClass1 {} MyParameterizedClass1 m1; - // :: error: (lock.expression.not.final) + // :: error: [lock.expression.not.final] MyParameterizedClass1 m2; MyParameterizedClass1 m3; - // :: error: (lock.expression.not.final) + // :: error: [lock.expression.not.final] MyParameterizedClass1 m4; class MyClassContainingALock { @@ -298,7 +298,7 @@ class MyClassContainingALock { void testItselfFinalLock() { @SuppressWarnings("assignment") // prevent flow-sensitive type refinement final @GuardedBy(".finalLock") MyClassContainingALock m = someValue(); - // :: error: (lock.not.held) + // :: error: [lock.not.held] m.field = new Object(); // Ignore this error: it is expected that an error will be issued for dereferencing 'm' in // order to take the 'm.finalLock' lock. Typically, the Lock Checker does not support an @@ -306,7 +306,7 @@ void testItselfFinalLock() { // ReentrantLock field guarding its containing object. This unfortunately makes it a bit // difficult for users since they have to add a @SuppressWarnings for this call while still // making sure that warnings for other dereferences are not suppressed. - // :: error: (lock.not.held) + // :: error: [lock.not.held] m.finalLock.lock(); m.field = new Object(); } @@ -314,11 +314,11 @@ void testItselfFinalLock() { void testItselfNonFinalLock() { @SuppressWarnings("assignment") // prevent flow-sensitive type refinement final @GuardedBy(".nonFinalLock") MyClassContainingALock m = someValue(); - // ::error: (lock.not.held) :: error: (lock.expression.not.final) + // ::error: [lock.not.held] :: error: [lock.expression.not.final] m.field = new Object(); - // ::error: (lock.not.held) :: error: (lock.expression.not.final) + // ::error: [lock.not.held] :: error: [lock.expression.not.final] m.nonFinalLock.lock(); - // :: error: (lock.expression.not.final) + // :: error: [lock.expression.not.final] m.field = new Object(); } diff --git a/checker/tests/lock/Methods.java b/checker/tests/lock/Methods.java index 52c1b64d9c4e..69169d0b6e5e 100644 --- a/checker/tests/lock/Methods.java +++ b/checker/tests/lock/Methods.java @@ -12,22 +12,22 @@ void lockedByThis() {} // unguarded calls void unguardedCalls() { - // :: error: (contracts.precondition) + // :: error: [contracts.precondition] lockedByLock(); // error - // :: error: (contracts.precondition) + // :: error: [contracts.precondition] lockedByThis(); // error } @Holding("lock") void usingHolding1() { lockedByLock(); - // :: error: (contracts.precondition) + // :: error: [contracts.precondition] lockedByThis(); // error } @Holding("this") void usingHolding2() { - // :: error: (contracts.precondition) + // :: error: [contracts.precondition] lockedByLock(); // error lockedByThis(); } @@ -35,21 +35,21 @@ void usingHolding2() { void usingSynchronization1() { synchronized (lock) { lockedByLock(); - // :: error: (contracts.precondition) + // :: error: [contracts.precondition] lockedByThis(); // error } } void usingSynchronization2() { synchronized (this) { - // :: error: (contracts.precondition) + // :: error: [contracts.precondition] lockedByLock(); // error lockedByThis(); } } synchronized void usingMethodModifier() { - // :: error: (contracts.precondition) + // :: error: [contracts.precondition] lockedByLock(); // error lockedByThis(); } diff --git a/checker/tests/lock/Overriding.java b/checker/tests/lock/Overriding.java index 18a8ade398e9..1b10b5aed934 100644 --- a/checker/tests/lock/Overriding.java +++ b/checker/tests/lock/Overriding.java @@ -17,7 +17,7 @@ void guardedByThree() {} @ReleasesNoLocks void rnlMethod() { - // :: error: (method.guarantee.violated) + // :: error: [method.guarantee.violated] mrlMethod(); rnlMethod(); implicitRnlMethod(); @@ -25,7 +25,7 @@ void rnlMethod() { } void implicitRnlMethod() { - // :: error: (method.guarantee.violated) + // :: error: [method.guarantee.violated] mrlMethod(); rnlMethod(); implicitRnlMethod(); @@ -34,11 +34,11 @@ void implicitRnlMethod() { @LockingFree void lfMethod() { - // :: error: (method.guarantee.violated) + // :: error: [method.guarantee.violated] mrlMethod(); - // :: error: (method.guarantee.violated) + // :: error: [method.guarantee.violated] rnlMethod(); - // :: error: (method.guarantee.violated) + // :: error: [method.guarantee.violated] implicitRnlMethod(); lfMethod(); } @@ -74,7 +74,7 @@ void lfMethod3() {} class SubClass extends SuperClass { @Holding({"a", "b"}) // error @Override - // :: error: (contracts.precondition.override) + // :: error: [contracts.precondition.override] void guardedByOne() {} @Holding({"a", "b"}) @@ -87,17 +87,17 @@ void guardedByThree() {} @MayReleaseLocks @Override - // :: error: (override.sideeffect) + // :: error: [override.sideeffect] void rnlMethod() {} @MayReleaseLocks @Override - // :: error: (override.sideeffect) + // :: error: [override.sideeffect] void implicitRnlMethod() {} @ReleasesNoLocks @Override - // :: error: (override.sideeffect) + // :: error: [override.sideeffect] void lfMethod() {} @MayReleaseLocks @@ -135,7 +135,7 @@ void lfMethod3() {} // Test overriding @Holding with JCIP @GuardedBy. class SubClassJcip extends SuperClass { @net.jcip.annotations.GuardedBy({"a", "b"}) @Override - // :: error: (contracts.precondition.override) + // :: error: [contracts.precondition.override] void guardedByOne() {} @net.jcip.annotations.GuardedBy({"a", "b"}) @Override @@ -148,7 +148,7 @@ void guardedByThree() {} // Test overriding @Holding with Javax @GuardedBy. class SubClassJavax extends SuperClass { @javax.annotation.concurrent.GuardedBy({"a", "b"}) @Override - // :: error: (contracts.precondition.override) + // :: error: [contracts.precondition.override] void guardedByOne() {} @javax.annotation.concurrent.GuardedBy({"a", "b"}) @Override diff --git a/checker/tests/lock/PrimitivesLocking.java b/checker/tests/lock/PrimitivesLocking.java index 38ab2845c034..8a722642d44e 100644 --- a/checker/tests/lock/PrimitivesLocking.java +++ b/checker/tests/lock/PrimitivesLocking.java @@ -17,145 +17,145 @@ public void testOperationsWithPrimitives() { // @GuardedByName("lock") boolean b; - // TODO reenable this error: (lock.not.held) + // TODO reenable this error: [lock.not.held] i = i >>> primitive; - // TODO reenable this error: (lock.not.held) + // TODO reenable this error: [lock.not.held] i = primitive >>> i; - // TODO reenable this error: (lock.not.held) + // TODO reenable this error: [lock.not.held] i >>>= primitive; - // TODO reenable this error: (lock.not.held) + // TODO reenable this error: [lock.not.held] primitive >>>= i; - // TODO reenable this error: (lock.not.held) + // TODO reenable this error: [lock.not.held] i %= primitive; - // TODO reenable this error: (lock.not.held) + // TODO reenable this error: [lock.not.held] i = 4 % primitive; - // TODO reenable this error: (lock.not.held) + // TODO reenable this error: [lock.not.held] i = primitive % 4; - // TODO reenable this error: (lock.not.held) + // TODO reenable this error: [lock.not.held] primitive++; - // TODO reenable this error: (lock.not.held) + // TODO reenable this error: [lock.not.held] primitive--; - // TODO reenable this error: (lock.not.held) + // TODO reenable this error: [lock.not.held] ++primitive; - // TODO reenable this error: (lock.not.held) + // TODO reenable this error: [lock.not.held] --primitive; - // TODO reenable this error: (lock.not.held) + // TODO reenable this error: [lock.not.held] if (primitive != 5) {} - // TODO reenable this error: (lock.not.held) + // TODO reenable this error: [lock.not.held] i = primitive >> i; - // TODO reenable this error: (lock.not.held) + // TODO reenable this error: [lock.not.held] i = primitive << i; - // TODO reenable this error: (lock.not.held) + // TODO reenable this error: [lock.not.held] i = i >> primitive; - // TODO reenable this error: (lock.not.held) + // TODO reenable this error: [lock.not.held] i = i << primitive; - // TODO reenable this error: (lock.not.held) + // TODO reenable this error: [lock.not.held] i <<= primitive; - // TODO reenable this error: (lock.not.held) + // TODO reenable this error: [lock.not.held] i >>= primitive; - // TODO reenable this error: (lock.not.held) + // TODO reenable this error: [lock.not.held] primitive <<= i; - // TODO reenable this error: (lock.not.held) + // TODO reenable this error: [lock.not.held] primitive >>= i; - // TODO reenable this error: (lock.not.held) + // TODO reenable this error: [lock.not.held] assert (primitiveBoolean); - // TODO reenable this error: (lock.not.held) + // TODO reenable this error: [lock.not.held] b = primitive >= i; - // TODO reenable this error: (lock.not.held) + // TODO reenable this error: [lock.not.held] b = primitive <= i; - // TODO reenable this error: (lock.not.held) + // TODO reenable this error: [lock.not.held] b = primitive > i; - // TODO reenable this error: (lock.not.held) + // TODO reenable this error: [lock.not.held] b = primitive < i; - // TODO reenable this error: (lock.not.held) + // TODO reenable this error: [lock.not.held] b = i >= primitive; - // TODO reenable this error: (lock.not.held) + // TODO reenable this error: [lock.not.held] b = i <= primitive; - // TODO reenable this error: (lock.not.held) + // TODO reenable this error: [lock.not.held] b = i > primitive; - // TODO reenable this error: (lock.not.held) + // TODO reenable this error: [lock.not.held] b = i < primitive; - // TODO reenable this error: (lock.not.held) + // TODO reenable this error: [lock.not.held] i += primitive; - // TODO reenable this error: (lock.not.held) + // TODO reenable this error: [lock.not.held] i -= primitive; - // TODO reenable this error: (lock.not.held) + // TODO reenable this error: [lock.not.held] i *= primitive; - // TODO reenable this error: (lock.not.held) + // TODO reenable this error: [lock.not.held] i /= primitive; - // TODO reenable this error: (lock.not.held) + // TODO reenable this error: [lock.not.held] i = 4 + primitive; - // TODO reenable this error: (lock.not.held) + // TODO reenable this error: [lock.not.held] i = 4 - primitive; - // TODO reenable this error: (lock.not.held) + // TODO reenable this error: [lock.not.held] i = 4 * primitive; - // TODO reenable this error: (lock.not.held) + // TODO reenable this error: [lock.not.held] i = 4 / primitive; - // TODO reenable this error: (lock.not.held) + // TODO reenable this error: [lock.not.held] i = primitive + 4; - // TODO reenable this error: (lock.not.held) + // TODO reenable this error: [lock.not.held] i = primitive - 4; - // TODO reenable this error: (lock.not.held) + // TODO reenable this error: [lock.not.held] i = primitive * 4; - // TODO reenable this error: (lock.not.held) + // TODO reenable this error: [lock.not.held] i = primitive / 4; - // TODO reenable this error: (lock.not.held) + // TODO reenable this error: [lock.not.held] if (primitiveBoolean) {} - // TODO reenable this error: (lock.not.held) + // TODO reenable this error: [lock.not.held] i = ~primitive; - // TODO reenable this error: (lock.not.held) + // TODO reenable this error: [lock.not.held] b = primitiveBoolean || false; - // TODO reenable this error: (lock.not.held) + // TODO reenable this error: [lock.not.held] b = primitiveBoolean | false; - // TODO reenable this error: (lock.not.held) + // TODO reenable this error: [lock.not.held] b = primitiveBoolean ^ true; - // TODO reenable this error: (lock.not.held) + // TODO reenable this error: [lock.not.held] b &= primitiveBoolean; - // TODO reenable this error: (lock.not.held) + // TODO reenable this error: [lock.not.held] b |= primitiveBoolean; - // TODO reenable this error: (lock.not.held) + // TODO reenable this error: [lock.not.held] b ^= primitiveBoolean; - // TODO reenable this error: (lock.not.held) + // TODO reenable this error: [lock.not.held] b = !primitiveBoolean; - // TODO reenable this error: (lock.not.held) + // TODO reenable this error: [lock.not.held] i = primitive; - // TODO reenable this error: (lock.not.held) + // TODO reenable this error: [lock.not.held] b = true && primitiveBoolean; - // TODO reenable this error: (lock.not.held) + // TODO reenable this error: [lock.not.held] b = true & primitiveBoolean; - // TODO reenable this error: (lock.not.held) + // TODO reenable this error: [lock.not.held] b = false || primitiveBoolean; - // TODO reenable this error: (lock.not.held) + // TODO reenable this error: [lock.not.held] b = false | primitiveBoolean; - // TODO reenable this error: (lock.not.held) + // TODO reenable this error: [lock.not.held] b = false ^ primitiveBoolean; - // TODO reenable this error: (lock.not.held) + // TODO reenable this error: [lock.not.held] b = primitiveBoolean && true; - // TODO reenable this error: (lock.not.held) + // TODO reenable this error: [lock.not.held] b = primitiveBoolean & true; } } diff --git a/checker/tests/lock/SimpleLockTest.java b/checker/tests/lock/SimpleLockTest.java index 3709f9900a8e..8752d285a506 100644 --- a/checker/tests/lock/SimpleLockTest.java +++ b/checker/tests/lock/SimpleLockTest.java @@ -5,22 +5,22 @@ public class SimpleLockTest { final Object lock1 = new Object(), lock2 = new Object(); void testMethodCall(@GuardedBy("lock1") SimpleLockTest this) { - // :: error: (lock.not.held) + // :: error: [lock.not.held] synchronized (lock1) { } - // :: error: (lock.not.held) + // :: error: [lock.not.held] synchronized (this.lock1) { } - // :: error: (lock.not.held) + // :: error: [lock.not.held] synchronized (lock2) { } - // :: error: (lock.not.held) + // :: error: [lock.not.held] synchronized (this.lock2) { } @SuppressWarnings({"assignment", "method.invocation"}) // prevent flow-sensitive type refinement final @GuardedBy("myClass.field") MyClass myClass = someValue(); - // :: error: (lock.not.held) + // :: error: [lock.not.held] synchronized (myClass.field) { } synchronized (myClass) { diff --git a/checker/tests/lock/Strings.java b/checker/tests/lock/Strings.java index 5328a0d3d980..f64dd8b19cbd 100644 --- a/checker/tests/lock/Strings.java +++ b/checker/tests/lock/Strings.java @@ -24,21 +24,21 @@ void StringIsGBnothing( void StringConcat(@GuardedBy("lock") MyClass param) { { String s1a = "a" + "a"; - // :: error: (lock.not.held) + // :: error: [lock.not.held] String s1b = "a" + param; - // :: error: (lock.not.held) + // :: error: [lock.not.held] String s1c = param + "a"; - // :: error: (lock.not.held) + // :: error: [lock.not.held] String s1d = param.toString(); String s2 = "a"; - // :: error: (lock.not.held) + // :: error: [lock.not.held] s2 += param; String s3 = "a"; // In addition to testing whether "lock" is held, tests that the result of a string // concatenation has type @GuardedBy({}). - // :: error: (lock.not.held) + // :: error: [lock.not.held] String s4 = s3 += param; } synchronized (lock) { diff --git a/checker/tests/lock/TestConcurrentSemantics1.java b/checker/tests/lock/TestConcurrentSemantics1.java index d3cce3b82a0d..463bf599c978 100644 --- a/checker/tests/lock/TestConcurrentSemantics1.java +++ b/checker/tests/lock/TestConcurrentSemantics1.java @@ -38,7 +38,7 @@ void method1() { @GuardedBy("lock1") MyClass local = new MyClass(); m = local; lock1.lock(); - // :: error: (lock.not.held) + // :: error: [lock.not.held] m.field = new Object(); } diff --git a/checker/tests/lock/TestConcurrentSemantics2.java b/checker/tests/lock/TestConcurrentSemantics2.java index 4907a456cd8a..6762fa515fae 100644 --- a/checker/tests/lock/TestConcurrentSemantics2.java +++ b/checker/tests/lock/TestConcurrentSemantics2.java @@ -13,7 +13,7 @@ void method() { // * bar() is called on the other thread. // * Context switch back to this thread. // o is no longer null and an "assignment" error should be issued. - // :: error: (assignment) + // :: error: [assignment] @GuardedBy("b") Object o2 = o; } @@ -24,6 +24,6 @@ void bar() { // Test that field assignments do not cause their type to be refined: @GuardedBy("a") Object myObject1 = null; - // :: error: (assignment) + // :: error: [assignment] @GuardedBy("b") Object myObject2 = myObject1; } diff --git a/checker/tests/lock/TestTreeKinds.java b/checker/tests/lock/TestTreeKinds.java index b7fc3786b631..4d2faaa686b8 100644 --- a/checker/tests/lock/TestTreeKinds.java +++ b/checker/tests/lock/TestTreeKinds.java @@ -25,7 +25,7 @@ MyClass[] newMyClassArray() { { // In constructor/initializer, it's OK not to hold the lock on 'this', but other locks must // be respected. - // :: error: (lock.not.held) + // :: error: [lock.not.held] m.field = new Object(); } @@ -97,7 +97,7 @@ class MyParametrizedType { @GuardedBy("lock") MyParametrizedType myParametrizedType = new MyParametrizedType<>(); MyClass getFooWithWrongReturnType() { - // :: error: (return) + // :: error: [return] return foo; // return of guarded object } @@ -136,7 +136,7 @@ void testEnumType() { // TODO: "assignment" is technically correct, but we could // make it friendlier for the user if constant enum values on the RHS // automatically cast to the @GuardedBy annotation of the LHS. - // :: error: (assignment) + // :: error: [assignment] myEnum = myEnumType.ABC; } @@ -146,7 +146,7 @@ void testThreadHoldsLock(@GuardedBy("intrinsicLock") MyClass m) { if (Thread.holdsLock(intrinsicLock)) { m.field.toString(); } else { - // :: error: (lock.not.held) + // :: error: [lock.not.held] m.field.toString(); } } @@ -166,7 +166,7 @@ void testTreeTypes() { // do { // break; // } while (foo.field != null); // access to guarded object in condition of do/while loop - // :: error: (lock.not.held) + // :: error: [lock.not.held] for (foo = new MyClass(); foo.field != null; foo = new MyClass()) { break; } // access to guarded object in condition of for loop @@ -177,34 +177,34 @@ void testTreeTypes() { // accesses are considered dereferences). unguardedFoo.method2(); // Same as above, but the guard must be satisfied if the receiver is @GuardSatisfied. - // :: error: (lock.not.held) + // :: error: [lock.not.held] foo.method2(); // attempt to use guarded object in a switch statement - // :: error: (lock.not.held) + // :: error: [lock.not.held] switch (foo.field.hashCode()) { } // attempt to use guarded object inside a try with resources // try(foo = new MyClass()) { foo.field.toString(); } // Retrieving an element from a guarded array is a dereference - // :: error: (lock.not.held) + // :: error: [lock.not.held] MyClass m = fooArray[0]; // method call on dereference of unguarded element of *guarded* array - // :: error: (lock.not.held) + // :: error: [lock.not.held] fooArray[0].field.toString(); - // :: error: (lock.not.held) + // :: error: [lock.not.held] l = fooArray.length; // dereference of guarded array itself // method call on dereference of guarded array element - // :: error: (lock.not.held) + // :: error: [lock.not.held] fooArray2[0].field.toString(); // method call on dereference of unguarded array - TODO: currently preconditions are not // retrieved correctly from array types. This is not unique to the Lock Checker. // fooArray2.field.toString(); // method call on dereference of guarded array element of multidimensional array - // :: error: (lock.not.held) + // :: error: [lock.not.held] fooArray3[0][0].field.toString(); // method call on dereference of unguarded single-dimensional array element of unguarded // multidimensional array - TODO: currently preconditions are not retrieved correctly from @@ -216,38 +216,38 @@ void testTreeTypes() { // fooArray3.field.toString(); // method call on dereference of unguarded array element of *guarded* multidimensional array - // :: error: (lock.not.held) + // :: error: [lock.not.held] fooArray4[0][0].field.toString(); // dereference of unguarded single-dimensional array element of *guarded* multidimensional // array - // :: error: (lock.not.held) + // :: error: [lock.not.held] l = fooArray4[0].length; // dereference of guarded multidimensional array - // :: error: (lock.not.held) + // :: error: [lock.not.held] l = fooArray4.length; // method call on dereference of unguarded array element of *guarded subarray* of // multidimensional array - // :: error: (lock.not.held) + // :: error: [lock.not.held] fooArray5[0][0].field.toString(); // dereference of guarded single-dimensional array element of multidimensional array - // :: error: (lock.not.held) + // :: error: [lock.not.held] l = fooArray5[0].length; // dereference of unguarded multidimensional array l = fooArray5.length; - // :: error: (lock.not.held) + // :: error: [lock.not.held] l = getFooArray().length; // dereference of guarded array returned by a method // method call on dereference of guarded array element returned by a method - // :: error: (lock.not.held) + // :: error: [lock.not.held] getFooArray2()[0].field.toString(); // dereference of unguarded array returned by a method l = getFooArray2().length; // method call on dereference of guarded array element of multidimensional array returned by // a method - // :: error: (lock.not.held) + // :: error: [lock.not.held] getFooArray3()[0][0].field.toString(); // dereference of unguarded single-dimensional array element of multidimensional array // returned by a method @@ -257,23 +257,23 @@ void testTreeTypes() { // method call on dereference of unguarded array element of *guarded* multidimensional array // returned by a method - // :: error: (lock.not.held) + // :: error: [lock.not.held] getFooArray4()[0][0].field.toString(); // dereference of unguarded single-dimensional array element of *guarded* multidimensional // array returned by a method - // :: error: (lock.not.held) + // :: error: [lock.not.held] l = getFooArray4()[0].length; // dereference of guarded multidimensional array returned by a method - // :: error: (lock.not.held) + // :: error: [lock.not.held] l = getFooArray4().length; // method call on dereference of unguarded array element of *guarded subarray* of // multidimensional array returned by a method - // :: error: (lock.not.held) + // :: error: [lock.not.held] getFooArray5()[0][0].field.toString(); // dereference of guarded single-dimensional array element of multidimensional array // returned by a method - // :: error: (lock.not.held) + // :: error: [lock.not.held] l = getFooArray5()[0].length; // dereference of unguarded multidimensional array returned by a method l = getFooArray5().length; @@ -281,10 +281,10 @@ void testTreeTypes() { // Test different @GuardedBy(...) present on the element and array locations. @SuppressWarnings("lock:assignment") // prevent flow-sensitive type refinement @GuardedBy("lock") MyClass @GuardedBy("lock2") [] array = newMyClassArray(); - // :: error: (lock.not.held) + // :: error: [lock.not.held] array[0].field = new Object(); if (lock.isHeldByCurrentThread()) { - // :: error: (lock.not.held) + // :: error: [lock.not.held] array[0].field = new Object(); if (lock2.isHeldByCurrentThread()) { array[0].field = new Object(); @@ -292,17 +292,17 @@ void testTreeTypes() { } // method call on guarded object within parenthesized expression - // :: error: (lock.not.held) + // :: error: [lock.not.held] String s = (foo.field.toString()); - // :: error: (lock.not.held) + // :: error: [lock.not.held] foo.field.toString(); // method call on guarded object - // :: error: (lock.not.held) + // :: error: [lock.not.held] getFoo().field.toString(); // method call on guarded object returned by a method - // :: error: (lock.not.held) + // :: error: [lock.not.held] this.foo.field.toString(); // method call on guarded object using 'this' literal // dereference of guarded object in labeled statement label: - // :: error: (lock.not.held) + // :: error: [lock.not.held] foo.field.toString(); // access to guarded object in instanceof expression (OK) if (foo instanceof MyClass) {} @@ -317,33 +317,33 @@ void testTreeTypes() { // access to guarded object in a lambda expression Runnable rn = () -> { - // :: error: (lock.not.held) + // :: error: [lock.not.held] foo.field.toString(); }; - // :: error: (lock.not.held) + // :: error: [lock.not.held] i = myClassInstance.i; // access to member field of guarded object // MemberReferenceTrees? how do they work fooArray = new MyClass[3]; // second allocation of guarded array (OK) // dereference of guarded object in conditional expression tree - // :: error: (lock.not.held) + // :: error: [lock.not.held] s = i == 5 ? foo.field.toString() : f.field.toString(); // dereference of guarded object in conditional expression tree - // :: error: (lock.not.held) + // :: error: [lock.not.held] s = i == 5 ? f.field.toString() : foo.field.toString(); // Testing of 'return' is done in getFooWithWrongReturnType() // throwing a guarded object - when throwing an exception, it must be @GuardedBy({}). Even // @GuardedByUnknown is not allowed. try { - // :: error: (throw) + // :: error: [throw] throw exception; } catch (Exception e) { } // casting of a guarded object to an unguarded object - // :: error: (assignment) + // :: error: [assignment] @GuardedBy({}) Object e1 = (Object) exception; // OK, since the local variable's type gets refined to @GuardedBy("lock") Object e2 = (Object) exception; - // :: error: (lock.not.held) + // :: error: [lock.not.held] l = myParametrizedType.l; // dereference of guarded object having a parameterized type // We need to support locking on local variables and protecting local variables because @@ -361,7 +361,7 @@ void testTreeTypes() { // turned on, foo may no longer be null by now, the refinement to @GuardedByBottom is // lost and the refined type of foo is now the declared type ( @GuardedBy("lock") ), // resulting in the lock.not.held error. - // :: error: (lock.not.held) + // :: error: [lock.not.held] foo.field.toString(); } @@ -388,12 +388,12 @@ public void testLocals() { @SuppressWarnings("assignment") // prevent flow-sensitive refinement @GuardedBy("localLock") MyClass guardedByLocalLock = someValue(); - // :: error: (lock.not.held) + // :: error: [lock.not.held] guardedByLocalLock.field.toString(); @GuardedBy("lock") MyClass local = guardedByLock(); - // :: error: (lock.not.held) + // :: error: [lock.not.held] local.field.toString(); lockTheLock(); @@ -411,7 +411,7 @@ public void testMethodAnnotations() { lockTheLock(); requiresLockHeldMethod(); } else { - // :: error: (contracts.precondition) + // :: error: [contracts.precondition] requiresLockHeldMethod(); } @@ -421,17 +421,17 @@ public void testMethodAnnotations() { unlockTheLock(); - // :: error: (lock.not.held) + // :: error: [lock.not.held] foo.field.toString(); } else { - // :: error: (lock.not.held) + // :: error: [lock.not.held] foo.field.toString(); } if (tryToLockTheLock()) { foo.field.toString(); } else { - // :: error: (lock.not.held) + // :: error: [lock.not.held] foo.field.toString(); } @@ -442,7 +442,7 @@ public void testMethodAnnotations() { } else { lockTheLock(); nonSideEffectFreeMethod(); - // :: error: (lock.not.held) + // :: error: [lock.not.held] foo.field.toString(); } @@ -453,7 +453,7 @@ public void testMethodAnnotations() { } else { lockTheLock(); nonSideEffectFreeMethod(); - // :: error: (lock.not.held) + // :: error: [lock.not.held] foo.field.toString(); } } @@ -468,7 +468,7 @@ void testBoxedPrimitiveType() { } void testReceiverGuardedByItself(@GuardedBy("") TestTreeKinds this) { - // :: error: (lock.not.held) + // :: error: [lock.not.held] method(); synchronized (this) { method(); @@ -478,7 +478,7 @@ void testReceiverGuardedByItself(@GuardedBy("") TestTreeKinds this) { void method(@GuardSatisfied TestTreeKinds this) {} void testOtherClassReceiverGuardedByItself(final @GuardedBy("") OtherClass o) { - // :: error: (lock.not.held) + // :: error: [lock.not.held] o.foo(); synchronized (o) { o.foo(); @@ -491,24 +491,24 @@ void foo(@GuardSatisfied OtherClass this) {} void testExplicitLockSynchronized() { final ReentrantLock lock = new ReentrantLock(); - // :: error: (explicit.lock.synchronized) + // :: error: [explicit.lock.synchronized] synchronized (lock) { } } void testPrimitiveTypeGuardedby() { - // :: error: (immutable.type.guardedby) + // :: error: [immutable.type.guardedby] @GuardedBy("lock") int a = 0; - // :: error: (immutable.type.guardedby) + // :: error: [immutable.type.guardedby] @GuardedBy int b = 0; - // :: error: (immutable.type.guardedby) :: error: (guardsatisfied.location.disallowed) + // :: error: [immutable.type.guardedby] :: error: [guardsatisfied.location.disallowed] @GuardSatisfied int c = 0; - // :: error: (immutable.type.guardedby) :: error: (guardsatisfied.location.disallowed) + // :: error: [immutable.type.guardedby] :: error: [guardsatisfied.location.disallowed] @GuardSatisfied(1) int d = 0; int e = 0; - // :: error: (immutable.type.guardedby) + // :: error: [immutable.type.guardedby] @GuardedByUnknown int f = 0; - // :: error: (immutable.type.guardedby) :: error: (assignment) + // :: error: [immutable.type.guardedby] :: error: [assignment] @GuardedByBottom int g = 0; } diff --git a/checker/tests/lock/ThisPostCondition.java b/checker/tests/lock/ThisPostCondition.java index 59c582485041..423d79fe0cc5 100644 --- a/checker/tests/lock/ThisPostCondition.java +++ b/checker/tests/lock/ThisPostCondition.java @@ -49,7 +49,7 @@ void lockTheLock2() { } void doNotLock() { - // :: error: (lock.not.held) + // :: error: [lock.not.held] bar.field.toString(); } @@ -57,7 +57,7 @@ void tryTryLock() { if (myLock.tryLock()) { bar.field.toString(); } else { - // :: error: (lock.not.held) + // :: error: [lock.not.held] bar.field.toString(); } } diff --git a/checker/tests/lock/ThisSuper.java b/checker/tests/lock/ThisSuper.java index 4fe9a0204966..9d1c815047b7 100644 --- a/checker/tests/lock/ThisSuper.java +++ b/checker/tests/lock/ThisSuper.java @@ -43,31 +43,31 @@ public LockExampleSubclass() { synchronized (super.myLock) { super.locked.toString(); super.locked2.toString(); - // :: error: (contracts.precondition) + // :: error: [contracts.precondition] locked.toString(); } synchronized (myLock) { - // :: error: (contracts.precondition) + // :: error: [contracts.precondition] super.locked.toString(); - // :: error: (contracts.precondition) + // :: error: [contracts.precondition] super.locked2.toString(); locked.toString(); } - // :: error: (assignment) + // :: error: [assignment] les1.locked = le1.locked; - // :: error: (assignment) + // :: error: [assignment] les1.locked = le1.locked2; - // :: error: (assignment) + // :: error: [assignment] les1.locked = les2.locked; - // :: error: (assignment) + // :: error: [assignment] this.locked = super.locked; - // :: error: (assignment) + // :: error: [assignment] this.locked = super.locked2; - // :: error: (assignment) + // :: error: [assignment] m1 = m2; } @@ -75,13 +75,13 @@ public LockExampleSubclass() { public void accessLock() { synchronized (myLock) { this.locked.field = new Object(); - // :: error: (lock.not.held) + // :: error: [lock.not.held] super.locked.field = new Object(); System.out.println( this.locked.field + " " + - // :: error: (lock.not.held) + // :: error: [lock.not.held] super.locked.field); System.out.println("Are locks equal? " + (super.locked == this.locked ? "yes" : "no")); } diff --git a/checker/tests/lock/ViewpointAdaptation.java b/checker/tests/lock/ViewpointAdaptation.java index c6880481203a..ad61d2e8287e 100644 --- a/checker/tests/lock/ViewpointAdaptation.java +++ b/checker/tests/lock/ViewpointAdaptation.java @@ -4,7 +4,7 @@ import org.checkerframework.checker.lock.qual.GuardedBy; public class ViewpointAdaptation { - // :: error: (expression.unparsable) + // :: error: [expression.unparsable] private final @GuardedBy("a") ViewpointAdaptation f = new ViewpointAdaptation(); private @GuardedBy("this.lock") ViewpointAdaptation g = new ViewpointAdaptation(); @@ -15,7 +15,7 @@ public class ViewpointAdaptation { public void method1(final String a) { synchronized (a) { - // :: error: (expression.unparsable) + // :: error: [expression.unparsable] f.counter++; } } @@ -23,11 +23,11 @@ public void method1(final String a) { public void method2() { ViewpointAdaptation t = new ViewpointAdaptation(); - // :: error: (assignment) + // :: error: [assignment] t.g = g; // "t.lock" != "this.lock" synchronized (t.lock) { - // :: error: (lock.not.held) + // :: error: [lock.not.held] g.counter++; } } @@ -42,7 +42,7 @@ public void method3() { synchronized (l) { // Aliasing of lock expressions is not tracked by the Lock Checker. // The Lock Checker does not know that l == t.lock - // :: error: (lock.not.held) + // :: error: [lock.not.held] g.counter++; } } diff --git a/checker/tests/lock/ViewpointAdaptation2.java b/checker/tests/lock/ViewpointAdaptation2.java index 24a6affcb0c7..0da14b16fbc0 100644 --- a/checker/tests/lock/ViewpointAdaptation2.java +++ b/checker/tests/lock/ViewpointAdaptation2.java @@ -25,23 +25,23 @@ class Use { @GuardedBy("lockExample1.myLock") Object o2 = lockExample1.locked2; - // :: error: (assignment) + // :: error: [assignment] @GuardedBy("myLock") Object o3 = lockExample1.locked; - // :: error: (assignment) + // :: error: [assignment] @GuardedBy("this.myLock") Object o4 = lockExample1.locked2; @GuardedBy("lockExample1.myLock") Object oM1 = lockExample1.getLocked(); - // :: error: (assignment) + // :: error: [assignment] @GuardedBy("myLock") Object oM2 = lockExample1.getLocked(); - // :: error: (assignment) + // :: error: [assignment] @GuardedBy("this.myLock") Object oM3 = lockExample1.getLocked(); void uses() { lockExample1.locked = o1; - // :: error: (assignment) + // :: error: [assignment] lockExample1.locked = o3; } } diff --git a/checker/tests/lock/ViewpointAdaptation3.java b/checker/tests/lock/ViewpointAdaptation3.java index f25c6882a35f..b6b5e339c927 100644 --- a/checker/tests/lock/ViewpointAdaptation3.java +++ b/checker/tests/lock/ViewpointAdaptation3.java @@ -38,12 +38,12 @@ public LockExampleSubclass() { final LockExampleSubclass les3 = les2; LockExample le1 = new LockExample(); - // :: error: (assignment) + // :: error: [assignment] les1.locked = le1.locked; - // :: error: (assignment) + // :: error: [assignment] les1.locked = le1.locked2; - // :: error: (assignment) + // :: error: [assignment] les1.locked = les2.locked; } } @@ -63,18 +63,18 @@ void method(final Class1 a) { final Object lock = new Object(); @GuardedBy("lock") MyClass local = new MyClass(); - // :: error: (assignment) + // :: error: [assignment] local = m; - // :: error: (lock.not.held) + // :: error: [lock.not.held] local.field = new Object(); synchronized (lock) { - // :: error: (lock.not.held) + // :: error: [lock.not.held] a.m.field = new Object(); } synchronized (this.lock) { - // :: error: (lock.not.held) + // :: error: [lock.not.held] a.m.field = new Object(); } synchronized (a.lock) { @@ -85,18 +85,18 @@ void method(final Class1 a) { local.field = new Object(); } synchronized (this.lock) { - // :: error: (lock.not.held) + // :: error: [lock.not.held] local.field = new Object(); } synchronized (a.lock) { - // :: error: (lock.not.held) + // :: error: [lock.not.held] local.field = new Object(); } synchronized (lock) { - // :: error: (lock.not.held) + // :: error: [lock.not.held] this.m.field = new Object(); - // :: error: (lock.not.held) + // :: error: [lock.not.held] m.field = new Object(); } synchronized (this.lock) { @@ -104,9 +104,9 @@ void method(final Class1 a) { m.field = new Object(); } synchronized (a.lock) { - // :: error: (lock.not.held) + // :: error: [lock.not.held] this.m.field = new Object(); - // :: error: (lock.not.held) + // :: error: [lock.not.held] m.field = new Object(); } } diff --git a/checker/tests/mustcall-nolightweightownership/BorrowOnReturn.java b/checker/tests/mustcall-nolightweightownership/BorrowOnReturn.java index 91c43c9f248d..b984be3af18a 100644 --- a/checker/tests/mustcall-nolightweightownership/BorrowOnReturn.java +++ b/checker/tests/mustcall-nolightweightownership/BorrowOnReturn.java @@ -10,19 +10,19 @@ void a() {} @Owning Object getOwnedFoo() { - // :: error: (return) + // :: error: [return] return new Foo(); } Object getNoAnnoFoo() { // Treat as owning, so warn - // :: error: (return) + // :: error: [return] return new Foo(); } @NotOwning Object getNotOwningFooWrong() { - // :: error: (return) + // :: error: [return] return new Foo(); } @@ -31,7 +31,7 @@ Object getNotOwningFooRightButNoNotOwningAnno() { f.a(); // This is still an error for now, because it's treated as an owning pointer. TODO: fix this // kind of FP? - // :: error: (return) + // :: error: [return] return f; } @@ -39,7 +39,7 @@ Object getNotOwningFooRightButNoNotOwningAnno() { Object getNotOwningFooRight() { Foo f = new Foo(); f.a(); - // :: error: (return) + // :: error: [return] return f; } diff --git a/checker/tests/mustcall/BorrowOnReturn.java b/checker/tests/mustcall/BorrowOnReturn.java index 6844ae92824d..b0bd0eabfbd3 100644 --- a/checker/tests/mustcall/BorrowOnReturn.java +++ b/checker/tests/mustcall/BorrowOnReturn.java @@ -10,13 +10,13 @@ void a() {} @Owning Object getOwnedFoo() { - // :: error: (return) + // :: error: [return] return new Foo(); } Object getNoAnnoFoo() { // Treat as owning, so warn - // :: error: (return) + // :: error: [return] return new Foo(); } @@ -31,7 +31,7 @@ Object getNotOwningFooRightButNoNotOwningAnno() { f.a(); // This is still an error for now, because it's treated as an owning pointer. TODO: fix this // kind of FP? - // :: error: (return) + // :: error: [return] return f; } diff --git a/checker/tests/mustcall/CreatesMustCallForSimple.java b/checker/tests/mustcall/CreatesMustCallForSimple.java index 8ac1739013a2..cf9e1868b46c 100644 --- a/checker/tests/mustcall/CreatesMustCallForSimple.java +++ b/checker/tests/mustcall/CreatesMustCallForSimple.java @@ -19,7 +19,7 @@ static void test1() { CreatesMustCallForSimple cos = makeNoMC(); @MustCall({}) CreatesMustCallForSimple a = cos; cos.reset(); - // :: error: (assignment) + // :: error: [assignment] @MustCall({}) CreatesMustCallForSimple b = cos; @MustCall("a") CreatesMustCallForSimple c = cos; } @@ -28,7 +28,7 @@ static void test2() { CreatesMustCallForSimple cos = makeNoMC(); @MustCall({}) CreatesMustCallForSimple a = cos; cos.resetThis(); - // :: error: (assignment) + // :: error: [assignment] @MustCall({}) CreatesMustCallForSimple b = cos; @MustCall("a") CreatesMustCallForSimple c = cos; } @@ -36,7 +36,7 @@ static void test2() { static void test3() { Object cos = makeNoMC(); @MustCall({}) Object a = cos; - // :: error: (createsmustcallfor.target.unparseable) + // :: error: [createsmustcallfor.target.unparseable] ((CreatesMustCallForSimple) cos).reset(); // It would be better to issue an assignment incompatible error here, but the // error above is okay too. @@ -50,7 +50,7 @@ static void test4() { @MustCall({}) Object a = cos; CreatesMustCallForSimple r = ((CreatesMustCallForSimple) cos); r.reset(); - // :: error: (assignment) + // :: error: [assignment] @MustCall({}) Object b = r; @MustCall("a") Object c = r; } diff --git a/checker/tests/mustcall/FileDescriptors.java b/checker/tests/mustcall/FileDescriptors.java index 928dc8cba3c6..e93cc0caccf3 100644 --- a/checker/tests/mustcall/FileDescriptors.java +++ b/checker/tests/mustcall/FileDescriptors.java @@ -6,13 +6,13 @@ class FileDescriptors { void test(@Owning RandomAccessFile r) throws Exception { @MustCall("close") FileDescriptor fd = r.getFD(); - // :: error: (assignment) + // :: error: [assignment] @MustCall({}) FileDescriptor fd2 = r.getFD(); } void test2(@Owning RandomAccessFile r) throws Exception { @MustCall("close") FileInputStream f = new FileInputStream(r.getFD()); - // :: error: (assignment) + // :: error: [assignment] @MustCall({}) FileInputStream f2 = new FileInputStream(r.getFD()); } } diff --git a/checker/tests/mustcall/FunctionalInterfaces.java b/checker/tests/mustcall/FunctionalInterfaces.java index b556623ffa53..2f4805d99e9d 100644 --- a/checker/tests/mustcall/FunctionalInterfaces.java +++ b/checker/tests/mustcall/FunctionalInterfaces.java @@ -26,7 +26,7 @@ public static void method() {} public void normalConstruction() { - // :: error: (assignment) + // :: error: [assignment] @MustCall({}) Actor a = new ActorImpl(); } @@ -37,14 +37,14 @@ class ActorImplInline implements Actor { public void act() {} } - // :: error: (assignment) + // :: error: [assignment] @MustCall({}) Actor a = new ActorImplInline(); } public void anonymousClass() { @MustCall({}) Actor a = - // :: error: (assignment) + // :: error: [assignment] new Actor() { public void act() {} }; diff --git a/checker/tests/mustcall/LogTheSocket.java b/checker/tests/mustcall/LogTheSocket.java index e5181a13ba87..63a0bd41f248 100644 --- a/checker/tests/mustcall/LogTheSocket.java +++ b/checker/tests/mustcall/LogTheSocket.java @@ -30,7 +30,7 @@ class LogTheSocket { void testAssign(@Owning ServerSocket s1) { s = s1; - // :: error: (assignment) + // :: error: [assignment] s2 = s1; } diff --git a/checker/tests/mustcall/NonOwningPolyInteraction.java b/checker/tests/mustcall/NonOwningPolyInteraction.java index 1ed9f5c5ae10..909a86fda8b7 100644 --- a/checker/tests/mustcall/NonOwningPolyInteraction.java +++ b/checker/tests/mustcall/NonOwningPolyInteraction.java @@ -11,7 +11,7 @@ void foo(@NotOwning InputStream instream) { } void bar(@Owning InputStream instream) { - // :: error: (assignment) + // :: error: [assignment] @MustCall({}) BufferedInputStream bis = new BufferedInputStream(instream); @MustCall({"close"}) BufferedInputStream bis2 = new BufferedInputStream(instream); } @@ -30,7 +30,7 @@ void baz(InputStream instream) { // extra param(s) here and on the next constructor because Java requires constructors to have // different signatures. NonOwningPolyInteraction(@Owning InputStream instream, int x) { - // :: error: (assignment) + // :: error: [assignment] @MustCall({}) BufferedInputStream bis = new BufferedInputStream(instream); @MustCall({"close"}) BufferedInputStream bis2 = new BufferedInputStream(instream); } diff --git a/checker/tests/mustcall/NotInheritableMustCallOnClassError.java b/checker/tests/mustcall/NotInheritableMustCallOnClassError.java index c89abe65219f..e4b44a939fc1 100644 --- a/checker/tests/mustcall/NotInheritableMustCallOnClassError.java +++ b/checker/tests/mustcall/NotInheritableMustCallOnClassError.java @@ -5,7 +5,7 @@ import org.checkerframework.checker.mustcall.qual.*; @MustCall("foo") -// :: warning: (mustcall.not.inheritable) +// :: warning: [mustcall.not.inheritable] public class NotInheritableMustCallOnClassError { public void foo() {} } diff --git a/checker/tests/mustcall/NullableTransfer.java b/checker/tests/mustcall/NullableTransfer.java index b9d819001f20..c30b2460102e 100644 --- a/checker/tests/mustcall/NullableTransfer.java +++ b/checker/tests/mustcall/NullableTransfer.java @@ -10,7 +10,7 @@ void test(@Owning InputStream is) { if (is == null) { @MustCall({}) InputStream is2 = is; } else { - // :: error: (assignment) + // :: error: [assignment] @MustCall({}) InputStream is3 = is; @MustCall("close") InputStream is4 = is; } diff --git a/checker/tests/mustcall/OwningMustCallNothing.java b/checker/tests/mustcall/OwningMustCallNothing.java index e5b1eda6411c..7c28cb784ff8 100644 --- a/checker/tests/mustcall/OwningMustCallNothing.java +++ b/checker/tests/mustcall/OwningMustCallNothing.java @@ -5,7 +5,7 @@ import org.checkerframework.checker.mustcall.qual.Owning; @InheritableMustCall({}) -// :: error: (inconsistent.mustcall.subtype) +// :: error: [inconsistent.mustcall.subtype] public class OwningMustCallNothing implements Closeable { protected @Owning AnnotationClassLoader loader; @@ -25,7 +25,7 @@ AnnotationClassLoader createAnnotationClassLoader() { public void close() {} } -// :: error: (inconsistent.mustcall.subtype) +// :: error: [inconsistent.mustcall.subtype] @MustCall({}) class OwningMustCallNothing2 implements Closeable { protected @Owning AnnotationClassLoader loader; @@ -46,21 +46,21 @@ public void close() {} } @InheritableMustCall("close") -// :: error: (declaration.inconsistent.with.extends.clause) +// :: error: [declaration.inconsistent.with.extends.clause] class SubclassMustCallClose1 extends OwningMustCallNothing {} -// :: error: (declaration.inconsistent.with.extends.clause) +// :: error: [declaration.inconsistent.with.extends.clause] @MustCall("close") class SubclassMustCallClose2 extends OwningMustCallNothing {} @InheritableMustCall("close") -// :: error: (declaration.inconsistent.with.extends.clause) +// :: error: [declaration.inconsistent.with.extends.clause] class SubclassMustCallClose3 extends OwningMustCallNothing2 {} -// :: error: (declaration.inconsistent.with.extends.clause) +// :: error: [declaration.inconsistent.with.extends.clause] @MustCall("close") class SubclassMustCallClose4 extends OwningMustCallNothing2 {} @InheritableMustCall({}) // Don't check whether AnnotationClassLoaders are closed. -// :: error: (inconsistent.mustcall.subtype) +// :: error: [inconsistent.mustcall.subtype] class AnnotationClassLoader implements Closeable { public void close() {} } diff --git a/checker/tests/mustcall/OwningParams.java b/checker/tests/mustcall/OwningParams.java index 0c8e67297c61..83584494f81c 100644 --- a/checker/tests/mustcall/OwningParams.java +++ b/checker/tests/mustcall/OwningParams.java @@ -6,7 +6,7 @@ class OwningParams { static void o1(@Owning OwningParams o) {} void test(@Owning @MustCall({"a"}) OwningParams o, @Owning OwningParams p) { - // :: error: (argument) + // :: error: [argument] o1(o); o1(p); } diff --git a/checker/tests/mustcall/PolyMustCallDifferentNames.java b/checker/tests/mustcall/PolyMustCallDifferentNames.java index 9e179d160693..c784a67bbb7d 100644 --- a/checker/tests/mustcall/PolyMustCallDifferentNames.java +++ b/checker/tests/mustcall/PolyMustCallDifferentNames.java @@ -18,7 +18,7 @@ static class Wrapper1 { public @PolyMustCall Wrapper1(@PolyMustCall Wrapped w) { // we get this error since we only have a field-assignment special case for // @MustCallAlias, not @PolyMustCall. - // :: error: (assignment) + // :: error: [assignment] this.field = w; } @@ -58,9 +58,9 @@ static void test1() { @MustCall("a") Wrapped x = new Wrapped(); @MustCall("b") Wrapper1 w1 = new Wrapper1(x); @MustCall("b") Wrapper1 w2 = getWrapper1(x); - // :: error: (assignment) + // :: error: [assignment] @MustCall("a") Wrapper1 w3 = new Wrapper1(x); - // :: error: (assignment) + // :: error: [assignment] @MustCall("a") Wrapper1 w4 = getWrapper1(x); } @@ -68,9 +68,9 @@ static void test2() { @MustCall("a") Wrapped x = new Wrapped(); @MustCall("c") Wrapper2 w1 = new Wrapper2(x); @MustCall("c") Wrapper2 w2 = getWrapper2(x); - // :: error: (assignment) + // :: error: [assignment] @MustCall("a") Wrapper2 w3 = new Wrapper2(x); - // :: error: (assignment) + // :: error: [assignment] @MustCall("a") Wrapper2 w4 = getWrapper2(x); } } diff --git a/checker/tests/mustcall/PolyTests.java b/checker/tests/mustcall/PolyTests.java index 0dbc4d3b233f..2389dc4ddc01 100644 --- a/checker/tests/mustcall/PolyTests.java +++ b/checker/tests/mustcall/PolyTests.java @@ -10,7 +10,7 @@ class PolyTests { static void test1(@Owning @MustCall("close") Object o) { @MustCall("close") Object o1 = id(o); - // :: error: (assignment) + // :: error: [assignment] @MustCall({}) Object o2 = id(o); } @@ -25,7 +25,7 @@ static void test2(@Owning @MustCall({}) Object o) { static void test3(@Owning @MustCall({"close"}) Object o) { @MustCall("close") Object o1 = new PolyTests(o); - // :: error: (assignment) + // :: error: [assignment] @MustCall({}) Object o2 = new PolyTests(o); } @@ -36,7 +36,7 @@ static void test4(@Owning @MustCall({}) Object o) { static void testArbitary(@Owning PolyTests p) { @MustCall("close") Object o1 = p; - // :: error: (assignment) + // :: error: [assignment] @MustCall({}) Object o2 = p; } } diff --git a/checker/tests/mustcall/SimpleSocketField.java b/checker/tests/mustcall/SimpleSocketField.java index 6e907132c8f1..e1a175f8d4bb 100644 --- a/checker/tests/mustcall/SimpleSocketField.java +++ b/checker/tests/mustcall/SimpleSocketField.java @@ -15,7 +15,7 @@ class SimpleSocketField { void test() { @MustCall("close") Socket s = mySock; - // :: error: (assignment) + // :: error: [assignment] @MustCall({}) Socket s1 = mySock; } } diff --git a/checker/tests/mustcall/SocketBufferedReader.java b/checker/tests/mustcall/SocketBufferedReader.java index ba31523b29c3..be52d660c314 100644 --- a/checker/tests/mustcall/SocketBufferedReader.java +++ b/checker/tests/mustcall/SocketBufferedReader.java @@ -13,7 +13,7 @@ void test(String address, int port) { PrintStream out = new PrintStream(socket.getOutputStream()); BufferedReader in = new BufferedReader(new InputStreamReader(socket.getInputStream())); @MustCall("close") BufferedReader reader = in; - // :: error: (assignment) + // :: error: [assignment] @MustCall({}) BufferedReader reader2 = in; in.close(); } catch (Exception e) { diff --git a/checker/tests/mustcall/Subtype0.java b/checker/tests/mustcall/Subtype0.java index 5ea1a298fb4c..4cfc7c5875e6 100644 --- a/checker/tests/mustcall/Subtype0.java +++ b/checker/tests/mustcall/Subtype0.java @@ -17,15 +17,15 @@ static void test( @Owning Subtype2 s2, @Owning Subtype3 s3, @Owning Subtype4 s4) { - // :: error: (assignment) + // :: error: [assignment] @MustCall({}) Object obj1 = s0; @MustCall({"a"}) Object obj2 = s0; - // :: error: (assignment) + // :: error: [assignment] @MustCall({}) Object obj3 = s1; @MustCall({"a"}) Object obj4 = s1; - // :: error: (assignment) + // :: error: [assignment] @MustCall({}) Object obj5 = s2; @MustCall({"a"}) Object obj6 = s2; @@ -37,11 +37,11 @@ static void test( } @MustCall({}) - // :: error: (inconsistent.mustcall.subtype) :: error: (super.invocation) + // :: error: [inconsistent.mustcall.subtype] :: error: [super.invocation] public class Subtype3 extends Subtype0 {} @InheritableMustCall({}) - // :: error: (inconsistent.mustcall.subtype) :: error: (super.invocation) + // :: error: [inconsistent.mustcall.subtype] :: error: [super.invocation] public class Subtype4 extends Subtype0 {} @MustCall({"a"}) public class Subtype5 extends Subtype0 {} diff --git a/checker/tests/mustcall/Subtyping.java b/checker/tests/mustcall/Subtyping.java index bba00513714a..4e8909c13793 100644 --- a/checker/tests/mustcall/Subtyping.java +++ b/checker/tests/mustcall/Subtyping.java @@ -8,13 +8,13 @@ class Subtyping { void test_act(@Owning @MustCallUnknown Object o) { @MustCallUnknown Object act = o; - // :: error: (assignment) + // :: error: [assignment] @MustCall("close") Object file = o; - // :: error: (assignment) + // :: error: [assignment] @MustCall({"close", "read"}) Object f2 = o; - // :: error: (assignment) + // :: error: [assignment] @MustCall({}) Object notAfile = o; - // :: error: (assignment) + // :: error: [assignment] unannotatedObj = o; } @@ -22,20 +22,20 @@ void test_close(@Owning @MustCall("close") Object o) { @MustCallUnknown Object act = o; @MustCall("close") Object file = o; @MustCall({"close", "read"}) Object f2 = o; - // :: error: (assignment) + // :: error: [assignment] @MustCall({}) Object notAfile = o; - // :: error: (assignment) + // :: error: [assignment] unannotatedObj = o; } void test_close_read(@Owning @MustCall({"close", "read"}) Object o) { @MustCallUnknown Object act = o; - // :: error: (assignment) + // :: error: [assignment] @MustCall("close") Object file = o; @MustCall({"close", "read"}) Object f2 = o; - // :: error: (assignment) + // :: error: [assignment] @MustCall({}) Object notAfile = o; - // :: error: (assignment) + // :: error: [assignment] unannotatedObj = o; } diff --git a/checker/tests/mustcall/TryWithResourcesSimple.java b/checker/tests/mustcall/TryWithResourcesSimple.java index 8b85dd8342ac..a7587cb940f9 100644 --- a/checker/tests/mustcall/TryWithResourcesSimple.java +++ b/checker/tests/mustcall/TryWithResourcesSimple.java @@ -22,7 +22,7 @@ void test_fancy_sock(String address, int port) { // This is illegal, because getFancySock()'s return type has another MC method beyond // "close", which is the only MC method for Socket itself. try (Socket socket = getFancySocket()) { - // :: error: (assignment) + // :: error: [assignment] @MustCall({"close"}) Object s = socket; } catch (Exception e) { diff --git a/checker/tests/nonempty/Comparisons.java b/checker/tests/nonempty/Comparisons.java index 20a2dd27e58a..e9eb6c784a33 100644 --- a/checker/tests/nonempty/Comparisons.java +++ b/checker/tests/nonempty/Comparisons.java @@ -7,7 +7,7 @@ class Comparisons { /**** Tests for EQ ****/ void testEqZeroWithReturn(List strs) { if (strs.size() == 0) { - // :: error: (method.invocation) + // :: error: [method.invocation] strs.iterator().next(); return; } @@ -16,10 +16,10 @@ void testEqZeroWithReturn(List strs) { void testEqZeroFallthrough(List strs) { if (strs.size() == 0) { - // :: error: (method.invocation) + // :: error: [method.invocation] strs.iterator().next(); } - // :: error: (method.invocation) + // :: error: [method.invocation] strs.iterator().next(); } @@ -27,7 +27,7 @@ void testEqNonZero(List strs) { if (1 == strs.size()) { strs.iterator().next(); } else { - // :: error: (method.invocation) + // :: error: [method.invocation] strs.iterator().next(); } } @@ -39,7 +39,7 @@ void testImplicitNonZero(List strs1, List strs2) { if (strs1.size() == strs2.size()) { @NonEmpty List strs3 = strs2; // OK } - // :: error: (assignment) + // :: error: [assignment] @NonEmpty List strs4 = strs2; } @@ -56,7 +56,7 @@ List getNonEmptyList() { void testEqualIndexOfRefinement(List objs, Object obj) { if (objs.indexOf(obj) == -1) { - // :: error: (assignment) + // :: error: [assignment] @NonEmpty List objs2 = objs; } else { objs.iterator().next(); @@ -72,7 +72,7 @@ void t0(List strs) { strs.iterator().next(); } if (1 != strs.size()) { - // :: error: (method.invocation) + // :: error: [method.invocation] strs.iterator().next(); } } @@ -82,7 +82,7 @@ void testNotEqualsRefineElse(List strs1, List strs2) { return; } if (strs1.size() != strs2.size()) { - // :: error: (assignment) + // :: error: [assignment] @NonEmpty List strs3 = strs2; } else { @NonEmpty List strs4 = strs1; @@ -94,13 +94,13 @@ void testNotEqualsRefineIndexOf(List objs, Object obj) { if (objs.indexOf(obj) != -1) { @NonEmpty List objs2 = objs; } else { - // :: error: (method.invocation) + // :: error: [method.invocation] objs.iterator().next(); } if (-1 != objs.indexOf(obj)) { @NonEmpty List objs2 = objs; } else { - // :: error: (method.invocation) + // :: error: [method.invocation] objs.iterator().next(); } } @@ -110,31 +110,31 @@ void t1(List strs) { if (strs.size() > 10) { strs.iterator().next(); } else if (0 > strs.size()) { - // :: error: (method.invocation) + // :: error: [method.invocation] strs.iterator().next(); } else if (100 > strs.size()) { - // :: error: (method.invocation) + // :: error: [method.invocation] strs.iterator().next(); } if (strs.size() > 0) { strs.iterator().next(); } else { - // :: error: (method.invocation) + // :: error: [method.invocation] strs.iterator().next(); } if (0 > strs.size()) { - // :: error: (method.invocation) + // :: error: [method.invocation] strs.iterator().next(); } else { - // :: error: (method.invocation) + // :: error: [method.invocation] strs.iterator().next(); } } void t2(List strs) { if (strs.size() > -1) { - // :: error: (method.invocation) + // :: error: [method.invocation] strs.iterator().next(); } } @@ -143,7 +143,7 @@ void testRefineIndexOfGT(List objs, Object obj) { if (objs.indexOf(obj) > -1) { @NonEmpty List objs2 = objs; } else { - // :: error: (method.invocation) + // :: error: [method.invocation] objs.iterator().next(); } } @@ -151,7 +151,7 @@ void testRefineIndexOfGT(List objs, Object obj) { /**** Tests for GTE ****/ void t3(List strs) { if (strs.size() >= 0) { - // :: error: (method.invocation) + // :: error: [method.invocation] strs.iterator().next(); } else if (strs.size() >= 1) { strs.iterator().next(); @@ -160,7 +160,7 @@ void t3(List strs) { void t4(List strs) { if (0 >= strs.size()) { - // :: error: (method.invocation) + // :: error: [method.invocation] strs.iterator().next(); } } @@ -169,7 +169,7 @@ void testRefineGTEIndexOf(List strs, String s) { if (strs.indexOf(s) >= 0) { strs.iterator().next(); } else { - // :: error: (assignment) + // :: error: [assignment] @NonEmpty List strs2 = strs; } } @@ -177,11 +177,11 @@ void testRefineGTEIndexOf(List strs, String s) { /**** Tests for LT ****/ void t5(List strs) { if (strs.size() < 10) { - // :: error: (method.invocation) + // :: error: [method.invocation] strs.iterator().next(); } if (strs.size() < 1) { - // :: error: (method.invocation) + // :: error: [method.invocation] strs.iterator().next(); } else { strs.iterator().next(); // OK @@ -192,13 +192,13 @@ void t6(List strs) { if (0 < strs.size()) { strs.iterator().next(); // Equiv. to strs.size() > 0 } else { - // :: error: (method.invocation) + // :: error: [method.invocation] strs.iterator().next(); // Equiv. to strs.size() <= 0 } if (strs.size() < 10) { // Doesn't tell us a useful fact - // :: error: (method.invocation) + // :: error: [method.invocation] strs.iterator().next(); } else { strs.iterator().next(); @@ -208,11 +208,11 @@ void t6(List strs) { /**** Tests for LTE ****/ void t7(List strs) { if (strs.size() <= 2) { - // :: error: (method.invocation) + // :: error: [method.invocation] strs.iterator().next(); } if (strs.size() <= 0) { - // :: error: (method.invocation) + // :: error: [method.invocation] strs.iterator().next(); } else { strs.iterator().next(); // OK, since strs must be non-empty @@ -223,15 +223,15 @@ void t8(List strs) { if (1 <= strs.size()) { strs.iterator().next(); } else { - // :: error: (method.invocation) + // :: error: [method.invocation] strs.iterator().next(); } if (0 <= strs.size()) { - // :: error: (method.invocation) + // :: error: [method.invocation] strs.iterator().next(); } else { - // :: error: (method.invocation) + // :: error: [method.invocation] strs.iterator().next(); } } diff --git a/checker/tests/nonempty/EnsuresNonEmptyIfTest.java b/checker/tests/nonempty/EnsuresNonEmptyIfTest.java index f1669b8b90e7..3627fb84fbb8 100644 --- a/checker/tests/nonempty/EnsuresNonEmptyIfTest.java +++ b/checker/tests/nonempty/EnsuresNonEmptyIfTest.java @@ -20,11 +20,11 @@ void m2(@NonEmpty ArrayList l1) {} void test(ArrayList l1) { // m2 requires a @NonEmpty collection, l1 has type @UnknownNonEmpty - // :: error: (argument) + // :: error: [argument] m2(l1); if (!m1(l1)) { - // :: error: (argument) + // :: error: [argument] m2(l1); } else { m2(l1); // OK diff --git a/checker/tests/nonempty/EnsuresNonEmptyTest.java b/checker/tests/nonempty/EnsuresNonEmptyTest.java index 1c60cae2576d..86314abd4f06 100644 --- a/checker/tests/nonempty/EnsuresNonEmptyTest.java +++ b/checker/tests/nonempty/EnsuresNonEmptyTest.java @@ -13,7 +13,7 @@ void m2(@NonEmpty ArrayList l1) {} void test(ArrayList l1) { // m2 requires a @NonEmpty collection, l1 has type @UnknownNonEmpty - // :: error: (argument) + // :: error: [argument] m2(l1); m1(l1); diff --git a/checker/tests/nonempty/ImmutableListOperations.java b/checker/tests/nonempty/ImmutableListOperations.java index 1fdb87ad0081..cd180895c19d 100644 --- a/checker/tests/nonempty/ImmutableListOperations.java +++ b/checker/tests/nonempty/ImmutableListOperations.java @@ -6,7 +6,7 @@ class ImmutableListOperations { void testCreateEmptyImmutableList() { List emptyInts = List.of(); // Creating a copy of an empty list should also yield an empty list - // :: error: (assignment) + // :: error: [assignment] @NonEmpty List copyOfEmptyInts = List.copyOf(emptyInts); } diff --git a/checker/tests/nonempty/ImmutableMapOperations.java b/checker/tests/nonempty/ImmutableMapOperations.java index f097a4589f1f..af7f85c8e157 100644 --- a/checker/tests/nonempty/ImmutableMapOperations.java +++ b/checker/tests/nonempty/ImmutableMapOperations.java @@ -7,7 +7,7 @@ class ImmutableMapOperations { void emptyImmutableMap() { Map emptyMap = Map.of(); - // :: error: (assignment) + // :: error: [assignment] @NonEmpty Map nonEmptyMap = emptyMap; } @@ -18,7 +18,7 @@ void nonEmptyImmutableMap() { void immutableCopyEmptyMap() { Map emptyMap = Map.of(); - // :: error: (assignment) + // :: error: [assignment] @NonEmpty Map nonEmptyMap = Map.copyOf(emptyMap); } diff --git a/checker/tests/nonempty/ImmutableSetOperations.java b/checker/tests/nonempty/ImmutableSetOperations.java index 02c002cae501..4daa9442ee0b 100644 --- a/checker/tests/nonempty/ImmutableSetOperations.java +++ b/checker/tests/nonempty/ImmutableSetOperations.java @@ -6,7 +6,7 @@ class ImmutableSetOperations { void testCreateEmptyImmutableSet() { Set emptyInts = Set.of(); // Creating a copy of an empty set should also yield an empty set - // :: error: (assignment) + // :: error: [assignment] @NonEmpty Set copyOfEmptyInts = Set.copyOf(emptyInts); } diff --git a/checker/tests/nonempty/IndexOfNonNegative.java b/checker/tests/nonempty/IndexOfNonNegative.java index 623267cc34f1..e547fb25cdc6 100644 --- a/checker/tests/nonempty/IndexOfNonNegative.java +++ b/checker/tests/nonempty/IndexOfNonNegative.java @@ -75,7 +75,7 @@ public void clear() {} // iterators @Override - // :: error: (override.receiver) + // :: error: [override.receiver] public @PolyNonEmpty Iterator iterator(@PolyNonEmpty IndexOfNonNegative this) { throw new Error(""); } diff --git a/checker/tests/nonempty/Issue6407.java b/checker/tests/nonempty/Issue6407.java index c52697ae2539..42a29a2f0253 100644 --- a/checker/tests/nonempty/Issue6407.java +++ b/checker/tests/nonempty/Issue6407.java @@ -12,7 +12,7 @@ void usesJdk() { items.add("hello"); @NonEmpty List bar = items; // OK items.remove("hello"); - // :: error: (assignment) + // :: error: [assignment] @NonEmpty List baz = items; // I expect an error here } @@ -38,7 +38,7 @@ void noJdk() { items.add("hello"); @NonEmpty MyList bar = items; // OK items.remove("hello"); - // :: error: (assignment) + // :: error: [assignment] @NonEmpty MyList baz = items; } @@ -48,14 +48,14 @@ void noJdk2() { items.add("hello"); @NonEmpty MyList bar = items; // OK removeIt(items, "hello"); - // :: error: (assignment) + // :: error: [assignment] @NonEmpty MyList baz = items; } void initialRemoval() { // items initially has the type @UnknownNonEmpty MyList items = new MyList<>(); - // :: error: (method.invocation) + // :: error: [method.invocation] items.remove("hello"); } } diff --git a/checker/tests/nonempty/IteratorOperations.java b/checker/tests/nonempty/IteratorOperations.java index a862cbf959cb..8d4f54caf2cd 100644 --- a/checker/tests/nonempty/IteratorOperations.java +++ b/checker/tests/nonempty/IteratorOperations.java @@ -5,14 +5,14 @@ class IteratorOperations { void testPolyNonEmptyIterator(List nums) { - // :: error: (method.invocation) + // :: error: [method.invocation] nums.iterator().next(); if (!nums.isEmpty()) { @NonEmpty Iterator nonEmptyIterator = nums.iterator(); nonEmptyIterator.next(); } else { - // :: error: (assignment) + // :: error: [assignment] @NonEmpty Iterator unknownEmptyIterator = nums.iterator(); } } @@ -20,7 +20,7 @@ void testPolyNonEmptyIterator(List nums) { void testSwitchRefinementNoFallthrough(List nums) { switch (nums.size()) { case 0: - // :: error: (method.invocation) + // :: error: [method.invocation] nums.iterator().next(); break; case 1: @@ -34,13 +34,13 @@ void testSwitchRefinementNoFallthrough(List nums) { void testSwitchRefinementWithFallthrough(List nums) { switch (nums.size()) { case 0: - // :: error: (method.invocation) + // :: error: [method.invocation] nums.iterator().next(); case 1: - // :: error: (assignment) + // :: error: [assignment] @NonEmpty List nums2 = nums; default: - // :: error: (assignment) + // :: error: [assignment] @NonEmpty List nums3 = nums; } } @@ -51,7 +51,7 @@ void testSwitchRefinementNoZero(List nums) { nums.iterator().next(); break; default: - // :: error: (assignment) + // :: error: [assignment] @NonEmpty List nums3 = nums; } } @@ -59,7 +59,7 @@ void testSwitchRefinementNoZero(List nums) { void testSwitchRefinementIndexOf(List strs, String s) { switch (strs.indexOf(s)) { case -1: - // :: error: (method.invocation) + // :: error: [method.invocation] strs.iterator().next(); break; case 0: diff --git a/checker/tests/nonempty/ListOperations.java b/checker/tests/nonempty/ListOperations.java index fe0956fec12d..769bce1b2b76 100644 --- a/checker/tests/nonempty/ListOperations.java +++ b/checker/tests/nonempty/ListOperations.java @@ -6,14 +6,14 @@ class ListOperations { // Skip test until we decide whether to handle accesses on empty containers // void testGetOnEmptyList(List strs) { - // // :: error: (method.invocation) + // // :: error: [method.invocation] // strs.get(0); // } // Skip test until we decide whether to handle accesses on empty containers // void testGetOnNonEmptyList(List strs) { // if (strs.isEmpty()) { - // // :: error: (method.invocation) + // // :: error: [method.invocation] // strs.get(0); // } else { // strs.get(0); // OK @@ -29,7 +29,7 @@ void testAddToEmptyListAndGet() { void testAddAllWithEmptyList() { List nums = new ArrayList<>(); nums.addAll(List.of()); - // :: error: (assignment) + // :: error: [assignment] @NonEmpty List nums2 = nums; } @@ -44,7 +44,7 @@ void testContains(List nums) { if (nums.contains(11)) { @NonEmpty List nums2 = nums; // OK } - // :: error: (assignment) + // :: error: [assignment] @NonEmpty List nums2 = nums; } // TODO: consider other sequences (e.g., calling get(int) after clear()) diff --git a/checker/tests/nonempty/MapOperations.java b/checker/tests/nonempty/MapOperations.java index 63073baaf6a6..d1202e9d7830 100644 --- a/checker/tests/nonempty/MapOperations.java +++ b/checker/tests/nonempty/MapOperations.java @@ -5,7 +5,7 @@ class MapOperations { // Skip test until we decide whether to handle accesses on empty containers // void addToMapParam(Map m) { - // // :: error: (method.invocation) + // // :: error: [method.invocation] // m.get("hello"); // m.put("hello", 1); @@ -20,7 +20,7 @@ class MapOperations { // m.get("hello"); // OK // m.clear(); - // // :: error: (method.invocation) + // // :: error: [method.invocation] // m.get("hello"); // } @@ -28,7 +28,7 @@ void containsKeyRefinement(Map m, String key) { if (m.containsKey(key)) { @NonEmpty Map m2 = m; // OK } else { - // :: error: (assignment) + // :: error: [assignment] @NonEmpty Map m2 = m; // OK } } @@ -37,7 +37,7 @@ void containsValueRefinement(Map m, Integer value) { if (m.containsValue(value)) { @NonEmpty Map m2 = m; } else { - // :: error: (assignment) + // :: error: [assignment] @NonEmpty Map m2 = m; } } diff --git a/checker/tests/nonempty/NonEmptyHierarchyTest.java b/checker/tests/nonempty/NonEmptyHierarchyTest.java index a68659d84d71..060c49ea9989 100644 --- a/checker/tests/nonempty/NonEmptyHierarchyTest.java +++ b/checker/tests/nonempty/NonEmptyHierarchyTest.java @@ -7,7 +7,7 @@ class NonEmptyHierarchyTest { void testAssignments(@NonEmpty List l1, @UnknownNonEmpty List l2) { @NonEmpty List l3 = l1; // OK, both are @NonEmpty - // :: error: (assignment) + // :: error: [assignment] @NonEmpty List l4 = l2; List l5 = l1; // l5 implicitly has type @UnknownNonEmpty, assigning l1 to it is legal diff --git a/checker/tests/nonempty/RequiresNonEmptyTest.java b/checker/tests/nonempty/RequiresNonEmptyTest.java index dd7ab5ef7010..2305a6e97fd7 100644 --- a/checker/tests/nonempty/RequiresNonEmptyTest.java +++ b/checker/tests/nonempty/RequiresNonEmptyTest.java @@ -27,14 +27,14 @@ void test(@NonEmpty List l1, @NonEmpty List l2) { // At this point, we should have an error since m1 requires that list1 is @NonEmpty, which // is not the case here. - // :: error: (contracts.precondition) + // :: error: [contracts.precondition] testClass.m1(); testClass.list1 = l1; testClass.m1(); // OK // A call to m2 is still illegal here, since list2 is still @UnknownNonEmpty. - // :: error: (contracts.precondition) + // :: error: [contracts.precondition] testClass.m2(); testClass.list2 = l2; @@ -43,7 +43,7 @@ void test(@NonEmpty List l1, @NonEmpty List l2) { testClass.m4(); // No longer OK to call m2, no guarantee that m4() was pure. - // :: error: (contracts.precondition) + // :: error: [contracts.precondition] testClass.m2(); } } diff --git a/checker/tests/nonempty/SetOperations.java b/checker/tests/nonempty/SetOperations.java index ca8af22822c4..24155d78d825 100644 --- a/checker/tests/nonempty/SetOperations.java +++ b/checker/tests/nonempty/SetOperations.java @@ -6,7 +6,7 @@ class SetOperations { void testIsEmpty(Set nums) { if (nums.isEmpty()) { - // :: error: (assignment) + // :: error: [assignment] @NonEmpty Set nums2 = nums; } else { @NonEmpty Set nums3 = nums; // OK @@ -17,13 +17,13 @@ void testContains(Set nums) { if (nums.contains(1)) { @NonEmpty Set nums2 = nums; } else { - // :: error: (assignment) + // :: error: [assignment] @NonEmpty Set nums3 = nums; } } void testAdd(Set nums) { - // :: error: (assignment) + // :: error: [assignment] @NonEmpty Set nums2 = nums; // No guarantee that the set is non-empty here if (nums.add(1)) { @NonEmpty Set nums3 = nums; @@ -32,13 +32,13 @@ void testAdd(Set nums) { void testAddAllEmptySet() { Set nums = new HashSet<>(); - // :: error: (assignment) + // :: error: [assignment] @NonEmpty Set nums2 = nums; if (nums.addAll(Set.of())) { // Adding an empty set will always return false, this is effectively dead code @NonEmpty Set nums3 = nums; } else { - // :: error: (assignment) + // :: error: [assignment] @NonEmpty Set nums3 = nums; } } @@ -49,7 +49,7 @@ void testRemove() { @NonEmpty Set nums2 = nums; nums.remove(1); - // :: error: (assignment) + // :: error: [assignment] @NonEmpty Set nums3 = nums; } } diff --git a/checker/tests/nonempty/SizeInIsEmpty.java b/checker/tests/nonempty/SizeInIsEmpty.java index 31ca40ea5d25..bd378a3e7768 100644 --- a/checker/tests/nonempty/SizeInIsEmpty.java +++ b/checker/tests/nonempty/SizeInIsEmpty.java @@ -62,7 +62,7 @@ void testRefineIsEmpty1(SizeInIsEmpty container) { if (!container.isEmpty()) { container.iterator().next(); } else { - // :: error: (method.invocation) + // :: error: [method.invocation] container.iterator().next(); } } @@ -71,7 +71,7 @@ void testRefineIsEmpty2(SizeInIsEmpty container) { if (!container.isEmpty2()) { container.iterator().next(); } else { - // :: error: (method.invocation) + // :: error: [method.invocation] container.iterator().next(); } } @@ -80,7 +80,7 @@ void testRefineIsEmpty3(SizeInIsEmpty container) { if (!container.isEmpty3()) { container.iterator().next(); } else { - // :: error: (method.invocation) + // :: error: [method.invocation] container.iterator().next(); } } diff --git a/checker/tests/nonempty/Streams.java b/checker/tests/nonempty/Streams.java index 57ba66e17dd4..edd01266e1db 100644 --- a/checker/tests/nonempty/Streams.java +++ b/checker/tests/nonempty/Streams.java @@ -12,7 +12,7 @@ void testStreamAnyMatch(Stream strStream) { if (strStream.anyMatch(str -> str.length() > 10)) { @NonEmpty Stream neStream = strStream; } else { - // :: error: (assignment) + // :: error: [assignment] @NonEmpty Stream err = strStream; } } @@ -21,7 +21,7 @@ void testStreamAllMatch(Stream strStream) { if (strStream.allMatch(str -> str.length() > 10)) { @NonEmpty Stream neStream = strStream; } else { - // :: error: (assignment) + // :: error: [assignment] @NonEmpty Stream err = strStream; } } @@ -31,13 +31,13 @@ void testMapNonEmptyStream(@NonEmpty List strs) { } void testMapNonEmptyStream(Stream strs) { - // :: error: (assignment) + // :: error: [assignment] @NonEmpty Stream lens = strs.map(str -> str.length()); } void testNoneMatch(Stream strs) { if (strs.noneMatch(str -> str.length() < 10)) { - // :: error: (assignment) + // :: error: [assignment] @NonEmpty Stream err = strs; } else { // something matched; meaning that the stream MUST be non-empty diff --git a/checker/tests/nonempty/UnmodifiableTest.java b/checker/tests/nonempty/UnmodifiableTest.java index a77f7d75eb79..3ab09e58d3c6 100644 --- a/checker/tests/nonempty/UnmodifiableTest.java +++ b/checker/tests/nonempty/UnmodifiableTest.java @@ -13,7 +13,7 @@ void unmodifiableCopy(@NonEmpty List strs) { void checkNonEmptyThenCopy(List strs) { if (strs.isEmpty()) { - // :: error: (method.invocation) + // :: error: [method.invocation] Collections.unmodifiableList(strs).iterator().next(); } else { Collections.unmodifiableList(strs).iterator().next(); // OK @@ -21,7 +21,7 @@ void checkNonEmptyThenCopy(List strs) { } void testVarargsEmpty() { - // :: error: (assignment) + // :: error: [assignment] @NonEmpty List items = List.of(); } diff --git a/checker/tests/nullness-asserts/NonNullMapValue.java b/checker/tests/nullness-asserts/NonNullMapValue.java index f5035493b967..93fb0c070646 100644 --- a/checker/tests/nullness-asserts/NonNullMapValue.java +++ b/checker/tests/nullness-asserts/NonNullMapValue.java @@ -34,13 +34,13 @@ public class NonNullMapValue { void testMyMap(String key) { @NonNull String value; - // :: error: (assignment) + // :: error: [assignment] value = myMap.get(key); // should issue warning if (myMap.containsKey(key)) { value = myMap.get(key); } for (String keyInMap : myMap.keySet()) { - // :: error: (assignment) + // :: error: [assignment] value = myMap.get(key); // should issue warning } for (String keyInMap : myMap.keySet()) { @@ -142,7 +142,7 @@ public void negateMap(Map map, Object key) { public void withinElseInvalid(Map map, Object key) { if (map.containsKey(key)) { } else { - // :: error: (assignment) + // :: error: [assignment] @NonNull Object v = map.get(key); // should issue warning } } @@ -171,9 +171,9 @@ void testAnd(MyMap map, MyMap map2) { if (map.containsKey(KEY)) { map.get(KEY).toString(); } - // :: warning: (nulltest.redundant) + // :: warning: [nulltest.redundant] if (map.containsKey(KEY2) && map.get(KEY2).toString() != null) {} - // :: error: (dereference.of.nullable) :: warning: (nulltest.redundant) + // :: error: [dereference.of.nullable] :: warning: [nulltest.redundant] if (map2.containsKey(KEY2) && map2.get(KEY2).toString() != null) {} } @@ -181,7 +181,7 @@ void testAndWithIllegalMapAnnotation(MyMap2 map) { if (map.containsKey(KEY)) { map.get(KEY).toString(); } - // :: warning: (nulltest.redundant) + // :: warning: [nulltest.redundant] if (map.containsKey(KEY2) && map.get(KEY2).toString() != null) { // do nothing } @@ -205,7 +205,7 @@ interface MyMap3 { @EnsuresNonNullIf(result = true, expression = "get(#1)") // The following error is issued because, unlike in interface MyMap2, // this interface has no get() method. - // :: error: (flowexpr.parse.error) + // :: error: [flowexpr.parse.error] boolean containsKey(@Nullable Object a1); } } diff --git a/checker/tests/nullness-asserts/TestAssumeAssertionsAreEnabled.java b/checker/tests/nullness-asserts/TestAssumeAssertionsAreEnabled.java index 56aaed961693..e52e16bc3929 100644 --- a/checker/tests/nullness-asserts/TestAssumeAssertionsAreEnabled.java +++ b/checker/tests/nullness-asserts/TestAssumeAssertionsAreEnabled.java @@ -3,12 +3,12 @@ public class TestAssumeAssertionsAreEnabled { void foo(@Nullable String s1, @Nullable String s2) { - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] assert s2.equals(s1); } void bar(@Nullable String s1, @Nullable String s2) { - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] assert s2.equals(s1) : "@AssumeAssertion(nullness)"; } } diff --git a/checker/tests/nullness-assumeassertions/TestAssumeAssertionsAreDisabled.java b/checker/tests/nullness-assumeassertions/TestAssumeAssertionsAreDisabled.java index ae3f09038b7f..725ba4a42102 100644 --- a/checker/tests/nullness-assumeassertions/TestAssumeAssertionsAreDisabled.java +++ b/checker/tests/nullness-assumeassertions/TestAssumeAssertionsAreDisabled.java @@ -8,7 +8,7 @@ void foo(@Nullable String s1, @Nullable String s2) { assert s2.equals(s1); // However, even with assertions disabled, @AssumeAssertion is still respected - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] assert s2.equals(s1) : "@AssumeAssertion(nullness)"; } } diff --git a/checker/tests/nullness-assumekeyfor/AssumeKeyForTest.java b/checker/tests/nullness-assumekeyfor/AssumeKeyForTest.java index 54d2b7a8c614..7881da781a5d 100644 --- a/checker/tests/nullness-assumekeyfor/AssumeKeyForTest.java +++ b/checker/tests/nullness-assumekeyfor/AssumeKeyForTest.java @@ -19,7 +19,7 @@ void m2(Map m, String k) { } void m3(Map m, String k) { - // :: error: (assignment) + // :: error: [assignment] @NonNull Integer x = m.get(k); } @@ -36,12 +36,12 @@ void m6(Map m, @KeyFor("#1") String k) { } void m7(Map m, @KeyFor("#1") String k) { - // :: error: (assignment) + // :: error: [assignment] @NonNull Integer x = m.get(k); } void m7b(HashMap m, @KeyFor("#1") String k) { - // :: error: (assignment) + // :: error: [assignment] @NonNull Integer x = m.get(k); } diff --git a/checker/tests/nullness-checkcastelementtype/Issue1315.java b/checker/tests/nullness-checkcastelementtype/Issue1315.java index ec66dc23545b..edcbefa2182a 100644 --- a/checker/tests/nullness-checkcastelementtype/Issue1315.java +++ b/checker/tests/nullness-checkcastelementtype/Issue1315.java @@ -13,7 +13,7 @@ static class Box { @SuppressWarnings("unchecked") T test1(@Nullable Object p) { - // :: warning: (cast.unsafe) + // :: warning: [cast.unsafe] return (T) p; } @@ -29,7 +29,7 @@ static class Casts { public static void test() { Box bs = new Box<>(""); bs.f = bs.test1(null); - // :: error: (argument) + // :: error: [argument] bs.f = bs.test2(null); bs.f.toString(); } diff --git a/checker/tests/nullness-concurrent-semantics/Issue350.java b/checker/tests/nullness-concurrent-semantics/Issue350.java index 858acba80b98..d91277fbeb4c 100644 --- a/checker/tests/nullness-concurrent-semantics/Issue350.java +++ b/checker/tests/nullness-concurrent-semantics/Issue350.java @@ -10,7 +10,7 @@ class Test1 { public void test2() { y = ""; // Sanity check that -AconcurrentSemantics is set - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] y.toString(); } diff --git a/checker/tests/nullness-extra/issue309/Expected.txt b/checker/tests/nullness-extra/issue309/Expected.txt index 20239e31e11c..39acdd4542d6 100644 --- a/checker/tests/nullness-extra/issue309/Expected.txt +++ b/checker/tests/nullness-extra/issue309/Expected.txt @@ -1,2 +1,2 @@ -warning: (annotation.not.completed) +warning: [annotation.not.completed] 1 warning diff --git a/checker/tests/nullness-extra/issue348/Expected.txt b/checker/tests/nullness-extra/issue348/Expected.txt index 20239e31e11c..39acdd4542d6 100644 --- a/checker/tests/nullness-extra/issue348/Expected.txt +++ b/checker/tests/nullness-extra/issue348/Expected.txt @@ -1,2 +1,2 @@ -warning: (annotation.not.completed) +warning: [annotation.not.completed] 1 warning diff --git a/checker/tests/nullness-extra/issue594/Issue594.java b/checker/tests/nullness-extra/issue594/Issue594.java index e56f4458e9fa..14a7b4c4d3e2 100644 --- a/checker/tests/nullness-extra/issue594/Issue594.java +++ b/checker/tests/nullness-extra/issue594/Issue594.java @@ -13,7 +13,7 @@ public class Issue594 { // Should return @Nullable T private T getResult() { - // :: error: (return) + // :: error: [return] return result; } } diff --git a/checker/tests/nullness-extra/shorthand/NullnessOnlyExpected.txt b/checker/tests/nullness-extra/shorthand/NullnessOnlyExpected.txt index a9036056c6a9..a60ce3b5eddd 100644 --- a/checker/tests/nullness-extra/shorthand/NullnessOnlyExpected.txt +++ b/checker/tests/nullness-extra/shorthand/NullnessOnlyExpected.txt @@ -1,2 +1,2 @@ -NullnessRegexWithErrors.java:9:11: compiler.warn.proc.messager: (assignment) +NullnessRegexWithErrors.java:9:11: compiler.warn.proc.messager: [assignment] 1 warning diff --git a/checker/tests/nullness-extra/shorthand/NullnessRegexExpected.txt b/checker/tests/nullness-extra/shorthand/NullnessRegexExpected.txt index 2f1eec546ee6..b64d5fa21af0 100644 --- a/checker/tests/nullness-extra/shorthand/NullnessRegexExpected.txt +++ b/checker/tests/nullness-extra/shorthand/NullnessRegexExpected.txt @@ -1,3 +1,3 @@ -NullnessRegexWithErrors.java:9:11: compiler.warn.proc.messager: (assignment) -NullnessRegexWithErrors.java:10:21: compiler.warn.proc.messager: (argument) +NullnessRegexWithErrors.java:9:11: compiler.warn.proc.messager: [assignment] +NullnessRegexWithErrors.java:10:21: compiler.warn.proc.messager: [argument] 2 warnings diff --git a/checker/tests/nullness-javadoc/JavadocJdkAnnotations.java b/checker/tests/nullness-javadoc/JavadocJdkAnnotations.java index 5e95d83ddd70..362b84cbd277 100644 --- a/checker/tests/nullness-javadoc/JavadocJdkAnnotations.java +++ b/checker/tests/nullness-javadoc/JavadocJdkAnnotations.java @@ -15,7 +15,7 @@ void testPureAnnotation(Doc d) { d.isIncluded(); @NonNull Object x = f; d.tags(); - // :: error: (assignment) + // :: error: [assignment] @NonNull Object y = f; } } diff --git a/checker/tests/nullness-nodelombok/UnsoundnessTest.java b/checker/tests/nullness-nodelombok/UnsoundnessTest.java index 992e735cac2a..069a59fccdb7 100644 --- a/checker/tests/nullness-nodelombok/UnsoundnessTest.java +++ b/checker/tests/nullness-nodelombok/UnsoundnessTest.java @@ -11,7 +11,7 @@ static void test() { // If the CF and Lombok are ever able to work in the same invocation of javac // (i.e. without delomboking first), then this error should be changed back to an // expected error by re-adding the leading "::". - // error: (assignment) + // error: [assignment] builder().foo(null).build(); } } diff --git a/checker/tests/nullness-permitClearProperty/PermitClearProperty.java b/checker/tests/nullness-permitClearProperty/PermitClearProperty.java index 17ad0b11bce0..7b8418fdbe41 100644 --- a/checker/tests/nullness-permitClearProperty/PermitClearProperty.java +++ b/checker/tests/nullness-permitClearProperty/PermitClearProperty.java @@ -11,52 +11,52 @@ public class PermitClearProperty { static final @StringVal("my.property.name") String MY_PROPERTY_NAME = "my.property.name"; @NonNull String getLineSeparator1() { - // :: error: (return) + // :: error: [return] return System.getProperty("line.separator"); } @NonNull String getLineSeparator2() { - // :: error: (return) + // :: error: [return] return System.getProperty(LINE_SEPARATOR); } @NonNull String getMyProperty1() { - // :: error: (return) + // :: error: [return] return System.getProperty("my.property.name"); } @NonNull String getMyProperty2() { - // :: error: (return) + // :: error: [return] return System.getProperty(MY_PROPERTY_NAME); } @NonNull String getAProperty(String propName) { - // :: error: (return) + // :: error: [return] return System.getProperty(propName); } @NonNull String clearLineSeparator1() { - // :: error: (return) + // :: error: [return] return System.clearProperty("line.separator"); } @NonNull String clearLineSeparator2() { - // :: error: (return) + // :: error: [return] return System.clearProperty(LINE_SEPARATOR); } @NonNull String clearMyProperty1() { - // :: error: (return) + // :: error: [return] return System.clearProperty("my.property.name"); } @NonNull String clearMyProperty2() { - // :: error: (return) + // :: error: [return] return System.clearProperty(MY_PROPERTY_NAME); } @NonNull String clearAProperty(String propName) { - // :: error: (return) + // :: error: [return] return System.clearProperty(propName); } @@ -67,59 +67,59 @@ void callSetProperties(Properties p) { // All calls to setProperty are legal because they cannot unset a property. @NonNull String setLineSeparator1() { - // :: error: (return) + // :: error: [return] return System.setProperty("line.separator", "somevalue"); } @NonNull String setLineSeparator2() { - // :: error: (return) + // :: error: [return] return System.setProperty(LINE_SEPARATOR, "somevalue"); } @NonNull String setMyProperty1() { - // :: error: (return) + // :: error: [return] return System.setProperty("my.property.name", "somevalue"); } @NonNull String setMyProperty2() { - // :: error: (return) + // :: error: [return] return System.setProperty(MY_PROPERTY_NAME, "somevalue"); } @NonNull String setAProperty(String propName) { - // :: error: (return) + // :: error: [return] return System.setProperty(propName, "somevalue"); } // These calls to setProperty are illegal because null is not a permitted value. @NonNull String setLineSeparatorNull1() { - // :: error: (return) - // :: error: (argument) + // :: error: [return] + // :: error: [argument] return System.setProperty("line.separator", null); } @NonNull String setLineSeparatorNull2() { - // :: error: (argument) - // :: error: (return) + // :: error: [argument] + // :: error: [return] return System.setProperty(LINE_SEPARATOR, null); } @NonNull String setMyPropertyNull1() { - // :: error: (argument) - // :: error: (return) + // :: error: [argument] + // :: error: [return] return System.setProperty("my.property.name", null); } @NonNull String setMyPropertyNull2() { - // :: error: (argument) - // :: error: (return) + // :: error: [argument] + // :: error: [return] return System.setProperty(MY_PROPERTY_NAME, null); } @NonNull String setAPropertyNull(String propName) { - // :: error: (argument) - // :: error: (return) + // :: error: [argument] + // :: error: [return] return System.setProperty(propName, null); } } diff --git a/checker/tests/nullness-records/BasicRecord.java b/checker/tests/nullness-records/BasicRecord.java index f00e5d10c32b..1b1cfc1c394d 100644 --- a/checker/tests/nullness-records/BasicRecord.java +++ b/checker/tests/nullness-records/BasicRecord.java @@ -8,7 +8,7 @@ public static BasicRecord makeNonNull(String s) { } public static BasicRecord makeNull(@Nullable String s) { - // :: error: (argument) + // :: error: [argument] return new BasicRecord(s); } } diff --git a/checker/tests/nullness-records/BasicRecordCanon.java b/checker/tests/nullness-records/BasicRecordCanon.java index 9aa93f649b45..5dc059a7719d 100644 --- a/checker/tests/nullness-records/BasicRecordCanon.java +++ b/checker/tests/nullness-records/BasicRecordCanon.java @@ -8,7 +8,7 @@ public static BasicRecordCanon makeNonNull(String s) { } public static BasicRecordCanon makeNull(@Nullable String s) { - // :: error: (argument) + // :: error: [argument] return new BasicRecordCanon(s); } diff --git a/checker/tests/nullness-records/BasicRecordNullable.java b/checker/tests/nullness-records/BasicRecordNullable.java index e550b3998350..dd4846bd995e 100644 --- a/checker/tests/nullness-records/BasicRecordNullable.java +++ b/checker/tests/nullness-records/BasicRecordNullable.java @@ -20,12 +20,12 @@ public static BasicRecordNullable makeNull(@Nullable String s) { } public String getStringFromFieldErr() { - // :: error: (return) + // :: error: [return] return str; } public String getStringFromMethodErr() { - // :: error: (return) + // :: error: [return] return str(); } } diff --git a/checker/tests/nullness-records/DefaultQualRecord.java b/checker/tests/nullness-records/DefaultQualRecord.java index 18cc6ba327b9..ea4af071709c 100644 --- a/checker/tests/nullness-records/DefaultQualRecord.java +++ b/checker/tests/nullness-records/DefaultQualRecord.java @@ -2,9 +2,9 @@ import org.checkerframework.framework.qual.DefaultQualifier; class StandardQualClass { - // :: error: (assignment) + // :: error: [assignment] public static String s = null; - // :: error: (initialization.static.field.uninitialized) + // :: error: [initialization.static.field.uninitialized] public static String u; } @@ -15,7 +15,7 @@ class DefaultQualClass { } interface StandardQualInterface { - // :: error: (assignment) + // :: error: [assignment] public static String s = null; } @@ -26,9 +26,9 @@ interface DefaultQualInterface { enum StandardQualEnum { DUMMY; - // :: error: (assignment) + // :: error: [assignment] public static String s = null; - // :: error: (initialization.static.field.uninitialized) + // :: error: [initialization.static.field.uninitialized] public static String u; } @@ -40,13 +40,13 @@ enum DefaultQualEnum { } record StandardQualRecord(String m) { - // :: error: (assignment) + // :: error: [assignment] public static String s = null; - // :: error: (initialization.static.field.uninitialized) + // :: error: [initialization.static.field.uninitialized] public static String u; StandardQualRecord { - // :: error: (assignment) + // :: error: [assignment] m = null; } } diff --git a/checker/tests/nullness-records/GenericPair.java b/checker/tests/nullness-records/GenericPair.java index a7561795816f..6004b260f0df 100644 --- a/checker/tests/nullness-records/GenericPair.java +++ b/checker/tests/nullness-records/GenericPair.java @@ -5,7 +5,7 @@ public record GenericPair(K key, V value) { public static void foo() { GenericPair p = new GenericPair<>("k", null); - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] p.value().toString(); } } diff --git a/checker/tests/nullness-records/Issue5200.java b/checker/tests/nullness-records/Issue5200.java index 873021b55470..c24d1e75dc87 100644 --- a/checker/tests/nullness-records/Issue5200.java +++ b/checker/tests/nullness-records/Issue5200.java @@ -17,7 +17,7 @@ void checkEmpty(Foo foo) { if (foo.bar() != null && !foo.bar().isEmpty()) { System.out.println("ok"); } - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] if (foo.baz() != null && !foo.baz().isEmpty()) { System.out.println("not ok"); } diff --git a/checker/tests/nullness-records/LocalRecords.java b/checker/tests/nullness-records/LocalRecords.java index feea11ca6ff9..33fa3b059416 100644 --- a/checker/tests/nullness-records/LocalRecords.java +++ b/checker/tests/nullness-records/LocalRecords.java @@ -6,7 +6,7 @@ public static void foo() { record L(String key, @Nullable Integer value) {} L a = new L("one", 1); L b = new L("i", null); - // :: error: (argument) + // :: error: [argument] L c = new L(null, 6); } } diff --git a/checker/tests/nullness-records/NestedRecordTest.java b/checker/tests/nullness-records/NestedRecordTest.java index 81e9e927e6c1..db6411b7c657 100644 --- a/checker/tests/nullness-records/NestedRecordTest.java +++ b/checker/tests/nullness-records/NestedRecordTest.java @@ -16,25 +16,25 @@ public record NPerson(String familyName, @Nullable String maidenName) {} void nclient() { Nested.NPerson np1 = new Nested.NPerson(nn, nn); Nested.NPerson np2 = new Nested.NPerson(nn, nble); - // :: error: (argument) + // :: error: [argument] Nested.NPerson np3 = new Nested.NPerson(nble, nn); - // :: error: (argument) + // :: error: [argument] Nested.NPerson np4 = new Nested.NPerson(nble, nble); Inner.IPerson ip1 = new Inner.IPerson(nn, nn); Inner.IPerson ip2 = new Inner.IPerson(nn, nble); - // :: error: (argument) + // :: error: [argument] Inner.IPerson ip3 = new Inner.IPerson(nble, nn); - // :: error: (argument) + // :: error: [argument] Inner.IPerson ip4 = new Inner.IPerson(nble, nble); nn2 = np2.familyName(); nble2 = np2.familyName(); - // :: error: (assignment) + // :: error: [assignment] nn2 = np2.maidenName(); nble2 = np2.maidenName(); nn2 = ip2.familyName(); nble2 = ip2.familyName(); - // :: error: (assignment) + // :: error: [assignment] nn2 = ip2.maidenName(); nble2 = ip2.maidenName(); } @@ -46,25 +46,25 @@ public record IPerson(String familyName, @Nullable String maidenName) {} void iclient() { Nested.NPerson np1 = new Nested.NPerson(nn, nn); Nested.NPerson np2 = new Nested.NPerson(nn, nble); - // :: error: (argument) + // :: error: [argument] Nested.NPerson np3 = new Nested.NPerson(nble, nn); - // :: error: (argument) + // :: error: [argument] Nested.NPerson np4 = new Nested.NPerson(nble, nble); Inner.IPerson ip1 = new Inner.IPerson(nn, nn); Inner.IPerson ip2 = new Inner.IPerson(nn, nble); - // :: error: (argument) + // :: error: [argument] Inner.IPerson ip3 = new Inner.IPerson(nble, nn); - // :: error: (argument) + // :: error: [argument] Inner.IPerson ip4 = new Inner.IPerson(nble, nble); nn2 = np2.familyName(); nble2 = np2.familyName(); - // :: error: (assignment) + // :: error: [assignment] nn2 = np2.maidenName(); nble2 = np2.maidenName(); nn2 = ip2.familyName(); nble2 = ip2.familyName(); - // :: error: (assignment) + // :: error: [assignment] nn2 = ip2.maidenName(); nble2 = ip2.maidenName(); } @@ -73,25 +73,25 @@ void iclient() { void client() { Nested.NPerson np1 = new Nested.NPerson(nn, nn); Nested.NPerson np2 = new Nested.NPerson(nn, nble); - // :: error: (argument) + // :: error: [argument] Nested.NPerson np3 = new Nested.NPerson(nble, nn); - // :: error: (argument) + // :: error: [argument] Nested.NPerson np4 = new Nested.NPerson(nble, nble); Inner.IPerson ip1 = new Inner.IPerson(nn, nn); Inner.IPerson ip2 = new Inner.IPerson(nn, nble); - // :: error: (argument) + // :: error: [argument] Inner.IPerson ip3 = new Inner.IPerson(nble, nn); - // :: error: (argument) + // :: error: [argument] Inner.IPerson ip4 = new Inner.IPerson(nble, nble); nn2 = np2.familyName(); nble2 = np2.familyName(); - // :: error: (assignment) + // :: error: [assignment] nn2 = np2.maidenName(); nble2 = np2.maidenName(); nn2 = ip2.familyName(); nble2 = ip2.familyName(); - // :: error: (assignment) + // :: error: [assignment] nn2 = ip2.maidenName(); nble2 = ip2.maidenName(); } diff --git a/checker/tests/nullness-records/NormalizingRecord.java b/checker/tests/nullness-records/NormalizingRecord.java index 37ea10974e95..0508a0981d45 100644 --- a/checker/tests/nullness-records/NormalizingRecord.java +++ b/checker/tests/nullness-records/NormalizingRecord.java @@ -29,7 +29,7 @@ record NormalizingRecord2(String s) { record NormalizingRecordIllegalConstructor1(String s) { NormalizingRecordIllegalConstructor1(@Nullable String s) { - // :: error: (assignment) + // :: error: [assignment] this.s = s; } } @@ -38,7 +38,7 @@ record NormalizingRecordIllegalConstructor2(@Nullable String s) { NormalizingRecordIllegalConstructor2(String s) { if (s.equals("")) { // The formal parametr type is @NonNull, so this assignment to it is illegal. - // :: error: (assignment) + // :: error: [assignment] s = null; } this.s = s; @@ -47,7 +47,7 @@ record NormalizingRecordIllegalConstructor2(@Nullable String s) { class Client { - // :: error: (argument) + // :: error: [argument] NormalizingRecord1 nr1_1 = new NormalizingRecord1(null); NormalizingRecord1 nr1_2 = new NormalizingRecord1(""); NormalizingRecord1 nr1_3 = new NormalizingRecord1("hello"); diff --git a/checker/tests/nullness-records/RecordPurity.java b/checker/tests/nullness-records/RecordPurity.java index 83be0b5d06d8..920b68bcafc5 100644 --- a/checker/tests/nullness-records/RecordPurity.java +++ b/checker/tests/nullness-records/RecordPurity.java @@ -4,12 +4,12 @@ // @below-java17-jdk-skip-test record RecordPurity(@Nullable String first, @Nullable String second) { public String checkNullnessOfFields() { - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] return first.toString() + " " + second.toString(); } public String checkNullnessOfAccessors() { - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] return first().toString() + " " + second().toString(); } @@ -80,7 +80,7 @@ public String checkPurityOfImpureMethod() { java.util.List ss = java.util.List.of(); if (first(ss) == null) return ""; else - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] return "" + "".length() + first(ss).length(); } diff --git a/checker/tests/nullness-records/RecordPurityGeneric.java b/checker/tests/nullness-records/RecordPurityGeneric.java index be951f9691df..0c2a5fb46275 100644 --- a/checker/tests/nullness-records/RecordPurityGeneric.java +++ b/checker/tests/nullness-records/RecordPurityGeneric.java @@ -3,24 +3,24 @@ // @below-java17-jdk-skip-test record RecordPurityGeneric(A a, B b) { public String checkNullnessOfFields() { - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] return a.toString() + " " + b.toString(); } public String checkNullnessOfAccessors() { - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] return a().toString() + " " + b().toString(); } public static String checkNullnessOfFields( RecordPurityGeneric<@Nullable String, @Nullable String> r) { - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] return r.a.toString() + " " + r.b.toString(); } public static String checkNullnessOfAccessors( RecordPurityGeneric<@Nullable String, @Nullable String> r) { - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] return r.a().toString() + " " + r.b().toString(); } diff --git a/checker/tests/nullness-records/RecordPurityOverride.java b/checker/tests/nullness-records/RecordPurityOverride.java index d372cf04619e..4ba352c7ab68 100644 --- a/checker/tests/nullness-records/RecordPurityOverride.java +++ b/checker/tests/nullness-records/RecordPurityOverride.java @@ -20,7 +20,7 @@ public String checkPurityOfFields() { public String checkPurityOfAccessor1() { if (pure() == null || impure() == null) return ""; else - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] return pure().toString() + " " + impure().toString(); } @@ -32,7 +32,7 @@ public String checkPurityOfAccessor2() { public String checkPurityOfAccessor3() { if (impure() == null) return ""; else - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] return impure().toString(); } } diff --git a/checker/tests/nullness-safedefaultsbytecode/BytecodeDefaultsTest.java b/checker/tests/nullness-safedefaultsbytecode/BytecodeDefaultsTest.java index 06813e2f4a11..4550f1f8aab8 100644 --- a/checker/tests/nullness-safedefaultsbytecode/BytecodeDefaultsTest.java +++ b/checker/tests/nullness-safedefaultsbytecode/BytecodeDefaultsTest.java @@ -14,14 +14,14 @@ void g(String s) {} @AnnotatedFor("nullness") class HasErrors { Object f() { - // :: error: (return) + // :: error: [return] return null; } } class HasErrors2 { Object f() { - // :: error: (return) + // :: error: [return] return null; } } diff --git a/checker/tests/nullness-safedefaultssourcecode/BasicSafeDefaultsTest.java b/checker/tests/nullness-safedefaultssourcecode/BasicSafeDefaultsTest.java index f8df59e59a31..91a5ca8764dd 100644 --- a/checker/tests/nullness-safedefaultssourcecode/BasicSafeDefaultsTest.java +++ b/checker/tests/nullness-safedefaultssourcecode/BasicSafeDefaultsTest.java @@ -9,12 +9,12 @@ public class BasicSafeDefaultsTest { void m1() { @NonNull Object x1 = SdfuscLib.unannotated(); - // :: error: (assignment) + // :: error: [assignment] @NonNull Object x2 = SdfuscLib.returnsNullable(); @NonNull Object x3 = SdfuscLib.returnsNonNull(); - // :: error: (assignment) + // :: error: [assignment] @NonNull Object x4 = SdfuscLibNotAnnotatedFor.unannotated(); - // :: error: (assignment) + // :: error: [assignment] @NonNull Object x5 = SdfuscLibNotAnnotatedFor.returnsNullable(); @NonNull Object x6 = SdfuscLibNotAnnotatedFor.returnsNonNull(); } diff --git a/checker/tests/nullness-skipdefs/SkipDefs1.java b/checker/tests/nullness-skipdefs/SkipDefs1.java index 63f2749fc7e3..6700e429adac 100644 --- a/checker/tests/nullness-skipdefs/SkipDefs1.java +++ b/checker/tests/nullness-skipdefs/SkipDefs1.java @@ -10,7 +10,7 @@ static Object foo() { static class DontSkip { static Object foo() { - // :: error: (return) + // :: error: [return] return null; } } diff --git a/checker/tests/nullness-skipdefs/SkipDefs2.java b/checker/tests/nullness-skipdefs/SkipDefs2.java index aaab65a33317..f74a345c7841 100644 --- a/checker/tests/nullness-skipdefs/SkipDefs2.java +++ b/checker/tests/nullness-skipdefs/SkipDefs2.java @@ -11,7 +11,7 @@ static void foo() {} static class DontSkip { static Object foo() { - // :: error: (return) + // :: error: [return] return null; } } diff --git a/checker/tests/nullness-skipdirs/skip/SkipDirs1.java b/checker/tests/nullness-skipdirs/skip/SkipDirs1.java index dd3b88be43c8..45f0916a75ad 100644 --- a/checker/tests/nullness-skipdirs/skip/SkipDirs1.java +++ b/checker/tests/nullness-skipdirs/skip/SkipDirs1.java @@ -4,14 +4,14 @@ public class SkipDirs1 { static class DontSkipMe { static Object foo() { - // :: error: (return) + // :: error: [return] return null; } } static class DontSkip { static Object foo() { - // :: error: (return) + // :: error: [return] return null; } } diff --git a/checker/tests/nullness-skipuses/SkipUses1.java b/checker/tests/nullness-skipuses/SkipUses1.java index 08f350d76c45..929b3d5cf990 100644 --- a/checker/tests/nullness-skipuses/SkipUses1.java +++ b/checker/tests/nullness-skipuses/SkipUses1.java @@ -17,10 +17,10 @@ static class DontSkip { static class Main { void bar(boolean b) { @NonNull Object x = SkipMe.foo(); - // :: error: (assignment) + // :: error: [assignment] @NonNull Object y = DontSkip.foo(); - // :: error: (assignment) + // :: error: [assignment] @NonNull Object z = b ? SkipMe.foo() : DontSkip.foo(); } } diff --git a/checker/tests/nullness-skipuses/SkipUses2.java b/checker/tests/nullness-skipuses/SkipUses2.java index 126d459b238d..08467524144d 100644 --- a/checker/tests/nullness-skipuses/SkipUses2.java +++ b/checker/tests/nullness-skipuses/SkipUses2.java @@ -24,7 +24,7 @@ void bar(boolean b) { SkipMe.f = null; SkipMe.foo(); DontSkip.f = null; - // :: error: (contracts.precondition) + // :: error: [contracts.precondition] DontSkip.foo(); } } diff --git a/checker/tests/nullness-stubfile/Issue4598.java b/checker/tests/nullness-stubfile/Issue4598.java index 9613ba4f3a87..29e71d96ea5b 100644 --- a/checker/tests/nullness-stubfile/Issue4598.java +++ b/checker/tests/nullness-stubfile/Issue4598.java @@ -9,7 +9,7 @@ public class Issue4598 { public Object foo() { Objects.requireNonNull(d, "destination"); - // :: error: (return) + // :: error: [return] return d; } } diff --git a/checker/tests/nullness-stubfile/NullnessStubfileMerge.java b/checker/tests/nullness-stubfile/NullnessStubfileMerge.java index feaab47ce653..4b408c9607cd 100644 --- a/checker/tests/nullness-stubfile/NullnessStubfileMerge.java +++ b/checker/tests/nullness-stubfile/NullnessStubfileMerge.java @@ -27,10 +27,10 @@ public class NullnessStubfileMerge { void method() { // below fails because of stub file overruling annotated JDK - // :: error: (type.argument) + // :: error: [type.argument] java.util.List<@NonNull String> l; - // :: error: (assignment) + // :: error: [assignment] @NonNull String error1 = nonNull.intern(); nonNull.substring('!'); @@ -41,7 +41,7 @@ void method() { char[] nullChars = null; nonNull.getChars(1, 1, nonNullChars, 1); - // :: error: (argument) + // :: error: [argument] nonNull.getChars(1, 1, nullChars, 1); } } diff --git a/checker/tests/nullness-warnredundantannotations/RedundantAnnoWithDefaultQualifier.java b/checker/tests/nullness-warnredundantannotations/RedundantAnnoWithDefaultQualifier.java index d1377fb53ec8..6576cab63b18 100644 --- a/checker/tests/nullness-warnredundantannotations/RedundantAnnoWithDefaultQualifier.java +++ b/checker/tests/nullness-warnredundantannotations/RedundantAnnoWithDefaultQualifier.java @@ -5,10 +5,10 @@ @DefaultQualifier(Nullable.class) public class RedundantAnnoWithDefaultQualifier { - // :: warning: (redundant.anno) + // :: warning: [redundant.anno] void foo(@Nullable String message) {} - // :: warning: (redundant.anno) + // :: warning: [redundant.anno] @Nullable Integer foo() { return 5; } diff --git a/checker/tests/nullness-warnredundantannotations/RedundantAnnotation.java b/checker/tests/nullness-warnredundantannotations/RedundantAnnotation.java index 8591fa4d55b0..fb569e83f262 100644 --- a/checker/tests/nullness-warnredundantannotations/RedundantAnnotation.java +++ b/checker/tests/nullness-warnredundantannotations/RedundantAnnotation.java @@ -26,65 +26,65 @@ */ @NonNull class RedundantAnnotation< - // TODO :: warning: (redundant.anno) + // TODO :: warning: [redundant.anno] T extends @Nullable Object> { enum InnerEnum { - // TODO :: warning: (redundant.anno) - // :: error: (nullness.on.enum) + // TODO :: warning: [redundant.anno] + // :: error: [nullness.on.enum] @NonNull EXPLICIT, IMPLICIT, } - // :: warning: (redundant.anno) + // :: warning: [redundant.anno] @NonNull Object f; - // :: warning: (redundant.anno) + // :: warning: [redundant.anno] @NonNull Integer foo(InputStream arg) { - // :: warning: (redundant.anno) + // :: warning: [redundant.anno] @Nullable Object local; return Integer.valueOf(1); } - // :: warning: (redundant.anno) + // :: warning: [redundant.anno] void foo2(@NonNull Integer i) {} - // TODO :: warning: (redundant.anno) - // :: error: (nullness.on.constructor) + // TODO :: warning: [redundant.anno] + // :: error: [nullness.on.constructor] @NonNull RedundantAnnotation() { f = new Object(); } - // :: error: (nullness.on.receiver) - // :: warning: (redundant.anno) + // :: error: [nullness.on.receiver] + // :: warning: [redundant.anno] void bar(@NonNull RedundantAnnotation this, InputStream arg) throws Exception { - // :: warning: (redundant.anno) + // :: warning: [redundant.anno] try (@Nullable InputStream in = arg) { - // :: warning: (redundant.anno) - // :: warning: (nullness.on.exception.parameter) + // :: warning: [redundant.anno] + // :: warning: [nullness.on.exception.parameter] } catch (@NonNull Exception e) { } - // TODO :: warning: (redundant.anno) warning on the upper bound + // TODO :: warning: [redundant.anno] warning on the upper bound List l; - // TODO :: warning: (redundant.anno) warning on the lower bound - // :: error: (super.wildcard) + // TODO :: warning: [redundant.anno] warning on the lower bound + // :: error: [super.wildcard] List l2; Object obj = null; - // TODO :: warning: (redundant.anno) for the typecast + // TODO :: warning: [redundant.anno] for the typecast String x = (@Nullable String) obj; - // TODO :: warning: (redundant.anno) for the instanceof - // :: error: (instanceof.nullable) + // TODO :: warning: [redundant.anno] for the instanceof + // :: error: [instanceof.nullable] boolean b = x instanceof @Nullable String; - // TODO :: warning: (redundant.anno) on the component type + // TODO :: warning: [redundant.anno] on the component type @NonNull String[] strs; - // TODO :: warning: (redundant.anno) on the component type + // TODO :: warning: [redundant.anno] on the component type strs = new @NonNull String[10]; } } diff --git a/checker/tests/nullness/AliasedAnnotations.java b/checker/tests/nullness/AliasedAnnotations.java index a88b5a72f2a2..4747e9b5f319 100644 --- a/checker/tests/nullness/AliasedAnnotations.java +++ b/checker/tests/nullness/AliasedAnnotations.java @@ -4,83 +4,83 @@ public class AliasedAnnotations { void useNonNullAnnotations() { - // :: error: (assignment) + // :: error: [assignment] @org.checkerframework.checker.nullness.qual.NonNull Object nn1 = null; - // :: error: (assignment) + // :: error: [assignment] @com.sun.istack.internal.NotNull Object nn2 = null; - // :: error: (assignment) + // :: error: [assignment] @edu.umd.cs.findbugs.annotations.NonNull Object nn3 = null; - // :: error: (assignment) + // :: error: [assignment] @javax.annotation.Nonnull Object nn4 = null; - // Invalid location for NonNull :: error: (assignment) + // Invalid location for NonNull :: error: [assignment] // @javax.validation.constraints.NotNull Object nn5 = null; - // :: error: (assignment) + // :: error: [assignment] @org.eclipse.jdt.annotation.NonNull Object nn6 = null; - // :: error: (assignment) + // :: error: [assignment] @org.jetbrains.annotations.NotNull Object nn7 = null; - // :: error: (assignment) + // :: error: [assignment] @org.netbeans.api.annotations.common.NonNull Object nn8 = null; - // :: error: (assignment) + // :: error: [assignment] @org.jmlspecs.annotation.NonNull Object nn9 = null; } void useNullableAnnotations1(@org.checkerframework.checker.nullness.qual.Nullable Object nble) { - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] nble.toString(); } void useNullableAnnotations2(@com.sun.istack.internal.Nullable Object nble) { - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] nble.toString(); } void useNullableAnnotations3(@edu.umd.cs.findbugs.annotations.Nullable Object nble) { - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] nble.toString(); } void useNullableAnnotations4(@edu.umd.cs.findbugs.annotations.CheckForNull Object nble) { - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] nble.toString(); } void useNullableAnnotations5(@edu.umd.cs.findbugs.annotations.UnknownNullness Object nble) { - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] nble.toString(); } void useNullableAnnotations6(@javax.annotation.Nullable Object nble) { - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] nble.toString(); } void useNullableAnnotations7(@javax.annotation.CheckForNull Object nble) { - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] nble.toString(); } void useNullableAnnotations9(@org.eclipse.jdt.annotation.Nullable Object nble) { - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] nble.toString(); } void useNullableAnnotations10(@org.jetbrains.annotations.Nullable Object nble) { - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] nble.toString(); } void useNullableAnnotations12(@org.netbeans.api.annotations.common.NullAllowed Object nble) { - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] nble.toString(); } void useNullableAnnotations13(@org.netbeans.api.annotations.common.NullUnknown Object nble) { - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] nble.toString(); } void useNullableAnnotations14(@org.jmlspecs.annotation.Nullable Object nble) { - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] nble.toString(); } } diff --git a/checker/tests/nullness/Aliasing.java b/checker/tests/nullness/Aliasing.java index 17314f501891..cc4493d37d9e 100644 --- a/checker/tests/nullness/Aliasing.java +++ b/checker/tests/nullness/Aliasing.java @@ -13,7 +13,7 @@ public static void main(String[] args) { static void m(@NonNull Aliasing a, @NonNull Aliasing b) { a.no = b.nno; // Changing a.no to nonnull does not mean that b.no is also nonnull - // :: error: (assignment) + // :: error: [assignment] b.nno = b.no; System.out.println("@NonNull field b.nno is: " + b.nno); diff --git a/checker/tests/nullness/AnnotatedSupertype.java b/checker/tests/nullness/AnnotatedSupertype.java index 8922a988609d..4d9fa401f729 100644 --- a/checker/tests/nullness/AnnotatedSupertype.java +++ b/checker/tests/nullness/AnnotatedSupertype.java @@ -5,14 +5,14 @@ public class AnnotatedSupertype { class NullableSupertype - // :: error: (nullness.on.supertype) + // :: error: [nullness.on.supertype] extends @Nullable Object - // :: error: (nullness.on.supertype) + // :: error: [nullness.on.supertype] implements @Nullable Serializable {} @NonNull class NonNullSupertype - // :: error: (nullness.on.supertype) + // :: error: [nullness.on.supertype] extends @NonNull Object - // :: error: (nullness.on.supertype) + // :: error: [nullness.on.supertype] implements @NonNull Serializable {} } diff --git a/checker/tests/nullness/AnonymousSkipDefs.java b/checker/tests/nullness/AnonymousSkipDefs.java index 2eb9ee119b09..6da52caeab7f 100644 --- a/checker/tests/nullness/AnonymousSkipDefs.java +++ b/checker/tests/nullness/AnonymousSkipDefs.java @@ -9,7 +9,7 @@ public static void main(String[] args) { @Override public void run() { @Nullable Object veryNull = null; - // :: error: (assignment) + // :: error: [assignment] @NonNull Object notNull = veryNull; notNull.toString(); } diff --git a/checker/tests/nullness/ArrayArgs.java b/checker/tests/nullness/ArrayArgs.java index 8916343daa9f..3b944324732b 100644 --- a/checker/tests/nullness/ArrayArgs.java +++ b/checker/tests/nullness/ArrayArgs.java @@ -11,20 +11,20 @@ public void test() { test(NonNull.class); String[] s1 = new String[] {null, null, null}; - // :: error: (argument) + // :: error: [argument] test(s1); String[] s2 = new String[] {"hello", null, "goodbye"}; - // :: error: (argument) + // :: error: [argument] test(s2); - // :: error: (assignment) + // :: error: [assignment] @NonNull String[] s3 = new String[] {"hello", null, "goodbye"}; - // :: error: (new.array) + // :: error: [new.array] @NonNull String[] s4 = new String[3]; // TODO: when issue 25 is fixed, the following is safe // and no error needs to be raised. String[] s5 = new String[] {"hello", "goodbye"}; - // :: error: (argument) + // :: error: [argument] test(s5); @NonNull String[] s6 = new String[] {"hello", "goodbye"}; test(s6); diff --git a/checker/tests/nullness/ArrayCreationNullable.java b/checker/tests/nullness/ArrayCreationNullable.java index b042b0541416..2c80d0fdb831 100644 --- a/checker/tests/nullness/ArrayCreationNullable.java +++ b/checker/tests/nullness/ArrayCreationNullable.java @@ -10,13 +10,13 @@ public class ArrayCreationNullable { void testObjectArray(@NonNull Object @NonNull [] p) { @NonNull Object @NonNull [] objs; - // :: error: (new.array) + // :: error: [new.array] objs = new Object[10]; objs[0].toString(); - // :: error: (assignment) + // :: error: [assignment] objs = new @Nullable Object[10]; objs[0].toString(); - // :: error: (new.array) + // :: error: [new.array] objs = new @NonNull Object[10]; objs[0].toString(); // Allowed. @@ -29,7 +29,7 @@ void testObjectArray2() { Object[] objs; // Even if the default qualifier is NonNull, array component // types must be Nullable. - // :: error: (new.array) + // :: error: [new.array] objs = new Object[10]; objs[0].toString(); } @@ -40,36 +40,36 @@ void testInitializers() { objs = new Object[] {new Object(), "ha"}; @NonNull Object[] objs2 = {}; - // :: error: (assignment) + // :: error: [assignment] objs2 = new Integer[] {1, null, 3}; - // :: error: (assignment) + // :: error: [assignment] objs2 = new Object[] {new Object(), "ha", null}; @NonNull Object[] objs3 = new Integer[] {1, 2, 3}; objs3 = new Integer[] {1, 2, 3}; - // :: error: (assignment) + // :: error: [assignment] objs3 = new Integer[] {1, 2, 3, null}; (new Integer[] {1, 2, 3})[0].toString(); - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] (new Integer[] {1, 2, 3, null})[0].toString(); // The assignment context is used to infer a @Nullable component type. @Nullable Object[] objs4 = new Integer[] {1, 2, 3}; - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] objs4[0].toString(); objs4 = new Integer[] {1, 2, 3}; } void testStringArray(@NonNull String @NonNull [] p) { @NonNull String @NonNull [] strs; - // :: error: (new.array) + // :: error: [new.array] strs = new String[10]; strs[0].toString(); - // :: error: (assignment) + // :: error: [assignment] strs = new @Nullable String[10]; strs[0].toString(); - // :: error: (new.array) + // :: error: [new.array] strs = new @NonNull String[10]; strs[0].toString(); // Allowed. @@ -79,13 +79,13 @@ void testStringArray(@NonNull String @NonNull [] p) { void testIntegerArray(@NonNull Integer @NonNull [] p) { @NonNull Integer @NonNull [] ints; - // :: error: (new.array) + // :: error: [new.array] ints = new Integer[10]; ints[0].toString(); - // :: error: (assignment) + // :: error: [assignment] ints = new @Nullable Integer[10]; ints[0].toString(); - // :: error: (new.array) + // :: error: [new.array] ints = new @NonNull Integer[10]; ints[0].toString(); // Allowed. @@ -108,7 +108,7 @@ void testToArray(java.util.Set nns) { // Given array is too small -> new one is created. nna = nns.toArray(new Object[nns.size()-2]); // Padding elements will be null. - // TODO:: error: (assignment) + // TODO:: error: [assignment] nna = nns.toArray(new Object[nns.size() + 2]); @Nullable Object [] nbla = nns.toArray(new Object[nns.size() + 2]); } @@ -116,25 +116,25 @@ void testToArray(java.util.Set nns) { void testMultiDim() { // new double[10][10] has type double @NonNull[] @Nullable[] - // :: error: (new.array) + // :: error: [new.array] double @NonNull [] @NonNull [] daa = new double[10][10]; double @NonNull [] @Nullable [] daa2 = new double[10][10]; // new Object[10][10] has type @Nullable Object @NonNull[] @Nullable[] - // :: error: (new.array) + // :: error: [new.array] @Nullable Object @NonNull [] @NonNull [] oaa = new Object[10][10]; @Nullable Object @NonNull [] @Nullable [] oaa2 = new Object[10][10]; // new Object[10][10] has type @Nullable Object @NonNull[] @Nullable[] - // :: error: (new.array) + // :: error: [new.array] oaa2 = new Object @NonNull [10] @NonNull [10]; @MonotonicNonNull Object @NonNull [] @MonotonicNonNull [] oaa3 = new @MonotonicNonNull Object @NonNull [10] @MonotonicNonNull [10]; oaa3[0] = new @MonotonicNonNull Object[4]; - // :: error: (assignment) + // :: error: [assignment] oaa3[0] = null; - // :: error: (assignment) :: error: (accessing.nullable) + // :: error: [assignment] :: error: [accessing.nullable] oaa3[0][0] = null; } @@ -145,7 +145,7 @@ void testMultiDim() { out[i] = null; } else { out[i] = in[i].getClass().toString(); - // :: error: (assignment) + // :: error: [assignment] out[i] = null; } } @@ -157,7 +157,7 @@ void testMonotonicNonNull() { loa = new Object @NonNull [10]; loa[0] = new Object(); @MonotonicNonNull Object @NonNull [] loa2 = new Object @NonNull [10]; - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] loa2[0].toString(); } @@ -165,7 +165,7 @@ void testMonotonicNonNull() { return new Object[10]; } - // :: error: (new.array) + // :: error: [new.array] @NonNull Object @NonNull [] oa0 = new Object[10]; // OK @@ -173,7 +173,7 @@ void testMonotonicNonNull() { Object[] oa1 = new Object[] {new Object()}; - // :: error: (assignment) + // :: error: [assignment] Object[] oa2 = new Object[] {new Object(), null}; public static void main(String[] args) { diff --git a/checker/tests/nullness/ArrayIndex.java b/checker/tests/nullness/ArrayIndex.java index 6b7800daf9aa..fe2349d97c01 100644 --- a/checker/tests/nullness/ArrayIndex.java +++ b/checker/tests/nullness/ArrayIndex.java @@ -9,7 +9,7 @@ void foo(@Nullable Object[] a, int i) { a[i + 1].hashCode(); } if (a[i + 1] != null) { - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] a[i].hashCode(); } } diff --git a/checker/tests/nullness/ArrayLazyNN.java b/checker/tests/nullness/ArrayLazyNN.java index eda610ba60c3..77cecad7718a 100644 --- a/checker/tests/nullness/ArrayLazyNN.java +++ b/checker/tests/nullness/ArrayLazyNN.java @@ -9,9 +9,9 @@ public class ArrayLazyNN { void test1() { @MonotonicNonNull Object[] o1 = new @MonotonicNonNull Object[10]; o1[0] = new Object(); - // :: error: (assignment) + // :: error: [assignment] o1[0] = null; - // :: error: (assignment) + // :: error: [assignment] @NonNull Object[] o2 = o1; @SuppressWarnings("nullness") @NonNull Object[] o3 = o1; diff --git a/checker/tests/nullness/ArrayRefs.java b/checker/tests/nullness/ArrayRefs.java index 10991fb96f5d..80a2c481ce63 100644 --- a/checker/tests/nullness/ArrayRefs.java +++ b/checker/tests/nullness/ArrayRefs.java @@ -8,7 +8,7 @@ public void test() { String[] s = null; - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] if (s.length > 0) { System.out.println("s.length > 0"); } @@ -19,7 +19,7 @@ public static void test2() { takeNNList(Arrays.asList(new Object[] {a})); takeNNList(Arrays.asList(new Object[] {a})); takeNNList(Arrays.asList(a, a, a)); - // :: error: (type.arguments.not.inferred) + // :: error: [type.arguments.not.inferred] takeNNList(Arrays.asList(a, a, null)); } diff --git a/checker/tests/nullness/AssertAfter.java b/checker/tests/nullness/AssertAfter.java index 328bd4275fec..6afca36d9726 100644 --- a/checker/tests/nullness/AssertAfter.java +++ b/checker/tests/nullness/AssertAfter.java @@ -12,7 +12,7 @@ public boolean setRepNonNull() { } public void plain() { - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] value.toString(); } @@ -22,7 +22,7 @@ public void testAfter() { } public void testBefore() { - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] value.toString(); setRepNonNull(); } @@ -31,7 +31,7 @@ public void withCondition(@Nullable String t) { if (t == null) { setRepNonNull(); } - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] value.toString(); } diff --git a/checker/tests/nullness/AssertAfter2.java b/checker/tests/nullness/AssertAfter2.java index fe064993d5fb..ca514763414c 100644 --- a/checker/tests/nullness/AssertAfter2.java +++ b/checker/tests/nullness/AssertAfter2.java @@ -25,20 +25,20 @@ public void addEdge(T parent, T child) { } public void addEdgeBad1(T parent, T child) { - // :: error: (assignment) + // :: error: [assignment] @NonNull List<@KeyFor("childMap") T> l = childMap.get(parent); } public void addEdgeBad2(T parent, T child) { addNode(parent); - // :: error: (assignment) + // :: error: [assignment] @NonNull List<@KeyFor("childMap") T> l = childMap.get(child); } public void addEdgeBad3(T parent, T child) { addNode(parent); parent = child; - // :: error: (assignment) + // :: error: [assignment] @NonNull List<@KeyFor("childMap") T> l = childMap.get(parent); } @@ -77,28 +77,28 @@ void addGood1() { } void addBad1() { - // :: error: (assignment) + // :: error: [assignment] @NonNull Object nn = get(f1, f2, f3); } void addBad2() { thing.add(f1, f2, f3); f1 = new Object(); - // :: error: (assignment) + // :: error: [assignment] @NonNull Object nn = thing.get(f1, f2, f3); } void addBad3() { thing.add(f1, f2, f3); f2 = new Object(); - // :: error: (assignment) + // :: error: [assignment] @NonNull Object nn = thing.get(f1, f2, f3); } void addBad4() { thing.add(f1, f2, f3); f3 = new Object(); - // :: error: (assignment) + // :: error: [assignment] @NonNull Object nn = thing.get(f1, f2, f3); } } diff --git a/checker/tests/nullness/AssertAfterChecked.java b/checker/tests/nullness/AssertAfterChecked.java index b50347102780..e2b8d6d833a0 100644 --- a/checker/tests/nullness/AssertAfterChecked.java +++ b/checker/tests/nullness/AssertAfterChecked.java @@ -12,7 +12,7 @@ void init() { } @EnsuresNonNull("f") - // :: error: (contracts.postcondition) + // :: error: [contracts.postcondition] void initBad() {} void testInit() { @@ -35,7 +35,7 @@ void init2() { } @EnsuresNonNull("f") - // :: error: (contracts.postcondition) + // :: error: [contracts.postcondition] void initBad() {} void testInit() { @@ -54,7 +54,7 @@ void initE2() { } @EnsuresNonNull("InitStaticField.f") - // :: error: (contracts.postcondition) + // :: error: [contracts.postcondition] void initBadE() {} void testInitE() { @@ -71,7 +71,7 @@ void testInitE2() { class TestParams { @EnsuresNonNull("get(#1)") - // :: error: (contracts.postcondition) + // :: error: [contracts.postcondition] void init(final TestParams p) {} @org.checkerframework.dataflow.qual.Pure @@ -101,7 +101,7 @@ void testInit3(TestParams p) { void testInit4(TestParams p) { p.init(this); - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] this.get(this).toString(); } } @@ -127,13 +127,13 @@ int init2() { } @EnsuresNonNull("f") - // :: error: (contracts.postcondition) + // :: error: [contracts.postcondition] int initBad1() { return 0; } @EnsuresNonNull("f") - // :: error: (contracts.postcondition) + // :: error: [contracts.postcondition] int initBad2() { if (5 == 5) { return 0; diff --git a/checker/tests/nullness/AssertIfChecked.java b/checker/tests/nullness/AssertIfChecked.java index f5f9b1b8b4ca..a050e60999b0 100644 --- a/checker/tests/nullness/AssertIfChecked.java +++ b/checker/tests/nullness/AssertIfChecked.java @@ -8,21 +8,21 @@ public class AssertIfChecked { @Nullable Object value; @EnsuresNonNullIf(result = true, expression = "value") - // :: error: (contracts.conditional.postcondition.returntype) + // :: error: [contracts.conditional.postcondition.returntype] public void badform1() {} @EnsuresNonNullIf(result = true, expression = "value") - // :: error: (contracts.conditional.postcondition.returntype) + // :: error: [contracts.conditional.postcondition.returntype] public Object badform2() { return new Object(); } @EnsuresNonNullIf(result = false, expression = "value") - // :: error: (contracts.conditional.postcondition.returntype) + // :: error: [contracts.conditional.postcondition.returntype] public void badform3() {} @EnsuresNonNullIf(result = false, expression = "value") - // :: error: (contracts.conditional.postcondition.returntype) + // :: error: [contracts.conditional.postcondition.returntype] public Object badform4() { return new Object(); } @@ -34,7 +34,7 @@ public boolean goodt1() { @EnsuresNonNullIf(result = true, expression = "value") public boolean badt1() { - // :: error: (contracts.conditional.postcondition) + // :: error: [contracts.conditional.postcondition] return value == null; } @@ -45,19 +45,19 @@ public boolean goodf1() { @EnsuresNonNullIf(result = false, expression = "value") public boolean badf1() { - // :: error: (contracts.conditional.postcondition) + // :: error: [contracts.conditional.postcondition] return value != null; } @EnsuresNonNullIf(result = true, expression = "value") public boolean bad2() { - // :: error: (contracts.conditional.postcondition) + // :: error: [contracts.conditional.postcondition] return value == null || unknown; } @EnsuresNonNullIf(result = false, expression = "value") public boolean bad3() { - // :: error: (contracts.conditional.postcondition) + // :: error: [contracts.conditional.postcondition] return value == null && unknown; } @@ -76,7 +76,7 @@ boolean testLitTTgood1(final @Nullable Object param) { @EnsuresNonNullIf(result = true, expression = "#1") boolean testLitTTbad1(final @Nullable Object param) { - // :: error: (contracts.conditional.postcondition) + // :: error: [contracts.conditional.postcondition] return true; } @@ -96,7 +96,7 @@ boolean testLitFFgood2(final @Nullable Object param) { @EnsuresNonNullIf(result = false, expression = "#1") boolean testLitFFbad1(final @Nullable Object param) { if (param == null) { - // :: error: (contracts.conditional.postcondition) + // :: error: [contracts.conditional.postcondition] return false; } return true; @@ -104,7 +104,7 @@ boolean testLitFFbad1(final @Nullable Object param) { @EnsuresNonNullIf(result = false, expression = "#1") boolean testLitFFbad2(final @Nullable Object param) { - // :: error: (contracts.conditional.postcondition) + // :: error: [contracts.conditional.postcondition] return false; } diff --git a/checker/tests/nullness/AssertIfClient.java b/checker/tests/nullness/AssertIfClient.java index 90b4a07962c6..bc446211a2ac 100644 --- a/checker/tests/nullness/AssertIfClient.java +++ b/checker/tests/nullness/AssertIfClient.java @@ -14,9 +14,9 @@ void rpcResponseNullable(Proxy proxy) { void rpcResponseTypestate() { Proxy proxy = new Proxy(); - // :: error: (assignment) + // :: error: [assignment] @NonNull Object response1 = proxy.rpcResponse(); - // :: error: (contracts.precondition) + // :: error: [contracts.precondition] rpcResponseNonNull(proxy); rpcResponseNullable(proxy); diff --git a/checker/tests/nullness/AssertIfFalseTest.java b/checker/tests/nullness/AssertIfFalseTest.java index 49f0135c40ef..497b3f4efcbf 100644 --- a/checker/tests/nullness/AssertIfFalseTest.java +++ b/checker/tests/nullness/AssertIfFalseTest.java @@ -11,18 +11,18 @@ public class AssertIfFalseTest { @EnsuresNonNullIf(result = false, expression = "get()") boolean isGettable() { // don't bother with the implementation - // :: error: (contracts.conditional.postcondition) + // :: error: [contracts.conditional.postcondition] return false; } void simple() { - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] get().toString(); } void checkWrongly() { if (isGettable()) { - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] get().toString(); } } diff --git a/checker/tests/nullness/AssertNonNullIfNonNullTest.java b/checker/tests/nullness/AssertNonNullIfNonNullTest.java index fc049c2e9f0e..0d1b2fd36011 100644 --- a/checker/tests/nullness/AssertNonNullIfNonNullTest.java +++ b/checker/tests/nullness/AssertNonNullIfNonNullTest.java @@ -29,7 +29,7 @@ public boolean isValueNonNull2() { // The @AssertNonNullIfNonNull annotation implies that if getValue() is // non-null, then is non-null, then value is non-null, but not the // converse, so an error should be issued here. - // :: error: (contracts.conditional.postcondition) + // :: error: [contracts.conditional.postcondition] return value != null; } diff --git a/checker/tests/nullness/AssertNonNullTest.java b/checker/tests/nullness/AssertNonNullTest.java index 4d643d6229d1..3128cc3f894e 100644 --- a/checker/tests/nullness/AssertNonNullTest.java +++ b/checker/tests/nullness/AssertNonNullTest.java @@ -4,14 +4,14 @@ public class AssertNonNullTest { public @Nullable String s; - // :: error: (contracts.postcondition) + // :: error: [contracts.postcondition] public @EnsuresNonNull("s") void makeNN() { s = null; } public static void main(String[] args) { AssertNonNullTest a = new AssertNonNullTest(); - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] a.s.equals("we"); AssertNonNullTest b = new AssertNonNullTest(); b.makeNN(); diff --git a/checker/tests/nullness/AssertNullable.java b/checker/tests/nullness/AssertNullable.java index 814538fe29b6..a1f5c47f95c0 100644 --- a/checker/tests/nullness/AssertNullable.java +++ b/checker/tests/nullness/AssertNullable.java @@ -5,7 +5,7 @@ public static void main(String[] args) { // This will result in an NPE, not an AssertionError: // Exception in thread "main" java.lang.NullPointerException // Therefore, the Nullness Checker warns about this. - // :: error: (condition.nullable) + // :: error: [condition.nullable] assert b; } else { String s = null; @@ -17,7 +17,7 @@ public static void main(String[] args) { void foo() { String s = 3 > 2 ? null : "ba"; - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] assert s.hashCode() > 4; } } diff --git a/checker/tests/nullness/AssertParameterNullness.java b/checker/tests/nullness/AssertParameterNullness.java index 8b9e1e111b5c..713a97396c13 100644 --- a/checker/tests/nullness/AssertParameterNullness.java +++ b/checker/tests/nullness/AssertParameterNullness.java @@ -21,9 +21,9 @@ public class AssertParameterNullness { boolean b1 = seq3[0]; boolean b2 = seq4[0]; } else { - // :: error: (accessing.nullable) + // :: error: [accessing.nullable] boolean b1 = seq3[0]; - // :: error: (accessing.nullable) + // :: error: [accessing.nullable] boolean b2 = seq4[0]; } return true; diff --git a/checker/tests/nullness/AssertTwice.java b/checker/tests/nullness/AssertTwice.java index 41e45d5b7db1..ecc77ad1d50d 100644 --- a/checker/tests/nullness/AssertTwice.java +++ b/checker/tests/nullness/AssertTwice.java @@ -17,7 +17,7 @@ private void assertTwiceWithUse() { String methodDeclaration = null; assert methodDeclaration != null : "@AssumeAssertion(nullness)"; methodDeclaration.toString(); - // :: warning: (nulltest.redundant) + // :: warning: [nulltest.redundant] assert methodDeclaration != null; methodDeclaration = null; } diff --git a/checker/tests/nullness/AssertWithStatic.java b/checker/tests/nullness/AssertWithStatic.java index a3c802f9dff2..47293114d5a2 100644 --- a/checker/tests/nullness/AssertWithStatic.java +++ b/checker/tests/nullness/AssertWithStatic.java @@ -47,10 +47,10 @@ public boolean noSysOut4() { } @EnsuresNonNull("AssertWithStatic.f") - // :: error: (contracts.postcondition) + // :: error: [contracts.postcondition] public void sysOutAfter1() {} @EnsuresNonNull("f") - // :: error: (contracts.postcondition) + // :: error: [contracts.postcondition] public void sysOutAfter2() {} } diff --git a/checker/tests/nullness/Asserts.java b/checker/tests/nullness/Asserts.java index 35e5ea6ad598..d067f03fdb69 100644 --- a/checker/tests/nullness/Asserts.java +++ b/checker/tests/nullness/Asserts.java @@ -17,7 +17,7 @@ void incorrectAssertExpr() { void correctAssertExpr() { String s = null; assert s == null : "@AssumeAssertion(nullness)"; - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] s.getClass(); // error } @@ -29,7 +29,7 @@ void assertComplexExpr(ArrayCell ac, int i) { assert ac.vals[i] != null : "@AssumeAssertion(nullness)"; @NonNull Object o = ac.vals[i]; i = 10; - // :: error: (assignment) + // :: error: [assignment] @NonNull Object o2 = ac.vals[i]; } @@ -46,7 +46,7 @@ boolean pairwiseEqual(boolean @Nullable [] seq1, boolean @Nullable [] seq2) { expression = {"#1", "#2"}) boolean sameLength(final boolean @Nullable [] seq1, final boolean @Nullable [] seq2) { // don't bother with the implementation - // :: error: (contracts.conditional.postcondition) + // :: error: [contracts.conditional.postcondition] return true; } @@ -57,7 +57,7 @@ static boolean ne(boolean a, boolean b) { void testAssertBad(boolean @Nullable [] seq1, boolean @Nullable [] seq2) { assert sameLength(seq1, seq2); // the @EnsuresNonNullIf is not taken from the assert, as it doesn't contain "nullness" - // :: error: (accessing.nullable) + // :: error: [accessing.nullable] if (seq1[0]) {} } @@ -72,7 +72,7 @@ void testAssertAnd(@Nullable Object o) { } void testAssertOr(@Nullable Object o) { - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] assert o != null || o.hashCode() > 6; } } diff --git a/checker/tests/nullness/AssignmentDuringInitialization.java b/checker/tests/nullness/AssignmentDuringInitialization.java index 6fe9c8f68713..acd680fe7a2f 100644 --- a/checker/tests/nullness/AssignmentDuringInitialization.java +++ b/checker/tests/nullness/AssignmentDuringInitialization.java @@ -11,14 +11,14 @@ public class AssignmentDuringInitialization { String f6; { - // :: error: (assignment) + // :: error: [assignment] f1 = f2; f2 = f1; f2.toString(); // Null pointer exception here } public AssignmentDuringInitialization() { - // :: error: (assignment) + // :: error: [assignment] f3 = f4; f4 = f3; f4.toString(); // Null pointer exception here diff --git a/checker/tests/nullness/BoxingNullness.java b/checker/tests/nullness/BoxingNullness.java index 112aec26b9c9..5f553a7ed4a3 100644 --- a/checker/tests/nullness/BoxingNullness.java +++ b/checker/tests/nullness/BoxingNullness.java @@ -5,7 +5,7 @@ void withinOperation() { Integer i1 = 3; int i1u = i1 + 2; // valid Integer i2 = null; - // :: error: (unboxing.of.nullable) + // :: error: [unboxing.of.nullable] int i2u = i2 + 2; // invalid Integer i3 = i1; i3.toString(); @@ -15,7 +15,7 @@ void withinAssignment() { Integer i1 = 5; int i1u = i1; Integer i2 = null; - // :: error: (unboxing.of.nullable) + // :: error: [unboxing.of.nullable] int i2u = i2; // invalid } @@ -29,9 +29,9 @@ void validWithinUnary() { void invalidWithinUnary() { // within blocks to stop flow Integer i1 = null, i2 = null, i3 = null, i4 = null; - // :: error: (unboxing.of.nullable) + // :: error: [unboxing.of.nullable] ++i1; // invalid - // :: error: (unboxing.of.nullable) + // :: error: [unboxing.of.nullable] i2++; // invalid } @@ -45,21 +45,21 @@ void validCompoundAssignmentsAsVariable() { void invalidCompoundAssignmentsAsVariable() { Integer i = null; - // :: error: (unboxing.of.nullable) + // :: error: [unboxing.of.nullable] i += 1; // invalid Boolean b = null; - // :: error: (unboxing.of.nullable) + // :: error: [unboxing.of.nullable] b &= true; // invalid } void invalidCompoundAssignmentAsValue() { @NonNull Integer var = 3; Integer val = null; - // :: error: (unboxing.of.nullable) + // :: error: [unboxing.of.nullable] var += val; Boolean b1 = null; boolean b2 = true; - // :: error: (unboxing.of.nullable) + // :: error: [unboxing.of.nullable] b2 &= b1; // invalid } @@ -89,9 +89,9 @@ void equalityTest() { System.out.println(u1 == u1); System.out.println(u1 != u1); - // :: error: (unboxing.of.nullable) + // :: error: [unboxing.of.nullable] System.out.println(bN6 == u1); // invalid - // :: error: (unboxing.of.nullable) + // :: error: [unboxing.of.nullable] System.out.println(bN7 != u1); // invalid } @@ -102,15 +102,15 @@ void addition() { Integer bN3 = null; Integer b1 = 1; int u1 = 1; - // :: error: (unboxing.of.nullable) + // :: error: [unboxing.of.nullable] System.out.println(bN + bN1); // invalid - // :: error: (unboxing.of.nullable) + // :: error: [unboxing.of.nullable] System.out.println(bN2 + b1); // invalid System.out.println(u1 + b1); System.out.println(u1 + u1); - // :: error: (unboxing.of.nullable) + // :: error: [unboxing.of.nullable] System.out.println(bN3 + u1); // invalid } @@ -121,7 +121,7 @@ void visitCast() { int u1 = 1; println(bN); - // :: error: (unboxing.of.nullable) + // :: error: [unboxing.of.nullable] println((int) bN2); // invalid println(b1); diff --git a/checker/tests/nullness/Bug102.java b/checker/tests/nullness/Bug102.java index b3602602aff2..0579aa8c90a3 100644 --- a/checker/tests/nullness/Bug102.java +++ b/checker/tests/nullness/Bug102.java @@ -13,7 +13,7 @@ void bug2() { m(c); } - // :: error: (invalid.polymorphic.qualifier) + // :: error: [invalid.polymorphic.qualifier] <@org.checkerframework.checker.nullness.qual.PolyNull S> void m( final C<@org.checkerframework.checker.nullness.qual.PolyNull String> a) {} } diff --git a/checker/tests/nullness/CallSuper.java b/checker/tests/nullness/CallSuper.java index 988be63bdeb8..2184edd3c0c4 100644 --- a/checker/tests/nullness/CallSuper.java +++ b/checker/tests/nullness/CallSuper.java @@ -9,7 +9,7 @@ public class CallSuper extends MyFilterInputStream { CallSuper(@Nullable InputStream in) { // The MyFilterInputStream constructor takes a NonNull argument // (but that's not true of FilterInputStream itself). - // :: error: (argument) + // :: error: [argument] super(in); } } diff --git a/checker/tests/nullness/CastTypeVariable.java b/checker/tests/nullness/CastTypeVariable.java index 367af70b8e83..bf5b6bec515c 100644 --- a/checker/tests/nullness/CastTypeVariable.java +++ b/checker/tests/nullness/CastTypeVariable.java @@ -10,7 +10,7 @@ public class CastTypeVariable { public static V mapGetHelper( Map mappings, MyAnnotatedTypeVariable key) { V possValue = (V) mappings.get(key); - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] possValue.addAnnotations(); return possValue; } diff --git a/checker/tests/nullness/CastsNullness.java b/checker/tests/nullness/CastsNullness.java index feeba2b3aed6..7616871ce17e 100644 --- a/checker/tests/nullness/CastsNullness.java +++ b/checker/tests/nullness/CastsNullness.java @@ -8,27 +8,27 @@ void test(String nonNullParam) { String nullable = null; Object lc2 = (Object) nullable; - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] lc2.toString(); // error } void testBoxing() { Integer b = null; - // :: error: (unboxing.of.nullable) + // :: error: [unboxing.of.nullable] int i = b; // no error, because there was already a nullpointer exception Object o = (int) b; } void testUnsafeCast(@Nullable Object x) { - // :: warning: (cast.unsafe) + // :: warning: [cast.unsafe] @NonNull Object y = (@NonNull Object) x; y.toString(); } void testUnsafeCastArray1(@Nullable Object[] x) { // Warning only with -AcheckCastElementType. - // TODO:: warning: (cast.unsafe) + // TODO:: warning: [cast.unsafe] @NonNull Object[] y = (@NonNull Object[]) x; y[0].toString(); } @@ -36,17 +36,17 @@ void testUnsafeCastArray1(@Nullable Object[] x) { void testUnsafeCastArray2(@NonNull Object x) { // We don't know about the component type of x -> warn // Warning only with -AcheckCastElementType. - // TODO:: warning: (cast.unsafe) + // TODO:: warning: [cast.unsafe] @NonNull Object[] y = (@NonNull Object[]) x; y[0].toString(); } void testUnsafeCastList1(java.util.ArrayList<@Nullable Object> x) { // Warning only with -AcheckCastElementType. - // TODO:: warning: (cast.unsafe) + // TODO:: warning: [cast.unsafe] java.util.List<@NonNull Object> y = (java.util.List<@NonNull Object>) x; y.get(0).toString(); - // TODO:: warning: (cast.unsafe) + // TODO:: warning: [cast.unsafe] java.util.List<@NonNull Object> y2 = (java.util.ArrayList<@NonNull Object>) x; java.util.List<@Nullable Object> y3 = (java.util.List<@Nullable Object>) x; } @@ -54,22 +54,22 @@ void testUnsafeCastList1(java.util.ArrayList<@Nullable Object> x) { void testUnsafeCastList2(java.util.List<@Nullable Object> x) { java.util.List<@Nullable Object> y = (java.util.ArrayList<@Nullable Object>) x; // Warning only with -AcheckCastElementType. - // TODO:: warning: (cast.unsafe) + // TODO:: warning: [cast.unsafe] java.util.List<@NonNull Object> y2 = (java.util.ArrayList<@NonNull Object>) x; } void testUnsafeCastList3(@NonNull Object x) { // Warning only with -AcheckCastElementType. - // TODO:: warning: (cast.unsafe) + // TODO:: warning: [cast.unsafe] // :: warning: [unchecked] unchecked cast java.util.List<@Nullable Object> y = (java.util.List<@Nullable Object>) x; - // TODO:: warning: (cast.unsafe) + // TODO:: warning: [cast.unsafe] // :: warning: [unchecked] unchecked cast java.util.List<@NonNull Object> y2 = (java.util.ArrayList<@NonNull Object>) x; } void testSuppression(@Nullable Object x) { - // :: error: (assignment) + // :: error: [assignment] @NonNull String s1 = (String) x; @SuppressWarnings("nullness") @NonNull String s2 = (String) x; @@ -85,18 +85,18 @@ class Generics { } void m() { - // :: error: (assignment) + // :: error: [assignment] t = (@Nullable T) null; nt = (@Nullable T) null; - // :: warning: (cast.unsafe) + // :: warning: [cast.unsafe] t = (T) null; - // :: warning: (cast.unsafe) + // :: warning: [cast.unsafe] nt = (T) null; } } void testSafeCasts() { - // :: error: (nullness.on.primitive) + // :: error: [nullness.on.primitive] Integer x = (@Nullable int) 1; } } diff --git a/checker/tests/nullness/ChainAssignment.java b/checker/tests/nullness/ChainAssignment.java index b826cc16a318..71f5d3152dfc 100644 --- a/checker/tests/nullness/ChainAssignment.java +++ b/checker/tests/nullness/ChainAssignment.java @@ -23,22 +23,22 @@ void m4() { } void n1() { - // :: error: (assignment) + // :: error: [assignment] x = y = null; } void n2() { - // :: error: (assignment) + // :: error: [assignment] this.x = this.y = null; } void n3() { - // :: error: (assignment) + // :: error: [assignment] x = this.y = null; } void n4() { - // :: error: (assignment) + // :: error: [assignment] this.x = y = null; } } diff --git a/checker/tests/nullness/ConditionalNullness.java b/checker/tests/nullness/ConditionalNullness.java index 9c8982a0c499..9da86bd208b0 100644 --- a/checker/tests/nullness/ConditionalNullness.java +++ b/checker/tests/nullness/ConditionalNullness.java @@ -8,7 +8,7 @@ public class ConditionalNullness { result = true) boolean checkNonNull() { // don't bother with the implementation - // :: error: (contracts.conditional.postcondition) + // :: error: [contracts.conditional.postcondition] return true; } @@ -24,19 +24,19 @@ void testSelfWithCheck() { if (checkNonNull()) { field.toString(); method().toString(); - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] other.field.toString(); // error - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] other.method().toString(); // error } - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] method().toString(); // error } void testSelfWithoutCheck() { - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] field.toString(); // error - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] method().toString(); // error } @@ -44,7 +44,7 @@ void testSelfWithCheckNegation() { if (checkNonNull()) { // nothing to do } else { - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] field.toString(); // error } field.toString(); // error @@ -55,26 +55,26 @@ void testOtherWithCheck() { if (other.checkNonNull()) { other.field.toString(); other.method().toString(); - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] field.toString(); // error - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] method().toString(); // error } - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] other.method().toString(); // error - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] method().toString(); // error } void testOtherWithoutCheck() { ConditionalNullness other = new ConditionalNullness(); - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] other.field.toString(); // error - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] other.method().toString(); // error - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] field.toString(); // error - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] method().toString(); // error } @@ -83,14 +83,14 @@ void testOtherWithCheckNegation() { if (other.checkNonNull()) { // nothing to do } else { - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] other.field.toString(); // error - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] other.method().toString(); // error - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] field.toString(); // error } - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] field.toString(); // error } } diff --git a/checker/tests/nullness/ConstructorPostcondition.java b/checker/tests/nullness/ConstructorPostcondition.java index 67f00461057e..a65d1dcf8370 100644 --- a/checker/tests/nullness/ConstructorPostcondition.java +++ b/checker/tests/nullness/ConstructorPostcondition.java @@ -7,7 +7,7 @@ class Box { } @EnsuresNonNull("#1.f") - // :: error: (contracts.postcondition) + // :: error: [contracts.postcondition] ConstructorPostcondition(Box b) {} @EnsuresNonNull("#1.f") diff --git a/checker/tests/nullness/ControlFlow.java b/checker/tests/nullness/ControlFlow.java index f8e614b8c249..2eb1d5a194c8 100644 --- a/checker/tests/nullness/ControlFlow.java +++ b/checker/tests/nullness/ControlFlow.java @@ -10,7 +10,7 @@ public static void main(String[] args) { // Can also throw exception or call System#exit return; } - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] System.out.println(s.toString()); } } diff --git a/checker/tests/nullness/CopyOfArray.java b/checker/tests/nullness/CopyOfArray.java index 3ad23e9bff7b..4210ce50f8b4 100644 --- a/checker/tests/nullness/CopyOfArray.java +++ b/checker/tests/nullness/CopyOfArray.java @@ -6,7 +6,7 @@ protected void makeCopy(Object[] args, int i) { Object[] copyExact1 = Arrays.copyOf(args, args.length); @Nullable Object[] copyExact2 = Arrays.copyOf(args, args.length); - // :: error: (assignment) + // :: error: [assignment] Object[] copyInexact1 = Arrays.copyOf(args, i); @Nullable Object[] copyInexact2 = Arrays.copyOf(args, i); } @@ -15,7 +15,7 @@ protected void makeCopyOfRange(Object[] args, int i) { Object[] copyExact1 = Arrays.copyOfRange(args, 2, args.length); @Nullable Object[] copyExact2 = Arrays.copyOfRange(args, 2, args.length); - // :: error: (assignment) + // :: error: [assignment] Object[] copyInexact1 = Arrays.copyOfRange(args, 2, i); @Nullable Object[] copyInexact2 = Arrays.copyOfRange(args, 2, i); } diff --git a/checker/tests/nullness/DefaultAnnotation.java b/checker/tests/nullness/DefaultAnnotation.java index 0b7edc749b77..cd4ce8844f79 100644 --- a/checker/tests/nullness/DefaultAnnotation.java +++ b/checker/tests/nullness/DefaultAnnotation.java @@ -17,10 +17,10 @@ public void testNoDefault() { locations = {TypeUseLocation.ALL})) public void testDefault() { - // :: error: (assignment) + // :: error: [assignment] String s = null; // error List lst = new List<>(); // valid - // :: error: (argument) + // :: error: [argument] lst.add(null); // error } @@ -30,16 +30,16 @@ public void testDefault() { public class InnerDefault { public void testDefault() { - // :: error: (assignment) + // :: error: [assignment] String s = null; // error List lst = new List<>(); // valid - // :: error: (argument) + // :: error: [argument] lst.add(null); // error s = lst.get(0); // valid List<@Nullable String> nullList = new List<>(); // valid nullList.add(null); // valid - // :: error: (assignment) + // :: error: [assignment] s = nullList.get(0); // error } } @@ -54,17 +54,17 @@ public String getNNString() { } public String getNNString2() { - // :: error: (return) + // :: error: [return] return null; // error } public T getNull(T t) { - // :: error: (return) + // :: error: [return] return null; // invalid } public T getNonNull(T t) { - // :: error: (return) + // :: error: [return] return null; // error } } @@ -85,10 +85,10 @@ public void testDefaultArgs() { DefaultDefs d = new DefaultDefs(); - // :: error: (assignment) + // :: error: [assignment] String s1 = d.<@Nullable String>getNull(null); // error String s2 = d.getNonNull("foo"); // valid - // :: error: (type.argument) :: error: (assignment) + // :: error: [type.argument] :: error: [assignment] String s3 = d.<@Nullable String>getNonNull("foo"); // error } } @@ -130,10 +130,10 @@ public boolean add(E e) { @DefaultQualifier(value = NonNull.class) public void testDefaultUnqualified() { - // :: error: (assignment) + // :: error: [assignment] String s = null; // error List lst = new List<>(); // valid - // :: error: (argument) + // :: error: [argument] lst.add(null); // error } } diff --git a/checker/tests/nullness/DefaultLoops.java b/checker/tests/nullness/DefaultLoops.java index f440169df3ce..5fff8b6ea035 100644 --- a/checker/tests/nullness/DefaultLoops.java +++ b/checker/tests/nullness/DefaultLoops.java @@ -15,7 +15,7 @@ void bar() { // nullable by default Object o; o = null; - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] o.hashCode(); o = new Object(); o.hashCode(); diff --git a/checker/tests/nullness/DefaultingForEach.java b/checker/tests/nullness/DefaultingForEach.java index 849a6d174cfe..197f182ae2d9 100644 --- a/checker/tests/nullness/DefaultingForEach.java +++ b/checker/tests/nullness/DefaultingForEach.java @@ -13,7 +13,7 @@ class DefaultForEach { void bar() { for (Object p : foo()) { - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] p.toString(); } } @@ -25,7 +25,7 @@ void bar() { void bar2() { for (Object p : foo2()) { - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] p.toString(); } } diff --git a/checker/tests/nullness/EnsuresNonNullIfTest2.java b/checker/tests/nullness/EnsuresNonNullIfTest2.java index f4476519d7ec..a432f755c3fe 100644 --- a/checker/tests/nullness/EnsuresNonNullIfTest2.java +++ b/checker/tests/nullness/EnsuresNonNullIfTest2.java @@ -48,7 +48,7 @@ void client() { if (hasId14()) { id.toString(); } - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] id.toString(); } diff --git a/checker/tests/nullness/EnsuresNonNullIfTestSimple.java b/checker/tests/nullness/EnsuresNonNullIfTestSimple.java index da8860004cb4..26e80efcdd42 100644 --- a/checker/tests/nullness/EnsuresNonNullIfTestSimple.java +++ b/checker/tests/nullness/EnsuresNonNullIfTestSimple.java @@ -11,7 +11,7 @@ public class EnsuresNonNullIfTestSimple { @EnsuresNonNullIf(result = true, expression = "values") public boolean repNulledBAD() { - // :: error: (contracts.conditional.postcondition) + // :: error: [contracts.conditional.postcondition] return values == null; } @@ -41,7 +41,7 @@ public void addAll(EnsuresNonNullIfTestSimple s) { */ if (s.repNulled()) { - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] s.values.hashCode(); } else { @NonNull Object y = s.values; diff --git a/checker/tests/nullness/EnumFieldUninit.java b/checker/tests/nullness/EnumFieldUninit.java index 791036e92b07..f871d559b3ed 100644 --- a/checker/tests/nullness/EnumFieldUninit.java +++ b/checker/tests/nullness/EnumFieldUninit.java @@ -1,10 +1,10 @@ enum EnumFieldUninit { DUMMY; - // :: error: (assignment) + // :: error: [assignment] public static String s = null; - // :: error: (initialization.static.field.uninitialized) + // :: error: [initialization.static.field.uninitialized] public static String u; static String[] arrayInit = new String[] {}; @@ -15,9 +15,9 @@ enum EnumFieldUninit { arrayInitInBlock = new String[] {}; } - // :: error: (assignment) + // :: error: [assignment] static String[] arrayInitToNull = null; - // :: error: (initialization.static.field.uninitialized) + // :: error: [initialization.static.field.uninitialized] static String[] arrayUninit; } diff --git a/checker/tests/nullness/EnumsNullness.java b/checker/tests/nullness/EnumsNullness.java index 33bbe55a492a..c03dae466cd1 100644 --- a/checker/tests/nullness/EnumsNullness.java +++ b/checker/tests/nullness/EnumsNullness.java @@ -9,22 +9,22 @@ enum MyEnum { D } - // :: error: (assignment) + // :: error: [assignment] MyEnum myEnum = null; // invalid @Nullable MyEnum myNullableEnum = null; void testLocalEnum() { // Enums are allowed to be null: no error here. MyEnum myNullableEnum = null; - // :: error: (assignment) + // :: error: [assignment] @NonNull MyEnum myEnum = null; // invalid } enum EnumBadAnnos { A, - // :: error: (nullness.on.enum) + // :: error: [nullness.on.enum] @NonNull B, - // :: error: (nullness.on.enum) + // :: error: [nullness.on.enum] @Nullable C, D; diff --git a/checker/tests/nullness/EqualToNullness.java b/checker/tests/nullness/EqualToNullness.java index 2c2dcca35741..c7e484e0ac07 100644 --- a/checker/tests/nullness/EqualToNullness.java +++ b/checker/tests/nullness/EqualToNullness.java @@ -6,7 +6,7 @@ public class EqualToNullness { // @Nullable String f; // // void t1(@Nullable String g) { - // // :: error: (dereference.of.nullable) + // // :: error: [dereference.of.nullable] // g.toLowerCase(); // if (g != null) { // g.toLowerCase(); @@ -14,7 +14,7 @@ public class EqualToNullness { // } // // void t2() { - // // :: error: (dereference.of.nullable) + // // :: error: [dereference.of.nullable] // f.toLowerCase(); // if (f == null) {} else { // f.toLowerCase(); @@ -22,7 +22,7 @@ public class EqualToNullness { // } // // void t1b(@Nullable String g) { - // // :: error: (dereference.of.nullable) + // // :: error: [dereference.of.nullable] // g.toLowerCase(); // if (null != g) { // g.toLowerCase(); @@ -30,7 +30,7 @@ public class EqualToNullness { // } // // void t2b() { - // // :: error: (dereference.of.nullable) + // // :: error: [dereference.of.nullable] // f.toLowerCase(); // if (null == f) {} else { // f.toLowerCase(); diff --git a/checker/tests/nullness/ExceptionParam.java b/checker/tests/nullness/ExceptionParam.java index 5275ca91ecac..56e647c80d4d 100644 --- a/checker/tests/nullness/ExceptionParam.java +++ b/checker/tests/nullness/ExceptionParam.java @@ -14,7 +14,7 @@ void exc1() { void exc2() { try { - // :: warning: (nullness.on.exception.parameter) + // :: warning: [nullness.on.exception.parameter] } catch (@NonNull AssertionError e) { @NonNull Object o = e; } @@ -22,7 +22,7 @@ void exc2() { void exc3() { try { - // :: warning: (nullness.on.exception.parameter) + // :: warning: [nullness.on.exception.parameter] } catch (@Nullable AssertionError e) { @NonNull Object o = e; } diff --git a/checker/tests/nullness/Exceptions.java b/checker/tests/nullness/Exceptions.java index c5175034aa17..4505730ef1b2 100644 --- a/checker/tests/nullness/Exceptions.java +++ b/checker/tests/nullness/Exceptions.java @@ -2,7 +2,7 @@ public class Exceptions { void exceptionParam(@Nullable Exception m) { - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] m.getClass(); // should emit error } @@ -15,7 +15,7 @@ void exception(@Nullable Exception m) { throwException(); } catch (Exception e) { e.getClass(); - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] m.getClass(); // should emit error } } @@ -23,11 +23,11 @@ void exception(@Nullable Exception m) { void throwException() { int a = 0; if (a == 0) { - // :: error: (throwing.nullable) + // :: error: [throwing.nullable] throw null; } else if (a == 1) { RuntimeException e = null; - // :: error: (throwing.nullable) + // :: error: [throwing.nullable] throw e; } else { RuntimeException e = new RuntimeException(); @@ -39,7 +39,7 @@ void reassignException() { try { throwException(); } catch (RuntimeException e) { - // :: error: (assignment) + // :: error: [assignment] e = null; throw e; } diff --git a/checker/tests/nullness/ExplictTypeVarAnnos.java b/checker/tests/nullness/ExplictTypeVarAnnos.java index e03d8a5f3984..7490de2ee199 100644 --- a/checker/tests/nullness/ExplictTypeVarAnnos.java +++ b/checker/tests/nullness/ExplictTypeVarAnnos.java @@ -42,6 +42,6 @@ public Consumer getField() { static class A {} - // :: error: (type.argument) + // :: error: [type.argument] static class B extends A {} } diff --git a/checker/tests/nullness/ExpressionsNullness.java b/checker/tests/nullness/ExpressionsNullness.java index b0f026faea2b..cfa909cb6190 100644 --- a/checker/tests/nullness/ExpressionsNullness.java +++ b/checker/tests/nullness/ExpressionsNullness.java @@ -31,7 +31,7 @@ public void test() { Class cl = Boolean.TYPE; List foo = new LinkedList(); - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] foo.get(0).toString(); // default applies to wildcard extends Set set = new HashSet(); diff --git a/checker/tests/nullness/FieldInit.java b/checker/tests/nullness/FieldInit.java index ead10eca6734..2a311c046e4f 100644 --- a/checker/tests/nullness/FieldInit.java +++ b/checker/tests/nullness/FieldInit.java @@ -1,7 +1,7 @@ import org.checkerframework.checker.nullness.qual.*; public class FieldInit { - // :: error: (argument) :: error: (method.invocation) + // :: error: [argument] :: error: [method.invocation] String f = init(this); String init(FieldInit o) { diff --git a/checker/tests/nullness/FinalFields.java b/checker/tests/nullness/FinalFields.java index e7c0febccee8..e1be981b72f3 100644 --- a/checker/tests/nullness/FinalFields.java +++ b/checker/tests/nullness/FinalFields.java @@ -6,7 +6,7 @@ class Upper { void access() { // Error, because non-final field type is not refined - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] fs.hashCode(); // private final field is refined ffs.hashCode(); @@ -16,13 +16,13 @@ void access() { public class FinalFields { public void foo(Upper u) { // Error, because final field in different class is not refined - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] u.fs.hashCode(); } public void bar(Lower l) { // Error, because final field in different class is not refined - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] l.fs.hashCode(); } @@ -39,7 +39,7 @@ class Lower { void access() { // Error, because non-final field type is not refined - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] fs.hashCode(); // private final field is refined ffs.hashCode(); diff --git a/checker/tests/nullness/FinalVar2.java b/checker/tests/nullness/FinalVar2.java index 9201396cfbb6..438572a914f6 100644 --- a/checker/tests/nullness/FinalVar2.java +++ b/checker/tests/nullness/FinalVar2.java @@ -35,7 +35,7 @@ static Object method3(@Nullable Object arg) { Object result = new Object() { public void useFinalVar() { - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] tmp.hashCode(); } }; diff --git a/checker/tests/nullness/FindBugs.java b/checker/tests/nullness/FindBugs.java index 8684a4dacc8e..ca21161cf6aa 100644 --- a/checker/tests/nullness/FindBugs.java +++ b/checker/tests/nullness/FindBugs.java @@ -8,18 +8,18 @@ Object getNull() { } @NonNull MyList<@org.checkerframework.checker.nullness.qual.Nullable Object> getListOfNulls() { - // :: error: (return) + // :: error: [return] return null; // error } void test() { Object o = getNull(); - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] o.toString(); // error MyList<@org.checkerframework.checker.nullness.qual.Nullable Object> l = getListOfNulls(); l.toString(); - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] l.get().toString(); // error } } diff --git a/checker/tests/nullness/FlowCompound.java b/checker/tests/nullness/FlowCompound.java index 80affb31171a..c3189f9a37ac 100644 --- a/checker/tests/nullness/FlowCompound.java +++ b/checker/tests/nullness/FlowCompound.java @@ -10,7 +10,7 @@ public boolean equals(@Nullable Object o) { void test(@Nullable String s) { if (s == null || s.length() > 0) { - // :: error: (assignment) + // :: error: [assignment] @NonNull String test = s; } diff --git a/checker/tests/nullness/FlowConditions.java b/checker/tests/nullness/FlowConditions.java index 71c0e8b602b8..7622cc123fbd 100644 --- a/checker/tests/nullness/FlowConditions.java +++ b/checker/tests/nullness/FlowConditions.java @@ -7,9 +7,9 @@ public class FlowConditions { void m(@Nullable Object x, @Nullable Object y) { if (x == null || y == null) { - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] x.toString(); - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] y.toString(); } else { x.toString(); diff --git a/checker/tests/nullness/FlowConstructor.java b/checker/tests/nullness/FlowConstructor.java index 02a9e883dac9..9bc2e298207e 100644 --- a/checker/tests/nullness/FlowConstructor.java +++ b/checker/tests/nullness/FlowConstructor.java @@ -15,13 +15,13 @@ public FlowConstructor(float f) { public FlowConstructor(int p) { a = "m"; b = "n"; - // :: error: (method.invocation) + // :: error: [method.invocation] nonRawMethod(); } public FlowConstructor(double p) { a = "m"; - // :: error: (method.invocation) + // :: error: [method.invocation] nonRawMethod(); // error b = "n"; } diff --git a/checker/tests/nullness/FlowConstructor2.java b/checker/tests/nullness/FlowConstructor2.java index 06b8409cb8c9..fac21f1a5d16 100644 --- a/checker/tests/nullness/FlowConstructor2.java +++ b/checker/tests/nullness/FlowConstructor2.java @@ -2,7 +2,7 @@ public class FlowConstructor2 { String f; public FlowConstructor2() { - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] f.hashCode(); } } diff --git a/checker/tests/nullness/FlowField.java b/checker/tests/nullness/FlowField.java index 2663e1f87ce3..f0c3b8399477 100644 --- a/checker/tests/nullness/FlowField.java +++ b/checker/tests/nullness/FlowField.java @@ -18,7 +18,7 @@ void test() { } void testFields() { - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] System.out.println(field.length()); } @@ -68,7 +68,7 @@ void testInstanceOf(@NonNull FlowField a) { } void testTwoLevels(@NonNull FlowField a, BooleanWrapper bwArg) { - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] if (!(a.bw.hashCode() == 0)) // warning here return; Object o = a.bw.b; // but not here diff --git a/checker/tests/nullness/FlowInitialization.java b/checker/tests/nullness/FlowInitialization.java index df55a573a9f6..1da91b917eb8 100644 --- a/checker/tests/nullness/FlowInitialization.java +++ b/checker/tests/nullness/FlowInitialization.java @@ -7,7 +7,7 @@ public class FlowInitialization { @NonNull String f; @Nullable String g; - // :: error: (initialization.fields.uninitialized) + // :: error: [initialization.fields.uninitialized] public FlowInitialization() {} public FlowInitialization(long l) { @@ -15,21 +15,21 @@ public FlowInitialization(long l) { f = g; } - // :: error: (initialization.fields.uninitialized) + // :: error: [initialization.fields.uninitialized] public FlowInitialization(boolean b) { if (b) { f = ""; } } - // :: error: (initialization.fields.uninitialized) + // :: error: [initialization.fields.uninitialized] public FlowInitialization(int i) { if (i == 0) { throw new RuntimeException(); } } - // :: error: (initialization.fields.uninitialized) + // :: error: [initialization.fields.uninitialized] public FlowInitialization(char c) { if (c == 'c') { return; diff --git a/checker/tests/nullness/FlowLoop.java b/checker/tests/nullness/FlowLoop.java index 1beef9f7facd..008684836fbc 100644 --- a/checker/tests/nullness/FlowLoop.java +++ b/checker/tests/nullness/FlowLoop.java @@ -8,14 +8,14 @@ void simpleWhileLoop() { s.toString(); s = null; } - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] s.toString(); // error } void whileConditionError() { String s = "m"; - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] while (s.toString() == "m") { // error s.toString(); s = null; @@ -31,7 +31,7 @@ void simpleForLoop() { void forLoopConditionError() { for (String s = "m"; - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] s.toString() != "m"; // error s = null) { s.toString(); @@ -59,7 +59,7 @@ void test(@Nullable Link in) { void multipleRuns() { String s = "m"; while (true) { - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] s.toString(); // error s = null; } @@ -68,7 +68,7 @@ void multipleRuns() { void multipleRunsDo() { String s = "m"; do { - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] s.toString(); // error s = null; } while (true); @@ -79,16 +79,16 @@ void alwaysRunForLoop() { for (s = null; s != null; s = "m") { s.toString(); // ok } - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] s.toString(); // error } public void badIterator() { Class opt_doc1 = null; - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] opt_doc1.getInterfaces(); Class opt_doc2 = null; - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] for (Class fd : opt_doc2.getInterfaces()) { // empty loop body } @@ -96,7 +96,7 @@ public void badIterator() { void testContinue(@Nullable Object o) { for (; ; ) { - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] o.toString(); if (true) continue; } @@ -104,7 +104,7 @@ void testContinue(@Nullable Object o) { void testBreak(@Nullable Object o) { while (true) { - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] o.toString(); if (true) break; } @@ -113,14 +113,14 @@ void testBreak(@Nullable Object o) { void testSimpleNull() { String r1 = null; while (r1 != null) {} - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] r1.toString(); // error } void testMulticheckNull() { String r1 = null; while (r1 != null && r1.equals("m")) {} - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] r1.toString(); // error } @@ -129,7 +129,7 @@ void testAssignInLoopSimple() { while (r1 != null) { r1 = null; } - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] r1.toString(); // error } @@ -138,7 +138,7 @@ void testAssignInLoopMulti() { while (r1 != null && r1.isEmpty()) { r1 = null; } - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] r1.toString(); // error } diff --git a/checker/tests/nullness/FlowNegation.java b/checker/tests/nullness/FlowNegation.java index c6e4f1440ede..8e2b119267cd 100644 --- a/checker/tests/nullness/FlowNegation.java +++ b/checker/tests/nullness/FlowNegation.java @@ -9,7 +9,7 @@ void testSimpleValid() { void testCase1() { String s = "m"; - // :: warning: (nulltest.redundant) + // :: warning: [nulltest.redundant] if (s != null) { } else { // nothing to do @@ -19,7 +19,7 @@ void testCase1() { void testCase2() { String s = "m"; - // :: warning: (nulltest.redundant) + // :: warning: [nulltest.redundant] if (s == null) { } else { // nothing to do @@ -29,25 +29,25 @@ void testCase2() { void testInvalidCase1() { String s = "m"; - // :: warning: (nulltest.redundant) + // :: warning: [nulltest.redundant] if (s != null) { s = null; } else { // nothing to do } - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] s.toString(); // error } void testInvalidCase2() { String s = "m"; - // :: warning: (nulltest.redundant) + // :: warning: [nulltest.redundant] if (s != null) { // nothing to do } else { s = null; } - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] s.toString(); // error } @@ -58,42 +58,42 @@ void testSimpleValidTernary() { void testTernaryCase1() { String s = "m"; - // :: warning: (nulltest.redundant) + // :: warning: [nulltest.redundant] Object m = (s != null) ? "m" : "n"; s.toString(); } void testTernaryCase2() { String s = "m"; - // :: warning: (nulltest.redundant) + // :: warning: [nulltest.redundant] Object m = (s == null) ? "m" : "n"; s.toString(); } void testTernaryInvalidCase1() { String s = "m"; - // :: warning: (nulltest.redundant) + // :: warning: [nulltest.redundant] Object m = (s != null) ? (s = null) : "n"; - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] s.toString(); // error } void testTernaryInvalidCase2() { String s = "m"; - // :: warning: (nulltest.redundant) + // :: warning: [nulltest.redundant] Object m = (s != null) ? "m" : (s = null); - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] s.toString(); // error } void testAssignInCond() { String s = "m"; if ((s = null) != "m") { - // :: error: (assignment) + // :: error: [assignment] @NonNull String l0 = s; } else { } - // :: error: (assignment) + // :: error: [assignment] @NonNull String l1 = s; } } diff --git a/checker/tests/nullness/FlowNonThis.java b/checker/tests/nullness/FlowNonThis.java index 6a13e4bdf96e..5a68fb7483ad 100644 --- a/checker/tests/nullness/FlowNonThis.java +++ b/checker/tests/nullness/FlowNonThis.java @@ -11,7 +11,7 @@ public static void main(String[] args) { t.setup(); System.out.println(t.c.length()); t.erase(); - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] System.out.println(t.c.length()); } @@ -19,15 +19,15 @@ public void setupThenErase() { setup(); System.out.println(c.length()); erase(); - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] System.out.println(c.length()); } public void justErase() { - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] System.out.println(c.length()); erase(); - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] System.out.println(c.length()); } diff --git a/checker/tests/nullness/FlowNullness.java b/checker/tests/nullness/FlowNullness.java index 2ef24c22d314..ef4c84e02cb3 100644 --- a/checker/tests/nullness/FlowNullness.java +++ b/checker/tests/nullness/FlowNullness.java @@ -6,13 +6,13 @@ public void testIf() { String str = "foo"; @NonNull String a; - // :: warning: (nulltest.redundant) + // :: warning: [nulltest.redundant] if (str != null) { a = str; } str = null; - // :: error: (assignment) + // :: error: [assignment] @NonNull String b = str; } @@ -20,13 +20,13 @@ public void testIfNoBlock() { String str = "foo"; @NonNull String a; - // :: warning: (nulltest.redundant) + // :: warning: [nulltest.redundant] if (str != null) { a = str; } str = null; - // :: error: (assignment) + // :: error: [assignment] @NonNull String b = str; } @@ -34,7 +34,7 @@ public void testElse() { String str = "foo"; @NonNull String a; - // :: warning: (nulltest.redundant) + // :: warning: [nulltest.redundant] if (str == null) { testAssert(); } else { @@ -42,7 +42,7 @@ public void testElse() { } str = null; - // :: error: (assignment) + // :: error: [assignment] @NonNull String b = str; } @@ -50,7 +50,7 @@ public void testElseNoBlock() { String str = "foo"; @NonNull String a; - // :: warning: (nulltest.redundant) + // :: warning: [nulltest.redundant] if (str == null) { testAssert(); } else { @@ -58,14 +58,14 @@ public void testElseNoBlock() { } str = null; - // :: error: (assignment) + // :: error: [assignment] @NonNull String b = str; } public void testReturnIf() { String str = "foo"; - // :: warning: (nulltest.redundant) + // :: warning: [nulltest.redundant] if (str == null) { testAssert(); return; @@ -74,14 +74,14 @@ public void testReturnIf() { @NonNull String a = str; str = null; - // :: error: (assignment) + // :: error: [assignment] @NonNull String b = str; } public void testReturnElse() { String str = "foo"; - // :: warning: (nulltest.redundant) + // :: warning: [nulltest.redundant] if (str != null) { testAssert(); } else { @@ -91,14 +91,14 @@ public void testReturnElse() { @NonNull String a = str; str = null; - // :: error: (assignment) + // :: error: [assignment] @NonNull String b = str; } public void testThrowIf() { String str = "foo"; - // :: warning: (nulltest.redundant) + // :: warning: [nulltest.redundant] if (str == null) { testAssert(); throw new RuntimeException("foo"); @@ -107,14 +107,14 @@ public void testThrowIf() { @NonNull String a = str; str = null; - // :: error: (assignment) + // :: error: [assignment] @NonNull String b = str; } public void testThrowElse() { String str = "foo"; - // :: warning: (nulltest.redundant) + // :: warning: [nulltest.redundant] if (str != null) { testAssert(); } else { @@ -124,34 +124,34 @@ public void testThrowElse() { @NonNull String a = str; str = null; - // :: error: (assignment) + // :: error: [assignment] @NonNull String b = str; } public void testAssert() { String str = "foo"; - // :: warning: (nulltest.redundant) + // :: warning: [nulltest.redundant] assert str != null; @NonNull String a = str; str = null; - // :: error: (assignment) + // :: error: [assignment] @NonNull String b = str; } public void testWhile() { String str = "foo"; - // :: warning: (nulltest.redundant) + // :: warning: [nulltest.redundant] while (str != null) { @NonNull String a = str; break; } str = null; - // :: error: (assignment) + // :: error: [assignment] @NonNull String b = str; } @@ -164,7 +164,7 @@ public void testIfInstanceOf() { } str = null; - // :: error: (assignment) + // :: error: [assignment] @NonNull String b = str; } @@ -174,7 +174,7 @@ public void testNew() { @NonNull String a = str; str = null; - // :: error: (assignment) + // :: error: [assignment] @NonNull String b = str; String s2 = new String(); @@ -184,7 +184,7 @@ public void testNew() { public void testExit() { String str = "foo"; - // :: warning: (nulltest.redundant) + // :: warning: [nulltest.redundant] if (str == null) { System.exit(0); } @@ -210,11 +210,11 @@ void test(@Nullable Object a, @Nullable Object b) {} m.equals(m = null); MyClass n = new MyClass(); - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] n.test(n = null, n.toString()); // error MyClass o = null; - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] o.equals(o == new MyClass()); // error } @@ -224,7 +224,7 @@ void instanceOf(@Nullable Object o) { o.toString(); return; } - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] o.toString(); // error } @@ -297,7 +297,7 @@ void equality_test(@Nullable String s) { void testNullableCall() { if (returnNullable() != null) { - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] returnNullable().toString(); // error } } @@ -307,14 +307,14 @@ void nonNullArg(@NonNull Object arg) { } void testNonNullArg(@Nullable Object arg) { - // :: error: (argument) + // :: error: [argument] nonNullArg(arg); // error nonNullArg(arg); // no error } void test() { String[] s = null; - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] for (int i = 0; i < s.length; ++i) { // error String m = s[i]; // fine.. s cannot be null } @@ -325,7 +325,7 @@ void test() { public void add_modified(double[] a, int count) { // System.out.println ("common: " + ArraysMDE.toString (a)); - // :: warning: (nulltest.redundant) + // :: warning: [nulltest.redundant] if (a == null) { return; } else if (intersect == null) { diff --git a/checker/tests/nullness/FlowSelf.java b/checker/tests/nullness/FlowSelf.java index 8a49f5b8508c..61ef12ba22ff 100644 --- a/checker/tests/nullness/FlowSelf.java +++ b/checker/tests/nullness/FlowSelf.java @@ -7,7 +7,7 @@ void test(@Nullable String s) { if (s == null) { return; } - // :: warning: (nulltest.redundant) + // :: warning: [nulltest.redundant] assert s != null; s = s.substring(1); diff --git a/checker/tests/nullness/GetConstantStr.java b/checker/tests/nullness/GetConstantStr.java index 59a3a5d60fa3..bfc68d9a0dc7 100644 --- a/checker/tests/nullness/GetConstantStr.java +++ b/checker/tests/nullness/GetConstantStr.java @@ -1,6 +1,6 @@ public class GetConstantStr { public static void get_constant_str(Object obj) { - // :: warning: (nulltest.redundant) + // :: warning: [nulltest.redundant] assert obj != null; } } diff --git a/checker/tests/nullness/GetInterfacesPurity.java b/checker/tests/nullness/GetInterfacesPurity.java index 8d27b531c579..bbae7f54e503 100644 --- a/checker/tests/nullness/GetInterfacesPurity.java +++ b/checker/tests/nullness/GetInterfacesPurity.java @@ -4,7 +4,7 @@ public class GetInterfacesPurity { @Pure public static boolean isSubtypeTestMethod(Class sub, Class sup) { - // :: error: (purity.not.deterministic.call) + // :: error: [purity.not.deterministic.call] Class[] interfaces = sub.getInterfaces(); return interfaces.length == 0; } diff --git a/checker/tests/nullness/GetProperty.java b/checker/tests/nullness/GetProperty.java index c9feb746f64f..d099351c2971 100644 --- a/checker/tests/nullness/GetProperty.java +++ b/checker/tests/nullness/GetProperty.java @@ -10,16 +10,16 @@ void m(Properties p) { String s = "line.separator"; nno = System.getProperty("line.separator"); - // :: error: (assignment) + // :: error: [assignment] nno = System.getProperty(s); - // :: error: (assignment) + // :: error: [assignment] nno = System.getProperty("not.a.builtin.property"); - // :: error: (assignment) + // :: error: [assignment] nno = p.getProperty("line.separator"); - // :: error: (assignment) + // :: error: [assignment] nno = p.getProperty(s); - // :: error: (assignment) + // :: error: [assignment] nno = p.getProperty("not.a.builtin.property"); } } diff --git a/checker/tests/nullness/GetRefArg.java b/checker/tests/nullness/GetRefArg.java index 7df75fae6a1c..c5d862392302 100644 --- a/checker/tests/nullness/GetRefArg.java +++ b/checker/tests/nullness/GetRefArg.java @@ -4,7 +4,7 @@ public class GetRefArg { private void get_ref_arg(Constructor constructor) throws Exception { Object val = constructor.newInstance(); - // :: warning: (nulltest.redundant) + // :: warning: [nulltest.redundant] assert val != null; } } diff --git a/checker/tests/nullness/InferNullType.java b/checker/tests/nullness/InferNullType.java index 1e0a4c91ed75..8c53592dfbb5 100644 --- a/checker/tests/nullness/InferNullType.java +++ b/checker/tests/nullness/InferNullType.java @@ -18,7 +18,7 @@ T toInfer4(T input, S p2) { } void x() { - // :: error: (type.arguments.not.inferred) + // :: error: [type.arguments.not.inferred] Object m = toInfer(null); Object m2 = toInfer2(null); @@ -26,11 +26,11 @@ void x() { Object m4 = toInfer3(1, null); Object m5 = toInfer3(null, 1); - // :: error: (type.arguments.not.inferred) + // :: error: [type.arguments.not.inferred] Object m6 = toInfer4(null, null); - // :: error: (type.arguments.not.inferred) + // :: error: [type.arguments.not.inferred] Object m7 = toInfer4(1, null); - // :: error: (type.arguments.not.inferred) + // :: error: [type.arguments.not.inferred] Object m8 = toInfer4(null, 1); } } diff --git a/checker/tests/nullness/InferTypeArgsConditionalExpression.java b/checker/tests/nullness/InferTypeArgsConditionalExpression.java index cac9a5784a23..35b2eaed4cfb 100644 --- a/checker/tests/nullness/InferTypeArgsConditionalExpression.java +++ b/checker/tests/nullness/InferTypeArgsConditionalExpression.java @@ -9,7 +9,7 @@ public class InferTypeArgsConditionalExpression { public void foo(Generic real, Generic other, boolean flag) { - // :: error: (type.arguments.not.inferred) + // :: error: [type.arguments.not.inferred] bar(flag ? real : other); } diff --git a/checker/tests/nullness/Initializer.java b/checker/tests/nullness/Initializer.java index 74d759dc725d..db334a3e276b 100644 --- a/checker/tests/nullness/Initializer.java +++ b/checker/tests/nullness/Initializer.java @@ -8,20 +8,20 @@ public class Initializer { public String a; public String b = "abc"; - // :: error: (assignment) + // :: error: [assignment] public String c = null; public String d = (""); - // :: error: (initialization.fields.uninitialized) + // :: error: [initialization.fields.uninitialized] public Initializer() { - // :: error: (assignment) + // :: error: [assignment] a = null; a = ""; c = ""; } - // :: error: (initialization.fields.uninitialized) + // :: error: [initialization.fields.uninitialized] public Initializer(boolean foo) {} public Initializer(int foo) { @@ -44,7 +44,7 @@ public Initializer(double foo) { f = ""; } - // :: error: (initialization.fields.uninitialized) + // :: error: [initialization.fields.uninitialized] public Initializer(double foo, boolean t) { if (!setFieldMaybe()) { // on this path, 'a' is not initialized @@ -66,7 +66,7 @@ public boolean setFieldMaybe(@UnknownInitialization Initializer this) { String f; void t1(@UnknownInitialization Initializer this) { - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] this.f.toString(); } @@ -75,22 +75,22 @@ void t1(@UnknownInitialization Initializer this) { class SubInitializer extends Initializer { - // :: error: (initialization.field.uninitialized) + // :: error: [initialization.field.uninitialized] String f; void subt1(@UnknownInitialization(Initializer.class) SubInitializer this) { fieldF.toString(); super.f.toString(); - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] this.f.toString(); } void subt2(@UnknownInitialization SubInitializer this) { - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] fieldF.toString(); - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] super.f.toString(); - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] this.f.toString(); } } diff --git a/checker/tests/nullness/InvariantTypes.java b/checker/tests/nullness/InvariantTypes.java index 6b27f1b2305f..d8594a4739ea 100644 --- a/checker/tests/nullness/InvariantTypes.java +++ b/checker/tests/nullness/InvariantTypes.java @@ -10,10 +10,10 @@ public class InvariantTypes { void testAsLocal() { @MonotonicNonNull Object[] lo; lo = new Object[5]; - // :: error: (assignment) + // :: error: [assignment] lo[0] = null; lo[0] = new Object(); - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] lo[1].toString(); } diff --git a/checker/tests/nullness/IsEmptyPoll.java b/checker/tests/nullness/IsEmptyPoll.java index e1466a25d69b..342ae9039d5c 100644 --- a/checker/tests/nullness/IsEmptyPoll.java +++ b/checker/tests/nullness/IsEmptyPoll.java @@ -18,13 +18,13 @@ void mNonNull(Queue q) { void mNullable(Queue<@Nullable String> q) { while (!q.isEmpty()) { - // :: error: (assignment) + // :: error: [assignment] @NonNull String firstNode = q.poll(); } } void mNoCheck(Queue<@Nullable String> q) { - // :: error: (assignment) + // :: error: [assignment] @NonNull String firstNode = q.poll(); } } diff --git a/checker/tests/nullness/Issue1046Java7.java b/checker/tests/nullness/Issue1046Java7.java index 83a9088c7633..643ee288c616 100644 --- a/checker/tests/nullness/Issue1046Java7.java +++ b/checker/tests/nullness/Issue1046Java7.java @@ -19,7 +19,7 @@ static void transform2(Function q) {} void test1(Function p, Function p2) { transform(p); - // :: error: (argument) + // :: error: [argument] transform2(p); transform(p2); transform2(p2); diff --git a/checker/tests/nullness/Issue1096.java b/checker/tests/nullness/Issue1096.java index e60a1d9af420..14e65ff64d19 100644 --- a/checker/tests/nullness/Issue1096.java +++ b/checker/tests/nullness/Issue1096.java @@ -17,7 +17,7 @@ class PreCond { } void earlyBad(@UnknownInitialization PreCond this) { - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] f.toString(); } @@ -33,7 +33,7 @@ void doNullable(@UnknownInitialization PreCond this) { void foo(@UnknownInitialization PreCond this) { // The receiver is not fully initialized, so raise an error. - // :: error: (contracts.precondition) + // :: error: [contracts.precondition] early(); } @@ -41,7 +41,7 @@ void bar() { // The receiver is initialized, so non-null field f is definitely non-null. early(); // Nullable fields stay nullable - // :: error: (contracts.precondition) + // :: error: [contracts.precondition] doNullable(); } } @@ -49,7 +49,7 @@ void bar() { class User { void foo(@UnknownInitialization PreCond pc) { // The receiver is not fully initialized, so raise an error. - // :: error: (contracts.precondition) + // :: error: [contracts.precondition] pc.early(); } @@ -57,7 +57,7 @@ void bar(PreCond pc) { // The receiver is initialized, so non-null field f is definitely non-null. pc.early(); // Nullable fields stay nullable - // :: error: (contracts.precondition) + // :: error: [contracts.precondition] pc.doNullable(); } } diff --git a/checker/tests/nullness/Issue1102.java b/checker/tests/nullness/Issue1102.java index 3270b9efb06b..fec15c4481fc 100644 --- a/checker/tests/nullness/Issue1102.java +++ b/checker/tests/nullness/Issue1102.java @@ -22,7 +22,7 @@ class Issue1102Use { void bar() { Issue1102Decl d = Issue1102Decl.newInstance(f); - // :: error: (type.arguments.not.inferred) + // :: error: [type.arguments.not.inferred] d = Issue1102Decl.newInstance(g); } } diff --git a/checker/tests/nullness/Issue1522.java b/checker/tests/nullness/Issue1522.java index fdabd0b90713..8efeec8390af 100644 --- a/checker/tests/nullness/Issue1522.java +++ b/checker/tests/nullness/Issue1522.java @@ -13,25 +13,25 @@ void bar() { void copyVector(Vector v, Integer[] intArray, String[] stringArray) { // Java types aren't compatible - // :: error: (vector.copyinto) + // :: error: [vector.copyinto] v.copyInto(intArray); v.copyInto(stringArray); } void copyStack(SubClassVector v, Integer[] intArray, String[] stringArray) { // Java types aren't compatible - // :: error: (vector.copyinto) + // :: error: [vector.copyinto] v.copyInto(intArray); v.copyInto(stringArray); } void copyVectorErrors(Vector<@Nullable String> v, String[] stringArray) { - // :: error: (vector.copyinto) + // :: error: [vector.copyinto] v.copyInto(stringArray); } void copyStackErrors(SubClassVector<@Nullable String> v, String[] stringArray) { - // :: error: (vector.copyinto) + // :: error: [vector.copyinto] v.copyInto(stringArray); } diff --git a/checker/tests/nullness/Issue1590.java b/checker/tests/nullness/Issue1590.java index 07df89044dc4..5e67204ad102 100644 --- a/checker/tests/nullness/Issue1590.java +++ b/checker/tests/nullness/Issue1590.java @@ -4,7 +4,7 @@ public class Issue1590 { private String a; public Issue1590() { - // :: error: (method.invocation) + // :: error: [method.invocation] init(); } diff --git a/checker/tests/nullness/Issue1590a.java b/checker/tests/nullness/Issue1590a.java index bffd160321c1..c7411b1dd46b 100644 --- a/checker/tests/nullness/Issue1590a.java +++ b/checker/tests/nullness/Issue1590a.java @@ -4,9 +4,9 @@ public class Issue1590a { private String a; - // :: error: (initialization.fields.uninitialized) + // :: error: [initialization.fields.uninitialized] public Issue1590a() { - // :: error: (method.invocation) + // :: error: [method.invocation] init(); } diff --git a/checker/tests/nullness/Issue160.java b/checker/tests/nullness/Issue160.java index 9832262c2912..787b456db594 100644 --- a/checker/tests/nullness/Issue160.java +++ b/checker/tests/nullness/Issue160.java @@ -32,7 +32,7 @@ public static void t1b() { } else { return; } - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] System.out.println(s.toString()); } @@ -42,7 +42,7 @@ public static void t2b() { } else { throw new RuntimeException(); } - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] System.out.println(s.toString()); } @@ -52,7 +52,7 @@ public static void t3b() { } else { System.exit(0); } - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] System.out.println(s.toString()); } } diff --git a/checker/tests/nullness/Issue1847.java b/checker/tests/nullness/Issue1847.java index 50e2b5acc332..f419cd7a519d 100644 --- a/checker/tests/nullness/Issue1847.java +++ b/checker/tests/nullness/Issue1847.java @@ -9,7 +9,7 @@ public class Issue1847 { public void test() { // Should give null error here: - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] withLookup((String myVar) -> map.get(myVar).length()); for (Iterator> iterator = map.entrySet().iterator(); iterator.hasNext(); ) { @@ -22,7 +22,7 @@ public void test() { } // Should also give null error here: - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] withLookup(myVar -> map.get(myVar).length()); } diff --git a/checker/tests/nullness/Issue1847B.java b/checker/tests/nullness/Issue1847B.java index ca198cab16e4..35f3c37e2db1 100644 --- a/checker/tests/nullness/Issue1847B.java +++ b/checker/tests/nullness/Issue1847B.java @@ -3,17 +3,17 @@ public class Issue1847B { public void test1() { - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] Function<@Nullable String, String> f1 = (@Nullable String myVar) -> myVar.toString(); { String myVar = "hello"; } - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] Function<@Nullable String, String> f2 = (@Nullable String myVar) -> myVar.toString(); } public void test2() { - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] Function f1 = (@Nullable String myVar) -> myVar.toString(); } } diff --git a/checker/tests/nullness/Issue1922.java b/checker/tests/nullness/Issue1922.java index 40269e57ae44..08575603bf42 100644 --- a/checker/tests/nullness/Issue1922.java +++ b/checker/tests/nullness/Issue1922.java @@ -18,10 +18,10 @@ public class Issue1922 { // Find a key in a map and return String version of its value. public static String findKeyAndFetchString(Map someMap) { - // :: error: (type.argument) + // :: error: [type.argument] @Nullable @KeyFor("someMap") String myKey = Issue1922.<@KeyFor("someMap") String>findKey(someMap.keySet(), "Foo"); - // :: error: (argument) + // :: error: [argument] Object value = someMap.get(myKey); return value.toString(); } diff --git a/checker/tests/nullness/Issue1981.java b/checker/tests/nullness/Issue1981.java index bd7e1f41b175..2e594357c396 100644 --- a/checker/tests/nullness/Issue1981.java +++ b/checker/tests/nullness/Issue1981.java @@ -10,12 +10,12 @@ void test(List ids) { } static > List func1(Iterable elements) { - // :: error: (return) + // :: error: [return] return null; } static List> func2(List list) { - // :: error: (return) + // :: error: [return] return null; } } diff --git a/checker/tests/nullness/Issue2013.java b/checker/tests/nullness/Issue2013.java index cc61d55c1f0a..5dde1f671b1c 100644 --- a/checker/tests/nullness/Issue2013.java +++ b/checker/tests/nullness/Issue2013.java @@ -9,7 +9,7 @@ static class Super { private @Nullable String name = null; @EnsuresNonNull("name()") - // :: error: (contracts.postcondition) + // :: error: [contracts.postcondition] void ensureNameNonNull() { name = "name"; } @@ -29,7 +29,7 @@ static class Sub extends Super { @Nullable String subname = null; @Override - // :: error: (contracts.postcondition) + // :: error: [contracts.postcondition] void ensureNameNonNull() { super.ensureNameNonNull(); subname = "Sub"; @@ -54,7 +54,7 @@ void requiresNameNonNull() { void use() { if (super.name() != null) { - // :: error: (contracts.precondition) + // :: error: [contracts.precondition] requiresNameNonNull(); } @@ -63,7 +63,7 @@ void use() { } if (super.name() != null) { - // :: error: (contracts.precondition) + // :: error: [contracts.precondition] super.requiresNameNonNull(); } @@ -72,11 +72,11 @@ void use() { } super.ensureNameNonNull(); - // :: error: (contracts.precondition) + // :: error: [contracts.precondition] requiresNameNonNull(); super.ensureNameNonNull(); - // :: error: (contracts.precondition) + // :: error: [contracts.precondition] super.requiresNameNonNull(); ensureNameNonNull(); diff --git a/checker/tests/nullness/Issue2048.java b/checker/tests/nullness/Issue2048.java index 912c562857fa..019322293a02 100644 --- a/checker/tests/nullness/Issue2048.java +++ b/checker/tests/nullness/Issue2048.java @@ -16,7 +16,7 @@ class UseNbl { void foo(Fooer fooer) {} } - // :: error: (type.arguments.not.inferred) :: error: (type.argument) + // :: error: [type.arguments.not.inferred] :: error: [type.argument] Fooer<@Nullable Foo> nblFooer = new Fooer<>(); Fooer<@NonNull Foo> nnFooer = new Fooer<>(); diff --git a/checker/tests/nullness/Issue2247.java b/checker/tests/nullness/Issue2247.java index 1b9f55edf869..70da992472e1 100644 --- a/checker/tests/nullness/Issue2247.java +++ b/checker/tests/nullness/Issue2247.java @@ -13,22 +13,22 @@ public class Issue2247 { class ValidUseType { - // :: error: (annotations.on.use) + // :: error: [annotations.on.use] void test1(@Nullable DeclaredClass object) {} - // :: error: (annotations.on.use) + // :: error: [annotations.on.use] @Nullable DeclaredClass test2() { return null; } - // :: error: (annotations.on.use) + // :: error: [annotations.on.use] void test3(List<@Nullable DeclaredClass> param) { @Nullable DeclaredClass object = null; - // :: error: (annotations.on.use) + // :: error: [annotations.on.use] @Nullable DeclaredClass[] array = null; } - // :: error: (annotations.on.use) + // :: error: [annotations.on.use] void test4(@NonNull T t) {} void test5(Map map) { diff --git a/checker/tests/nullness/Issue2407.java b/checker/tests/nullness/Issue2407.java index 45f43c89ee98..e6e6ac514bed 100644 --- a/checker/tests/nullness/Issue2407.java +++ b/checker/tests/nullness/Issue2407.java @@ -8,16 +8,16 @@ public class Issue2407 { void setMessage(String message) {} @EnsuresNonNull("1") - // :: error: (flowexpr.parse.error) + // :: error: [flowexpr.parse.error] void method() {} @EnsuresNonNullIf(expression = "1", result = true) - // :: error: (flowexpr.parse.error) + // :: error: [flowexpr.parse.error] void method2() {} void main() { Issue2407 object = new Issue2407(); - // :: error: (contracts.precondition) + // :: error: [contracts.precondition] object.setMessage(new Object() + "bar"); } } diff --git a/checker/tests/nullness/Issue2432.java b/checker/tests/nullness/Issue2432.java index 976f40a75366..5b769f37af95 100644 --- a/checker/tests/nullness/Issue2432.java +++ b/checker/tests/nullness/Issue2432.java @@ -9,9 +9,9 @@ public class Issue2432 { void jdkAnnotation(List<@PolyNull Object> nl, @Nullable Object no, @PolyNull Object po) { - // :: error: (argument) + // :: error: [argument] nl.add(null); - // :: error: (argument) + // :: error: [argument] nl.add(no); // OK nl.add(po); @@ -23,9 +23,9 @@ void polyReceiverType( @NonNull Object nno, @Nullable Object no, @PolyNull Object po) { - // :: error: (argument) + // :: error: [argument] Object object = tc.echo(no); - // :: error: (assignment) + // :: error: [assignment] nno = tc.echo(po); // No error. Return value remains @PolyNull. // Note po's @PolyNull is unsubstitutable (from parameter but not from declaration) @@ -34,14 +34,14 @@ void polyReceiverType( // the following two methods tests pesudo assignment of arguments with poly annotation void polyAssignment(TypeArgClass<@NonNull Object> nnc, @PolyNull Object po) { - // :: error: (argument) + // :: error: [argument] nnc.echo(po); } void polyAssignment2(TypeArgClass<@Nullable Object> nc, @PolyNull Object po) { // No error nc.echo(po); - // :: error: (assignment) + // :: error: [assignment] po = nc.echo(po); } @@ -74,7 +74,7 @@ void lubWithTypeArgNoReceiver3(TypeArgClass<@Nullable Object> nc, @NonNull Objec // lub combination: (@NonNull, @Nullable) = @Nullable void lubWithTypeArgNoReceiver4(TypeArgClass<@NonNull Object> nnc, @Nullable Object no) { - // :: error: (argument) + // :: error: [argument] foo2PolyTypeArg(nnc, no, new Object()); } @@ -82,7 +82,7 @@ void lubWithTypeArgNoReceiver4(TypeArgClass<@NonNull Object> nnc, @Nullable Obje // T dummy in tripleAdd is to ensure poly annotations from declaration is handled separately void lubWithReceiver( TypeArgClass<@PolyNull Object> pc, @Nullable Object no, @NonNull Object nno) { - // :: error: (argument) + // :: error: [argument] pc.tripleAdd(no, nno, no); // No error pc.tripleAdd(no, nno, nno); @@ -95,7 +95,7 @@ void declarationPolyInParameter( pc.echo(nno, no); // the invocation is valid, while the assignment is not - // :: error: (assignment) + // :: error: [assignment] @NonNull Object nonnull = pc.echo(nno, no); } diff --git a/checker/tests/nullness/Issue2470.java b/checker/tests/nullness/Issue2470.java index 222625624d6f..2a428ce66c86 100644 --- a/checker/tests/nullness/Issue2470.java +++ b/checker/tests/nullness/Issue2470.java @@ -30,7 +30,7 @@ public void print() { static void buggy() { new Example() - // :: error: (contracts.precondition) + // :: error: [contracts.precondition] .print(); } @@ -43,7 +43,7 @@ static void ok() { static void buggy2() { new Example() .setS("test") - // :: error: (contracts.precondition) + // :: error: [contracts.precondition] .print(); } diff --git a/checker/tests/nullness/Issue2564.java b/checker/tests/nullness/Issue2564.java index b0159e9a79c2..01886238492f 100644 --- a/checker/tests/nullness/Issue2564.java +++ b/checker/tests/nullness/Issue2564.java @@ -4,9 +4,9 @@ public abstract class Issue2564 { public enum EnumType { - // :: error: (enum.declaration) + // :: error: [enum.declaration] @KeyFor("myMap") MY_KEY, - // :: error: (enum.declaration) + // :: error: [enum.declaration] @KeyFor("enumMap") ENUM_KEY; private static final Map enumMap = new HashMap<>(); diff --git a/checker/tests/nullness/Issue2587.java b/checker/tests/nullness/Issue2587.java index 30ba0eac373e..f3c409ec5a84 100644 --- a/checker/tests/nullness/Issue2587.java +++ b/checker/tests/nullness/Issue2587.java @@ -5,7 +5,7 @@ @SuppressWarnings({"enum.declaration", "assignment"}) // These warnings are not relevant public abstract class Issue2587 { public enum EnumType { - // :: error: (expression.unparsable) + // :: error: [expression.unparsable] @KeyFor("myMap") MY_KEY, @KeyFor("enumMap") ENUM_KEY; @@ -18,11 +18,11 @@ void method() { } public static class Inner { - // :: error: (expression.unparsable) + // :: error: [expression.unparsable] @KeyFor("myMap") String MY_KEY = ""; public static class Inner2 { - // :: error: (expression.unparsable) + // :: error: [expression.unparsable] @KeyFor("myMap") String MY_KEY2 = ""; @KeyFor("innerMap") String MY_KEY3 = ""; diff --git a/checker/tests/nullness/Issue261.java b/checker/tests/nullness/Issue261.java index f247cf76fa9e..9d5170956c94 100644 --- a/checker/tests/nullness/Issue261.java +++ b/checker/tests/nullness/Issue261.java @@ -4,7 +4,7 @@ public class Issue261 { boolean b; class Flag { - // :: error: (initialization.field.uninitialized) + // :: error: [initialization.field.uninitialized] T value; } diff --git a/checker/tests/nullness/Issue2619b.java b/checker/tests/nullness/Issue2619b.java index 9b4768559c7b..071f7a60b1c2 100644 --- a/checker/tests/nullness/Issue2619b.java +++ b/checker/tests/nullness/Issue2619b.java @@ -10,7 +10,7 @@ void m01(Aux aux1, Aux aux2) { if (aux1.hasValue(Aux.MINIMUM_VALUE) && aux2.hasValue(Aux.MINIMUM_VALUE)) { // hasValue is not side-effect-free, so the @KeyFor("aux1.map") is cleared rather than // glb'ed. - // :: error: (assignment) + // :: error: [assignment] @KeyFor({"aux1.map", "aux2.map"}) String s1 = Aux.MINIMUM_VALUE; } } @@ -31,7 +31,7 @@ void m03(Aux aux1, Aux aux2) { void m04(Aux aux1, Aux aux2) { if (map.containsKey(Aux.MINIMUM_VALUE) && aux1.hasValue(Aux.MINIMUM_VALUE)) { - // :: error: (assignment) + // :: error: [assignment] @KeyFor({"aux1.map", "map"}) String s1 = Aux.MINIMUM_VALUE; @KeyFor("aux1.map") String s2 = Aux.MINIMUM_VALUE; } diff --git a/checker/tests/nullness/Issue273.java b/checker/tests/nullness/Issue273.java index 11d89df46e02..0fb8bb4c744f 100644 --- a/checker/tests/nullness/Issue273.java +++ b/checker/tests/nullness/Issue273.java @@ -13,7 +13,7 @@ public static void main(String... p) { @KeyFor("m0") String k = "key"; m0.put(k, 1); - // :: error: (argument) + // :: error: [argument] getMap2(m0, m1, k).toString(); } diff --git a/checker/tests/nullness/Issue2865.java b/checker/tests/nullness/Issue2865.java index 611d09741e37..4ef1faefda14 100644 --- a/checker/tests/nullness/Issue2865.java +++ b/checker/tests/nullness/Issue2865.java @@ -7,13 +7,13 @@ public C(T a) {} public void f(T a) { new C(a); - // :: error: (argument) + // :: error: [argument] new C(null); } } void test(Issue2865<@NonNull String> s) { - // :: error: (argument) + // :: error: [argument] s.new C(null); s.new C(""); } diff --git a/checker/tests/nullness/Issue2888.java b/checker/tests/nullness/Issue2888.java index 023eb0a90a79..d21331203c4b 100644 --- a/checker/tests/nullness/Issue2888.java +++ b/checker/tests/nullness/Issue2888.java @@ -5,7 +5,7 @@ public class Issue2888 { void foo() { noa = null; - // :: error: (accessing.nullable) :: error: (assignment) + // :: error: [accessing.nullable] :: error: [assignment] noa[0] = null; } @@ -24,7 +24,7 @@ public void bar1(@Nullable String... args) { private void bar2(@Nullable String... args) { if (args != null && args.length > 0) { @Nullable final String arg0 = args[0]; - // :: warning: (nulltest.redundant) + // :: warning: [nulltest.redundant] if (arg0 != null) { System.out.println("arg0: " + arg0); } diff --git a/checker/tests/nullness/Issue289.java b/checker/tests/nullness/Issue289.java index 68846dd6d6e9..0018a91a5491 100644 --- a/checker/tests/nullness/Issue289.java +++ b/checker/tests/nullness/Issue289.java @@ -31,10 +31,10 @@ class Lower2 extends Middle {} void complex() { Upper<@Nullable String> uns = new Lower1<>(); - // :: error: (assignment) + // :: error: [assignment] Upper us = new Lower1<>(); - // :: error: (assignment) + // :: error: [assignment] uns = new Lower2<>(); us = new Lower2<>(); } diff --git a/checker/tests/nullness/Issue293.java b/checker/tests/nullness/Issue293.java index c281128f6fea..1bddc80c7f99 100644 --- a/checker/tests/nullness/Issue293.java +++ b/checker/tests/nullness/Issue293.java @@ -45,7 +45,7 @@ void test4() throws Exception { s = null; } } finally { - // :: error: (argument) + // :: error: [argument] write(s); } } diff --git a/checker/tests/nullness/Issue296.java b/checker/tests/nullness/Issue296.java index 93e175a34b91..18c8f96e7abe 100644 --- a/checker/tests/nullness/Issue296.java +++ b/checker/tests/nullness/Issue296.java @@ -9,7 +9,7 @@ public class Issue296 { public static void f1(T[] a) { @Nullable T[] r1 = Arrays.copyOf(a, a.length + 1); - // :: error: (argument) + // :: error: [argument] @Nullable T[] r2 = Arrays.<@NonNull T>copyOf(a, a.length + 1); @Nullable T[] r3 = Arrays.<@Nullable T>copyOf(a, a.length + 1); } @@ -22,7 +22,7 @@ public static void f2(@NonNull T[] a) { public static void f3(@Nullable T[] a) { @Nullable T[] r1 = Arrays.copyOf(a, a.length + 1); - // :: error: (argument) + // :: error: [argument] @Nullable T[] r2 = Arrays.<@NonNull T>copyOf(a, a.length + 1); @Nullable T[] r3 = Arrays.<@Nullable T>copyOf(a, a.length + 1); } diff --git a/checker/tests/nullness/Issue3020.java b/checker/tests/nullness/Issue3020.java index 4d10b8ab139a..16fd9bb26e0d 100644 --- a/checker/tests/nullness/Issue3020.java +++ b/checker/tests/nullness/Issue3020.java @@ -3,7 +3,7 @@ enum Issue3020 { void retrieveConstant() { Class theClass = Issue3020.class; - // :: error: (accessing.nullable) + // :: error: [accessing.nullable] Object unused = passThrough(theClass.getEnumConstants())[0]; } diff --git a/checker/tests/nullness/Issue3033.java b/checker/tests/nullness/Issue3033.java index aeec5926a9a4..daf0757efa60 100644 --- a/checker/tests/nullness/Issue3033.java +++ b/checker/tests/nullness/Issue3033.java @@ -12,12 +12,12 @@ void main() { if (obj1 instanceof Test) { Test obj2 = new Test(); - // :: error: (instanceof.nullable) + // :: error: [instanceof.nullable] if (obj1 instanceof @Nullable Test) { obj1 = null; } - // :: warning: (instanceof.nonnull.redundant) + // :: warning: [instanceof.nonnull.redundant] if (obj2 instanceof @NonNull Test) { obj2 = obj1; } diff --git a/checker/tests/nullness/Issue306.java b/checker/tests/nullness/Issue306.java index c20e4aa908f6..14dd3a3c7007 100644 --- a/checker/tests/nullness/Issue306.java +++ b/checker/tests/nullness/Issue306.java @@ -25,19 +25,19 @@ void fakeMethod() { // The following error has to be raised: from the signature it is not guaranteed that the // parameter is returned. - // :: error: (monotonic) + // :: error: [monotonic] x = check(x); } @MonotonicNonNull Object y; void realError(@MonotonicNonNull Object p) { - // :: error: (monotonic) + // :: error: [monotonic] x = y; - // :: error: (monotonic) + // :: error: [monotonic] x = p; // It would be nice not to raise the following error. - // :: error: (monotonic) + // :: error: [monotonic] x = x; } } diff --git a/checker/tests/nullness/Issue3150.java b/checker/tests/nullness/Issue3150.java index 619f5a5de16f..989e55b6b130 100644 --- a/checker/tests/nullness/Issue3150.java +++ b/checker/tests/nullness/Issue3150.java @@ -5,15 +5,15 @@ public class Issue3150 { void foo(@Nullable Object nble, @NonNull Object nn) { - // :: error: (type.arguments.not.inferred) + // :: error: [type.arguments.not.inferred] requireNonNull1(null); - // :: error: (type.arguments.not.inferred) + // :: error: [type.arguments.not.inferred] requireNonNull1(nble); requireNonNull1("hello"); requireNonNull1(nn); - // :: error: (argument) + // :: error: [argument] requireNonNull2(null); - // :: error: (argument) + // :: error: [argument] requireNonNull2(nble); requireNonNull1("hello"); requireNonNull1(nn); diff --git a/checker/tests/nullness/Issue3349.java b/checker/tests/nullness/Issue3349.java index 7cd64d72966c..21bf8f784fe3 100644 --- a/checker/tests/nullness/Issue3349.java +++ b/checker/tests/nullness/Issue3349.java @@ -1,7 +1,7 @@ import java.io.Serializable; import org.checkerframework.checker.nullness.qual.*; -// :: warning: (explicit.annotation.ignored) +// :: warning: [explicit.annotation.ignored] public class Issue3349 { void foo(T p1) { @NonNull Serializable s = p1; diff --git a/checker/tests/nullness/Issue3443.java b/checker/tests/nullness/Issue3443.java index c3bca15f7278..5c87a4107f4b 100644 --- a/checker/tests/nullness/Issue3443.java +++ b/checker/tests/nullness/Issue3443.java @@ -2,7 +2,7 @@ public class Issue3443 { static > Supplier3443 passThrough(T t) { - // :: error: (return) + // :: error: [return] return t; } diff --git a/checker/tests/nullness/Issue345.java b/checker/tests/nullness/Issue345.java index 6e4bec08c7cc..a92237f82fed 100644 --- a/checker/tests/nullness/Issue345.java +++ b/checker/tests/nullness/Issue345.java @@ -5,7 +5,7 @@ public class Issue345 { String f2; { - // :: error: (assignment) + // :: error: [assignment] f1 = f2; f2 = f1; f2.toString(); // Null pointer exception here diff --git a/checker/tests/nullness/Issue354.java b/checker/tests/nullness/Issue354.java index cdeae0ea6066..19779748278c 100644 --- a/checker/tests/nullness/Issue354.java +++ b/checker/tests/nullness/Issue354.java @@ -7,7 +7,7 @@ public class Issue354 { new Object() { @Override public String toString() { - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] return a.toString(); } }.toString(); diff --git a/checker/tests/nullness/Issue355.java b/checker/tests/nullness/Issue355.java index d7289cfc804e..c94b64aef2b7 100644 --- a/checker/tests/nullness/Issue355.java +++ b/checker/tests/nullness/Issue355.java @@ -41,7 +41,7 @@ class Issue355d { } void m(List xs) { - // :: error: (iterating.over.nullable) + // :: error: [iterating.over.nullable] for (Object x : checkNotNull(xs)) {} } } @@ -52,7 +52,7 @@ class Issue355e { } void m(@Nullable List xs) { - // :: error: (argument) + // :: error: [argument] for (Object x : checkNotNull(xs)) {} } } diff --git a/checker/tests/nullness/Issue3614.java b/checker/tests/nullness/Issue3614.java index ae0cf6776471..82fe33ec45ff 100644 --- a/checker/tests/nullness/Issue3614.java +++ b/checker/tests/nullness/Issue3614.java @@ -31,7 +31,7 @@ public class Issue3614 { } public static @PolyNull Boolean not2(@PolyNull Boolean b) { - // :: error: (unboxing.of.nullable) + // :: error: [unboxing.of.nullable] return (b == null) ? b : !b; } @@ -78,7 +78,7 @@ public class Issue3614 { } public static @PolyNull Integer plus1Err(@PolyNull Integer b0, @PolyNull Integer b1) { - // :: error: (return) :: error: (unboxing.of.nullable) + // :: error: [return] :: error: [unboxing.of.nullable] return (b0 == null) ? null : (b0 + b1); } @@ -86,7 +86,7 @@ public class Issue3614 { if (b0 == null) { return null; } else { - // :: error: (unboxing.of.nullable) + // :: error: [unboxing.of.nullable] return b0 + b1; } } @@ -95,7 +95,7 @@ public class Issue3614 { if (a == null) { return null; } - // :: error: (unboxing.of.nullable) + // :: error: [unboxing.of.nullable] return a + b; } diff --git a/checker/tests/nullness/Issue3631.java b/checker/tests/nullness/Issue3631.java index 41288898a030..a5122ed24f4f 100644 --- a/checker/tests/nullness/Issue3631.java +++ b/checker/tests/nullness/Issue3631.java @@ -4,7 +4,7 @@ public class Issue3631 { void f(Object otherArg) { // Casts aren't a supported JavaExpression. - // :: error: (contracts.precondition) + // :: error: [contracts.precondition] ((Issue3631Helper) otherArg).m(); } } diff --git a/checker/tests/nullness/Issue3850.java b/checker/tests/nullness/Issue3850.java index a41d86825df0..55b3ecf287f4 100644 --- a/checker/tests/nullness/Issue3850.java +++ b/checker/tests/nullness/Issue3850.java @@ -3,7 +3,7 @@ public class Issue3850 { private static Iterable<@PolyNull String> toPos(Iterable nodes) { - // :: error: (return) + // :: error: [return] return transform(nodes, node -> node == null ? null : node.toString()); } diff --git a/checker/tests/nullness/Issue391.java b/checker/tests/nullness/Issue391.java index e3ca20f16700..6bccedb8603c 100644 --- a/checker/tests/nullness/Issue391.java +++ b/checker/tests/nullness/Issue391.java @@ -32,9 +32,9 @@ void ensuresNonNull() { void method2() { ClassA a = new ClassA(); - // :: error: (contracts.precondition) + // :: error: [contracts.precondition] a.getValue(); - // :: error: (contracts.precondition) + // :: error: [contracts.precondition] method(); } diff --git a/checker/tests/nullness/Issue3929.java b/checker/tests/nullness/Issue3929.java index 630109d9e6fd..ddd2def69adb 100644 --- a/checker/tests/nullness/Issue3929.java +++ b/checker/tests/nullness/Issue3929.java @@ -25,7 +25,7 @@ public List getKeys() { // TODO: This is a false positive. // See https://github.com/typetools/checker-framework/issues/2174 -// :: error: (type.argument) +// :: error: [type.argument] class NullableMyClass3929> { public List getKeys() { return new ArrayList<>(); diff --git a/checker/tests/nullness/Issue3970.java b/checker/tests/nullness/Issue3970.java index 3710d99c4971..246918db804d 100644 --- a/checker/tests/nullness/Issue3970.java +++ b/checker/tests/nullness/Issue3970.java @@ -12,7 +12,7 @@ public interface InterfaceB> { void t(InterfaceA a) { if (a.f() == 1) { - // :: error: (assignment) + // :: error: [assignment] InterfaceA a2 = a.g(); } } diff --git a/checker/tests/nullness/Issue400.java b/checker/tests/nullness/Issue400.java index 460bd494cea0..cf5c9d74884d 100644 --- a/checker/tests/nullness/Issue400.java +++ b/checker/tests/nullness/Issue400.java @@ -3,9 +3,9 @@ public class Issue400 { final class YYPair { - // :: error: (initialization.field.uninitialized) + // :: error: [initialization.field.uninitialized] T first; - // :: error: (initialization.field.uninitialized) + // :: error: [initialization.field.uninitialized] V second; } diff --git a/checker/tests/nullness/Issue408.java b/checker/tests/nullness/Issue408.java index b3229690a56c..0ab4ac83a495 100644 --- a/checker/tests/nullness/Issue408.java +++ b/checker/tests/nullness/Issue408.java @@ -19,7 +19,7 @@ static class Baz extends Bar { @Override String doIssue408(@UnderInitialization Baz this) { - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] return myString.toLowerCase(); } } diff --git a/checker/tests/nullness/Issue415.java b/checker/tests/nullness/Issue415.java index fc81578e2d7e..76f2ade6b1f6 100644 --- a/checker/tests/nullness/Issue415.java +++ b/checker/tests/nullness/Issue415.java @@ -12,9 +12,9 @@ public final class Issue415 { Map mymap = new HashMap<>(); - // :: error: (expression.unparsable) + // :: error: [expression.unparsable] public static void usesField(Set<@KeyFor("this.mymap") String> keySet) { - // :: error: (expression.unparsable) + // :: error: [expression.unparsable] new ArrayList<@KeyFor("this.mymap") String>(keySet); } diff --git a/checker/tests/nullness/Issue4853Nullness.java b/checker/tests/nullness/Issue4853Nullness.java index 2800a9b94116..1ec8603d9a32 100644 --- a/checker/tests/nullness/Issue4853Nullness.java +++ b/checker/tests/nullness/Issue4853Nullness.java @@ -9,7 +9,7 @@ class InnerMyClass implements Interface {} abstract static class SubMyClass extends MyClass<@Nullable String> { protected void f() { - // :: error: (argument) + // :: error: [argument] method(new InnerMyClass()); } diff --git a/checker/tests/nullness/Issue4923.java b/checker/tests/nullness/Issue4923.java index 81e0a02118f5..f8f327db947b 100644 --- a/checker/tests/nullness/Issue4923.java +++ b/checker/tests/nullness/Issue4923.java @@ -14,6 +14,6 @@ public void go() { final Object x = new Object(); // Make sure that initializer type is compatible with declared type - // :: error: (assignment) + // :: error: [assignment] final Object y = null; } diff --git a/checker/tests/nullness/Issue577.java b/checker/tests/nullness/Issue577.java index 27c7a22da446..3107bd1895c4 100644 --- a/checker/tests/nullness/Issue577.java +++ b/checker/tests/nullness/Issue577.java @@ -10,7 +10,7 @@ void fooOuter(int[] array) {} class InnerBanana extends InnerApple { @Override - // :: error: (override.param) + // :: error: [override.param] void foo(int[] array, long[] array2, F2 param3) {} } } @@ -29,7 +29,7 @@ void fooOuter(E array) {} class InnerPineapple extends InnerApple<@Nullable String> { @Override - // :: error: (override.param) + // :: error: [override.param] void foo(E array, String array2, F3 param3) {} } } diff --git a/checker/tests/nullness/Issue579Error.java b/checker/tests/nullness/Issue579Error.java index d54efa36c6b1..19a57b513601 100644 --- a/checker/tests/nullness/Issue579Error.java +++ b/checker/tests/nullness/Issue579Error.java @@ -6,7 +6,7 @@ public class Issue579Error { public void foo(Generic real, Generic other, boolean flag) { - // :: error: (type.arguments.not.inferred) + // :: error: [type.arguments.not.inferred] bar(flag ? real : other); } diff --git a/checker/tests/nullness/Issue602.java b/checker/tests/nullness/Issue602.java index 5c9dcde00f37..42f90c2d67fa 100644 --- a/checker/tests/nullness/Issue602.java +++ b/checker/tests/nullness/Issue602.java @@ -13,9 +13,9 @@ void loop(boolean condition) { @NonNull String notNull = "hello"; String nullable = ""; while (condition) { - // :: error: (assignment) + // :: error: [assignment] notNull = nullable; - // :: error: (assignment) + // :: error: [assignment] notNull = id(nullable); nullable = null; } diff --git a/checker/tests/nullness/Issue6393.java b/checker/tests/nullness/Issue6393.java index 77bd93f343bd..eff14875c5cd 100644 --- a/checker/tests/nullness/Issue6393.java +++ b/checker/tests/nullness/Issue6393.java @@ -20,7 +20,7 @@ static T f(Class x, GClass y) { } catch (IOException e) { throw new IllegalStateException(e); } - // :: warning: (cast.unsafe) + // :: warning: [cast.unsafe] return (T) z; } } diff --git a/checker/tests/nullness/Issue67.java b/checker/tests/nullness/Issue67.java index 804137c743a1..311040038bb0 100644 --- a/checker/tests/nullness/Issue67.java +++ b/checker/tests/nullness/Issue67.java @@ -13,7 +13,7 @@ void test() { if (map.containsKey(KEY)) { map.get(KEY).toString(); // no problem } - // :: warning: (nulltest.redundant) + // :: warning: [nulltest.redundant] if (map.containsKey(KEY2) && map.get(KEY2).toString() != null) { // error // do nothing } diff --git a/checker/tests/nullness/Issue6750.java b/checker/tests/nullness/Issue6750.java index 0bfa8395b610..eb07b5ed9eeb 100644 --- a/checker/tests/nullness/Issue6750.java +++ b/checker/tests/nullness/Issue6750.java @@ -23,9 +23,9 @@ Map getMap(Function s) { } void use() { - // :: error: (argument) + // :: error: [argument] needKeyFor("", getMap(String::toString)); - // :: error: (expression.unparsable) :: error: (assignment) + // :: error: [expression.unparsable] :: error: [assignment] @KeyFor("getMap(String::toString)") String s = returnKeyFor(new HashMap<>(getMap(String::toString))); } @@ -33,7 +33,7 @@ void method(List externals) { externals.stream().collect(Collectors.groupingBy(Issue6750::type)).entrySet().stream() .forEach( values -> { - // :: error: (assignment) + // :: error: [assignment] @KeyFor({}) String b = values.getKey(); }); } diff --git a/checker/tests/nullness/Issue6804.java b/checker/tests/nullness/Issue6804.java index 17e117556336..93267c8c98ee 100644 --- a/checker/tests/nullness/Issue6804.java +++ b/checker/tests/nullness/Issue6804.java @@ -7,12 +7,12 @@ interface Func { } void method1(Func<@Nullable Integer> y, String[] array) { - // :: error: (unboxing.of.nullable) + // :: error: [unboxing.of.nullable] String x = array[y.get()]; } void method2(String[] array, @Nullable Integer i) { - // :: error: (unboxing.of.nullable) + // :: error: [unboxing.of.nullable] String z = array[i]; } @@ -20,9 +20,9 @@ void method2(String[] array, @Nullable Integer i) { void method3(@Nullable Integer i, @Nullable Integer j) { String[][][] array = new String[0][0] - // :: error: (unboxing.of.nullable) + // :: error: [unboxing.of.nullable] [i]; - // :: error: (unboxing.of.nullable) + // :: error: [unboxing.of.nullable] String[] array2 = new String[j]; } } diff --git a/checker/tests/nullness/Issue7229.java b/checker/tests/nullness/Issue7229.java index 3ce526fdd1d9..dd6ec329d37e 100644 --- a/checker/tests/nullness/Issue7229.java +++ b/checker/tests/nullness/Issue7229.java @@ -2,7 +2,7 @@ public class Issue7229 { void f(@Nullable Integer[] array) { - // :: error: (unboxing.of.nullable) + // :: error: [unboxing.of.nullable] int x = array[0]; } } diff --git a/checker/tests/nullness/Issue7341.java b/checker/tests/nullness/Issue7341.java index 1285d847b175..f2e452dfbf7b 100644 --- a/checker/tests/nullness/Issue7341.java +++ b/checker/tests/nullness/Issue7341.java @@ -2,7 +2,7 @@ public class Issue7341 { public static void main(String[] args) { Object[] x = new Object[] {"a"}; Integer index = null; - // :: error: (unboxing.of.nullable) + // :: error: [unboxing.of.nullable] if (x[index] instanceof String) {} } } diff --git a/checker/tests/nullness/Issue738.java b/checker/tests/nullness/Issue738.java index 42eec0c63ac6..42b87115ecc2 100644 --- a/checker/tests/nullness/Issue738.java +++ b/checker/tests/nullness/Issue738.java @@ -15,15 +15,15 @@ void methodA(int[] is, Object @Nullable [] os, int i) { methodB(is, os); break; case 2: - // :: error: (argument) + // :: error: [argument] methodB2(is, os); break; case 3: - // :: error: (type.arguments.not.inferred) + // :: error: [type.arguments.not.inferred] methodB3(is, os); break; case 4: - // :: error: (type.arguments.not.inferred) + // :: error: [type.arguments.not.inferred] methodB4(is, os); break; } diff --git a/checker/tests/nullness/Issue752.java b/checker/tests/nullness/Issue752.java index 6ad259e75b53..627625a662ee 100644 --- a/checker/tests/nullness/Issue752.java +++ b/checker/tests/nullness/Issue752.java @@ -17,7 +17,7 @@ static Issue752 staticMethod() { // A package name without a class name is not a valid JavaExpression string. @RequiresNonNull("java.lang") - // :: error: (flowexpr.parse.error) + // :: error: [flowexpr.parse.error] void method1() {} @RequiresNonNull("java.lang.String.class") @@ -25,12 +25,12 @@ void method2() {} // A package name without a class name is not a valid JavaExpression string. @RequiresNonNull("a.b.c") - // :: error: (flowexpr.parse.error) + // :: error: [flowexpr.parse.error] void method3() {} // notaclass does not exist. @RequiresNonNull("a.b.c.notaclass") - // :: error: (flowexpr.parse.error) + // :: error: [flowexpr.parse.error] void method4() {} @RequiresNonNull("a.b.c.Issue752.class") @@ -44,12 +44,12 @@ void method7() {} // field is an instance field, and Issue752 is a class. @RequiresNonNull("a.b.c.Issue752.field") - // :: error: (flowexpr.parse.error) + // :: error: [flowexpr.parse.error] void method8() {} // field is an instance field, and Issue752 is a class. @RequiresNonNull("a.b.c.Issue752.field.field") - // :: error: (flowexpr.parse.error) + // :: error: [flowexpr.parse.error] void method9() {} @RequiresNonNull("a.b.c.Issue752.staticMethod()") @@ -60,11 +60,11 @@ void method11() {} // method() is an instance method, and Issue752 is a class. @RequiresNonNull("a.b.c.Issue752.method()") - // :: error: (flowexpr.parse.error) + // :: error: [flowexpr.parse.error] void method12() {} // method() is an instance method, and Issue752 is a class. @RequiresNonNull("a.b.c.Issue752.method().field") - // :: error: (flowexpr.parse.error) + // :: error: [flowexpr.parse.error] void method13() {} } diff --git a/checker/tests/nullness/Issue759.java b/checker/tests/nullness/Issue759.java index 65f405cc876a..66eadd4a73fa 100644 --- a/checker/tests/nullness/Issue759.java +++ b/checker/tests/nullness/Issue759.java @@ -35,7 +35,7 @@ void lowercase(final S items) {} void possibleValues2(final Gen genType) { lowercase2(genType.getConstants()); - // :: error: (type.arguments.not.inferred) + // :: error: [type.arguments.not.inferred] lowercase2(genType.getNullableConstants()); } @@ -43,7 +43,7 @@ void lowercase2(final S items) {} void possibleValues3(final Gen genType) { lowercase3(genType.getConstants()); - // :: error: (argument) + // :: error: [argument] lowercase3(genType.getNullableConstants()); } diff --git a/checker/tests/nullness/Issue764.java b/checker/tests/nullness/Issue764.java index ee5b0a79b0a2..a84dd6310a04 100644 --- a/checker/tests/nullness/Issue764.java +++ b/checker/tests/nullness/Issue764.java @@ -16,7 +16,7 @@ public void otherMethod() { } public void otherMethod2() { - // :: error: (contracts.precondition) + // :: error: [contracts.precondition] method(); } } diff --git a/checker/tests/nullness/Issue829.java b/checker/tests/nullness/Issue829.java index f7ded5a3cad0..e0789f5d1fc4 100644 --- a/checker/tests/nullness/Issue829.java +++ b/checker/tests/nullness/Issue829.java @@ -9,7 +9,7 @@ public class Issue829 { } public static Double getDoubleError(boolean flag) { - // :: error: (return) + // :: error: [return] return flag ? null : 1.0; } } diff --git a/checker/tests/nullness/Issue868.java b/checker/tests/nullness/Issue868.java index 72258ed97a87..fe1615f38e54 100644 --- a/checker/tests/nullness/Issue868.java +++ b/checker/tests/nullness/Issue868.java @@ -8,17 +8,17 @@ public class Issue868 { interface MyList {} void test1(E e) { - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] e.toString(); } void test2(E e) { - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] e.toString(); } void test3(E e) { - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] e.toString(); } @@ -26,14 +26,14 @@ void test4(E e) { e.toString(); } - // :: warning: (explicit.annotation.ignored) + // :: warning: [explicit.annotation.ignored] void test5(E e) { e.toString(); } - // :: warning: (explicit.annotation.ignored) + // :: warning: [explicit.annotation.ignored] void test6(E e) { - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] e.toString(); } @@ -41,19 +41,19 @@ void use() { this.<@Nullable MyList>test1(null); this.<@Nullable MyList>test2(null); this.<@Nullable MyList>test3(null); - // :: error: (type.argument) + // :: error: [type.argument] this.<@Nullable MyList>test4(null); - // :: error: (type.argument) + // :: error: [type.argument] this.<@Nullable MyList>test5(null); this.<@Nullable MyList>test6(null); } void use2(T t, @NonNull T nonNullT) { this.test1(t); - // :: error: (argument) + // :: error: [argument] this.<@NonNull T>test3(t); this.<@NonNull T>test3(nonNullT); - // :: error: (type.argument) + // :: error: [type.argument] this.test5(t); } } diff --git a/checker/tests/nullness/Issue906.java b/checker/tests/nullness/Issue906.java index d55ad0777143..3886d0058a4f 100644 --- a/checker/tests/nullness/Issue906.java +++ b/checker/tests/nullness/Issue906.java @@ -6,7 +6,7 @@ public class Issue906 { @SuppressWarnings("unchecked") public void start(A a, Class cb) { - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] Class c = (Class) a.getClass(); x(a, c); } diff --git a/checker/tests/nullness/Issue986.java b/checker/tests/nullness/Issue986.java index da9e793ec193..bea0eb1f33d1 100644 --- a/checker/tests/nullness/Issue986.java +++ b/checker/tests/nullness/Issue986.java @@ -17,7 +17,7 @@ void testArr4(@NonNull Object @NonNull [] nno1, @MonotonicNonNull Object @NonNul nno2 = nno1; lnno2 = lnno1; lnno2 = nno1; - // :: error: (assignment) + // :: error: [assignment] nno2 = lnno1; lnno2 = NullnessUtil.castNonNullDeep(nno1); nno2 = NullnessUtil.castNonNullDeep(lnno1); diff --git a/checker/tests/nullness/IteratorEarlyExit.java b/checker/tests/nullness/IteratorEarlyExit.java index 44b30e597242..43cf515facfe 100644 --- a/checker/tests/nullness/IteratorEarlyExit.java +++ b/checker/tests/nullness/IteratorEarlyExit.java @@ -11,7 +11,7 @@ public static void m1() { local = str; break; } - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] System.out.println(local.length()); } @@ -21,7 +21,7 @@ public static void m2() { for (String str : array) { local = str; } - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] System.out.println(local.length()); } @@ -29,7 +29,7 @@ public static void m3() { List array = new ArrayList<>(); Object local = new Object(); for (String str : array) { - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] System.out.println(local.toString()); // The next iteration might throw a NPE local = null; diff --git a/checker/tests/nullness/JavaCopExplosion.java b/checker/tests/nullness/JavaCopExplosion.java index 510ee3eee6b9..b4df83592a31 100644 --- a/checker/tests/nullness/JavaCopExplosion.java +++ b/checker/tests/nullness/JavaCopExplosion.java @@ -23,24 +23,24 @@ static void main(String @NonNull [] args) { @NonNull String s = "Dan"; String s2; s2 = null; - // :: warning: (nulltest.redundant) + // :: warning: [nulltest.redundant] if (s2 != null || s != null) { - // :: error: (assignment) + // :: error: [assignment] s = s2; } else { s = new String("Levitan"); } s2 = args[0]; - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] System.out.println("Possibly cause null pointer with this: " + s2.length()); - // :: warning: (nulltest.redundant) + // :: warning: [nulltest.redundant] if (s2 == null) { // do nothing } else { System.out.println("Can't cause null pointer here: " + s2.length()); s = s2; } - // :: warning: (nulltest.redundant) + // :: warning: [nulltest.redundant] if (s == null ? s2 != null : s2 != null) { s = s2; } @@ -74,13 +74,13 @@ public static int foo() { // y = z; nnz = z; z = null; - // :: error: (assignment) + // :: error: [assignment] nnz = z; while (z == null) { break; } - // :: error: (assignment) + // :: error: [assignment] nnz = z; while (z == null) { // do nothing @@ -106,7 +106,7 @@ public static int foo() { private void bar(List<@NonNull String> ss, String b, String c) { @NonNull String a; - // :: error: (iterating.over.nullable) + // :: error: [iterating.over.nullable] for (@NonNull String s : ss) { a = s; } @@ -114,7 +114,7 @@ private void bar(List<@NonNull String> ss, String b, String c) { System.out.println("hey"); } if (b != null) { - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] for (; b.length() > 0; b = null) { System.out.println(b.length()); } diff --git a/checker/tests/nullness/JavaCopFlow.java b/checker/tests/nullness/JavaCopFlow.java index 9c7c8605e60d..8b06f3f7314d 100644 --- a/checker/tests/nullness/JavaCopFlow.java +++ b/checker/tests/nullness/JavaCopFlow.java @@ -12,7 +12,7 @@ public void testIf(String str) { } str = null; - // :: error: (assignment) + // :: error: [assignment] @NonNull String b = str; } @@ -25,7 +25,7 @@ public void testIfNoBlock(String str) { } str = null; - // :: error: (assignment) + // :: error: [assignment] @NonNull String b = str; } @@ -40,7 +40,7 @@ public void testElse(String str) { } str = null; - // :: error: (assignment) + // :: error: [assignment] @NonNull String b = str; } @@ -55,7 +55,7 @@ public void testElseNoBlock(String str) { } str = null; - // :: error: (assignment) + // :: error: [assignment] @NonNull String b = str; } @@ -70,7 +70,7 @@ public void testReturnIf(String str) { @NonNull String a = str; str = null; - // :: error: (assignment) + // :: error: [assignment] @NonNull String b = str; } @@ -86,7 +86,7 @@ public void testReturnElse(String str) { @NonNull String a = str; str = null; - // :: error: (assignment) + // :: error: [assignment] @NonNull String b = str; } @@ -101,7 +101,7 @@ public void testThrowIf(String str) { @NonNull String a = str; str = null; - // :: error: (assignment) + // :: error: [assignment] @NonNull String b = str; } @@ -117,7 +117,7 @@ public void testThrowElse(String str) { @NonNull String a = str; str = null; - // :: error: (assignment) + // :: error: [assignment] @NonNull String b = str; } @@ -128,7 +128,7 @@ public void testAssert(@Nullable String str) { @NonNull String a = str; str = null; - // :: error: (assignment) + // :: error: [assignment] @NonNull String b = str; } @@ -141,7 +141,7 @@ public void testWhile(String str) { } str = null; - // :: error: (assignment) + // :: error: [assignment] @NonNull String b = str; } @@ -154,7 +154,7 @@ public void testIfInstanceOf(String str) { } str = null; - // :: error: (assignment) + // :: error: [assignment] @NonNull String b = str; } @@ -164,7 +164,7 @@ public void testNew() { @NonNull String a = str; str = null; - // :: error: (assignment) + // :: error: [assignment] @NonNull String b = str; } @@ -191,7 +191,7 @@ public void retestWhile(@Nullable String str) { int i = 0; while (true) { - // :: error: (assignment) + // :: error: [assignment] @NonNull String a = str; str = null; i++; @@ -201,17 +201,17 @@ public void retestWhile(@Nullable String str) { str = null; @NonNull String b = "hi"; try { - // :: error: (assignment) + // :: error: [assignment] b = str; methodThatThrowsRuntime(); str = "bar"; } finally { - // :: error: (assignment) + // :: error: [assignment] b = str; } str = null; - // :: error: (assignment) + // :: error: [assignment] b = str; str = "hi"; diff --git a/checker/tests/nullness/JavaExpressionParsingBug.java b/checker/tests/nullness/JavaExpressionParsingBug.java index 459c3d67081d..6ef59c56f011 100644 --- a/checker/tests/nullness/JavaExpressionParsingBug.java +++ b/checker/tests/nullness/JavaExpressionParsingBug.java @@ -28,63 +28,63 @@ public void b() {} public void c() {} void test1() { - // :: error: (contracts.precondition) + // :: error: [contracts.precondition] a(); JavaExpressionParsingBug.i = ""; a(); } void test1b() { - // :: error: (contracts.precondition) + // :: error: [contracts.precondition] a(); i = ""; a(); } void test1c() { - // :: error: (contracts.precondition) + // :: error: [contracts.precondition] a(); this.i = ""; a(); } void test2() { - // :: error: (contracts.precondition) + // :: error: [contracts.precondition] b(); JavaExpressionParsingBug.i = ""; b(); } void test2b() { - // :: error: (contracts.precondition) + // :: error: [contracts.precondition] b(); i = ""; b(); } void test2c() { - // :: error: (contracts.precondition) + // :: error: [contracts.precondition] b(); this.i = ""; b(); } void test3() { - // :: error: (contracts.precondition) + // :: error: [contracts.precondition] c(); JavaExpressionParsingBug.i = ""; c(); } void test3b() { - // :: error: (contracts.precondition) + // :: error: [contracts.precondition] c(); i = ""; c(); } void test3c() { - // :: error: (contracts.precondition) + // :: error: [contracts.precondition] c(); this.i = ""; c(); diff --git a/checker/tests/nullness/KeyForChecked.java b/checker/tests/nullness/KeyForChecked.java index 9bc2dbac30e8..e26c560b53bd 100644 --- a/checker/tests/nullness/KeyForChecked.java +++ b/checker/tests/nullness/KeyForChecked.java @@ -74,7 +74,7 @@ class KFIterator<@KeyForBottom E extends @Nullable Object> {} void incorrect1(Object map) { String nonkey = ""; - // :: error: (assignment) + // :: error: [assignment] @KeyFor("map") String key = nonkey; } @@ -126,7 +126,7 @@ void iter() { for (@KeyFor("emap") String st : s) {} for (String st : s) {} Object bubu = new Object(); - // :: error: (enhancedfor) + // :: error: [enhancedfor] for (@KeyFor("bubu") String st : s) {} } @@ -143,7 +143,7 @@ void entrySet() { // KeyFor has to be explicit on the component to Entry sets because // a) it's not clear which map the Entry set may have come from // b) and there is no guarantee the map is still accessible - // :: error: (assignment) + // :: error: [assignment] Set> es2 = emap.entrySet(); } diff --git a/checker/tests/nullness/KeyForFlow.java b/checker/tests/nullness/KeyForFlow.java index d5d824cdd138..152f902133f9 100644 --- a/checker/tests/nullness/KeyForFlow.java +++ b/checker/tests/nullness/KeyForFlow.java @@ -15,7 +15,7 @@ void testContainsKeyForLocalKeyAndLocalMap() { @KeyFor("m_local") Object s = k_local; } - // :: error: (assignment) + // :: error: [assignment] @KeyFor("m_local") String s2 = k_local; } @@ -26,7 +26,7 @@ void testContainsKeyForLocalKeyAndFieldMap() { @KeyFor("m") Object s = k_local; } - // :: error: (assignment) + // :: error: [assignment] @KeyFor("m") String s2 = k_local; } @@ -37,7 +37,7 @@ void testContainsKeyForFieldKeyAndLocalMap() { @KeyFor("m_local") Object s = k; } - // :: error: (assignment) + // :: error: [assignment] @KeyFor("m_local") String s2 = k; } @@ -46,7 +46,7 @@ void testContainsKeyForFieldKeyAndFieldMap() { @KeyFor("m") Object s = k; } - // :: error: (assignment) + // :: error: [assignment] @KeyFor("m") String s2 = k; } @@ -57,7 +57,7 @@ void testContainsKeyForStaticKeyAndFieldMap() { @KeyFor("m") Object s = k_s; } - // :: error: (assignment) + // :: error: [assignment] @KeyFor("m") String s2 = k_s; } @@ -69,7 +69,7 @@ void testContainsKeyForFieldKeyAndStaticMap() { @KeyFor("m_s") Object s = k; } - // :: error: (assignment) + // :: error: [assignment] @KeyFor("m_s") String s2 = k; } @@ -78,7 +78,7 @@ void testContainsKeyForFieldKeyAndReceiverMap() { @KeyFor("this") Object s = k; } - // :: error: (assignment) + // :: error: [assignment] @KeyFor("this") String s2 = k; } @@ -90,7 +90,7 @@ void testContainsKeyForFieldKeyAndReceiverMap() { String k2 = "key2"; void testCallingPutAfterAdd() { - // :: error: (argument) + // :: error: [argument] coll.add(k2); m2.put(k2, new Object()); } @@ -147,7 +147,7 @@ void testContainsKeyForFieldKeyAndMapFieldOfOtherClass() { @KeyFor("f.m") Object s = k; } - // :: error: (assignment) + // :: error: [assignment] @KeyFor("f.m") String s2 = k; } diff --git a/checker/tests/nullness/KeyForLocalVariable.java b/checker/tests/nullness/KeyForLocalVariable.java index da164e68c1c2..461a4fe42963 100644 --- a/checker/tests/nullness/KeyForLocalVariable.java +++ b/checker/tests/nullness/KeyForLocalVariable.java @@ -8,24 +8,24 @@ public class KeyForLocalVariable { public static void localVariableShadowing() { - // :: error: (expression.unparsable) + // :: error: [expression.unparsable] @KeyFor("m0") String kk; { Map m0 = new HashMap<>(); @SuppressWarnings("keyfor") @KeyFor("m0") String k = "key"; - // :: error: (assignment) + // :: error: [assignment] kk = k; } { Map m0 = new HashMap<>(); - // :: error: (assignment) + // :: error: [assignment] @KeyFor("m0") String k2 = kk; } } public static void invalidLocalVariable() { - // :: error: (expression.unparsable) + // :: error: [expression.unparsable] @KeyFor("foobar") String kk; } } diff --git a/checker/tests/nullness/KeyForLub.java b/checker/tests/nullness/KeyForLub.java index ef0e343d1e13..aaf387545d5d 100644 --- a/checker/tests/nullness/KeyForLub.java +++ b/checker/tests/nullness/KeyForLub.java @@ -19,23 +19,23 @@ void method( @UnknownKeyFor String unknown) { @KeyFor("map1") String key1 = flag ? key12 : key13; - // :: error: (assignment) + // :: error: [assignment] @KeyFor({"map1", "map2"}) String key2 = flag ? key12 : key13; - // :: error: (assignment) + // :: error: [assignment] @KeyFor({"map1", "map2"}) String key3 = flag ? key12 : unknown; } @PolyKeyFor String poly1(@KeyFor("map1") String key1, @PolyKeyFor String poly) { - // :: error: (return) + // :: error: [return] return flag ? key1 : poly; } void poly2(@PolyKeyFor String poly, @UnknownKeyFor String unknown, @KeyForBottom String bot) { - // :: error: (assignment) + // :: error: [assignment] @PolyKeyFor String s1 = flag ? poly : unknown; @PolyKeyFor String s2 = flag ? poly : bot; - // :: error: (assignment) + // :: error: [assignment] @KeyForBottom String s3 = flag ? poly : bot; } } diff --git a/checker/tests/nullness/KeyForMultiple.java b/checker/tests/nullness/KeyForMultiple.java index 1f0033f18169..6d20e2f91155 100644 --- a/checker/tests/nullness/KeyForMultiple.java +++ b/checker/tests/nullness/KeyForMultiple.java @@ -12,7 +12,7 @@ void m1() { Map<@KeyFor({"sharedBooks"}) String, Integer> sharedBooks = new HashMap<>(); Map<@KeyFor({"sharedBooks"}) String, Integer> sharedCounts1 = new HashMap<>(); - // :: error: (assignment) + // :: error: [assignment] Set<@KeyFor({"sharedCounts1"}) String> sharedCountsKeys1 = sharedCounts1.keySet(); } @@ -29,7 +29,7 @@ void m3() { Map<@KeyFor({"sharedBooks"}) String, Integer> sharedBooks = new HashMap<>(); Map<@KeyFor({"sharedBooks", "sharedCounts2"}) String, Integer> sharedCounts2 = new HashMap<>(); - // :: error: (assignment) + // :: error: [assignment] Set<@KeyFor({"sharedCounts2"}) String> sharedCountsKeys2 = sharedCounts2.keySet(); } diff --git a/checker/tests/nullness/KeyForPostcondition.java b/checker/tests/nullness/KeyForPostcondition.java index 8bd2dac99b07..101572d40260 100644 --- a/checker/tests/nullness/KeyForPostcondition.java +++ b/checker/tests/nullness/KeyForPostcondition.java @@ -18,7 +18,7 @@ public void putKey(String x) { } public void usePutKey(String x) { - // :: error: (assignment) + // :: error: [assignment] @KeyFor("m") String a = x; putKey(x); @KeyFor("m") String b = x; @@ -35,13 +35,13 @@ public boolean tryPutKey(String x) { } public void useTryPutKey(String x) { - // :: error: (assignment) + // :: error: [assignment] @KeyFor("m") String a = x; if (tryPutKey(x)) { @KeyFor("m") String b = x; } - // :: error: (assignment) + // :: error: [assignment] @KeyFor("m") String c = x; } } diff --git a/checker/tests/nullness/KeyForShadowing.java b/checker/tests/nullness/KeyForShadowing.java index 6ca4c8bda09c..d1757fb28577 100644 --- a/checker/tests/nullness/KeyForShadowing.java +++ b/checker/tests/nullness/KeyForShadowing.java @@ -15,17 +15,17 @@ public static void main(String... p) { // We expect an error for the next one since we are not respecting the method contract. It // expects the key to be for the second parameter, not the first. - // :: error: (argument) + // :: error: [argument] getMap3(m0, m1, k).toString(); // We expect an error for the next one since although we are respecting the method contract, // since the key is for the first parameter, the Nullness Checker is misinterpreting "m1" to // be the local m1 to this method, and not the first parameter to the method. - // :: error: (argument) + // :: error: [argument] getMap2(m0, m1, k).toString(); - // :: error: (argument) + // :: error: [argument] getMap1(m0, m1, k).toString(); getMap4(m0, m1, k).toString(); @@ -34,21 +34,21 @@ public static void main(String... p) { public static @NonNull Integer getMap1( Map m1, // m1,m0 flipped Map m0, - // :: error: (expression.unparsable) + // :: error: [expression.unparsable] @KeyFor("m0") String k) { - // :: error: (return) + // :: error: [return] return m0.get(k); } public static @NonNull Integer getMap2( Map m1, // m1,m0 flipped Map m0, - // :: error: (expression.unparsable) + // :: error: [expression.unparsable] @KeyFor("m1") String k) { // This method body is incorrect. // We expect this error because we are indicating that // the key is for m1, so m0.get(k) is @Nullable. - // :: error: (return) + // :: error: [return] return m0.get(k); } @@ -66,7 +66,7 @@ public static void main(String... p) { // This method body is incorrect. // We expect this error because we are indicating that // the key is for m1, so m0.get(k) is @Nullable. - // :: error: (return) + // :: error: [return] return m0.get(k); } } diff --git a/checker/tests/nullness/KeyForSubtyping.java b/checker/tests/nullness/KeyForSubtyping.java index c53df018648e..46a8edec752a 100644 --- a/checker/tests/nullness/KeyForSubtyping.java +++ b/checker/tests/nullness/KeyForSubtyping.java @@ -15,17 +15,17 @@ public void testSubtypeAssignments( // variables such that a line of code can have an effect on a subsequent line of code. We // want each of these tests to be independent. - // :: error: (assignment) + // :: error: [assignment] ab = a; - // :: error: (assignment) + // :: error: [assignment] ab = b; - // :: error: (assignment) + // :: error: [assignment] a = b; - // :: error: (assignment) + // :: error: [assignment] a = not_a_key; - // :: error: (assignment) + // :: error: [assignment] b = not_a_key; - // :: error: (assignment) + // :: error: [assignment] ab = not_a_key; // Now try the success cases @@ -44,13 +44,13 @@ public void testDataFlow( // Test that when a valid assignment is made, dataflow transfers the // KeyFor type qualifier from the right-hand side to the left-hand side. - // :: error: (argument) + // :: error: [argument] method1(not_yet_a_key); not_yet_a_key = a; method1(not_yet_a_key); method1(a); - // :: error: (argument) + // :: error: [argument] method1(b); method1(ab); @@ -66,7 +66,7 @@ public void testSetOrdering( // Try the error case first - see the note in method testSubtypeAssignments - // :: error: (assignment) + // :: error: [assignment] abc = ac; ac = abc; @@ -97,11 +97,11 @@ private void testWithNullnessAnnotation( @Nullable @KeyFor({"this.mapA", "this.mapB"}) String ab) { // These fail only because a @Nullable RHS cannot be assigned to a @NonNull LHS. - // :: error: (assignment) + // :: error: [assignment] a = ab; - // :: error: (assignment) + // :: error: [assignment] b = ab; - // :: error: (assignment) + // :: error: [assignment] not_a_key = ab; not_a_key = a; // Succeeds because both sides are @NonNull @@ -123,7 +123,7 @@ static class Sub extends Super { void method1(@KeyFor("this.map1") String s) {} @Override - // :: error: (override.param) + // :: error: [override.param] void method2(@KeyFor({"this.map1", "this.map2"}) String s) {} } } diff --git a/checker/tests/nullness/KeyForValidation.java b/checker/tests/nullness/KeyForValidation.java index 562209908eb0..ed4802424c5e 100644 --- a/checker/tests/nullness/KeyForValidation.java +++ b/checker/tests/nullness/KeyForValidation.java @@ -6,17 +6,17 @@ public class KeyForValidation { - // :: error: (expression.unparsable) - // :: error: (initialization.static.field.uninitialized) + // :: error: [expression.unparsable] + // :: error: [initialization.static.field.uninitialized] static @KeyFor("this") Object f; - // :: error: (initialization.field.uninitialized) + // :: error: [initialization.field.uninitialized] @KeyFor("this") Object g; - // :: error: (expression.unparsable) + // :: error: [expression.unparsable] void m(@KeyFor("#0") Object p) {} - // :: error: (expression.unparsable) + // :: error: [expression.unparsable] void m2(@KeyFor("#4") Object p) {} // OK @@ -28,15 +28,15 @@ void m4(@KeyFor("#1") Object p, Map m) {} // TODO: index with wrong type void m4(@KeyFor("#2") String p, Map m) {} - // :: error: (expression.unparsable) - // :: error: (initialization.field.uninitialized) + // :: error: [expression.unparsable] + // :: error: [initialization.field.uninitialized] @KeyFor("INVALID") Object h; - // :: error: (initialization.field.uninitialized) + // :: error: [initialization.field.uninitialized] @KeyFor("f") Object i; void foo(Object p) { - // :: error: (expression.unparsable) + // :: error: [expression.unparsable] @KeyFor("ALSOBAD") Object j; @KeyFor("j") Object k; @@ -45,49 +45,49 @@ void foo(Object p) { @KeyFor("p") Object o; } - // :: error: (expression.unparsable) + // :: error: [expression.unparsable] void foo2(@KeyFor("ALSOBAD") Object o) {} - // :: error: (expression.unparsable) + // :: error: [expression.unparsable] void foo3(@KeyFor("ALSOBAD") Object[] o) {} - // :: error: (expression.unparsable) + // :: error: [expression.unparsable] void foo4(Map<@KeyFor("ALSOBAD") Object, Object> o) {} - // :: error: (expression.unparsable) + // :: error: [expression.unparsable] @KeyFor("ALSOBAD") Object[] foo5() { throw new RuntimeException(); } - // :: error: (expression.unparsable) + // :: error: [expression.unparsable] @KeyFor("ALSOBAD") Object foo6() { throw new RuntimeException(); } - // :: error: (expression.unparsable) + // :: error: [expression.unparsable] Map<@KeyFor("ALSOBAD") Object, Object> foo7() { throw new RuntimeException(); } - // :: error: (expression.unparsable) + // :: error: [expression.unparsable] <@KeyFor("ALSOBAD") T> void foo8() { throw new RuntimeException(); } - // :: error: (expression.unparsable) + // :: error: [expression.unparsable] <@KeyForBottom T extends @KeyFor("ALSOBAD") Object> void foo9() {} - // :: error: (expression.unparsable) + // :: error: [expression.unparsable] void foo10(@KeyFor("ALSOBAD") KeyForValidation this) {} - // :: error: (expression.unparsable) + // :: error: [expression.unparsable] public void test(Set<@KeyFor("BAD") String> keySet) { - // :: error: (expression.unparsable) + // :: error: [expression.unparsable] new ArrayList<@KeyFor("BAD") String>(keySet); - // :: error: (expression.unparsable) + // :: error: [expression.unparsable] List<@KeyFor("BAD") String> list = new ArrayList<>(); - // :: error: (expression.unparsable) + // :: error: [expression.unparsable] for (@KeyFor("BAD") String s : list) {} } @@ -95,47 +95,47 @@ public void test(Set<@KeyFor("BAD") String> keySet) { Object instanceField = new Object(); - // :: error: (expression.unparsable) + // :: error: [expression.unparsable] static void bar2(@KeyFor("this.instanceField") Object o) {} - // :: error: (expression.unparsable) + // :: error: [expression.unparsable] static void bar3(@KeyFor("this.instanceField") Object[] o) {} - // :: error: (expression.unparsable) + // :: error: [expression.unparsable] static void bar4(Map<@KeyFor("this.instanceField") Object, Object> o) {} - // :: error: (expression.unparsable) + // :: error: [expression.unparsable] static @KeyFor("this.instanceField") Object[] bar5() { throw new RuntimeException(); } - // :: error: (expression.unparsable) + // :: error: [expression.unparsable] static @KeyFor("this.instanceField") Object bar6() { throw new RuntimeException(); } - // :: error: (expression.unparsable) + // :: error: [expression.unparsable] static Map<@KeyFor("this.instanceField") Object, Object> bar7() { throw new RuntimeException(); } - // :: error: (expression.unparsable) + // :: error: [expression.unparsable] static <@KeyFor("this.instanceField") T> void bar8() { throw new RuntimeException(); } - // :: error: (expression.unparsable) + // :: error: [expression.unparsable] static <@KeyForBottom T extends @KeyFor("this.instanceField") Object> void bar9() {} - // :: error: (expression.unparsable) + // :: error: [expression.unparsable] public static void test2(Set<@KeyFor("this.instanceField") String> keySet) { - // :: error: (expression.unparsable) + // :: error: [expression.unparsable] new ArrayList<@KeyFor("this.instanceField") String>(keySet); - // :: error: (expression.unparsable) + // :: error: [expression.unparsable] new ArrayList<@KeyFor("this.instanceField") String>(); List list = new ArrayList<>(); - // :: error: (enhancedfor) :: error: (expression.unparsable) + // :: error: [enhancedfor] :: error: [expression.unparsable] for (@KeyFor("this.instanceField") String s : list) {} } } diff --git a/checker/tests/nullness/KeyFors.java b/checker/tests/nullness/KeyFors.java index c0761ec98131..a512b8129d3b 100644 --- a/checker/tests/nullness/KeyFors.java +++ b/checker/tests/nullness/KeyFors.java @@ -14,7 +14,7 @@ public void withoutKeyFor() { Map map = new HashMap<>(); String key = "key"; - // :: error: (assignment) + // :: error: [assignment] @NonNull String value = map.get(key); } @@ -69,12 +69,12 @@ static class Otherclass { public void testStaticKeyFor(@KeyFor("Otherclass.map") String s1, String s2) { Otherclass.map.get(s1).toString(); - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] Otherclass.map.get(s2).toString(); Otherclass o = new Otherclass(); o.map.get(s1).toString(); - // TODO:: error: (dereference.of.nullable) + // TODO:: error: [dereference.of.nullable] o.map.get(s2).toString(); } diff --git a/checker/tests/nullness/Lazy.java b/checker/tests/nullness/Lazy.java index 27483da94460..412a172e339d 100644 --- a/checker/tests/nullness/Lazy.java +++ b/checker/tests/nullness/Lazy.java @@ -32,26 +32,26 @@ void _test() { void test2() {} void test3() { - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] g.toLowerCase(); } void test4() { - // :: error: (assignment) + // :: error: [assignment] g = null; - // :: error: (monotonic) + // :: error: [monotonic] g = g2; } void _test3() { - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] _g.toLowerCase(); } void _test4() { - // :: error: (assignment) + // :: error: [assignment] _g = null; - // :: error: (monotonic) + // :: error: [monotonic] _g = _g2; } } diff --git a/checker/tests/nullness/LazyInitialization.java b/checker/tests/nullness/LazyInitialization.java index 74b684c1fc7d..bd4b991f88ed 100644 --- a/checker/tests/nullness/LazyInitialization.java +++ b/checker/tests/nullness/LazyInitialization.java @@ -16,17 +16,17 @@ void randomMethod() {} void testAssignment() { lazy = "m"; - // :: error: (assignment) + // :: error: [assignment] lazy = null; // null } void testLazyBeingNull() { - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] nullable.toString(); // error nonnull.toString(); - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] lazy.toString(); // error - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] lazy3.toString(); // error } @@ -40,7 +40,7 @@ void testAfterInvocation() { randomMethod(); - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] nullable.toString(); // error nonnull.toString(); lazy.toString(); @@ -79,15 +79,15 @@ class PptRelation2 { public @MonotonicNonNull Object equality_view2; public void init_hierarchy_new(PptRelation2 pr1, PptRelation2 pr2, Object eq) { - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] pr1.equality_view2.toString(); pr1.equality_view2 = eq; pr1.equality_view2.toString(); - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] pr2.equality_view2.toString(); - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] this.equality_view2.toString(); pr2.equality_view2 = eq; diff --git a/checker/tests/nullness/Listener.java b/checker/tests/nullness/Listener.java index 8f0804592ad3..3da79fd933cd 100644 --- a/checker/tests/nullness/Listener.java +++ b/checker/tests/nullness/Listener.java @@ -6,7 +6,7 @@ public class Listener { public Listener() { Talker w = new Talker(); - // :: error: (argument) + // :: error: [argument] w.register(this); f = "abc"; diff --git a/checker/tests/nullness/LogicOperations.java b/checker/tests/nullness/LogicOperations.java index 7b900355563c..7a00ad19392e 100644 --- a/checker/tests/nullness/LogicOperations.java +++ b/checker/tests/nullness/LogicOperations.java @@ -19,23 +19,23 @@ void oneAndComplement(@Nullable Object a) { a.toString(); return; } - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] a.toString(); // error } void repAndComplement(@Nullable Object a, @Nullable Object b) { if (a == null && b == null) { - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] a.toString(); // error return; } - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] a.toString(); // error } void oneOrComplement(@Nullable Object a) { if (a == null || helper()) { - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] a.toString(); // error return; } @@ -44,14 +44,14 @@ void oneOrComplement(@Nullable Object a) { void simpleOr1(@Nullable Object a, @Nullable Object b) { if (a != null || b != null) { - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] a.toString(); // error } } void simpleOr2(@Nullable Object a, @Nullable Object b) { if (a != null || b != null) { - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] b.toString(); // error } } @@ -59,10 +59,10 @@ void simpleOr2(@Nullable Object a, @Nullable Object b) { void sideeffect() { Object a = "m"; if ((a = null) != "n") { - // :: error: (assignment) + // :: error: [assignment] @NonNull Object l1 = a; } - // :: error: (assignment) + // :: error: [assignment] @NonNull Object l2 = a; } diff --git a/checker/tests/nullness/MapGetNullable.java b/checker/tests/nullness/MapGetNullable.java index a5bfe6fefbb8..f8997ff0627e 100644 --- a/checker/tests/nullness/MapGetNullable.java +++ b/checker/tests/nullness/MapGetNullable.java @@ -8,7 +8,7 @@ public class MapGetNullable { void foo0(Map m, @KeyFor("#1") String key) { - // :: error: (assignment) + // :: error: [assignment] @NonNull Integer val = m.get(key); } @@ -27,7 +27,7 @@ public static class MyMap1 extends HashMap { } void foo1(MyMap1 m, @KeyFor("#1") String key) { - // :: error: (assignment) + // :: error: [assignment] @NonNull Integer val = m.get(key); } @@ -38,7 +38,7 @@ V get1(MyMap1 m, @KeyFor("#1") String key) { public static class MyMap2 extends HashMap {} void foo2(MyMap2<@Nullable Integer, String> m, @KeyFor("#1") String key) { - // :: error: (assignment) + // :: error: [assignment] @NonNull Integer val = m.get(key); } @@ -49,7 +49,7 @@ V get2(MyMap2 m, @KeyFor("#1") String key) { public static class MyMap3 extends HashMap {} void foo3(MyMap3 m, @KeyFor("#1") String key) { - // :: error: (assignment) + // :: error: [assignment] @NonNull Integer val = m.get(key); } @@ -70,7 +70,7 @@ Integer get4(MyMap4 m, @KeyFor("#1") String key) { public static class MyMap5 extends HashMap {} void foo5(MyMap5<@Nullable Integer> m, @KeyFor("#1") String key) { - // :: error: (assignment) + // :: error: [assignment] @NonNull Integer val = m.get(key); } @@ -98,23 +98,23 @@ Integer get6(MyMap6 m, @KeyFor("#1") String key) { public static class MyMap7 extends HashMap { void useget(@KeyFor("this") String k) { - // :: error: (assignment) + // :: error: [assignment] @NonNull Integer val = get(k); } void useget2(@KeyFor("this") String k) { - // :: error: (assignment) + // :: error: [assignment] @NonNull Integer val = this.get(k); } } void foo7(MyMap7 m, @KeyFor("#1") String key) { - // :: error: (assignment) + // :: error: [assignment] @NonNull Integer val = m.get(key); } Integer get7(MyMap7 m, @KeyFor("#1") String key) { - // :: error: (return) + // :: error: [return] return m.get(key); } @@ -127,12 +127,12 @@ public static class MyMap9 extends HashMap { } void foo9(MyMap9 m, @KeyFor("#1") String key) { - // :: error: (assignment) + // :: error: [assignment] @NonNull Integer val = m.get(key); } void foo9a(MyMap9 m, @KeyFor("#1") String key) { - // :: error: (assignment) + // :: error: [assignment] @NonNull Integer val = m.get(key, 22); } @@ -141,13 +141,13 @@ V get9(MyMap9 m, @KeyFor("#1") String key) { } V get9a(MyMap9 m, @KeyFor("#1") String key) { - // :: error: (return) + // :: error: [return] return m.get(key, 22); } public @Nullable Date getNullableKey1(Map<@Nullable Object, Date> dates, @Nullable Object scope) { // This error is mandated because *some* maps prohibit null keys. - // :: error: (argument) + // :: error: [argument] return dates.get(scope); } diff --git a/checker/tests/nullness/MapMerge.java b/checker/tests/nullness/MapMerge.java index 26a11156a4ec..1ad1c00c9a36 100644 --- a/checker/tests/nullness/MapMerge.java +++ b/checker/tests/nullness/MapMerge.java @@ -6,12 +6,12 @@ public class MapMerge { public static void main(String[] args) { Map map = new HashMap<>(); map.put("k", "v"); - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] map.merge("k", "v", (a, b) -> null).toString(); } void foo(Map map) { - // :: error: (return) + // :: error: [return] merge(map, "k", "v", (a, b) -> null).toString(); } diff --git a/checker/tests/nullness/Marino.java b/checker/tests/nullness/Marino.java index 39dc3c072236..0d3ce30ad0de 100644 --- a/checker/tests/nullness/Marino.java +++ b/checker/tests/nullness/Marino.java @@ -25,10 +25,10 @@ void testWhile() throws Exception { @NonNull String a = s; // s cannot be null here s = null; - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] System.out.println("hi" + s.length()); if (i > 2) break; - // :: error: (assignment) + // :: error: [assignment] a = null; } // Checker doesn't catch that m_str not initialized. @@ -37,12 +37,12 @@ void testWhile() throws Exception { // Dereference of any static field is allowed. // I suppose this is a design decision for practicality in interacting with libraries...? - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] System.out.println("Member string has length: " + ms_str.length()); System.out.println( "Everyone should get this error: " + - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] m_nullableStr.length()); s = null; @@ -53,7 +53,7 @@ void testWhile() throws Exception { s = "bye"; } finally { // Checker doesn't catch that s will be null here. - // :: error: (assignment) + // :: error: [assignment] b = s; System.out.println("b has length: " + b.length()); } diff --git a/checker/tests/nullness/MethodInvocation.java b/checker/tests/nullness/MethodInvocation.java index b2c9ed7ebe5d..059425d91332 100644 --- a/checker/tests/nullness/MethodInvocation.java +++ b/checker/tests/nullness/MethodInvocation.java @@ -6,7 +6,7 @@ public class MethodInvocation { String s; public MethodInvocation() { - // :: error: (method.invocation) + // :: error: [method.invocation] a(); b(); c(); @@ -14,7 +14,7 @@ public MethodInvocation() { } public MethodInvocation(boolean p) { - // :: error: (method.invocation) + // :: error: [method.invocation] a(); // still not okay to be initialized s = "abc"; } @@ -22,12 +22,12 @@ public MethodInvocation(boolean p) { public void a() {} public void b(@UnderInitialization MethodInvocation this) { - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] s.hashCode(); } public void c(@UnknownInitialization MethodInvocation this) { - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] s.hashCode(); } } diff --git a/checker/tests/nullness/MethodOverloadingContractsKeyFor.java b/checker/tests/nullness/MethodOverloadingContractsKeyFor.java index 9afffdde326f..b2e8ef9e26c8 100644 --- a/checker/tests/nullness/MethodOverloadingContractsKeyFor.java +++ b/checker/tests/nullness/MethodOverloadingContractsKeyFor.java @@ -31,7 +31,7 @@ void test(ClassA classA, ClassB classB) { map.get(name(classA)).toString(); put(classB); - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] map.get(name(classB)).toString(); } diff --git a/checker/tests/nullness/MethodTypeVars4.java b/checker/tests/nullness/MethodTypeVars4.java index a0ff26e25efc..87e4ef581485 100644 --- a/checker/tests/nullness/MethodTypeVars4.java +++ b/checker/tests/nullness/MethodTypeVars4.java @@ -23,7 +23,7 @@ void f1(I i) { void f2(I i) { @NonNull String s = i.doit(); s = i.doit3(); - // :: error: (type.arguments.not.inferred) + // :: error: [type.arguments.not.inferred] List<@Nullable String> ls = i.doit2(); } } diff --git a/checker/tests/nullness/MisuseProperties.java b/checker/tests/nullness/MisuseProperties.java index ea2c44c75bde..eee4e09b2789 100644 --- a/checker/tests/nullness/MisuseProperties.java +++ b/checker/tests/nullness/MisuseProperties.java @@ -10,18 +10,18 @@ public class MisuseProperties { void propertiesToHashtable(Properties p) { - // :: error: (argument) + // :: error: [argument] p.setProperty("line.separator", null); - // :: error: (argument) + // :: error: [argument] p.put("line.separator", null); Hashtable h = p; // Error, because HashTable value has NonNull bound. // put(K,V) as a member of the raw type java.util.Hashtable // :: warning: [unchecked] unchecked call to put(K,V) as a member of the raw type // java.util.Hashtable - // :: error: (argument) + // :: error: [argument] h.put("line.separator", null); - // :: error: (argument) + // :: error: [argument] System.setProperty("line.separator", null); Dictionary d1 = p; @@ -30,11 +30,11 @@ void propertiesToHashtable(Properties p) { // java.util.Dictionary d1.put("line.separator", null); - // :: error: (assignment) + // :: error: [assignment] Dictionary d2 = p; d2.put("line.separator", null); - // :: error: (clear.system.property) + // :: error: [clear.system.property] System.setProperties(p); // OK; p has no null values System.clearProperty("foo.bar"); // OK @@ -43,7 +43,7 @@ void propertiesToHashtable(Properties p) { // These first few need to be special-cased, I think: - // :: error: (clear.system.property) + // :: error: [clear.system.property] System.clearProperty("line.separator"); p.remove("line.separator"); diff --git a/checker/tests/nullness/MultiConstructorInit.java b/checker/tests/nullness/MultiConstructorInit.java index a0091a702e7e..cc725e4762a2 100644 --- a/checker/tests/nullness/MultiConstructorInit.java +++ b/checker/tests/nullness/MultiConstructorInit.java @@ -13,12 +13,12 @@ public MultiConstructorInit() { this(true); } - // :: error: (initialization.fields.uninitialized) + // :: error: [initialization.fields.uninitialized] public MultiConstructorInit(int t) { new MultiConstructorInit(); } - // :: error: (initialization.fields.uninitialized) + // :: error: [initialization.fields.uninitialized] public MultiConstructorInit(float t) {} public static void main(String[] args) { diff --git a/checker/tests/nullness/MultipleErrors.java b/checker/tests/nullness/MultipleErrors.java index cfa942b330cb..eeef39d64417 100644 --- a/checker/tests/nullness/MultipleErrors.java +++ b/checker/tests/nullness/MultipleErrors.java @@ -2,16 +2,16 @@ // the same compilation unit are all shown. class MultipleErrors1 { - // :: error: (assignment) + // :: error: [assignment] Object o1 = null; } class MultipleErrors2 { - // :: error: (assignment) + // :: error: [assignment] Object o2 = null; } interface MultipleErrors3 { - // :: error: (assignment) + // :: error: [assignment] Object o3 = null; } diff --git a/checker/tests/nullness/MyException.java b/checker/tests/nullness/MyException.java index eefe65288cf1..727e27bd78a2 100644 --- a/checker/tests/nullness/MyException.java +++ b/checker/tests/nullness/MyException.java @@ -6,9 +6,9 @@ public MyException() {} public final String getTotalTrace() { final StringBuilder sb = new StringBuilder(); - // :: error: (iterating.over.nullable) + // :: error: [iterating.over.nullable] for (StackTraceElement st : getStackTrace()) { - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] sb.append(st.toString()); sb.append(System.lineSeparator()); } diff --git a/checker/tests/nullness/NNOEMoreTests.java b/checker/tests/nullness/NNOEMoreTests.java index 988efecb0a10..4c0cc82c71ea 100644 --- a/checker/tests/nullness/NNOEMoreTests.java +++ b/checker/tests/nullness/NNOEMoreTests.java @@ -12,20 +12,20 @@ void test1() { } @RequiresNonNull("xxx") - // :: error: (flowexpr.parse.error) + // :: error: [flowexpr.parse.error] void test2() { - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] nullable.toString(); } } class NNOESeparate { void call1(NNOEMain p) { - // :: error: (contracts.precondition) + // :: error: [contracts.precondition] p.test1(); Object xxx = new Object(); - // :: error: (flowexpr.parse.error) + // :: error: [flowexpr.parse.error] p.test2(); } diff --git a/checker/tests/nullness/NNOEStaticFields.java b/checker/tests/nullness/NNOEStaticFields.java index 73cd6eaa5e49..7a6125f7ea4e 100644 --- a/checker/tests/nullness/NNOEStaticFields.java +++ b/checker/tests/nullness/NNOEStaticFields.java @@ -41,29 +41,29 @@ void m2(NNOEStaticFields out) { } @RequiresNonNull("NoClueWhatThisShouldBe") - // :: error: (flowexpr.parse.error) + // :: error: [flowexpr.parse.error] void testF5() { - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] NNOEStaticFields.nullable.toString(); } void trueNegative() { - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] nullable.toString(); - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] otherNullable.toString(); } @RequiresNonNull("nullable") void test1() { nullable.toString(); - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] otherNullable.toString(); } @RequiresNonNull("otherNullable") void test2() { - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] nullable.toString(); otherNullable.toString(); } @@ -94,7 +94,7 @@ static class ChicoryPremain1 { // this postcondition cannot be proved with the Checker Framework, as the relation // between doPurity and pureMethods is not explicit public static boolean shouldDoPurity() { - // :: error: (contracts.conditional.postcondition) + // :: error: [contracts.conditional.postcondition] return doPurity; } diff --git a/checker/tests/nullness/NegatingConditionalNullness.java b/checker/tests/nullness/NegatingConditionalNullness.java index c28602dcf7cc..ffb8f27235ab 100644 --- a/checker/tests/nullness/NegatingConditionalNullness.java +++ b/checker/tests/nullness/NegatingConditionalNullness.java @@ -30,13 +30,13 @@ static void testSimple(NegatingConditionalNullness ppt) { // False tests static void testFalse(NegatingConditionalNullness ppt) { - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] ppt.splitters.toString(); // error } static void testFalseNoAssertion(NegatingConditionalNullness ppt) { ppt.has_splitters(); - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] ppt.splitters.toString(); // error } @@ -44,13 +44,13 @@ static void testFalseIf(NegatingConditionalNullness ppt) { if (ppt.has_splitters()) { return; } - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] ppt.splitters.toString(); // error } // static void testFalseIfBody(NegatingConditionalNullness ppt) { // if (!ppt.has_splitters()) { - // // :: error: (dereference.of.nullable) + // // :: error: [dereference.of.nullable] // ppt.splitters.toString(); // error // } // } diff --git a/checker/tests/nullness/NewNullable.java b/checker/tests/nullness/NewNullable.java index 2f91a35922ef..08dc9775aeb0 100644 --- a/checker/tests/nullness/NewNullable.java +++ b/checker/tests/nullness/NewNullable.java @@ -3,10 +3,10 @@ public class NewNullable { Object o = new Object(); Object nn = new @NonNull Object(); - // :: warning: (new.class) + // :: warning: [new.class] @Nullable Object lazy = new @MonotonicNonNull Object(); - // :: warning: (new.class) + // :: warning: [new.class] @Nullable Object poly = new @PolyNull Object(); - // :: warning: (new.class) + // :: warning: [new.class] @Nullable Object nbl = new @Nullable Object(); } diff --git a/checker/tests/nullness/NonEmptyCollection.java b/checker/tests/nullness/NonEmptyCollection.java index 0c3781613263..2c40d9e6dfad 100644 --- a/checker/tests/nullness/NonEmptyCollection.java +++ b/checker/tests/nullness/NonEmptyCollection.java @@ -10,7 +10,7 @@ public class NonEmptyCollection { } public static @NonNull String returnPoll1(PriorityQueue1<@NonNull String> pq) { - // :: error: (return) + // :: error: [return] return pq.poll(); } diff --git a/checker/tests/nullness/NullableConstructor.java b/checker/tests/nullness/NullableConstructor.java index a6f8d4bf9cbb..3f8aae7dfb96 100644 --- a/checker/tests/nullness/NullableConstructor.java +++ b/checker/tests/nullness/NullableConstructor.java @@ -2,6 +2,6 @@ public class NullableConstructor { - // :: error: (nullness.on.constructor) + // :: error: [nullness.on.constructor] @Nullable NullableConstructor() {} } diff --git a/checker/tests/nullness/NullnessFieldInvar.java b/checker/tests/nullness/NullnessFieldInvar.java index 4e000ae850ea..db5b6c01721f 100644 --- a/checker/tests/nullness/NullnessFieldInvar.java +++ b/checker/tests/nullness/NullnessFieldInvar.java @@ -52,28 +52,28 @@ public SubSub2(@NonNull Object o) { class Use { void test(Super superO, Sub sub, SubSub1 subSub1, SubSub2 subSub2) { - // :: error: (assignment) + // :: error: [assignment] @NonNull Object x1 = superO.o; @NonNull Object x2 = sub.o; @NonNull Object x3 = subSub1.o; - // :: error: (assignment) + // :: error: [assignment] @NonNull Object x5 = sub.subO; - // :: error: (assignment) + // :: error: [assignment] @NonNull Object x6 = subSub1.subO; @NonNull Object x7 = subSub2.subO; } void test2( SP superO, SB sub, SS1 subSub1, SS2 subSub2) { - // :: error: (assignment) + // :: error: [assignment] @NonNull Object x1 = superO.o; @NonNull Object x2 = sub.o; @NonNull Object x3 = subSub1.o; - // :: error: (assignment) + // :: error: [assignment] @NonNull Object x5 = sub.subO; - // :: error: (assignment) + // :: error: [assignment] @NonNull Object x6 = subSub1.subO; @NonNull Object x7 = subSub2.subO; } @@ -84,12 +84,12 @@ class SuperWithNonFinal { } // nonfinal isn't final - // :: error: (field.invariant.not.final) + // :: error: [field.invariant.not.final] @FieldInvariant(field = "nonfinal", qualifier = NonNull.class) class SubSubInvalid extends SuperWithNonFinal {} // field is declared in this class - // :: error: (field.invariant.not.found) + // :: error: [field.invariant.not.found] @FieldInvariant(field = "field", qualifier = NonNull.class) class Invalid { final Object field = new Object(); @@ -103,9 +103,9 @@ class Shadowing extends SubSub2 { @Nullable Object subO; void test() { - // :: error: (assignment) + // :: error: [assignment] @NonNull Object x = o; // error - // :: error: (assignment) + // :: error: [assignment] @NonNull Object x2 = subO; // error @NonNull Object x3 = super.o; @@ -123,9 +123,9 @@ class Inherits extends SubSub2 { @Nullable Object subO; void test() { - // :: error: (assignment) + // :: error: [assignment] @NonNull Object x = o; // error - // :: error: (assignment) + // :: error: [assignment] @NonNull Object x2 = subO; // error @NonNull Object x3 = super.o; @@ -139,19 +139,19 @@ public Inherits() { class Super2 {} - // :: error: (field.invariant.not.wellformed) + // :: error: [field.invariant.not.wellformed] @FieldInvariant( field = {}, qualifier = NonNull.class) class Invalid1 extends Super2 {} - // :: error: (field.invariant.not.wellformed) + // :: error: [field.invariant.not.wellformed] @FieldInvariant( field = {"a", "b"}, qualifier = {NonNull.class, NonNull.class, NonNull.class}) class Invalid2 extends Super2 {} - // :: error: (field.invariant.not.found) + // :: error: [field.invariant.not.found] @FieldInvariant(field = "x", qualifier = NonNull.class) class NoSuper {} diff --git a/checker/tests/nullness/NullnessIssue4996.java b/checker/tests/nullness/NullnessIssue4996.java index 78600f6d7d22..7d53d191616b 100644 --- a/checker/tests/nullness/NullnessIssue4996.java +++ b/checker/tests/nullness/NullnessIssue4996.java @@ -9,12 +9,12 @@ abstract class Inner { class Client { Object getFrom(CaptureOuter o) { - // :: error: (return) + // :: error: [return] return o.get(); } Object getFrom(CaptureOuter.Inner o) { - // :: error: (return) + // :: error: [return] return o.get(); } } diff --git a/checker/tests/nullness/ObjectArrayParam.java b/checker/tests/nullness/ObjectArrayParam.java index c7ed7f1d911c..a3f8d7103f38 100644 --- a/checker/tests/nullness/ObjectArrayParam.java +++ b/checker/tests/nullness/ObjectArrayParam.java @@ -5,7 +5,7 @@ class ObjectArrayParam { void test(@UnknownInitialization Object... args) { for (Object obj : args) { boolean isClass = obj instanceof Class; - // :: warning: (cast.unsafe) + // :: warning: [cast.unsafe] @Initialized @NonNull Class clazz = (isClass ? (@Initialized @NonNull Class) obj : obj.getClass()); } } diff --git a/checker/tests/nullness/ObjectListParam.java b/checker/tests/nullness/ObjectListParam.java index c9cc7083b3dd..747429adb34f 100644 --- a/checker/tests/nullness/ObjectListParam.java +++ b/checker/tests/nullness/ObjectListParam.java @@ -3,11 +3,11 @@ import org.checkerframework.checker.nullness.qual.*; class ObjectListParam { - // :: error: (type.argument) + // :: error: [type.argument] void test(List<@UnknownInitialization Object> args) { for (Object obj : args) { boolean isClass = obj instanceof Class; - // :: warning: (cast.unsafe) + // :: warning: [cast.unsafe] @Initialized Class clazz = (isClass ? (@Initialized Class) obj : obj.getClass()); } } diff --git a/checker/tests/nullness/ObjectsRequireNonNull.java b/checker/tests/nullness/ObjectsRequireNonNull.java index 1e0f9f2b7ed5..9aba142e1488 100644 --- a/checker/tests/nullness/ObjectsRequireNonNull.java +++ b/checker/tests/nullness/ObjectsRequireNonNull.java @@ -6,9 +6,9 @@ public class ObjectsRequireNonNull { void foo(@Nullable Object nble, @NonNull Object nn) { - // :: error: (argument) + // :: error: [argument] Objects.requireNonNull(null); - // :: error: (argument) + // :: error: [argument] Objects.requireNonNull(nble); Objects.requireNonNull("hello"); Objects.requireNonNull(nn); diff --git a/checker/tests/nullness/ObjectsRequireNonNullElse.java b/checker/tests/nullness/ObjectsRequireNonNullElse.java index 160c64143758..858e20ee09a3 100644 --- a/checker/tests/nullness/ObjectsRequireNonNullElse.java +++ b/checker/tests/nullness/ObjectsRequireNonNullElse.java @@ -12,7 +12,7 @@ public static void main(String[] args) { System.err.println(requireNonNullElse(null, "Something")); // This should fail typechecks, because it fails at run time. - // :: error: (argument) + // :: error: [argument] System.err.println((Object) requireNonNullElse(null, null)); } } diff --git a/checker/tests/nullness/OverrideANNA.java b/checker/tests/nullness/OverrideANNA.java index 00c074a562e0..cf161b92deda 100644 --- a/checker/tests/nullness/OverrideANNA.java +++ b/checker/tests/nullness/OverrideANNA.java @@ -17,7 +17,7 @@ void setf(@UnknownInitialization Super this) { static class Sub extends Super { @Override - // :: error: (contracts.postcondition) + // :: error: [contracts.postcondition] void setf(@UnknownInitialization Sub this) {} } diff --git a/checker/tests/nullness/OverrideANNA2.java b/checker/tests/nullness/OverrideANNA2.java index 95f4b3596331..d3f97b54d2a1 100644 --- a/checker/tests/nullness/OverrideANNA2.java +++ b/checker/tests/nullness/OverrideANNA2.java @@ -22,7 +22,7 @@ static class Sub extends Super { @EnsuresNonNull("f") // We cannot ensure that Super.f is non-null since it is // shadowed by Sub.f, hence we get an error. - // :: error: (contracts.postcondition.override) + // :: error: [contracts.postcondition.override] void setf(@UnknownInitialization Sub this) { f = new Object(); } diff --git a/checker/tests/nullness/OverrideANNA3.java b/checker/tests/nullness/OverrideANNA3.java index 17beeb4c9e6c..2f01e496d322 100644 --- a/checker/tests/nullness/OverrideANNA3.java +++ b/checker/tests/nullness/OverrideANNA3.java @@ -20,7 +20,7 @@ void setfg(@UnknownInitialization Super this) { static class Sub extends Super { @Override @EnsuresNonNull("f") - // :: error: (contracts.postcondition.override) + // :: error: [contracts.postcondition.override] void setfg(@UnknownInitialization Sub this) { f = new Object(); } diff --git a/checker/tests/nullness/OverrideNNOE.java b/checker/tests/nullness/OverrideNNOE.java index b203b196a9ab..210efb3178f3 100644 --- a/checker/tests/nullness/OverrideNNOE.java +++ b/checker/tests/nullness/OverrideNNOE.java @@ -11,7 +11,7 @@ void call() {} static class Sub extends Super { @Override @RequiresNonNull("f") - // :: error: (contracts.precondition.override) + // :: error: [contracts.precondition.override] void call() { f.hashCode(); } diff --git a/checker/tests/nullness/OverrideNNOE2.java b/checker/tests/nullness/OverrideNNOE2.java index cc7c945ac440..8780fa5af138 100644 --- a/checker/tests/nullness/OverrideNNOE2.java +++ b/checker/tests/nullness/OverrideNNOE2.java @@ -14,7 +14,7 @@ static class Sub extends Super { @Override @RequiresNonNull({"f", "g"}) - // :: error: (contracts.precondition.override) + // :: error: [contracts.precondition.override] void call() { g.hashCode(); } diff --git a/checker/tests/nullness/ParameterExpression.java b/checker/tests/nullness/ParameterExpression.java index 39eb74192dc3..25b91b893d76 100644 --- a/checker/tests/nullness/ParameterExpression.java +++ b/checker/tests/nullness/ParameterExpression.java @@ -4,16 +4,16 @@ public class ParameterExpression { public void m1( @Nullable Object o, @Nullable Object o1, @Nullable Object o2, @Nullable Object o3) { - // :: error: (flowexpr.parse.error.postcondition) + // :: error: [flowexpr.parse.error.postcondition] m2(o); - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] o.toString(); m3(o); o.toString(); m4(o1, o2, o3); - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] o1.toString(); - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] o2.toString(); o3.toString(); } @@ -21,7 +21,7 @@ public void m1( @SuppressWarnings("assert.postcondition") // "#0" is illegal syntax; it should be "#1" @EnsuresNonNull("#0") - // :: error: (flowexpr.parse.error) + // :: error: [flowexpr.parse.error] public void m2(final @Nullable Object o) {} @SuppressWarnings("contracts.postcondition") @@ -45,61 +45,61 @@ public void m5() { } @EnsuresNonNull("param") - // :: error: (flowexpr.parse.error) + // :: error: [flowexpr.parse.error] public void m6a(Object param) { param = new Object(); } @EnsuresNonNull("param") - // :: error: (flowexpr.parse.error) + // :: error: [flowexpr.parse.error] public void m6b(Object param) { - // :: error: (assignment) + // :: error: [assignment] param = null; } @EnsuresNonNull("param") - // :: error: (flowexpr.parse.error) + // :: error: [flowexpr.parse.error] public void m6c(@Nullable Object param) { param = new Object(); } @EnsuresNonNull("param") - // :: error: (flowexpr.parse.error) + // :: error: [flowexpr.parse.error] public void m6d(@Nullable Object param) { param = null; } @EnsuresNonNull("param.toString()") - // :: error: (flowexpr.parse.error) + // :: error: [flowexpr.parse.error] public void m6e(@Nullable Object param) { param = null; } @EnsuresNonNull("field") - // :: error: (contracts.postcondition) - // :: warning: (expression.parameter.name.shadows.field) + // :: error: [contracts.postcondition] + // :: warning: [expression.parameter.name.shadows.field] public void m7a(Object field) { field = new Object(); } @EnsuresNonNull("field") - // :: error: (contracts.postcondition) - // :: warning: (expression.parameter.name.shadows.field) + // :: error: [contracts.postcondition] + // :: warning: [expression.parameter.name.shadows.field] public void m7b(Object field) { - // :: error: (assignment) + // :: error: [assignment] field = null; } @EnsuresNonNull("field") - // :: error: (contracts.postcondition) - // :: warning: (expression.parameter.name.shadows.field) + // :: error: [contracts.postcondition] + // :: warning: [expression.parameter.name.shadows.field] public void m7c(@Nullable Object field) { field = new Object(); } @EnsuresNonNull("field") - // :: error: (contracts.postcondition) - // :: warning: (expression.parameter.name.shadows.field) + // :: error: [contracts.postcondition] + // :: warning: [expression.parameter.name.shadows.field] public void m7d(@Nullable Object field) { field = null; } @@ -109,13 +109,13 @@ public void m7d(@Nullable Object field) { public void m8() {} @RequiresNonNull("param") - // :: error: (flowexpr.parse.error) + // :: error: [flowexpr.parse.error] public void m9(Object param) {} // Warning issued. 'field' is a field, but in this case what matters is that it is the name of a // formal parameter. @RequiresNonNull("field") - // :: warning: (expression.parameter.name.shadows.field) + // :: warning: [expression.parameter.name.shadows.field] public void m10(Object field) {} // Conditional postconditions @@ -126,7 +126,7 @@ public boolean m11() { } @EnsuresNonNullIf(result = true, expression = "param") - // :: error: (flowexpr.parse.error) + // :: error: [flowexpr.parse.error] public boolean m12(Object param) { param = new Object(); return true; @@ -135,36 +135,36 @@ public boolean m12(Object param) { // Warning issued. 'field' is a field, but in this case what matters is that it is the name of a // formal parameter. @EnsuresNonNullIf(result = true, expression = "field") - // :: warning: (expression.parameter.name.shadows.field) + // :: warning: [expression.parameter.name.shadows.field] public boolean m13a(@Nullable Object field) { field = new Object(); - // :: error: (contracts.conditional.postcondition) + // :: error: [contracts.conditional.postcondition] return true; } @EnsuresNonNullIf(result = true, expression = "field") - // :: warning: (expression.parameter.name.shadows.field) + // :: warning: [expression.parameter.name.shadows.field] public boolean m13b(@Nullable Object field) { field = new Object(); return false; } @EnsuresNonNullIf(result = true, expression = "field") - // :: warning: (expression.parameter.name.shadows.field) + // :: warning: [expression.parameter.name.shadows.field] public boolean m13c(@Nullable Object field) { field = null; - // :: error: (contracts.conditional.postcondition) + // :: error: [contracts.conditional.postcondition] return true; } @EnsuresNonNullIf(result = true, expression = "field") - // :: warning: (expression.parameter.name.shadows.field) + // :: warning: [expression.parameter.name.shadows.field] public boolean m13d(@Nullable Object field) { field = null; return false; } // Annotations on formal parameters referring to a formal parameter of the same method. - // :: error: (expression.unparsable) + // :: error: [expression.unparsable] public void m14(@KeyFor("param2") Object param1, Map param2) {} } diff --git a/checker/tests/nullness/Polymorphism.java b/checker/tests/nullness/Polymorphism.java index 902c0245fa8e..bfdb7392214d 100644 --- a/checker/tests/nullness/Polymorphism.java +++ b/checker/tests/nullness/Polymorphism.java @@ -11,7 +11,7 @@ void testParam() { String nullable = null; @NonNull String nonNull = "m"; - // :: error: (assignment) + // :: error: [assignment] nonNull = identity(nullable); // invalid nonNull = identity(nonNull); @@ -23,7 +23,7 @@ void testParam() { // Test within a method @PolyNull String random(@PolyNull String m) { if (m == "d") { - // :: error: (return) + // :: error: [return] return null; // invalid } return "m"; // valid diff --git a/checker/tests/nullness/PolymorphismArrays.java b/checker/tests/nullness/PolymorphismArrays.java index 0681fb4a29bf..5ac789c43482 100644 --- a/checker/tests/nullness/PolymorphismArrays.java +++ b/checker/tests/nullness/PolymorphismArrays.java @@ -8,7 +8,7 @@ public PolymorphismArrays(String[][] elts) { public static boolean @PolyNull [] bad(boolean @PolyNull [] seq) { // Cannot directly return null; - // :: error: (return) + // :: error: [return] return null; } diff --git a/checker/tests/nullness/PostconditionBug.java b/checker/tests/nullness/PostconditionBug.java index 064af64ce10f..394a608efda2 100644 --- a/checker/tests/nullness/PostconditionBug.java +++ b/checker/tests/nullness/PostconditionBug.java @@ -5,7 +5,7 @@ public class PostconditionBug { void a(@UnknownInitialization PostconditionBug this) { @NonNull String f = "abc"; - // :: error: (assignment) + // :: error: [assignment] f = null; } } diff --git a/checker/tests/nullness/PreventClearProperty.java b/checker/tests/nullness/PreventClearProperty.java index 2aa77ca168a3..7e466253056a 100644 --- a/checker/tests/nullness/PreventClearProperty.java +++ b/checker/tests/nullness/PreventClearProperty.java @@ -15,56 +15,56 @@ public class PreventClearProperty { } @NonNull String getLineSeparator2() { - // :: error: (return) + // :: error: [return] return System.getProperty(LINE_SEPARATOR); } @NonNull String getMyProperty1() { - // :: error: (return) + // :: error: [return] return System.getProperty("my.property.name"); } @NonNull String getMyProperty2() { - // :: error: (return) + // :: error: [return] return System.getProperty(MY_PROPERTY_NAME); } @NonNull String getAProperty(String propName) { - // :: error: (return) + // :: error: [return] return System.getProperty(propName); } @NonNull String clearLineSeparator1() { - // :: error: (return) - // :: error: (clear.system.property) + // :: error: [return] + // :: error: [clear.system.property] return System.clearProperty("line.separator"); } @NonNull String clearLineSeparator2() { - // :: error: (return) - // :: error: (clear.system.property) + // :: error: [return] + // :: error: [clear.system.property] return System.clearProperty(LINE_SEPARATOR); } @NonNull String clearMyProperty1() { - // :: error: (return) + // :: error: [return] return System.clearProperty("my.property.name"); } @NonNull String clearMyProperty2() { - // :: error: (return) - // :: error: (clear.system.property) + // :: error: [return] + // :: error: [clear.system.property] return System.clearProperty(MY_PROPERTY_NAME); } @NonNull String clearAProperty(String propName) { - // :: error: (return) - // :: error: (clear.system.property) + // :: error: [return] + // :: error: [clear.system.property] return System.clearProperty(propName); } void callSetProperties(Properties p) { - // :: error: (clear.system.property) + // :: error: [clear.system.property] System.setProperties(p); } @@ -75,53 +75,53 @@ void callSetProperties(Properties p) { } @NonNull String setLineSeparator2() { - // :: error: (return) + // :: error: [return] return System.setProperty(LINE_SEPARATOR, "somevalue"); } @NonNull String setMyProperty1() { - // :: error: (return) + // :: error: [return] return System.setProperty("my.property.name", "somevalue"); } @NonNull String setMyProperty2() { - // :: error: (return) + // :: error: [return] return System.setProperty(MY_PROPERTY_NAME, "somevalue"); } @NonNull String setAProperty(String propName) { - // :: error: (return) + // :: error: [return] return System.setProperty(propName, "somevalue"); } // These calls to setProperty are illegal because null is not a permitted value. @NonNull String setLineSeparatorNull1() { - // :: error: (argument) + // :: error: [argument] return System.setProperty("line.separator", null); } @NonNull String setLineSeparatorNull2() { - // :: error: (argument) - // :: error: (return) + // :: error: [argument] + // :: error: [return] return System.setProperty(LINE_SEPARATOR, null); } @NonNull String setMyPropertyNull1() { - // :: error: (argument) - // :: error: (return) + // :: error: [argument] + // :: error: [return] return System.setProperty("my.property.name", null); } @NonNull String setMyPropertyNull2() { - // :: error: (argument) - // :: error: (return) + // :: error: [argument] + // :: error: [return] return System.setProperty(MY_PROPERTY_NAME, null); } @NonNull String setAPropertyNull(String propName) { - // :: error: (argument) - // :: error: (return) + // :: error: [argument] + // :: error: [return] return System.setProperty(propName, null); } } diff --git a/checker/tests/nullness/PrivateMethodUnknownInit.java b/checker/tests/nullness/PrivateMethodUnknownInit.java index efaa4600746e..a0cbb238533b 100644 --- a/checker/tests/nullness/PrivateMethodUnknownInit.java +++ b/checker/tests/nullness/PrivateMethodUnknownInit.java @@ -7,7 +7,7 @@ public class PrivateMethodUnknownInit { public PrivateMethodUnknownInit() { x = 1; m1(); - // :: error: (method.invocation) + // :: error: [method.invocation] m2(); } diff --git a/checker/tests/nullness/PureTest.java b/checker/tests/nullness/PureTest.java index 2523da47b69e..121c216e1004 100644 --- a/checker/tests/nullness/PureTest.java +++ b/checker/tests/nullness/PureTest.java @@ -8,11 +8,11 @@ public class PureTest { } public void test() { - // :: error: (assignment) + // :: error: [assignment] @NonNull Object l0 = puremethod(null); if (puremethod(null) == null) { - // :: error: (assignment) + // :: error: [assignment] @NonNull Object l1 = puremethod(null); } @@ -21,12 +21,12 @@ public void test() { } if (puremethod("m") != null) { - // :: error: (assignment) + // :: error: [assignment] @NonNull Object l1 = puremethod(null); } if (puremethod("m") != null) { - // :: error: (assignment) + // :: error: [assignment] @NonNull Object l1 = puremethod("n"); } @@ -40,10 +40,10 @@ public void test() { x = new Object(); - // :: error: (assignment) + // :: error: [assignment] @NonNull Object l3 = puremethod(x); - // :: error: (assignment) + // :: error: [assignment] @NonNull Object l4 = puremethod("n"); } @@ -67,7 +67,7 @@ static void testInstanceofNegative(PureTest pt) { if (pt.getSuperclass() instanceof Object) { return; } - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] pt.getSuperclass().toString(); } @@ -120,7 +120,7 @@ static void testInstanceofPositive3(PureTest pt) { } else { pt.setSuperclass(null); } - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] pt.getSuperclass().toString(); } diff --git a/checker/tests/nullness/Raw2.java b/checker/tests/nullness/Raw2.java index 00fb53439df7..01928e0e3d63 100644 --- a/checker/tests/nullness/Raw2.java +++ b/checker/tests/nullness/Raw2.java @@ -4,7 +4,7 @@ public class Raw2 { private @NonNull Object field; - // :: error: (initialization.fields.uninitialized) + // :: error: [initialization.fields.uninitialized] public Raw2(int i) { this.method(this); } @@ -19,9 +19,9 @@ public Raw2() { } private void method(@UnknownInitialization Raw2 this, @UnknownInitialization Raw2 arg) { - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] arg.field.hashCode(); - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] this.field.hashCode(); } diff --git a/checker/tests/nullness/RawField.java b/checker/tests/nullness/RawField.java index ab89451d5a0d..61e86f9f31f0 100644 --- a/checker/tests/nullness/RawField.java +++ b/checker/tests/nullness/RawField.java @@ -8,17 +8,17 @@ class RawField { public @UnknownInitialization RawField a; public RawField() { - // :: error: (assignment) + // :: error: [assignment] a = null; this.a = this; a = this; } - // :: error: (initialization.fields.uninitialized) + // :: error: [initialization.fields.uninitialized] public RawField(boolean foo) {} void t1() { - // :: error: (method.invocation) + // :: error: [method.invocation] a.t1(); } diff --git a/checker/tests/nullness/RawMethodInvocation.java b/checker/tests/nullness/RawMethodInvocation.java index e9443b5e3eed..2dc97b0b973c 100644 --- a/checker/tests/nullness/RawMethodInvocation.java +++ b/checker/tests/nullness/RawMethodInvocation.java @@ -30,7 +30,7 @@ void init_ab(@UnknownInitialization RawMethodInvocation this) { RawMethodInvocation(long constructor_escapes_raw) { a = 1; // this call is not valid, this is still raw - // :: error: (method.invocation) + // :: error: [method.invocation] nonRawMethod(); b = 2; } diff --git a/checker/tests/nullness/RawSuper.java b/checker/tests/nullness/RawSuper.java index faad56f499bf..4696df5a62c8 100644 --- a/checker/tests/nullness/RawSuper.java +++ b/checker/tests/nullness/RawSuper.java @@ -10,7 +10,7 @@ class A { A() { super(); mRA(this); - // :: error: (type.incompatible) + // :: error: [type.incompatible] mA(this); afield = new Object(); mRA(this); @@ -34,7 +34,7 @@ class B extends A { mRA(this); mA(this); mRB(this); - // :: error: (type.incompatible) + // :: error: [type.incompatible] mB(this); bfield = new Object(); mRA(this); @@ -44,7 +44,7 @@ class B extends A { } void raw(B this) { - // :: error: (type.incompatible) + // :: error: [type.incompatible] super.nonRaw(); } } @@ -59,7 +59,7 @@ class C extends B { mRB(this); mB(this); mRC(this); - // :: error: (type.incompatible) + // :: error: [type.incompatible] mC(this); cfield = new Object(); mRA(this); diff --git a/checker/tests/nullness/RawTypesBounded.java b/checker/tests/nullness/RawTypesBounded.java index 44178a04c694..48e7011ae3be 100644 --- a/checker/tests/nullness/RawTypesBounded.java +++ b/checker/tests/nullness/RawTypesBounded.java @@ -10,16 +10,16 @@ class Bad { @NonNull String field; public Bad() { - // :: error: (method.invocation) + // :: error: [method.invocation] this.init(); // error - // :: error: (method.invocation) + // :: error: [method.invocation] init(); // error this.field = "field"; // valid - // :: error: (assignment) + // :: error: [assignment] this.field = null; // error field = "field"; // valid - // :: error: (assignment) + // :: error: [assignment] field = null; // error } @@ -39,22 +39,22 @@ public A() { } public void init(@UnknownInitialization A this) { - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] output(this.field.length()); } public void initExpl2(@UnknownInitialization A this) { - // :: error: (argument) + // :: error: [argument] output(this.field); } public void initImpl1(@UnknownInitialization A this) { - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] output(field.length()); } public void initImpl2(@UnknownInitialization A this) { - // :: error: (argument) + // :: error: [argument] output(field); } } @@ -64,30 +64,30 @@ class B extends A { public B() { super(); - // :: error: (assignment) + // :: error: [assignment] this.otherField = null; // error this.otherField = "otherField"; // valid } @Override public void init(@UnknownInitialization B this) { - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] output(this.field.length()); // error (TODO: substitution) super.init(); // valid } public void initImpl1(@UnknownInitialization B this) { - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] output(field.length()); // error (TODO: substitution) } public void initExpl2(@UnknownInitialization B this) { - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] output(this.otherField.length()); // error } public void initImpl2(@UnknownInitialization B this) { - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] output(otherField.length()); // error } @@ -108,7 +108,7 @@ class C extends B { @Override public void init(@UnknownInitialization C this) { - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] output(this.strings.length); // error System.out.println(); // valid } @@ -144,7 +144,7 @@ class AllFieldsInitialized { // If all fields have an initializer, then the type of "this" // should still not be non-raw (there might be uninitilized subclasses) public AllFieldsInitialized() { - // :: error: (method.invocation) + // :: error: [method.invocation] nonRawMethod(); } @@ -161,15 +161,15 @@ class AllFieldsSetInInitializer { public AllFieldsSetInInitializer() { elapsedMillis = 0; - // :: error: (method.invocation) + // :: error: [method.invocation] nonRawMethod(); startTime = 0; - // :: error: (method.invocation) + // :: error: [method.invocation] nonRawMethod(); // still error (subclasses...) } public AllFieldsSetInInitializer(boolean b) { - // :: error: (method.invocation) + // :: error: [method.invocation] nonRawMethod(); } @@ -185,7 +185,7 @@ public ConstructorInvocations(int v) { public ConstructorInvocations() { this(0); - // :: error: (method.invocation) + // :: error: [method.invocation] nonRawMethod(); } @@ -205,7 +205,7 @@ public MethodAccess() { void cast(@UnknownInitialization Object... args) { @SuppressWarnings("rawtypes") - // :: error: (assignment) + // :: error: [assignment] Object[] argsNonRaw1 = args; @SuppressWarnings("cast") diff --git a/checker/tests/nullness/RawTypesUses.java b/checker/tests/nullness/RawTypesUses.java index f86a8ac6ac04..5ee60f012d14 100644 --- a/checker/tests/nullness/RawTypesUses.java +++ b/checker/tests/nullness/RawTypesUses.java @@ -10,11 +10,11 @@ G foo() { void foo() { Generic<@Nullable String> notRawNullable = new Generic<>(); - // :: error: (assignment) + // :: error: [assignment] @NonNull Object o1 = notRawNullable.foo(); Generic rawNullable = new Generic<@Nullable String>(); - // :: error: (assignment) + // :: error: [assignment] @NonNull Object o2 = rawNullable.foo(); Generic<@NonNull String> notRawNonNull = new Generic<>(); @@ -22,9 +22,9 @@ void foo() { Generic rawNonNull = new Generic<@NonNull String>(); Generic rawNonNullAlais = rawNonNull; - // :: error: (assignment) + // :: error: [assignment] @NonNull Object o4 = rawNonNull.foo(); - // :: error: (assignment) + // :: error: [assignment] @NonNull Object o5 = rawNonNullAlais.foo(); } @@ -33,19 +33,19 @@ void foo() { void bar() { // :: warning: [unchecked] unchecked conversion Generic<@Nullable String> notRawNullable = rawReturn(); - // :: error: (assignment) + // :: error: [assignment] @NonNull Object o1 = notRawNullable.foo(); Generic rawNullable = rawReturn(); - // :: error: (assignment) + // :: error: [assignment] @NonNull Object o2 = rawNullable.foo(); - // :: error: (assignment) + // :: error: [assignment] @NonNull Object o3 = rawReturn().foo(); Generic local = rawReturn(); Generic localAlias = local; - // :: error: (assignment) + // :: error: [assignment] @NonNull Object o4 = local.foo(); } } diff --git a/checker/tests/nullness/ReadyReadLine.java b/checker/tests/nullness/ReadyReadLine.java index 740826270a5f..9e0a4e10127c 100644 --- a/checker/tests/nullness/ReadyReadLine.java +++ b/checker/tests/nullness/ReadyReadLine.java @@ -11,7 +11,7 @@ void m(MyBufferedReader buf) throws Exception { } if (buf.readLine() != null) { - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] buf.readLine().toString(); } } @@ -27,7 +27,7 @@ class MyBufferedReader { @Pure public boolean ready() throws Exception { // don't bother with implementation. - // :: error: (contracts.conditional.postcondition) + // :: error: [contracts.conditional.postcondition] return true; } } diff --git a/checker/tests/nullness/ReceiverAnnotation.java b/checker/tests/nullness/ReceiverAnnotation.java index 1a4cef239204..ebfff198a218 100644 --- a/checker/tests/nullness/ReceiverAnnotation.java +++ b/checker/tests/nullness/ReceiverAnnotation.java @@ -5,9 +5,9 @@ public class ReceiverAnnotation { void receiver1(ReceiverAnnotation this) {} - // :: error: (nullness.on.receiver) + // :: error: [nullness.on.receiver] void receiver2(@NonNull ReceiverAnnotation this) {} - // :: error: (nullness.on.receiver) + // :: error: [nullness.on.receiver] void receiver3(@Nullable ReceiverAnnotation this) {} } diff --git a/checker/tests/nullness/ReferencesDefaults.java b/checker/tests/nullness/ReferencesDefaults.java index 9e21548917bb..8f3a6d9181fc 100644 --- a/checker/tests/nullness/ReferencesDefaults.java +++ b/checker/tests/nullness/ReferencesDefaults.java @@ -11,7 +11,7 @@ Object test() { class Use { Decl d = new Decl(); // here the default for f is NonNull -> error - // :: error: (assignment) + // :: error: [assignment] Object f = d.test(); } } diff --git a/checker/tests/nullness/RefineOverride.java b/checker/tests/nullness/RefineOverride.java index 5a6b124e91cd..1cdfde5c1c38 100644 --- a/checker/tests/nullness/RefineOverride.java +++ b/checker/tests/nullness/RefineOverride.java @@ -128,7 +128,7 @@ void m19(@PolyNull T s1, @PolyNull T s2) {} // The new permissible types are not supertypes of the old types, // but they still expand the set of permitted invocations. - // :: error: (override.param) + // :: error: [override.param] @Override void m21(@NonNull String[] a) {} @@ -146,7 +146,7 @@ void m24(@PolyNull String[] a) {} @Override void m25(@PolyNull T[] a) {} - // :: error: (override.param) + // :: error: [override.param] @Override void m26(@NonNull T[] a) {} @@ -191,7 +191,7 @@ void t1(String s) {} @Override void t2(@Nullable String s) {} - // :: error: (override.param) + // :: error: [override.param] @Override void t3(String s) {} diff --git a/checker/tests/nullness/RepeatEnsuresKeyForWithError.java b/checker/tests/nullness/RepeatEnsuresKeyForWithError.java index af5b491be009..060d682ac12d 100644 --- a/checker/tests/nullness/RepeatEnsuresKeyForWithError.java +++ b/checker/tests/nullness/RepeatEnsuresKeyForWithError.java @@ -56,7 +56,7 @@ public boolean client4(String a, String b, String c) { value = {"#1", "#2"}, map = "map") @EnsuresKeyFor(value = "#3", map = "map") - // :: error: (contracts.postcondition) + // :: error: [contracts.postcondition] public void withpostconditionsfunc1(String a, String b, String c) { map.put(a, 1); map.put(c, 3); @@ -70,7 +70,7 @@ public void withpostconditionsfunc1(String a, String b, String c) { public boolean withcondpostconditionsfunc2(String a, String b, String c) { map.put(a, 1); map.put(c, 3); - // :: error: (contracts.conditional.postcondition) + // :: error: [contracts.conditional.postcondition] return true; } @@ -79,7 +79,7 @@ public boolean withcondpostconditionsfunc2(String a, String b, String c) { @EnsuresKeyFor(value = "#2", map = "map"), }) @EnsuresKeyFor(value = "#3", map = "map") - // :: error: (contracts.postcondition) + // :: error: [contracts.postcondition] public void withpostconditionfunc1(String a, String b, String c) { map.put(a, 1); map.put(c, 3); @@ -93,7 +93,7 @@ public void withpostconditionfunc1(String a, String b, String c) { public boolean withcondpostconditionfunc2(String a, String b, String c) { map.put(a, 1); map.put(c, 3); - // :: error: (contracts.conditional.postcondition) + // :: error: [contracts.conditional.postcondition] return true; } } diff --git a/checker/tests/nullness/RepeatEnsuresNonNullWithError.java b/checker/tests/nullness/RepeatEnsuresNonNullWithError.java index 227ec026a9f4..4fdc3fbb9c7f 100644 --- a/checker/tests/nullness/RepeatEnsuresNonNullWithError.java +++ b/checker/tests/nullness/RepeatEnsuresNonNullWithError.java @@ -58,13 +58,13 @@ public boolean withcondpostconditionsfunc1() { value1 = "value1"; value2 = "value2"; value3 = null; // condition not satisfied here - // :: error: (contracts.conditional.postcondition) + // :: error: [contracts.conditional.postcondition] return true; } @EnsuresNonNull("value1") @EnsuresNonNull(value = {"value2", "value3"}) - // :: error: (contracts.postcondition) + // :: error: [contracts.postcondition] public void withpostconditionsfunc2() { value1 = "value1"; value2 = "value2"; @@ -80,13 +80,13 @@ public boolean withcondpostconditionfunc1() { value1 = "value1"; value2 = "value2"; value3 = null; // condition not satisfied here - // :: error: (contracts.conditional.postcondition) + // :: error: [contracts.conditional.postcondition] return true; } @EnsuresNonNull.List({@EnsuresNonNull("value1"), @EnsuresNonNull("value2")}) @EnsuresNonNull("value3") - // :: error: (contracts.postcondition) + // :: error: [contracts.postcondition] public void withpostconditionfunc2() { value1 = "value1"; value2 = "value2"; diff --git a/checker/tests/nullness/RepeatedRequiresNonNull.java b/checker/tests/nullness/RepeatedRequiresNonNull.java index 7bb1e56ca8c7..c5fe1f42b23f 100644 --- a/checker/tests/nullness/RepeatedRequiresNonNull.java +++ b/checker/tests/nullness/RepeatedRequiresNonNull.java @@ -16,20 +16,20 @@ void test() { } void use1() { - // :: error: (contracts.precondition) + // :: error: [contracts.precondition] test(); } void use2() { if (this.f1 != null) { - // :: error: (contracts.precondition) + // :: error: [contracts.precondition] test(); } } void use3() { if (this.f2 != null) { - // :: error: (contracts.precondition) + // :: error: [contracts.precondition] test(); } } @@ -52,20 +52,20 @@ void test2() { } void use21() { - // :: error: (contracts.precondition) + // :: error: [contracts.precondition] test2(); } void use22() { if (this.f1 != null) { - // :: error: (contracts.precondition) + // :: error: [contracts.precondition] test2(); } } void use23() { if (this.f2 != null) { - // :: error: (contracts.precondition) + // :: error: [contracts.precondition] test2(); } } diff --git a/checker/tests/nullness/RequiresNonNullTest.java b/checker/tests/nullness/RequiresNonNullTest.java index e48a931d2418..6e66a6f5eab8 100644 --- a/checker/tests/nullness/RequiresNonNullTest.java +++ b/checker/tests/nullness/RequiresNonNullTest.java @@ -10,7 +10,7 @@ public class RequiresNonNullTest { void method1() { field1.toString(); // OK, field1 is known to be non-null this.field1.toString(); // OK, field1 is known to be non-null - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] field2.toString(); // error, might throw NullPointerException } @@ -24,7 +24,7 @@ void method2() { field1 = new Object(); method1(); // OK, satisfies method precondition field1 = null; - // :: error: (contracts.precondition) + // :: error: [contracts.precondition] method1(); // error, does not satisfy method precondition } @@ -34,7 +34,7 @@ void method2() { public void requiresNonNullField() {} public void clientFail(RequiresNonNullTest arg1) { - // :: error: (contracts.precondition) + // :: error: [contracts.precondition] arg1.requiresNonNullField(); } @@ -52,14 +52,14 @@ public void clientOK(RequiresNonNullTest arg2) { @Pure @RequiresNonNull("staticfield") - // :: warning: (purity.deterministic.void.method) + // :: warning: [purity.deterministic.void.method] public void reqStaticName() { reqStaticQualName(); } @Pure @RequiresNonNull("RequiresNonNullTest.staticfield") - // :: warning: (purity.deterministic.void.method) + // :: warning: [purity.deterministic.void.method] public void reqStaticQualName() { reqStaticName(); } @@ -78,9 +78,9 @@ public void statClientOK(RequiresNonNullTest arg1) { } public void statClientFail(RequiresNonNullTest arg1) { - // :: error: (contracts.precondition) + // :: error: [contracts.precondition] arg1.reqStaticName(); - // :: error: (contracts.precondition) + // :: error: [contracts.precondition] arg1.reqStaticQualName(); } @@ -91,7 +91,7 @@ public void subClientOK(NNOESubTest arg3) { } public void subClientFail(NNOESubTest arg4) { - // :: error: (contracts.precondition) + // :: error: [contracts.precondition] arg4.requiresNonNullField(); } @@ -117,7 +117,7 @@ public void hidingClient1(NNOEHidingTest arg5) { arg5.field = "ha!"; // TODO: The error message should say something about the hidden field. - // :: error: (contracts.precondition) + // :: error: [contracts.precondition] arg5.requiresNonNullField(); // TODO: Add test like: @@ -126,7 +126,7 @@ public void hidingClient1(NNOEHidingTest arg5) { } public void hidingClient2(NNOEHidingTest arg6) { - // :: error: (contracts.precondition) + // :: error: [contracts.precondition] arg6.requiresNonNullField(); } @@ -148,6 +148,6 @@ void test() { @RequiresNonNull("thisShouldIssue1Error") // Test case for Issue 1051 // https://github.com/typetools/checker-framework/issues/1051 - // :: error: (flowexpr.parse.error) + // :: error: [flowexpr.parse.error] void testIssue1051() {} } diff --git a/checker/tests/nullness/ScopingConstruct.java b/checker/tests/nullness/ScopingConstruct.java index aef5935f30df..93edf0d4d07d 100644 --- a/checker/tests/nullness/ScopingConstruct.java +++ b/checker/tests/nullness/ScopingConstruct.java @@ -48,10 +48,10 @@ public void close() {} // This is a Java error. // ScopingConstruct.@Nullable StaticNested.@Nullable NestedNested scnsnnnn; - // :: error: (nullness.on.outer) + // :: error: [nullness.on.outer] ScopingConstruct.@Nullable StaticNested.NestedInner scnsnni; - // :: error: (nullness.on.outer) + // :: error: [nullness.on.outer] ScopingConstruct.@Nullable StaticNested.@Nullable NestedInner scnsnnni; ScopingConstruct.Inner sci; @@ -60,21 +60,21 @@ public void close() {} ScopingConstruct.Inner.@Nullable InnerInner scinii; - // :: error: (nullness.on.outer) + // :: error: [nullness.on.outer] @Nullable ScopingConstruct.Inner nsci; - // :: error: (nullness.on.outer) + // :: error: [nullness.on.outer] @Nullable ScopingConstruct.Inner.InnerInner nsciii; - // :: error: (nullness.on.outer) + // :: error: [nullness.on.outer] @Nullable ScopingConstruct.Inner.@Nullable InnerInner nscinii; ScopingConstruct.@Nullable Inner scni; - // :: error: (nullness.on.outer) + // :: error: [nullness.on.outer] ScopingConstruct.@Nullable Inner.InnerInner scniii; - // :: error: (nullness.on.outer) + // :: error: [nullness.on.outer] ScopingConstruct.@Nullable Inner.@Nullable InnerInner scninii; ScopingConstruct.StaticNested.NestedInner scsnni; @@ -99,21 +99,21 @@ public void close() {} ScopingConstruct.Inner.@Nullable InnerInner @Nullable [] sciniina; - // :: error: (nullness.on.outer) + // :: error: [nullness.on.outer] @Nullable ScopingConstruct.Inner @Nullable [] nscina; - // :: error: (nullness.on.outer) + // :: error: [nullness.on.outer] @Nullable ScopingConstruct.Inner.InnerInner @Nullable [] nsciiina; - // :: error: (nullness.on.outer) + // :: error: [nullness.on.outer] @Nullable ScopingConstruct.Inner.@Nullable InnerInner @Nullable [] nsciniina; ScopingConstruct.@Nullable Inner @Nullable [] scnina; - // :: error: (nullness.on.outer) + // :: error: [nullness.on.outer] ScopingConstruct.@Nullable Inner.InnerInner @Nullable [] scniina; - // :: error: (nullness.on.outer) + // :: error: [nullness.on.outer] ScopingConstruct.@Nullable Inner.@Nullable InnerInner @Nullable [] scniniina; ScopingConstruct.Inner sci() { @@ -128,17 +128,17 @@ ScopingConstruct.Inner.InnerInner sciii() { throw new Error("not implemented"); } - // :: error: (nullness.on.outer) + // :: error: [nullness.on.outer] @Nullable ScopingConstruct.Inner nsci() { throw new Error("not implemented"); } - // :: error: (nullness.on.outer) + // :: error: [nullness.on.outer] @Nullable ScopingConstruct.Inner.InnerInner nsciii() { throw new Error("not implemented"); } - // :: error: (nullness.on.outer) + // :: error: [nullness.on.outer] @Nullable ScopingConstruct.Inner.@Nullable InnerInner nscinii() { throw new Error("not implemented"); } @@ -147,12 +147,12 @@ ScopingConstruct.Inner.InnerInner sciii() { throw new Error("not implemented"); } - // :: error: (nullness.on.outer) + // :: error: [nullness.on.outer] ScopingConstruct.@Nullable Inner.InnerInner scniii() { throw new Error("not implemented"); } - // :: error: (nullness.on.outer) + // :: error: [nullness.on.outer] ScopingConstruct.@Nullable Inner.@Nullable InnerInner scninii() { throw new Error("not implemented"); } @@ -169,17 +169,17 @@ ScopingConstruct.Inner.InnerInner sciii() { throw new Error("not implemented"); } - // :: error: (nullness.on.outer) + // :: error: [nullness.on.outer] @Nullable ScopingConstruct.Inner @Nullable [] nscin() { throw new Error("not implemented"); } - // :: error: (nullness.on.outer) + // :: error: [nullness.on.outer] @Nullable ScopingConstruct.Inner.InnerInner @Nullable [] nsciiin() { throw new Error("not implemented"); } - // :: error: (nullness.on.outer) + // :: error: [nullness.on.outer] @Nullable ScopingConstruct.Inner.@Nullable InnerInner @Nullable [] nsciniin() { throw new Error("not implemented"); } @@ -188,12 +188,12 @@ ScopingConstruct.Inner.InnerInner sciii() { throw new Error("not implemented"); } - // :: error: (nullness.on.outer) + // :: error: [nullness.on.outer] ScopingConstruct.@Nullable Inner.InnerInner @Nullable [] scniiin() { throw new Error("not implemented"); } - // :: error: (nullness.on.outer) + // :: error: [nullness.on.outer] ScopingConstruct.@Nullable Inner.@Nullable InnerInner @Nullable [] scniniin() { throw new Error("not implemented"); } @@ -214,10 +214,10 @@ void fscsn(ScopingConstruct.StaticNested scsn) {} void fscnsn(ScopingConstruct.@Nullable StaticNested scnsn) {} - // :: error: (nullness.on.outer) + // :: error: [nullness.on.outer] void fscnsnni(ScopingConstruct.@Nullable StaticNested.NestedInner scnsnni) {} - // :: error: (nullness.on.outer) + // :: error: [nullness.on.outer] void fscnsnnni(ScopingConstruct.@Nullable StaticNested.@Nullable NestedInner scnsnnni) {} void fsci(ScopingConstruct.Inner sci) {} @@ -226,21 +226,21 @@ void fsciii(ScopingConstruct.Inner.InnerInner sciii) {} void fscinii(ScopingConstruct.Inner.@Nullable InnerInner scinii) {} - // :: error: (nullness.on.outer) + // :: error: [nullness.on.outer] void fnsci(@Nullable ScopingConstruct.Inner nsci) {} - // :: error: (nullness.on.outer) + // :: error: [nullness.on.outer] void fnsciii(@Nullable ScopingConstruct.Inner.InnerInner nsciii) {} - // :: error: (nullness.on.outer) + // :: error: [nullness.on.outer] void fnscinii(@Nullable ScopingConstruct.Inner.@Nullable InnerInner nscinii) {} void fscni(ScopingConstruct.@Nullable Inner scni) {} - // :: error: (nullness.on.outer) + // :: error: [nullness.on.outer] void fscniii(ScopingConstruct.@Nullable Inner.InnerInner scniii) {} - // :: error: (nullness.on.outer) + // :: error: [nullness.on.outer] void fscninii(ScopingConstruct.@Nullable Inner.@Nullable InnerInner scninii) {} void fscsnni(ScopingConstruct.StaticNested.NestedInner scsnni) {} @@ -276,12 +276,12 @@ void lvscnsn() { } void lvscnsnni() { - // :: error: (nullness.on.outer) + // :: error: [nullness.on.outer] ScopingConstruct.@Nullable StaticNested.NestedInner scnsnni; } void lvscnsnnni() { - // :: error: (nullness.on.outer) + // :: error: [nullness.on.outer] ScopingConstruct.@Nullable StaticNested.@Nullable NestedInner scnsnnni; } @@ -298,17 +298,17 @@ void lvscinii() { } void lvnsci() { - // :: error: (nullness.on.outer) + // :: error: [nullness.on.outer] @Nullable ScopingConstruct.Inner nsci; } void lvnsciii() { - // :: error: (nullness.on.outer) + // :: error: [nullness.on.outer] @Nullable ScopingConstruct.Inner.InnerInner nsciii; } void lvnscinii() { - // :: error: (nullness.on.outer) + // :: error: [nullness.on.outer] @Nullable ScopingConstruct.Inner.@Nullable InnerInner nscinii; } @@ -317,12 +317,12 @@ void lvscni() { } void lvscniii() { - // :: error: (nullness.on.outer) + // :: error: [nullness.on.outer] ScopingConstruct.@Nullable Inner.InnerInner scniii; } void lvscninii() { - // :: error: (nullness.on.outer) + // :: error: [nullness.on.outer] ScopingConstruct.@Nullable Inner.@Nullable InnerInner scninii; } @@ -363,12 +363,12 @@ void rvscnsn() { } void rvscnsnni() { - // :: error: (nullness.on.outer) + // :: error: [nullness.on.outer] try (ScopingConstruct.@Nullable StaticNested.NestedInner scnsnni = null) {} } void rvscnsnnni() { - // :: error: (nullness.on.outer) + // :: error: [nullness.on.outer] try (ScopingConstruct.@Nullable StaticNested.@Nullable NestedInner scnsnnni = null) {} } @@ -385,17 +385,17 @@ void rvscinii() { } void rvnsci() { - // :: error: (nullness.on.outer) + // :: error: [nullness.on.outer] try (@Nullable ScopingConstruct.Inner nsci = null) {} } void rvnsciii() { - // :: error: (nullness.on.outer) + // :: error: [nullness.on.outer] try (@Nullable ScopingConstruct.Inner.InnerInner nsciii = null) {} } void rvnscinii() { - // :: error: (nullness.on.outer) + // :: error: [nullness.on.outer] try (@Nullable ScopingConstruct.Inner.@Nullable InnerInner nscinii = null) {} } @@ -404,12 +404,12 @@ void rvscni() { } void rvscniii() { - // :: error: (nullness.on.outer) + // :: error: [nullness.on.outer] try (ScopingConstruct.@Nullable Inner.InnerInner scniii = null) {} } void rvscninii() { - // :: error: (nullness.on.outer) + // :: error: [nullness.on.outer] try (ScopingConstruct.@Nullable Inner.@Nullable InnerInner scninii = null) {} } @@ -450,12 +450,12 @@ void fvscnsn() { } void fvscnsnni() { - // :: error: (nullness.on.outer) + // :: error: [nullness.on.outer] for (ScopingConstruct.@Nullable StaticNested.NestedInner scnsnni = null; ; ) {} } void fvscnsnnni() { - // :: error: (nullness.on.outer) + // :: error: [nullness.on.outer] for (ScopingConstruct.@Nullable StaticNested.@Nullable NestedInner scnsnnni = null; ; ) {} } @@ -472,17 +472,17 @@ void fvscinii() { } void fvnsci() { - // :: error: (nullness.on.outer) + // :: error: [nullness.on.outer] for (@Nullable ScopingConstruct.Inner nsci = null; ; ) {} } void fvnsciii() { - // :: error: (nullness.on.outer) + // :: error: [nullness.on.outer] for (@Nullable ScopingConstruct.Inner.InnerInner nsciii = null; ; ) {} } void fvnscinii() { - // :: error: (nullness.on.outer) + // :: error: [nullness.on.outer] for (@Nullable ScopingConstruct.Inner.@Nullable InnerInner nscinii = null; ; ) {} } @@ -491,12 +491,12 @@ void fvscni() { } void fvscniii() { - // :: error: (nullness.on.outer) + // :: error: [nullness.on.outer] for (ScopingConstruct.@Nullable Inner.InnerInner scniii = null; ; ) {} } void fvscninii() { - // :: error: (nullness.on.outer) + // :: error: [nullness.on.outer] for (ScopingConstruct.@Nullable Inner.@Nullable InnerInner scninii = null; ; ) {} } diff --git a/checker/tests/nullness/SelfDependentType.java b/checker/tests/nullness/SelfDependentType.java index a3eb3059ea1f..3cc0ea7fd2df 100644 --- a/checker/tests/nullness/SelfDependentType.java +++ b/checker/tests/nullness/SelfDependentType.java @@ -24,7 +24,7 @@ class SdtGraph1 { HashMap> childMap; - // :: error: (expression.parameter.name) + // :: error: [expression.parameter.name] public SdtGraph1(HashMap> childMap) { this.childMap = childMap; } @@ -34,7 +34,7 @@ class SdtGraph2 { HashMap> childMap; - // :: error: (expression.parameter.name) + // :: error: [expression.parameter.name] public SdtGraph2(HashMap> childMap) { this.childMap = childMap; } @@ -80,7 +80,7 @@ class SdtGraph11 { HashMap> childMapField; - // :: error: (expression.parameter.name) + // :: error: [expression.parameter.name] public SdtGraph11(HashMap> childMap) { this.childMapField = childMap; } @@ -90,7 +90,7 @@ class SdtGraph12 { HashMap> childMapField; - // :: error: (expression.parameter.name) + // :: error: [expression.parameter.name] public SdtGraph12(HashMap> childMap) { this.childMapField = childMap; } diff --git a/checker/tests/nullness/SetIteratorTest.java b/checker/tests/nullness/SetIteratorTest.java index 9c60dbbba1dd..f2801d453ae6 100644 --- a/checker/tests/nullness/SetIteratorTest.java +++ b/checker/tests/nullness/SetIteratorTest.java @@ -26,7 +26,7 @@ public String listChildren(String parentNode) { if (edges.get(parentNode) != null) { for (String childNode : edges.get(parentNode).keySet()) { - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] edges.get(parentNode).toString(); for (String childNodeEdgeX : edges.get(parentNode).get(childNode)) { childrenString += " " + childNode + "(" + childNodeEdgeX + ")"; @@ -42,7 +42,7 @@ public void listChildren2(String parentNode) { Iterator itor = edges.get(parentNode).keySet().iterator(); edges.get(parentNode).toString(); String s = itor.next(); - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] edges.get(parentNode).toString(); } } diff --git a/checker/tests/nullness/Simple2.java b/checker/tests/nullness/Simple2.java index df0cddb1b0e6..318608857427 100644 --- a/checker/tests/nullness/Simple2.java +++ b/checker/tests/nullness/Simple2.java @@ -5,7 +5,7 @@ public class Simple2 { @NonNull String f; public Simple2() { - // :: error: (method.invocation) + // :: error: [method.invocation] test(); f = "abc"; @@ -17,7 +17,7 @@ public void test() { public void a(Simple2 arg) { @Nullable String s = null; - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] s.hashCode(); } diff --git a/checker/tests/nullness/StaticInitializer.java b/checker/tests/nullness/StaticInitializer.java index 5d8767964fe3..ce37cc913839 100644 --- a/checker/tests/nullness/StaticInitializer.java +++ b/checker/tests/nullness/StaticInitializer.java @@ -4,7 +4,7 @@ public class StaticInitializer { public static String a; - // :: error: (initialization.static.field.uninitialized) + // :: error: [initialization.static.field.uninitialized] public static String b; static { @@ -15,9 +15,9 @@ public StaticInitializer() {} } class StaticInitializer2 { - // :: error: (initialization.static.field.uninitialized) + // :: error: [initialization.static.field.uninitialized] public static String a; - // :: error: (initialization.static.field.uninitialized) + // :: error: [initialization.static.field.uninitialized] public static String b; } diff --git a/checker/tests/nullness/StaticInitializer2.java b/checker/tests/nullness/StaticInitializer2.java index 5e100734f716..b5d2ff5eb90d 100644 --- a/checker/tests/nullness/StaticInitializer2.java +++ b/checker/tests/nullness/StaticInitializer2.java @@ -13,7 +13,7 @@ public class StaticInitializer2 { static String a; static { - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] a.toString(); } } diff --git a/checker/tests/nullness/SuperCall.java b/checker/tests/nullness/SuperCall.java index 58495625034c..c2c2687dfc8a 100644 --- a/checker/tests/nullness/SuperCall.java +++ b/checker/tests/nullness/SuperCall.java @@ -8,7 +8,7 @@ public A(@NonNull Object arg) {} public static class B extends A { public B(@Nullable Object arg) { - // :: error: (argument) + // :: error: [argument] super(arg); } } diff --git a/checker/tests/nullness/SuperConstructorInit.java b/checker/tests/nullness/SuperConstructorInit.java index dee483267958..3d182bff6f3f 100644 --- a/checker/tests/nullness/SuperConstructorInit.java +++ b/checker/tests/nullness/SuperConstructorInit.java @@ -11,7 +11,7 @@ public SuperConstructorInit() { public static class B extends SuperConstructorInit { String b; - // :: error: (initialization.fields.uninitialized) + // :: error: [initialization.fields.uninitialized] public B() { super(); a.toString(); diff --git a/checker/tests/nullness/SuppressWarningsPartialKeys.java b/checker/tests/nullness/SuppressWarningsPartialKeys.java index c9ab87bdbab9..d7a6c424c2e7 100644 --- a/checker/tests/nullness/SuppressWarningsPartialKeys.java +++ b/checker/tests/nullness/SuppressWarningsPartialKeys.java @@ -14,7 +14,7 @@ public class SuppressWarningsPartialKeys { @SuppressWarnings("type") @NonNull Object suppressed5() { - // :: error: (return) + // :: error: [return] return null; } @@ -25,49 +25,49 @@ public class SuppressWarningsPartialKeys { @SuppressWarnings("i") @NonNull Object err1() { - // :: error: (return) + // :: error: [return] return null; } @SuppressWarnings("") @NonNull Object err6() { - // :: error: (return) + // :: error: [return] return null; } @SuppressWarnings("nullness:i") @NonNull Object errn1() { - // :: error: (return) + // :: error: [return] return null; } @SuppressWarnings("nullness:eturn.type") @NonNull Object errn2() { - // :: error: (return) + // :: error: [return] return null; } @SuppressWarnings("nullness:typ") @NonNull Object errn3() { - // :: error: (return) + // :: error: [return] return null; } @SuppressWarnings("nullness:ype.incompatible") @NonNull Object errn4() { - // :: error: (return) + // :: error: [return] return null; } @SuppressWarnings("nullness:return.type.") @NonNull Object errn5() { - // :: error: (return) + // :: error: [return] return null; } @SuppressWarnings("nullness:") @NonNull Object errn6() { - // :: error: (return) + // :: error: [return] return null; } } diff --git a/checker/tests/nullness/SwitchTest.java b/checker/tests/nullness/SwitchTest.java index b972fe2c9c03..1d5bee6fa0de 100644 --- a/checker/tests/nullness/SwitchTest.java +++ b/checker/tests/nullness/SwitchTest.java @@ -2,7 +2,7 @@ public class SwitchTest { public static void main(String[] args) { - // :: error: (switching.nullable) + // :: error: [switching.nullable] switch (getNbl()) { case X: System.out.println("X"); diff --git a/checker/tests/nullness/Synchronization.java b/checker/tests/nullness/Synchronization.java index 5a4b07314cb7..2d08963d8844 100644 --- a/checker/tests/nullness/Synchronization.java +++ b/checker/tests/nullness/Synchronization.java @@ -5,7 +5,7 @@ public class Synchronization { // Plain public void bad() { Object o = null; - // :: error: (locking.nullable) + // :: error: [locking.nullable] synchronized (o) { } // should emit error } @@ -23,7 +23,7 @@ public void flow() { synchronized (o) { } // valid o = null; - // :: error: (locking.nullable) + // :: error: [locking.nullable] synchronized (o) { } // invalid } diff --git a/checker/tests/nullness/TestAssignment.java b/checker/tests/nullness/TestAssignment.java index 1233c386124a..7ea6df07d773 100644 --- a/checker/tests/nullness/TestAssignment.java +++ b/checker/tests/nullness/TestAssignment.java @@ -8,7 +8,7 @@ public class TestAssignment { void a() { @NonNull String f = "abc"; - // :: error: (assignment) + // :: error: [assignment] f = null; } diff --git a/checker/tests/nullness/TestPolyNull.java b/checker/tests/nullness/TestPolyNull.java index 791a42964fbc..5e5f8c9a1786 100644 --- a/checker/tests/nullness/TestPolyNull.java +++ b/checker/tests/nullness/TestPolyNull.java @@ -28,9 +28,9 @@ void test2() { retval[i] = "dummy"; } else { retval[i] = seq[i].getClass().toString(); - // :: error: (assignment) + // :: error: [assignment] retval[i] = null; - // :: error: (assignment) + // :: error: [assignment] retval[i] = nullable; } } diff --git a/checker/tests/nullness/ThisNodeTest.java b/checker/tests/nullness/ThisNodeTest.java index 0076d2d3fc67..c5424f0e22f8 100644 --- a/checker/tests/nullness/ThisNodeTest.java +++ b/checker/tests/nullness/ThisNodeTest.java @@ -6,12 +6,12 @@ public ThisNodeTest() { new Object() { void test() { @UnderInitialization ThisNodeTest l1 = ThisNodeTest.this; - // :: error: (assignment) + // :: error: [assignment] @Initialized ThisNodeTest l2 = ThisNodeTest.this; - // :: error: (method.invocation) + // :: error: [method.invocation] ThisNodeTest.this.foo(); - // :: error: (method.invocation) + // :: error: [method.invocation] foo(); } }; diff --git a/checker/tests/nullness/ThreadLocalTest.java b/checker/tests/nullness/ThreadLocalTest.java index b401570e8c24..f9fe310ec6f7 100644 --- a/checker/tests/nullness/ThreadLocalTest.java +++ b/checker/tests/nullness/ThreadLocalTest.java @@ -12,9 +12,9 @@ protected Integer initialValue() { } void foo() { - // :: error: (type.argument) + // :: error: [type.argument] new ThreadLocal<@NonNull Object>(); - // :: error: (type.argument) + // :: error: [type.argument] new InheritableThreadLocal<@NonNull Object>(); new ThreadLocal<@Nullable Object>(); new InheritableThreadLocal<@Nullable Object>(); diff --git a/checker/tests/nullness/ThreadLocalTest2.java b/checker/tests/nullness/ThreadLocalTest2.java index 98078b6ed939..a9940df17b0d 100644 --- a/checker/tests/nullness/ThreadLocalTest2.java +++ b/checker/tests/nullness/ThreadLocalTest2.java @@ -34,13 +34,13 @@ protected Integer initialValue() { class MyThreadLocalNnIncorrectOverride extends ThreadLocal<@NonNull Integer> { @Override - // :: error: (override.return) + // :: error: [override.return] protected @Nullable Integer initialValue() { return null; } } - // :: error: (method.not.overridden) + // :: error: [method.not.overridden] class MyThreadLocalNnNoOverride extends ThreadLocal<@NonNull Integer> {} class MyThreadLocalNble extends ThreadLocal<@Nullable Integer> { @@ -60,9 +60,9 @@ class MyThreadLocalNbleStrongerOverride extends ThreadLocal<@Nullable Integer> { class MyThreadLocalNbleNoOverride extends ThreadLocal<@Nullable Integer> {} void foo() { - // :: error: (type.argument) + // :: error: [type.argument] new ThreadLocal<@NonNull Object>(); - // :: error: (type.argument) + // :: error: [type.argument] new InheritableThreadLocal<@NonNull Object>(); new ThreadLocal<@Nullable Object>(); new InheritableThreadLocal<@Nullable Object>(); diff --git a/checker/tests/nullness/Throwing.java b/checker/tests/nullness/Throwing.java index 63e43bb59505..a53320018780 100644 --- a/checker/tests/nullness/Throwing.java +++ b/checker/tests/nullness/Throwing.java @@ -4,14 +4,14 @@ public class Throwing { String a; - // :: error: (initialization.fields.uninitialized) + // :: error: [initialization.fields.uninitialized] public Throwing(boolean throwError) { if (throwError) { throw new RuntimeException("not a real error"); } } - // :: error: (initialization.fields.uninitialized) + // :: error: [initialization.fields.uninitialized] public Throwing(int input) { try { throw new RuntimeException("not a real error"); diff --git a/checker/tests/nullness/ToArrayDiagnostics.java b/checker/tests/nullness/ToArrayDiagnostics.java index de023ebec406..afe786e96bdf 100644 --- a/checker/tests/nullness/ToArrayDiagnostics.java +++ b/checker/tests/nullness/ToArrayDiagnostics.java @@ -15,15 +15,15 @@ String[] ok4(ArrayList list) { } String[] warn1(ArrayList list) { - // :: error: (new.array) + // :: error: [new.array] String[] resultArray = new String[list.size()]; - // :: error: (return) :: warning: (toarray.nullable.elements.not.newarray) + // :: error: [return] :: warning: [toarray.nullable.elements.not.newarray] return list.toArray(resultArray); } String[] warn2(ArrayList list) { int size = list.size(); - // :: error: (new.array) :: error: (return) :: warning: + // :: error: [new.array] :: error: [return] :: warning: // (toarray.nullable.elements.mismatched.size) return list.toArray(new String[size]); } diff --git a/checker/tests/nullness/ToArrayNullness.java b/checker/tests/nullness/ToArrayNullness.java index affcb8eb0e28..2366ac71881b 100644 --- a/checker/tests/nullness/ToArrayNullness.java +++ b/checker/tests/nullness/ToArrayNullness.java @@ -9,7 +9,7 @@ public class ToArrayNullness { void listToArrayObject() { for (@Nullable Object o : nullableList.toArray()) {} - // :: error: (enhancedfor) + // :: error: [enhancedfor] for (@NonNull Object o : nullableList.toArray()) {} for (@Nullable Object o : nonnullList.toArray()) {} @@ -18,12 +18,12 @@ void listToArrayObject() { void listToArrayE() { for (@Nullable String o : nullableList.toArray(new @Nullable String[0])) {} - // :: error: (enhancedfor) + // :: error: [enhancedfor] for (@NonNull String o : nullableList.toArray(new @Nullable String[0])) {} - // TODOINVARR:: error: (argument) + // TODOINVARR:: error: [argument] for (@Nullable String o : nullableList.toArray(new @NonNull String[0])) {} - // TODOINVARR:: error: (argument) - // :: error: (enhancedfor) + // TODOINVARR:: error: [argument] + // :: error: [enhancedfor] for (@NonNull String o : nullableList.toArray(new @NonNull String[0])) {} for (@Nullable String o : nonnullList.toArray(new String[0])) {} @@ -39,7 +39,7 @@ void listToArrayE() { void colToArrayObject() { for (@Nullable Object o : nullableCol.toArray()) {} - // :: error: (enhancedfor) + // :: error: [enhancedfor] for (@NonNull Object o : nullableCol.toArray()) {} for (@Nullable Object o : nonnullCol.toArray()) {} @@ -48,12 +48,12 @@ void colToArrayObject() { void colToArrayE() { for (@Nullable String o : nullableCol.toArray(new @Nullable String[0])) {} - // :: error: (enhancedfor) + // :: error: [enhancedfor] for (@NonNull String o : nullableCol.toArray(new @Nullable String[0])) {} - // TODOINVARR:: error: (argument) + // TODOINVARR:: error: [argument] for (@Nullable String o : nullableCol.toArray(new @NonNull String[0])) {} - // TODOINVARR:: error: (argument) - // :: error: (enhancedfor) + // TODOINVARR:: error: [argument] + // :: error: [enhancedfor] for (@NonNull String o : nullableCol.toArray(new @NonNull String[0])) {} for (@Nullable String o : nonnullCol.toArray(new String[0])) {} @@ -72,31 +72,31 @@ void testHearusitics() { for (@Nullable String o : nonnullCol.toArray(new String[nonnullCol.size()])) {} for (@NonNull String o : nonnullCol.toArray(new String[nonnullCol.size()])) {} - // :: warning: (toarray.nullable.elements.mismatched.size) + // :: warning: [toarray.nullable.elements.mismatched.size] for (@Nullable String o : nonnullCol.toArray(new @Nullable String[] {null})) {} - // :: error: (enhancedfor) :: warning: (toarray.nullable.elements.mismatched.size) + // :: error: [enhancedfor] :: warning: [toarray.nullable.elements.mismatched.size] for (@NonNull String o : nonnullCol.toArray(new @Nullable String[] {null})) {} // Size 1 is too big for an empty array. Complain. TODO: Could allow as result is Nullable. - // :: error: (new.array) :: warning: (toarray.nullable.elements.mismatched.size) + // :: error: [new.array] :: warning: [toarray.nullable.elements.mismatched.size] for (@Nullable String o : nonnullCol.toArray(new String[1])) {} - // :: error: (enhancedfor) :: error: (new.array) :: warning: + // :: error: [enhancedfor] :: error: [new.array] :: warning: // (toarray.nullable.elements.mismatched.size) for (@NonNull String o : nonnullCol.toArray(new String[1])) {} // Array too big -> complain. TODO: Could allow as result is Nullable. - // :: error: (new.array) :: warning: (toarray.nullable.elements.mismatched.size) + // :: error: [new.array] :: warning: [toarray.nullable.elements.mismatched.size] for (@Nullable String o : nonnullCol.toArray(new String[nonnullCol.size() + 1])) {} // Array too big -> complain. - // :: error: (enhancedfor) :: error: (new.array) :: warning: + // :: error: [enhancedfor] :: error: [new.array] :: warning: // (toarray.nullable.elements.mismatched.size) for (@NonNull String o : nonnullCol.toArray(new String[nonnullCol.size() + 1])) {} // cannot handle the following cases for now // new array not size 0 or .size -> complain about cration. TODO: Could allow as result is // Nullable. - // :: error: (new.array) :: warning: (toarray.nullable.elements.mismatched.size) + // :: error: [new.array] :: warning: [toarray.nullable.elements.mismatched.size] for (@Nullable String o : nonnullCol.toArray(new String[nonnullCol.size() - 1])) {} // New array not size 0 or .size -> complain about creation. - // :: error: (enhancedfor) :: error: (new.array) :: warning: + // :: error: [enhancedfor] :: error: [new.array] :: warning: // (toarray.nullable.elements.mismatched.size) for (@NonNull String o : nonnullCol.toArray(new String[nonnullCol.size() - 1])) {} } diff --git a/checker/tests/nullness/TryWithResources.java b/checker/tests/nullness/TryWithResources.java index 5436db01274a..dfa925a075c0 100644 --- a/checker/tests/nullness/TryWithResources.java +++ b/checker/tests/nullness/TryWithResources.java @@ -12,7 +12,7 @@ void m1(InputStream stream) { void m2() { try (BufferedReader in = null) { - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] in.toString(); } catch (Exception e) { } diff --git a/checker/tests/nullness/TwoStaticInitBlocks.java b/checker/tests/nullness/TwoStaticInitBlocks.java index 92657676bab3..a5ca966b10e4 100644 --- a/checker/tests/nullness/TwoStaticInitBlocks.java +++ b/checker/tests/nullness/TwoStaticInitBlocks.java @@ -20,7 +20,7 @@ public class TwoStaticInitBlocks { { ws_regexp = "hello"; t.toString(); - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] s.toString(); } } diff --git a/checker/tests/nullness/TypeVarPrimitivesNullness.java b/checker/tests/nullness/TypeVarPrimitivesNullness.java index 0049b465a459..b7c10ecacae6 100644 --- a/checker/tests/nullness/TypeVarPrimitivesNullness.java +++ b/checker/tests/nullness/TypeVarPrimitivesNullness.java @@ -4,12 +4,12 @@ public class TypeVarPrimitivesNullness { void method(T tLong) { - // :: error: (unboxing.of.nullable) + // :: error: [unboxing.of.nullable] long l = tLong; } void methodIntersection(T tLong) { - // :: error: (unboxing.of.nullable) + // :: error: [unboxing.of.nullable] long l = tLong; } @@ -22,12 +22,12 @@ public class TypeVarPrimitivesNullness { } void method3(@Nullable T tLong) { - // :: error: (unboxing.of.nullable) + // :: error: [unboxing.of.nullable] long l = tLong; } void methodIntersection3(@Nullable T tLong) { - // :: error: (unboxing.of.nullable) + // :: error: [unboxing.of.nullable] long l = tLong; } } diff --git a/checker/tests/nullness/UnannoPrimitives.java b/checker/tests/nullness/UnannoPrimitives.java index c2bb0ce6befb..3ee2e07392ea 100644 --- a/checker/tests/nullness/UnannoPrimitives.java +++ b/checker/tests/nullness/UnannoPrimitives.java @@ -1,10 +1,10 @@ import org.checkerframework.checker.nullness.qual.*; public class UnannoPrimitives { - // :: error: (nullness.on.primitive) + // :: error: [nullness.on.primitive] @Nullable int f; - // :: error: (nullness.on.primitive) + // :: error: [nullness.on.primitive] @NonNull int g; void local() { @@ -15,10 +15,10 @@ void local() { int i = Integer.valueOf(99) + 1900; int j = 7 + 1900; - // :: error: (nullness.on.primitive) + // :: error: [nullness.on.primitive] @Nullable int f; - // :: error: (nullness.on.primitive) + // :: error: [nullness.on.primitive] @NonNull int g; } @@ -28,31 +28,31 @@ static void testDate() { String strDate = "/" + year; } - // :: error: (nullness.on.primitive) + // :: error: [nullness.on.primitive] @Nullable byte[] d1 = {4}; byte @Nullable [] d1b = {4}; - // :: error: (nullness.on.primitive) + // :: error: [nullness.on.primitive] @Nullable byte[][] twoD = {{4}}; - // :: error: (nullness.on.primitive) + // :: error: [nullness.on.primitive] @Nullable byte[][][] threeD = {{{4}}}; - // :: error: (nullness.on.primitive) + // :: error: [nullness.on.primitive] @Nullable byte[][][][] fourD = {{{{4}}}}; @SuppressWarnings("ha!") byte[] d2 = {4}; - // :: error: (nullness.on.primitive) + // :: error: [nullness.on.primitive] Object ar = new @Nullable byte[] {4}; - // :: error: (nullness.on.primitive) + // :: error: [nullness.on.primitive] Object ar2 = new @NonNull byte[] {42}; void testCasts(Integer i1) { Object i2 = (int) i1; - // :: error: (nullness.on.primitive) + // :: error: [nullness.on.primitive] Object i3 = (@Nullable int) i1; } } diff --git a/checker/tests/nullness/UnboxConditions.java b/checker/tests/nullness/UnboxConditions.java index 8ac19930616d..1b2dac3c2755 100644 --- a/checker/tests/nullness/UnboxConditions.java +++ b/checker/tests/nullness/UnboxConditions.java @@ -5,16 +5,16 @@ public static void main(String[] args) { Boolean b2 = null; Boolean b3 = null; Boolean b4 = null; - // :: error: (condition.nullable) + // :: error: [condition.nullable] if (b) {} - // :: error: (condition.nullable) + // :: error: [condition.nullable] b = b1 ? b : b; - // :: error: (condition.nullable) + // :: error: [condition.nullable] while (b2) {} do { - // :: error: (condition.nullable) + // :: error: [condition.nullable] } while (b3); - // :: error: (condition.nullable) + // :: error: [condition.nullable] for (; b4; ) {} // legal! for (; ; ) { diff --git a/checker/tests/nullness/Unboxing.java b/checker/tests/nullness/Unboxing.java index 30682b45b1df..baa143724613 100644 --- a/checker/tests/nullness/Unboxing.java +++ b/checker/tests/nullness/Unboxing.java @@ -5,7 +5,7 @@ public class Unboxing { @Nullable Integer f; public void t1() { - // :: error: (unboxing.of.nullable) + // :: error: [unboxing.of.nullable] int l = f + 1; // no error, since f has been unboxed f.toString(); @@ -13,11 +13,11 @@ public void t1() { public void t2() { try { - // :: error: (unboxing.of.nullable) + // :: error: [unboxing.of.nullable] int l = f + 1; } catch (NullPointerException npe) { // f is known to be null on the exception edge - // :: error: (unboxing.of.nullable) + // :: error: [unboxing.of.nullable] int m = f + 1; } // after the merge, f cannot be null @@ -25,19 +25,19 @@ public void t2() { } void foo(@Nullable Integer in) { - // :: error: (unboxing.of.nullable) + // :: error: [unboxing.of.nullable] int q = in; } int bar(@Nullable Integer in) { - // :: error: (unboxing.of.nullable) + // :: error: [unboxing.of.nullable] return in; } int barT(T in) { - // :: error: (unboxing.of.nullable) + // :: error: [unboxing.of.nullable] int q = in; - // :: error: (unboxing.of.nullable) + // :: error: [unboxing.of.nullable] return in; } } diff --git a/checker/tests/nullness/UnusedNullness.java b/checker/tests/nullness/UnusedNullness.java index bcd7b75d729c..d096b1868dcb 100644 --- a/checker/tests/nullness/UnusedNullness.java +++ b/checker/tests/nullness/UnusedNullness.java @@ -38,12 +38,12 @@ protected void protometh(@Prototype UnusedNullness this) { protected void meth() { // Otherwise it's not legal. - // :: error: (assignment) + // :: error: [assignment] this.ppt = null; } protected void useUnusedField1(@Prototype UnusedNullness this) { - // :: error: (assignment) + // :: error: [assignment] @NonNull Object x = this.ppt; } diff --git a/checker/tests/nullness/ValidType.java b/checker/tests/nullness/ValidType.java index 3b8e766522e5..22dc1f384096 100644 --- a/checker/tests/nullness/ValidType.java +++ b/checker/tests/nullness/ValidType.java @@ -4,9 +4,9 @@ public class ValidType { void t1() { - // :: error: (conflicting.annos) + // :: error: [conflicting.annos] @NonNull @Nullable String l1; - // :: error: (conflicting.annos) + // :: error: [conflicting.annos] @UnderInitialization @UnknownInitialization String f; } } diff --git a/checker/tests/nullness/VarInfoName.java b/checker/tests/nullness/VarInfoName.java index 6bb352d254b1..138cdd26a94a 100644 --- a/checker/tests/nullness/VarInfoName.java +++ b/checker/tests/nullness/VarInfoName.java @@ -8,7 +8,7 @@ public abstract static class BooleanAndVisitor extends Visitor { private boolean result; public BooleanAndVisitor(VarInfoName name) { - // :: error: (argument) :: warning: (nulltest.redundant) + // :: error: [argument] :: warning: [nulltest.redundant] result = (name.accept(this) != null); } } diff --git a/checker/tests/nullness/VarargsNullness.java b/checker/tests/nullness/VarargsNullness.java index 0c18f1227d60..a2ab9abb6277 100644 --- a/checker/tests/nullness/VarargsNullness.java +++ b/checker/tests/nullness/VarargsNullness.java @@ -27,13 +27,13 @@ public void testNonVarargs() { public void format1(java.lang.String a1, java.lang.@Nullable Object... a2) { int x = a2.length; // no warning - // :: error: (enhancedfor) + // :: error: [enhancedfor] for (@NonNull Object p : a2) // warning System.out.println(p); } public void format2(java.lang.String a1, java.lang.Object @Nullable ... a2) { - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] int x = a2.length; // warning for (@NonNull Object p : a2) // no warning System.out.println(p); diff --git a/checker/tests/nullness/VarargsNullness2.java b/checker/tests/nullness/VarargsNullness2.java index ff4a72a6a2dd..865f8bfde773 100644 --- a/checker/tests/nullness/VarargsNullness2.java +++ b/checker/tests/nullness/VarargsNullness2.java @@ -7,7 +7,7 @@ public static void method1(Object... args) {} public static void method2(Object @Nullable ... args) {} public static void main(String[] args) { - // :: error: (argument) + // :: error: [argument] // :: warning: non-varargs call of varargs method with inexact argument type for last // parameter; method1(null); diff --git a/checker/tests/nullness/VoidUse.java b/checker/tests/nullness/VoidUse.java index 3702e5bbf334..8325dc9a4027 100644 --- a/checker/tests/nullness/VoidUse.java +++ b/checker/tests/nullness/VoidUse.java @@ -20,14 +20,14 @@ class Scanner

{ public void scan(Object tree, P p) {} } - // :: error: (type.argument) + // :: error: [type.argument] class MyScanner extends Scanner { void use(MyScanner ms) { ms.scan(new Object(), null); } } - // :: error: (type.argument) + // :: error: [type.argument] class MyScanner2 extends Scanner<@Nullable Object> { void use(MyScanner2 ms) { ms.scan(new Object(), null); diff --git a/checker/tests/nullness/WeakHasherMapNonNull.java b/checker/tests/nullness/WeakHasherMapNonNull.java index 62613a24fb30..51d0938f6f80 100644 --- a/checker/tests/nullness/WeakHasherMapNonNull.java +++ b/checker/tests/nullness/WeakHasherMapNonNull.java @@ -12,9 +12,9 @@ public abstract class WeakHasherMapNonNull extends AbstractMap imple public boolean containsKey(@NonNull Object key) { // :: warning: [unchecked] unchecked cast K kkey = (K) key; - // :: error: (argument) + // :: error: [argument] hash.containsKey(null); - // :: error: (contracts.conditional.postcondition) + // :: error: [contracts.conditional.postcondition] return true; } } diff --git a/checker/tests/nullness/WeakHasherMapNullable.java b/checker/tests/nullness/WeakHasherMapNullable.java index 2ff04aed66eb..d1d67851f208 100644 --- a/checker/tests/nullness/WeakHasherMapNullable.java +++ b/checker/tests/nullness/WeakHasherMapNullable.java @@ -11,9 +11,9 @@ public abstract class WeakHasherMapNullable extends AbstractMap impl public boolean containsKey(@Nullable Object key) { // :: warning: [unchecked] unchecked cast K kkey = (K) key; - // :: error: (argument) + // :: error: [argument] hash.containsKey(null); - // :: error: (contracts.conditional.postcondition) + // :: error: [contracts.conditional.postcondition] return true; } } diff --git a/checker/tests/nullness/Wellformed.java b/checker/tests/nullness/Wellformed.java index 07900a940a4d..9be1650bf8ac 100644 --- a/checker/tests/nullness/Wellformed.java +++ b/checker/tests/nullness/Wellformed.java @@ -1,29 +1,29 @@ import org.checkerframework.checker.nullness.qual.*; public class Wellformed { - // :: error: (conflicting.annos) + // :: error: [conflicting.annos] @NonNull @Nullable Object f = null; - // :: error: (conflicting.annos) + // :: error: [conflicting.annos] class Gen1a {} class Gen1b { - // :: error: (conflicting.annos) + // :: error: [conflicting.annos] void m(T p) {} - // :: error: (conflicting.annos) + // :: error: [conflicting.annos] <@NonNull @Nullable T> void m2(T p) {} } - // :: error: (conflicting.annos) + // :: error: [conflicting.annos] class Gen1c<@NonNull @Nullable TTT> {} class Gen2a<@Nullable T> {} - // :: error: (bound) + // :: error: [bound] class Gen2b<@Nullable T extends Object> {} - // :: error: (bound) + // :: error: [bound] class Gen2c<@Nullable T extends @NonNull Object> {} class Gen3a { @@ -43,7 +43,7 @@ class Gen3b { } class Gen4 { - // :: error: (initialization.field.uninitialized) + // :: error: [initialization.field.uninitialized] @NonNull T f; @NonNull T get() { @@ -61,9 +61,9 @@ class Gen5c extends Gen5a<@Nullable S> {} class Gen6a {} - // :: error: (type.argument) + // :: error: [type.argument] class Gen6b extends Gen6a<@Nullable Object> {} - // :: error: (type.argument) + // :: error: [type.argument] class Gen6c extends Gen6a<@Nullable S> {} } diff --git a/checker/tests/nullness/WhileTest.java b/checker/tests/nullness/WhileTest.java index 44d1b0783048..1019a07437e5 100644 --- a/checker/tests/nullness/WhileTest.java +++ b/checker/tests/nullness/WhileTest.java @@ -11,13 +11,13 @@ public static void main(String[] args) { public void testwhile1() { z = null; - // :: error: (assignment) + // :: error: [assignment] nnz = z; while (z == null) { break; } - // :: error: (assignment) + // :: error: [assignment] nnz = z; nnz.toString(); } @@ -33,7 +33,7 @@ public void testdo1() { do { break; } while (z == null); - // :: error: (assignment) + // :: error: [assignment] nnz = z; } @@ -48,7 +48,7 @@ public void testfor1() { for (; z == null; ) { break; } - // :: error: (assignment) + // :: error: [assignment] nnz = z; } diff --git a/checker/tests/nullness/WildcardGLB.java b/checker/tests/nullness/WildcardGLB.java index d6198b57a2d3..3307f853b55a 100644 --- a/checker/tests/nullness/WildcardGLB.java +++ b/checker/tests/nullness/WildcardGLB.java @@ -18,28 +18,28 @@ E getE() { // wildcard because the glb of the type parameter bound and the wildcard extends bound does not // exist. I don't think this leads to unsoundness, but it makes it so that this method can't be // called without an error. The method testUse below demos this. - // :: error: (type.argument) + // :: error: [type.argument] void use(MyClass> s) { - // :: error: (assignment) + // :: error: [assignment] List f = s.getE(); List<@Nullable String> f2 = s.getE(); } void testUse( - // :: error: (type.argument) + // :: error: [type.argument] MyClass> p1, // A comment to force a line break. MyClass> p2) { use(p1); - // :: error: (argument) + // :: error: [argument] use(p2); } // capture#196 extends @NonNull ArrayList<@NonNull String> - // :: error: (type.argument) + // :: error: [type.argument] void use2(MyClass> s) { // error: type.argument List f = s.getE(); - // :: error: (assignment) + // :: error: [assignment] List<@Nullable String> f2 = s.getE(); // error: assignment } @@ -50,16 +50,16 @@ E getE() { } // capture#952 extends @NonNull ArrayList<@Nullable String> - // :: error: (type.argument) + // :: error: [type.argument] void use3(MyClass2> s) { - // :: error: (assignment) + // :: error: [assignment] List f = s.getE(); List<@Nullable String> f2 = s.getE(); } - // :: error: (type.argument) + // :: error: [type.argument] void use4(MyClass2> s) { - // :: error: (assignment) + // :: error: [assignment] List f = s.getE(); List<@Nullable String> f2 = s.getE(); // ok } diff --git a/checker/tests/nullness/WildcardSubtype.java b/checker/tests/nullness/WildcardSubtype.java index fc76e0a6599b..021abb37601a 100644 --- a/checker/tests/nullness/WildcardSubtype.java +++ b/checker/tests/nullness/WildcardSubtype.java @@ -15,39 +15,39 @@ class MyClassVisitor extends Visitor<@Nullable MyClass> {} class NonNullMyClassVisitor extends Visitor<@NonNull MyClass> {} void test(MyClassVisitor myClassVisitor, NonNullMyClassVisitor nonNullMyClassVisitor) { - // :: error: (argument) + // :: error: [argument] take(new Visitor<@Nullable Object>()); - // :: error: (argument) + // :: error: [argument] take(new Visitor<@Nullable Object>()); Visitor visitor1 = myClassVisitor; Visitor visitor2 = nonNullMyClassVisitor; - // :: error: (assignment) + // :: error: [assignment] Visitor visitor3 = myClassVisitor; Visitor visitor4 = nonNullMyClassVisitor; - // :: error: (assignment) + // :: error: [assignment] Visitor visitor5 = new MyClassVisitor(); - // :: error: (assignment) + // :: error: [assignment] Visitor visitor6 = new MyClassVisitor(); - // :: error: (argument) + // :: error: [argument] take(new MyClassVisitor()); - // :: error: (argument) + // :: error: [argument] take(new MyClassVisitor()); } void take(Visitor<@NonNull ? extends @NonNull Object> v) {} void bar() { - // :: error: (argument) + // :: error: [argument] take(new Visitor<@Nullable Object>()); - // :: error: (argument) + // :: error: [argument] take(new MyClassVisitor()); } void baz() { - // :: error: (argument) + // :: error: [argument] take(new MyClassVisitor()); take(new NonNullMyClassVisitor()); } diff --git a/checker/tests/nullness/WildcardSubtype2.java b/checker/tests/nullness/WildcardSubtype2.java index c8e230567c44..081717f74d5d 100644 --- a/checker/tests/nullness/WildcardSubtype2.java +++ b/checker/tests/nullness/WildcardSubtype2.java @@ -15,40 +15,40 @@ class MyClassVisitor extends Visitor<@Nullable MyClass, @Nullable MyClass> {} class NonNullMyClassVisitor extends Visitor<@NonNull MyClass, @NonNull MyClass> {} void test(MyClassVisitor myClassVisitor, NonNullMyClassVisitor nonNullMyClassVisitor) { - // :: error: (argument) + // :: error: [argument] take(new Visitor<@Nullable Object, @Nullable Object>()); - // :: error: (argument) + // :: error: [argument] take(new Visitor<@Nullable Object, @Nullable Object>()); Visitor visitor1 = myClassVisitor; Visitor visitor2 = nonNullMyClassVisitor; - // :: error: (assignment) + // :: error: [assignment] Visitor visitor3 = myClassVisitor; Visitor visitor4 = nonNullMyClassVisitor; Visitor visitor5 = - // :: error: (assignment) + // :: error: [assignment] new MyClassVisitor(); Visitor visitor6 = - // :: error: (assignment) + // :: error: [assignment] new MyClassVisitor(); - // :: error: (argument) + // :: error: [argument] take(new MyClassVisitor()); - // :: error: (argument) + // :: error: [argument] take(new MyClassVisitor()); } void take(Visitor<@NonNull ? extends @NonNull Object, @NonNull ? extends @NonNull Object> v) {} void bar() { - // :: error: (argument) + // :: error: [argument] take(new Visitor<@Nullable Object, @Nullable Object>()); - // :: error: (argument) + // :: error: [argument] take(new MyClassVisitor()); } void baz() { - // :: error: (argument) + // :: error: [argument] take(new MyClassVisitor()); take(new NonNullMyClassVisitor()); } diff --git a/checker/tests/nullness/flow/EisopIssue300.java b/checker/tests/nullness/flow/EisopIssue300.java index 36b661eff323..67b8810ac9e6 100644 --- a/checker/tests/nullness/flow/EisopIssue300.java +++ b/checker/tests/nullness/flow/EisopIssue300.java @@ -17,7 +17,7 @@ void test() { return; } currentNode.setFieldNull(currentNode); - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] currentNode.toString(); } diff --git a/checker/tests/nullness/flow/EisopIssue300B.java b/checker/tests/nullness/flow/EisopIssue300B.java index d5c9aab6318c..55fc768003d1 100644 --- a/checker/tests/nullness/flow/EisopIssue300B.java +++ b/checker/tests/nullness/flow/EisopIssue300B.java @@ -17,7 +17,7 @@ public static void main(String[] args) { } r.m(r.f); - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] r.f.toString(); } } diff --git a/checker/tests/nullness/flow/EisopIssue300C.java b/checker/tests/nullness/flow/EisopIssue300C.java index 25b9e15e4eea..fa466d870909 100644 --- a/checker/tests/nullness/flow/EisopIssue300C.java +++ b/checker/tests/nullness/flow/EisopIssue300C.java @@ -25,7 +25,7 @@ public static void main(String[] args) { if (r.getF() != null) { r.getF().m2(); - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] r.getF().toString(); } } diff --git a/checker/tests/nullness/flow/EisopIssue553.java b/checker/tests/nullness/flow/EisopIssue553.java index 24ce4ec4f20c..e202036dffe8 100644 --- a/checker/tests/nullness/flow/EisopIssue553.java +++ b/checker/tests/nullness/flow/EisopIssue553.java @@ -13,13 +13,13 @@ static void n(Object o) { public static void main(String[] args) { EisopIssue553 x = null; Object o = x.sfield; - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] o = x.field; if (x.sfield == null) { return; } x.n(x.sfield); - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] x.sfield.toString(); } } diff --git a/checker/tests/nullness/flow/Issue1214.java b/checker/tests/nullness/flow/Issue1214.java index a74567da3de3..926f30e89ae6 100644 --- a/checker/tests/nullness/flow/Issue1214.java +++ b/checker/tests/nullness/flow/Issue1214.java @@ -9,7 +9,7 @@ static String ng1() { } catch (Exception e) { s = null; } - // :: error: (return) + // :: error: [return] return s; } @@ -23,7 +23,7 @@ static String ng2(int x) { } catch (Exception ee) { } } - // :: error: (return) + // :: error: [return] return s; } @@ -39,7 +39,7 @@ static String ng3() { s = null; } } - // :: error: (return) + // :: error: [return] return s; } @@ -50,7 +50,7 @@ static String ng4(int data) { } catch (Exception e) { s = null; } - // :: error: (return) + // :: error: [return] return s; } @@ -64,7 +64,7 @@ static String ng5(short data) { } catch (Exception ee) { } } - // :: error: (return) + // :: error: [return] return s; } @@ -80,7 +80,7 @@ static String ng6(int data) { s = null; } } - // :: error: (return) + // :: error: [return] return s; } diff --git a/checker/tests/nullness/flow/Issue3267.java b/checker/tests/nullness/flow/Issue3267.java index fac6ccd9f8eb..c8d7818d3fb2 100644 --- a/checker/tests/nullness/flow/Issue3267.java +++ b/checker/tests/nullness/flow/Issue3267.java @@ -6,7 +6,7 @@ public class Issue3267 { void m1(@Nullable Object obj) { if (true) { - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] obj.toString(); } } @@ -14,7 +14,7 @@ void m1(@Nullable Object obj) { void m2(@Nullable Object obj) { if (obj != null) {} if (true) { - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] obj.toString(); } } @@ -24,7 +24,7 @@ void m3(@Nullable Object obj) { } else { } if (true) { - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] obj.toString(); } } @@ -32,7 +32,7 @@ void m3(@Nullable Object obj) { void m4(@Nullable Object obj) { boolean bool = obj != null; if (true) { - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] obj.toString(); } } diff --git a/checker/tests/nullness/flow/Issue3275.java b/checker/tests/nullness/flow/Issue3275.java index 86b7c2e0f2f4..909e014cba63 100644 --- a/checker/tests/nullness/flow/Issue3275.java +++ b/checker/tests/nullness/flow/Issue3275.java @@ -28,7 +28,7 @@ void return_en(@Nullable Object obj) { void return_eet(@Nullable Object obj) { if ((obj == null) == true) { - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] obj.toString(); } } @@ -41,7 +41,7 @@ void return_eef(@Nullable Object obj) { void return_eeb(@Nullable Object obj) { if ((obj == null) == b) { - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] obj.toString(); } } @@ -54,14 +54,14 @@ void return_ent(@Nullable Object obj) { void return_enf(@Nullable Object obj) { if ((obj == null) != false) { - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] obj.toString(); } } void return_enb(@Nullable Object obj) { if ((obj == null) != b) { - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] obj.toString(); } } @@ -74,21 +74,21 @@ void return_net(@Nullable Object obj) { void return_nef(@Nullable Object obj) { if ((obj != null) == false) { - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] obj.toString(); } } void return_neb(@Nullable Object obj) { if ((obj != null) == b) { - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] obj.toString(); } } void return_nnt(@Nullable Object obj) { if ((obj != null) != true) { - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] obj.toString(); } } @@ -101,7 +101,7 @@ void return_nnf(@Nullable Object obj) { void return_nnb(@Nullable Object obj) { if ((obj != null) != b) { - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] obj.toString(); } } @@ -126,7 +126,7 @@ void assign_en(@Nullable Object obj) { void assign_eet(@Nullable Object obj) { if ((obj == null) == true) { - // :: error: (assignment) + // :: error: [assignment] f = obj; } } @@ -139,7 +139,7 @@ void assign_eef(@Nullable Object obj) { void assign_eeb(@Nullable Object obj) { if ((obj == null) == b) { - // :: error: (assignment) + // :: error: [assignment] f = obj; } } @@ -152,14 +152,14 @@ void assign_ent(@Nullable Object obj) { void assign_enf(@Nullable Object obj) { if ((obj == null) != false) { - // :: error: (assignment) + // :: error: [assignment] f = obj; } } void assign_enb(@Nullable Object obj) { if ((obj == null) != b) { - // :: error: (assignment) + // :: error: [assignment] f = obj; } } @@ -172,21 +172,21 @@ void assign_net(@Nullable Object obj) { void assign_nef(@Nullable Object obj) { if ((obj != null) == false) { - // :: error: (assignment) + // :: error: [assignment] f = obj; } } void assign_neb(@Nullable Object obj) { if ((obj != null) == b) { - // :: error: (assignment) + // :: error: [assignment] f = obj; } } void assign_nnt(@Nullable Object obj) { if ((obj != null) != true) { - // :: error: (assignment) + // :: error: [assignment] f = obj; } } @@ -199,7 +199,7 @@ void assign_nnf(@Nullable Object obj) { void assign_nnb(@Nullable Object obj) { if ((obj != null) != b) { - // :: error: (assignment) + // :: error: [assignment] f = obj; } } diff --git a/checker/tests/nullness/flow/LambdaFlow.java b/checker/tests/nullness/flow/LambdaFlow.java index 4fe6239367be..9912c0a942c4 100644 --- a/checker/tests/nullness/flow/LambdaFlow.java +++ b/checker/tests/nullness/flow/LambdaFlow.java @@ -48,7 +48,7 @@ void flowIntoThenOutOfLambda(@Nullable String param) { void flowIntoLambdaField() { if (field != null) { Function a = - // :: error: (return) + // :: error: [return] s -> field; } } @@ -78,7 +78,7 @@ void flowOutOfLambda2() { void flowIntoThenOutOfLambda() { if (field != null) { - // :: error: (type.arguments.not.inferred) :: error: (assignment) + // :: error: [type.arguments.not.inferred] :: error: [assignment] @NonNull String g = foo(s -> field); } } diff --git a/checker/tests/nullness/flow/PureAndFlow.java b/checker/tests/nullness/flow/PureAndFlow.java index 6e06a2fa3702..ed03cdc976ef 100644 --- a/checker/tests/nullness/flow/PureAndFlow.java +++ b/checker/tests/nullness/flow/PureAndFlow.java @@ -8,25 +8,25 @@ public abstract class PureAndFlow { void nonpure(String s1) {} @org.checkerframework.dataflow.qual.Pure - // :: warning: (purity.deterministic.void.method) + // :: warning: [purity.deterministic.void.method] void pure(String s2) {} @org.checkerframework.dataflow.qual.Deterministic - // :: warning: (purity.deterministic.void.method) + // :: warning: [purity.deterministic.void.method] void det(String s3) {} @org.checkerframework.dataflow.qual.Pure - // :: warning: (purity.deterministic.void.method) + // :: warning: [purity.deterministic.void.method] abstract void abstractpure(String s4); @org.checkerframework.dataflow.qual.Deterministic - // :: warning: (purity.deterministic.void.method) + // :: warning: [purity.deterministic.void.method] abstract void abstractdet(String s4); void withNonRow() { if (s2 != null) { nonpure("m"); - // :: error: (argument) + // :: error: [argument] pure(s2); } } @@ -40,21 +40,21 @@ void withPure() { interface IFace { @org.checkerframework.dataflow.qual.Pure - // :: warning: (purity.deterministic.void.method) + // :: warning: [purity.deterministic.void.method] void ifacepure(String s); @org.checkerframework.dataflow.qual.Deterministic - // :: warning: (purity.deterministic.void.method) + // :: warning: [purity.deterministic.void.method] void ifacedet(String s); } class Cons { @org.checkerframework.dataflow.qual.Pure - // :: warning: (purity.deterministic.constructor) + // :: warning: [purity.deterministic.constructor] Cons(String s) {} @org.checkerframework.dataflow.qual.Deterministic - // :: warning: (purity.deterministic.constructor) + // :: warning: [purity.deterministic.constructor] Cons(int i) {} } } diff --git a/checker/tests/nullness/flow/PurityError.java b/checker/tests/nullness/flow/PurityError.java index 9e52cdc9c6ac..61819c9a8ebc 100644 --- a/checker/tests/nullness/flow/PurityError.java +++ b/checker/tests/nullness/flow/PurityError.java @@ -7,7 +7,7 @@ void method() {} @Pure Object method2() { - // :: error: (purity.not.deterministic.call) + // :: error: [purity.not.deterministic.call] method(); return ""; } diff --git a/checker/tests/nullness/flow/TestNullnessUtil.java b/checker/tests/nullness/flow/TestNullnessUtil.java index 06539dd163e4..aad452181cb1 100644 --- a/checker/tests/nullness/flow/TestNullnessUtil.java +++ b/checker/tests/nullness/flow/TestNullnessUtil.java @@ -23,7 +23,7 @@ void testArr1(@Nullable Object @NonNull [] a) { // one way to use as a cast: @NonNull Object[] l2 = NullnessUtil.castNonNullDeep(a); // Careful, the non-deep version only casts the main modifier. - // :: error: (assignment) + // :: error: [assignment] @NonNull Object[] l2b = NullnessUtil.castNonNull(a); // OK @Nullable Object[] l2c = NullnessUtil.castNonNull(a); @@ -33,7 +33,7 @@ void testArr1b(@Nullable Object @Nullable [] a) { // one way to use as a cast: @NonNull Object[] l2 = NullnessUtil.castNonNullDeep(a); // Careful, the non-deep version only casts the main modifier. - // :: error: (assignment) + // :: error: [assignment] @NonNull Object[] l2b = NullnessUtil.castNonNull(a); // OK @Nullable Object[] l2c = NullnessUtil.castNonNull(a); @@ -63,7 +63,7 @@ void testArr3(@Nullable Object @NonNull [] a) { */ void testMultiArr1(@Nullable Object @NonNull [] @Nullable [] a) { - // :: error: (assignment) :: error: (accessing.nullable) + // :: error: [assignment] :: error: [accessing.nullable] @NonNull Object l3 = a[0][0]; // one way to use as a cast: @NonNull Object[][] l4 = NullnessUtil.castNonNullDeep(a); @@ -75,7 +75,7 @@ void testMultiArr2(@Nullable Object @NonNull [] @Nullable [] a) { } void testMultiArr3(@Nullable Object @Nullable [] @Nullable [] @Nullable [] a) { - // :: error: (dereference.of.nullable) :: error: (accessing.nullable) + // :: error: [dereference.of.nullable] :: error: [accessing.nullable] a[0][0][0].toString(); // another way to use as a cast: NullnessUtil.castNonNullDeep(a)[0][0][0].toString(); diff --git a/checker/tests/nullness/flow/TestOpt.java b/checker/tests/nullness/flow/TestOpt.java index e0da08b0f70f..55b02f2b9a20 100644 --- a/checker/tests/nullness/flow/TestOpt.java +++ b/checker/tests/nullness/flow/TestOpt.java @@ -11,7 +11,7 @@ void foo1(@Nullable Object p) { void foo1b(@Nullable Object p) { if (!Opt.isPresent(p)) { - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] p.toString(); } } @@ -33,7 +33,7 @@ void foo4(@Nullable Object p) { } void foo4b(@Nullable Object p) { - // :: error: (argument) + // :: error: [argument] String s = Opt.map(p, null); } @@ -42,7 +42,7 @@ void foo5(@Nullable Object p) { } void foo5b(@Nullable Object p) { - // :: error: (argument) + // :: error: [argument] @NonNull Object o = Opt.orElse(p, null); } @@ -51,7 +51,7 @@ void foo6(@Nullable Object p) { } void foo6b(@Nullable Object p) { - // :: error: (return) + // :: error: [return] @NonNull Object o = Opt.orElseGet(p, () -> null); } @@ -65,8 +65,8 @@ void foo7(Object p) { void foo7b(@Nullable Object p) { try { - // :: error: (assignment) - // :: error: (type.arguments.not.inferred) + // :: error: [assignment] + // :: error: [type.arguments.not.inferred] @NonNull Object o = Opt.orElseThrow(p, () -> null); } catch (Throwable t) { // p was null diff --git a/checker/tests/nullness/generics/AnnotatedGenerics.java b/checker/tests/nullness/generics/AnnotatedGenerics.java index f7a778406854..12cbeec2daff 100644 --- a/checker/tests/nullness/generics/AnnotatedGenerics.java +++ b/checker/tests/nullness/generics/AnnotatedGenerics.java @@ -4,7 +4,7 @@ public class AnnotatedGenerics { public static void testNullableTypeVariable() { class Test { - // :: error: (initialization.field.uninitialized) + // :: error: [initialization.field.uninitialized] T f; @Nullable T get() { @@ -12,7 +12,7 @@ class Test { } } Test> l = new Test<>(); - // :: error: (iterating.over.nullable) + // :: error: [iterating.over.nullable] for (String s : l.get()) {} } @@ -43,7 +43,7 @@ static void test() { MyClass c = new MyClass<>(); String c1 = c.next(); @Nullable String c2 = c.next(); - // :: error: (assignment) + // :: error: [assignment] @NonNull String c3 = c.next(); } } @@ -58,7 +58,7 @@ public void compare2(@NonNull T a1, @NonNull T a2) { } public void compare3(T a1, @Nullable T a2) { - // :: error: (argument) + // :: error: [argument] a1.compareTo(a2); } } diff --git a/checker/tests/nullness/generics/AnnotatedGenerics2.java b/checker/tests/nullness/generics/AnnotatedGenerics2.java index cc42d56b0d1e..bfaee6d17cbf 100644 --- a/checker/tests/nullness/generics/AnnotatedGenerics2.java +++ b/checker/tests/nullness/generics/AnnotatedGenerics2.java @@ -4,10 +4,10 @@ public class AnnotatedGenerics2 { // Top-level class to ensure that both classes are processed. class AnnotatedGenerics2Nble { - // :: error: (initialization.field.uninitialized) + // :: error: [initialization.field.uninitialized] @NonNull T myFieldNN; @Nullable T myFieldNble; - // :: error: (initialization.field.uninitialized) + // :: error: [initialization.field.uninitialized] T myFieldT; /* TODO: This test case gets affected by flow inference. @@ -17,13 +17,13 @@ void fields() { myFieldNble = myFieldNN; myFieldT = myFieldNN; - // TODO:: error: (assignment) + // TODO:: error: [assignment] myFieldNN = myFieldNble; myFieldNble = myFieldNble; - // TODO:: error: (assignment) + // TODO:: error: [assignment] myFieldT = myFieldNble; - // TODO:: error: (assignment) + // TODO:: error: [assignment] myFieldNN = myFieldT; myFieldNble = myFieldT; myFieldT = myFieldT; @@ -37,15 +37,15 @@ void fields1() { } void fields2() { - // :: error: (assignment) + // :: error: [assignment] myFieldNN = myFieldNble; myFieldNble = myFieldNble; - // :: error: (assignment) + // :: error: [assignment] myFieldT = myFieldNble; } void fields3() { - // :: error: (assignment) + // :: error: [assignment] myFieldNN = myFieldT; myFieldNble = myFieldT; myFieldT = myFieldT; @@ -56,13 +56,13 @@ void params(@NonNull T myParamNN, @Nullable T myParamNble, T myParamT) { myFieldNble = myParamNN; myFieldT = myParamNN; - // :: error: (assignment) + // :: error: [assignment] myFieldNN = myParamNble; myFieldNble = myParamNble; - // :: error: (assignment) + // :: error: [assignment] myFieldT = myParamNble; - // :: error: (assignment) + // :: error: [assignment] myFieldNN = myParamT; myFieldNble = myParamT; myFieldT = myParamT; @@ -70,10 +70,10 @@ void params(@NonNull T myParamNN, @Nullable T myParamNble, T myParamT) { } class AnnotatedGenerics2NN { - // :: error: (initialization.field.uninitialized) + // :: error: [initialization.field.uninitialized] @NonNull T myFieldNN; @Nullable T myFieldNble; - // :: error: (initialization.field.uninitialized) + // :: error: [initialization.field.uninitialized] T myFieldT; /* TODO: This test case gets affected by flow inference. @@ -83,13 +83,13 @@ void fields() { myFieldNble = myFieldNN; myFieldT = myFieldNN; - // TODO:: error: (assignment) + // TODO:: error: [assignment] myFieldNN = myFieldNble; myFieldNble = myFieldNble; - // TODO:: error: (assignment) + // TODO:: error: [assignment] myFieldT = myFieldNble; - // TODO:: error: (assignment) + // TODO:: error: [assignment] myFieldNN = myFieldT; myFieldNble = myFieldT; myFieldT = myFieldT; @@ -103,10 +103,10 @@ void fields1() { } void fields2() { - // :: error: (assignment) + // :: error: [assignment] myFieldNN = myFieldNble; myFieldNble = myFieldNble; - // :: error: (assignment) + // :: error: [assignment] myFieldT = myFieldNble; } @@ -121,10 +121,10 @@ void params(@NonNull T myParamNN, @Nullable T myParamNble, T myParamT) { myFieldNble = myParamNN; myFieldT = myParamNN; - // :: error: (assignment) + // :: error: [assignment] myFieldNN = myParamNble; myFieldNble = myParamNble; - // :: error: (assignment) + // :: error: [assignment] myFieldT = myParamNble; myFieldNN = myParamT; diff --git a/checker/tests/nullness/generics/AnnotatedGenerics3.java b/checker/tests/nullness/generics/AnnotatedGenerics3.java index 3abb3e9b31fa..31613e210d00 100644 --- a/checker/tests/nullness/generics/AnnotatedGenerics3.java +++ b/checker/tests/nullness/generics/AnnotatedGenerics3.java @@ -13,19 +13,19 @@ void setNull(Cell<@Nullable T> p) { } void indirect(Cell p) { - // :: error: (argument) + // :: error: [argument] setNull(p); } void setField(@Nullable T p) { - // :: error: (assignment) + // :: error: [assignment] this.f = p; } } void run() { Cell<@NonNull Object> c = new Cell<>(new Object()); - // :: error: (argument) + // :: error: [argument] c.setNull(c); c.f.hashCode(); diff --git a/checker/tests/nullness/generics/AnnotatedTypeParams.java b/checker/tests/nullness/generics/AnnotatedTypeParams.java index bb05de20dc14..5ac67df1e8b8 100644 --- a/checker/tests/nullness/generics/AnnotatedTypeParams.java +++ b/checker/tests/nullness/generics/AnnotatedTypeParams.java @@ -7,12 +7,12 @@ T get() { void testPositive() { MyClass<@Nullable String> l = new MyClass<>(); - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] l.get().toString(); } void testInvalidParam() { - // :: error: (type.argument) + // :: error: [type.argument] MyClass<@NonNull String> l; } } diff --git a/checker/tests/nullness/generics/AnnotatedTypeParams2.java b/checker/tests/nullness/generics/AnnotatedTypeParams2.java index 4f42b090a2e4..f7e081c8601d 100644 --- a/checker/tests/nullness/generics/AnnotatedTypeParams2.java +++ b/checker/tests/nullness/generics/AnnotatedTypeParams2.java @@ -10,12 +10,12 @@ public class AnnotatedTypeParams2 { void testPositive() { SomeClass<@Nullable String> l = new SomeClass<>(); - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] l.get().toString(); } void testInvalidParam() { - // :: error: (type.argument) + // :: error: [type.argument] SomeClass<@NonNull String> l; } } diff --git a/checker/tests/nullness/generics/AnonymousClass.java b/checker/tests/nullness/generics/AnonymousClass.java index 8349d77c9158..1860335faa66 100644 --- a/checker/tests/nullness/generics/AnonymousClass.java +++ b/checker/tests/nullness/generics/AnonymousClass.java @@ -5,13 +5,13 @@ public class AnonymousClass { class Bound {} void test() { - // :: error: (type.argument) + // :: error: [type.argument] new Bound<@Nullable String>() {}; } // The dummy parameter tests ParamApplier void test(Object dummy) { - // :: error: (type.argument) + // :: error: [type.argument] new Bound<@Nullable String>() {}; } } diff --git a/checker/tests/nullness/generics/BoundedWildcardTest.java b/checker/tests/nullness/generics/BoundedWildcardTest.java index 7579a0eed543..ac99e1db649b 100644 --- a/checker/tests/nullness/generics/BoundedWildcardTest.java +++ b/checker/tests/nullness/generics/BoundedWildcardTest.java @@ -18,26 +18,26 @@ public void initLoc(List s) { } } - // :: error: (bound) + // :: error: [bound] public void initLoc1(@Nullable List<@Nullable ? extends Styleable> s) { - // :: error: (iterating.over.nullable) + // :: error: [iterating.over.nullable] for (Styleable c : s) { locChildren(c); } } public void initLoc2(@Nullable List<@Nullable ? extends @Nullable Styleable> s) { - // :: error: (iterating.over.nullable) + // :: error: [iterating.over.nullable] for (Styleable c : s) { - // :: error: (argument) + // :: error: [argument] locChildren(c); } } public void initLoc3(@Nullable List s) { - // :: error: (iterating.over.nullable) + // :: error: [iterating.over.nullable] for (Styleable c : s) { - // :: error: (argument) + // :: error: [argument] locChildren(c); } } diff --git a/checker/tests/nullness/generics/CapturedWildcards.java b/checker/tests/nullness/generics/CapturedWildcards.java index f193812ccf2a..e1557affdbb1 100644 --- a/checker/tests/nullness/generics/CapturedWildcards.java +++ b/checker/tests/nullness/generics/CapturedWildcards.java @@ -11,7 +11,7 @@ public boolean pass(List list, MyClass other) { } public boolean fail(List list, MyClass other) { - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] return list.stream().anyMatch(je -> je.contains(other)); } } diff --git a/checker/tests/nullness/generics/CollectionsAnnotations.java b/checker/tests/nullness/generics/CollectionsAnnotations.java index afd85ef5e5f4..d3a8444c3be9 100644 --- a/checker/tests/nullness/generics/CollectionsAnnotations.java +++ b/checker/tests/nullness/generics/CollectionsAnnotations.java @@ -48,7 +48,7 @@ static void bad1() { } static void bad2() { - // :: error: (type.arguments.not.inferred) + // :: error: [type.arguments.not.inferred] addNull2(new PriorityQueue1<@NonNull Object>()); } @@ -57,11 +57,11 @@ public static void main(String[] args) { } static void bad3() { - // :: error: (type.arguments.not.inferred) + // :: error: [type.arguments.not.inferred] addNull2(new PriorityQueue2<@NonNull Object>()); } - // :: error: (type.argument) + // :: error: [type.argument] static <@Nullable E> void addNull3(Collection2 l) { l.add(null); } diff --git a/checker/tests/nullness/generics/CollectionsAnnotationsMin.java b/checker/tests/nullness/generics/CollectionsAnnotationsMin.java index 0502f903ef28..40983899d8cb 100644 --- a/checker/tests/nullness/generics/CollectionsAnnotationsMin.java +++ b/checker/tests/nullness/generics/CollectionsAnnotationsMin.java @@ -3,7 +3,7 @@ public class CollectionsAnnotationsMin { static class Collection1 { public void add(E elt) { - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] elt.hashCode(); } } @@ -18,7 +18,7 @@ public void add(E elt) { // This is allowed, as "null" cannot be added to f1 static Collection1 f1 = new PriorityQueue1<@NonNull Object>(); - // :: error: (assignment) + // :: error: [assignment] static Collection1<@Nullable Object> f2 = new PriorityQueue1<@NonNull Object>(); static void addNull1(Collection1<@Nullable Object> l) { @@ -27,13 +27,13 @@ static void addNull1(Collection1<@Nullable Object> l) { // The upper bound on E is implicitly from Collection1 static void addNull2(Collection1 l) { - // :: error: (argument) + // :: error: [argument] l.add(null); } // The upper bound on E is implicitly from Collection1 static E addNull2b(Collection1 l, E p) { - // :: error: (argument) + // :: error: [argument] l.add(null); return p; } @@ -43,16 +43,16 @@ static void addNull1(Collection1<@Nullable Object> l) { } static void bad() { - // :: error: (argument) + // :: error: [argument] addNull1(new PriorityQueue1<@NonNull Object>()); addNull2(new PriorityQueue1<@NonNull Object>()); addNull2b(new PriorityQueue1<@NonNull Object>(), new Object()); - // :: error: (type.arguments.not.inferred) + // :: error: [type.arguments.not.inferred] addNull3(new PriorityQueue1<@NonNull Object>()); - // :: error: (argument) + // :: error: [argument] f1.add(null); } } diff --git a/checker/tests/nullness/generics/GenericArgs.java b/checker/tests/nullness/generics/GenericArgs.java index 2e35833c65ac..268831b5aaa9 100644 --- a/checker/tests/nullness/generics/GenericArgs.java +++ b/checker/tests/nullness/generics/GenericArgs.java @@ -20,22 +20,22 @@ void test() { static class X<@NonNull T extends @NonNull Object> { T value() { - // :: error: (return) + // :: error: [return] return null; } } public static void test2() { - // :: error: (type.argument) + // :: error: [type.argument] Object o = new X().value(); } static <@NonNull Z extends @NonNull Object> void test3(Z z) {} void test4() { - // :: error: (type.argument) + // :: error: [type.argument] GenericArgs.<@Nullable Object>test3(null); - // :: error: (argument) + // :: error: [argument] GenericArgs.<@NonNull Object>test3(null); } @@ -44,7 +44,7 @@ static class GenericConstructor { } void test5() { - // :: error: (argument) + // :: error: [argument] new <@NonNull String>GenericConstructor(null); } diff --git a/checker/tests/nullness/generics/GenericArgs2.java b/checker/tests/nullness/generics/GenericArgs2.java index 8882154046ee..0ffd343d8d09 100644 --- a/checker/tests/nullness/generics/GenericArgs2.java +++ b/checker/tests/nullness/generics/GenericArgs2.java @@ -9,12 +9,12 @@ void add(T arg) {} public class GenericArgs2 { static void test1(Cell collection) { - // :: error: (argument) + // :: error: [argument] collection.add(null); // should fail } static void test2(Cell collection) { - // :: error: (argument) + // :: error: [argument] collection.add(null); // should fail } diff --git a/checker/tests/nullness/generics/GenericBoundsExplicit.java b/checker/tests/nullness/generics/GenericBoundsExplicit.java index 42fdf78c5d39..8b8a2c803eba 100644 --- a/checker/tests/nullness/generics/GenericBoundsExplicit.java +++ b/checker/tests/nullness/generics/GenericBoundsExplicit.java @@ -8,7 +8,7 @@ public class GenericBoundsExplicit<@NonNull T extends @Nullable Object> { T t; public void method() { - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] String str = t.toString(); } @@ -20,18 +20,18 @@ public static void doSomething() { class GenericBoundsExplicit2<@NonNull TT extends @Nullable Object> { @Nullable TT tt1; - // :: error: (initialization.field.uninitialized) + // :: error: [initialization.field.uninitialized] @NonNull TT tt2; - // :: error: (initialization.field.uninitialized) + // :: error: [initialization.field.uninitialized] TT tt3; public void context() { - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] tt1.toString(); tt2.toString(); - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] tt3.toString(); } } @@ -43,7 +43,7 @@ class GenericBoundsExplicit3<@NonNull TTT extends @NonNull Object> { TTT ttt3; public void context() { - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] ttt1.toString(); ttt2.toString(); ttt3.toString(); diff --git a/checker/tests/nullness/generics/GenericReturnField.java b/checker/tests/nullness/generics/GenericReturnField.java index c89fc7c56674..603c15a7f933 100644 --- a/checker/tests/nullness/generics/GenericReturnField.java +++ b/checker/tests/nullness/generics/GenericReturnField.java @@ -10,7 +10,7 @@ public class GenericReturnField { // Should return @Nullable T private T getResult() { - // :: error: (return) + // :: error: [return] return result; } } diff --git a/checker/tests/nullness/generics/GenericsBounds1.java b/checker/tests/nullness/generics/GenericsBounds1.java index a95788a7ae49..33ad2cc04bd5 100644 --- a/checker/tests/nullness/generics/GenericsBounds1.java +++ b/checker/tests/nullness/generics/GenericsBounds1.java @@ -11,16 +11,16 @@ interface GBList { */ public class GenericsBounds1 { void m1(@NonNull GBList g1, @NonNull GBList<@Nullable X> g2) { - // :: error: (assignment) + // :: error: [assignment] g1 = null; - // :: error: (argument) + // :: error: [argument] g1.add(null); - // :: error: (assignment) + // :: error: [assignment] g2 = null; g2.add(null); - // :: error: (assignment) + // :: error: [assignment] g2 = g1; g2.add(null); } diff --git a/checker/tests/nullness/generics/GenericsBounds2.java b/checker/tests/nullness/generics/GenericsBounds2.java index 684512a0d934..cf5cdee9916e 100644 --- a/checker/tests/nullness/generics/GenericsBounds2.java +++ b/checker/tests/nullness/generics/GenericsBounds2.java @@ -5,25 +5,25 @@ */ public class GenericsBounds2 { void m1(X @NonNull [] a1, @Nullable X @NonNull [] a2) { - // :: error: (assignment) + // :: error: [assignment] a1 = null; - // :: error: (assignment) + // :: error: [assignment] a1[0] = null; - // :: error: (assignment) + // :: error: [assignment] a2 = null; a2[0] = null; // This error is expected when arrays are invariant. // Currently, this error is not raised. - // TODOINVARR:: error: (assignment) + // TODOINVARR:: error: [assignment] a2 = a1; a2[0] = null; } void aaa(@Nullable Object[] p1, @NonNull Object[] p2) { // This one is only expected when we switch the default for arrays to be invariant. - // TODOINVARR:: error: (assignment) + // TODOINVARR:: error: [assignment] p1 = p2; } } diff --git a/checker/tests/nullness/generics/GenericsBounds3.java b/checker/tests/nullness/generics/GenericsBounds3.java index 19c36402638c..8fb80cb115fc 100644 --- a/checker/tests/nullness/generics/GenericsBounds3.java +++ b/checker/tests/nullness/generics/GenericsBounds3.java @@ -3,18 +3,18 @@ public class GenericsBounds3 { class Sup {} - // :: error: (type.argument) + // :: error: [type.argument] class Sub extends Sup<@Nullable Object> {} class SubGood extends Sup<@NonNull Object> {} interface ISup {} - // :: error: (type.argument) + // :: error: [type.argument] class ISub implements ISup<@Nullable Object> {} class ISubGood implements ISup<@NonNull Object> {} - // :: error: (type.argument) + // :: error: [type.argument] class ISub2 extends Sup implements java.io.Serializable, ISup<@Nullable Object> {} } diff --git a/checker/tests/nullness/generics/GenericsBounds4.java b/checker/tests/nullness/generics/GenericsBounds4.java index 609b5d0d3b55..bce73447e837 100644 --- a/checker/tests/nullness/generics/GenericsBounds4.java +++ b/checker/tests/nullness/generics/GenericsBounds4.java @@ -3,20 +3,20 @@ public class GenericsBounds4 { class Collection1 { public void add(E elt) { - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] elt.hashCode(); } } Collection1 f1 = new Collection1<@NonNull Object>(); - // :: error: (assignment) + // :: error: [assignment] Collection1<@Nullable ? extends @Nullable Object> f2 = new Collection1<@NonNull Object>(); Collection1<@Nullable ? extends @Nullable Object> f3 = new Collection1<@Nullable Object>(); void bad() { // This has to be forbidden, because f1 might refer to a // collection that has NonNull as type argument. - // :: error: (argument) + // :: error: [argument] f1.add(null); // This is forbidden by the Java type rules: diff --git a/checker/tests/nullness/generics/GenericsBounds5.java b/checker/tests/nullness/generics/GenericsBounds5.java index 535a1da04570..b25bea80ecff 100644 --- a/checker/tests/nullness/generics/GenericsBounds5.java +++ b/checker/tests/nullness/generics/GenericsBounds5.java @@ -4,7 +4,7 @@ public class GenericsBounds5 { class Collection1 { public void add(E elt) { // This call is forbidden, because elt might be null. - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] elt.hashCode(); } } @@ -28,19 +28,19 @@ void addNull2(Collection1<@Nullable ? extends @Nullable Object> l) { l.add(p); } - // :: error: (assignment) + // :: error: [assignment] Collection1<@Nullable ? extends @Nullable Integer> f = new Collection1<@NonNull Integer>(); void bad(Collection1<@NonNull Integer> nnarg) { // These have to be forbidden, because f1 might refer to a // collection that has NonNull as type argument. - // :: error: (type.arguments.not.inferred) + // :: error: [type.arguments.not.inferred] addNull1(nnarg); - // :: error: (argument) + // :: error: [argument] addNull2(nnarg); - // :: error: (type.arguments.not.inferred) + // :: error: [type.arguments.not.inferred] addNull3(nnarg, Integer.valueOf(4)); } } diff --git a/checker/tests/nullness/generics/GenericsExample.java b/checker/tests/nullness/generics/GenericsExample.java index 3714e2ee86ef..b8a7ddc0583d 100644 --- a/checker/tests/nullness/generics/GenericsExample.java +++ b/checker/tests/nullness/generics/GenericsExample.java @@ -26,11 +26,11 @@ void m() { t = null; t = nble; nble = null; - // :: error: (assignment) + // :: error: [assignment] nn = null; t = this.get(0); nble = this.get(0); - // :: error: (assignment) + // :: error: [assignment] nn = this.get(0); this.add(t); this.add(nble); @@ -59,11 +59,11 @@ void m() { t = null; t = nble; nble = null; - // :: error: (assignment) + // :: error: [assignment] nn = null; t = this.get(0); nble = this.get(0); - // :: error: (assignment) + // :: error: [assignment] nn = this.get(0); this.add(t); this.add(nble); @@ -89,18 +89,18 @@ T get(int i) { } void m() { - // :: error: (assignment) + // :: error: [assignment] t = null; - // :: error: (assignment) + // :: error: [assignment] t = nble; nble = null; - // :: error: (assignment) + // :: error: [assignment] nn = null; t = this.get(0); nble = this.get(0); nn = this.get(0); this.add(t); - // :: error: (argument) + // :: error: [argument] this.add(nble); this.add(nn); } @@ -124,18 +124,18 @@ T get(int i) { } void m() { - // :: error: (assignment) + // :: error: [assignment] t = null; - // :: error: (assignment) + // :: error: [assignment] t = nble; nble = null; - // :: error: (assignment) + // :: error: [assignment] nn = null; t = this.get(0); nble = this.get(0); nn = this.get(0); this.add(t); - // :: error: (argument) + // :: error: [argument] this.add(nble); this.add(nn); } @@ -159,19 +159,19 @@ T get(int i) { } void m() { - // :: error: (assignment) + // :: error: [assignment] t = null; - // :: error: (assignment) + // :: error: [assignment] t = nble; nble = null; - // :: error: (assignment) + // :: error: [assignment] nn = null; t = this.get(0); nble = this.get(0); - // :: error: (assignment) + // :: error: [assignment] nn = this.get(0); this.add(t); - // :: error: (argument) + // :: error: [argument] this.add(nble); this.add(nn); } diff --git a/checker/tests/nullness/generics/GenericsExampleMin.java b/checker/tests/nullness/generics/GenericsExampleMin.java index b40d08af224b..0220e9eca1cc 100644 --- a/checker/tests/nullness/generics/GenericsExampleMin.java +++ b/checker/tests/nullness/generics/GenericsExampleMin.java @@ -32,7 +32,7 @@ void m1() { // When the assignment to nn is added, the assignments to t and nble also fail, which is // unexpected. void m2() { - // :: error: (assignment) + // :: error: [assignment] nn = null; t = this.get(0); nble = this.get(0); @@ -49,9 +49,9 @@ class MyList2<@NonNull T> { @Nullable T nble; public MyList2(T t, @Nullable T nble) { - // :: error: (assignment) + // :: error: [assignment] this.t = this.nble; // error - // :: error: (assignment) + // :: error: [assignment] this.t = nble; // error } } @@ -62,12 +62,12 @@ class MyList3 { @NonNull T nn; public MyList3(T t, @Nullable T nble, @NonNull T nn) { - // :: error: (assignment) + // :: error: [assignment] this.t = nble; this.t = nn; - // :: error: (assignment) + // :: error: [assignment] this.nn = t; - // :: error: (assignment) + // :: error: [assignment] this.nn = nble; this.nn = nn; } @@ -79,11 +79,11 @@ class MyList4 { @NonNull T nn; public MyList4(T t, @Nullable T nble, @NonNull T nn) { - // :: error: (assignment) + // :: error: [assignment] this.t = nble; this.t = nn; this.nn = t; - // :: error: (assignment) + // :: error: [assignment] this.nn = nble; this.nn = nn; this.nn = t; diff --git a/checker/tests/nullness/generics/Issue134.java b/checker/tests/nullness/generics/Issue134.java index 8ad53cff216e..171c71fd3dcf 100644 --- a/checker/tests/nullness/generics/Issue134.java +++ b/checker/tests/nullness/generics/Issue134.java @@ -21,7 +21,7 @@ void bar(Wrap w, Integer f) { } void baz(Wrap<@Nullable Integer> w, Integer f) { - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] w.get().of(f).toString(); } } diff --git a/checker/tests/nullness/generics/Issue1838.java b/checker/tests/nullness/generics/Issue1838.java index f8c4adaee155..6e37e7e6cfef 100644 --- a/checker/tests/nullness/generics/Issue1838.java +++ b/checker/tests/nullness/generics/Issue1838.java @@ -15,7 +15,7 @@ public static void f() { list.add(null); List> listList = new ArrayList>(); listList.add(list); - // :: error: (argument) + // :: error: [argument] processElements(listList); } diff --git a/checker/tests/nullness/generics/Issue1838Min.java b/checker/tests/nullness/generics/Issue1838Min.java index 73eae2bc4d0a..cc23c87535ce 100644 --- a/checker/tests/nullness/generics/Issue1838Min.java +++ b/checker/tests/nullness/generics/Issue1838Min.java @@ -7,6 +7,6 @@ public class Issue1838Min { List> llno = new ArrayList<>(); - // :: error: (assignment) + // :: error: [assignment] List> lweo = llno; } diff --git a/checker/tests/nullness/generics/Issue240.java b/checker/tests/nullness/generics/Issue240.java index e5c6686315af..8900182dada1 100644 --- a/checker/tests/nullness/generics/Issue240.java +++ b/checker/tests/nullness/generics/Issue240.java @@ -12,5 +12,5 @@ class Use extends I<@Nullable String> {} class I2 {} // This use must be an error. -// :: error: (type.argument) +// :: error: [type.argument] class Use2 extends I2<@Nullable String> {} diff --git a/checker/tests/nullness/generics/Issue269.java b/checker/tests/nullness/generics/Issue269.java index a260d6c449f5..bf9bc0fb49ac 100644 --- a/checker/tests/nullness/generics/Issue269.java +++ b/checker/tests/nullness/generics/Issue269.java @@ -20,7 +20,7 @@ interface CallbackNN { void method2(CallbackNN callback) { // Forbid this call, because the bound is not respected. - // :: error: (argument) + // :: error: [argument] // :: warning: [unchecked] unchecked call to handler(H) as a member of the raw type // Issue269.CallbackNN callback.handler(null); diff --git a/checker/tests/nullness/generics/Issue270.java b/checker/tests/nullness/generics/Issue270.java index 820f7d6591a2..aa8ff4402d00 100644 --- a/checker/tests/nullness/generics/Issue270.java +++ b/checker/tests/nullness/generics/Issue270.java @@ -1,12 +1,12 @@ import org.checkerframework.checker.nullness.qual.*; -// ::error: (bound) +// ::error: [bound] public class Issue270<@Nullable TypeParam extends @NonNull Object> { public static void main() { - // ::error: (type.argument) + // ::error: [type.argument] @Nullable Issue270<@Nullable String> strWAtv = null; - // ::error: (type.argument) + // ::error: [type.argument] @Nullable Issue270<@NonNull Integer> intWAtv = null; } } diff --git a/checker/tests/nullness/generics/Issue282Min.java b/checker/tests/nullness/generics/Issue282Min.java index 6d6dabe57e81..3b8db488ec26 100644 --- a/checker/tests/nullness/generics/Issue282Min.java +++ b/checker/tests/nullness/generics/Issue282Min.java @@ -8,7 +8,7 @@ public class Issue282Min { static Set copyOf(Comparator comparator, Collection elements) { - // :: error: (return) + // :: error: [return] return null; } } diff --git a/checker/tests/nullness/generics/Issue314.java b/checker/tests/nullness/generics/Issue314.java index 529ed0571886..a362141228e7 100644 --- a/checker/tests/nullness/generics/Issue314.java +++ b/checker/tests/nullness/generics/Issue314.java @@ -11,7 +11,7 @@ public class Issue314 { } List m2(List<@NonNull T> l1) { - // :: error: (return) + // :: error: [return] return l1; } @@ -20,9 +20,9 @@ class Also { @NonNull S f2; { - // :: error: (assignment) + // :: error: [assignment] f1 = f2; - // :: error: (assignment) + // :: error: [assignment] f2 = f1; } } diff --git a/checker/tests/nullness/generics/Issue319.java b/checker/tests/nullness/generics/Issue319.java index 5d316f7d8414..1403f62391d4 100644 --- a/checker/tests/nullness/generics/Issue319.java +++ b/checker/tests/nullness/generics/Issue319.java @@ -39,7 +39,7 @@ void pass() { } void fail() { - // :: error: (argument) + // :: error: [argument] Foo f = newFoo(null); } diff --git a/checker/tests/nullness/generics/Issue329.java b/checker/tests/nullness/generics/Issue329.java index de42a45acc99..70a573a6c1c9 100644 --- a/checker/tests/nullness/generics/Issue329.java +++ b/checker/tests/nullness/generics/Issue329.java @@ -28,12 +28,12 @@ interface Flag {} void f1(Flag<@Nullable String> flag) { String s = getValue(flag); - // :: error: (type.arguments.not.inferred) + // :: error: [type.arguments.not.inferred] setExtension(s); } void f2(Flag<@Nullable String> flag) { - // :: error: (type.arguments.not.inferred) + // :: error: [type.arguments.not.inferred] setExtension(getValue(flag)); } } diff --git a/checker/tests/nullness/generics/Issue337.java b/checker/tests/nullness/generics/Issue337.java index 4e76ab58d1ab..6afcf2f4e43d 100644 --- a/checker/tests/nullness/generics/Issue337.java +++ b/checker/tests/nullness/generics/Issue337.java @@ -17,7 +17,7 @@ abstract class Issue337 { @Nullable R m2(@Nullable String key) { return (key == null) ? - // :: error: (argument) + // :: error: [argument] getThing(key) : null; } @@ -26,7 +26,7 @@ abstract class Issue337 { return (key != null) ? null : - // :: error: (argument) + // :: error: [argument] getThing(key); } } diff --git a/checker/tests/nullness/generics/Issue5006.java b/checker/tests/nullness/generics/Issue5006.java index 3a6b5f1c1545..b15ddd3626c7 100644 --- a/checker/tests/nullness/generics/Issue5006.java +++ b/checker/tests/nullness/generics/Issue5006.java @@ -12,7 +12,7 @@ interface X { interface Y extends X { @Override - // :: error: (super.wildcard) + // :: error: [super.wildcard] C get(); } } diff --git a/checker/tests/nullness/generics/Issue783c.java b/checker/tests/nullness/generics/Issue783c.java index c84e72b3e217..023872c14735 100644 --- a/checker/tests/nullness/generics/Issue783c.java +++ b/checker/tests/nullness/generics/Issue783c.java @@ -1,5 +1,5 @@ public class Issue783c { - // :: error: (initialization.field.uninitialized) + // :: error: [initialization.field.uninitialized] private T val; public void set(T val) { diff --git a/checker/tests/nullness/generics/Issue849.java b/checker/tests/nullness/generics/Issue849.java index a88635892ca2..9e27108dc3dd 100644 --- a/checker/tests/nullness/generics/Issue849.java +++ b/checker/tests/nullness/generics/Issue849.java @@ -8,7 +8,7 @@ public class Issue849 { class Gen {} void nullness(Gen> genGenNonNull) { - // :: error: (assignment) + // :: error: [assignment] Gen<@Nullable ? extends @Nullable Gen<@Nullable Object>> a = genGenNonNull; } } diff --git a/checker/tests/nullness/generics/MethodTypeVars.java b/checker/tests/nullness/generics/MethodTypeVars.java index 15c8bd01d5c2..c03e579ca395 100644 --- a/checker/tests/nullness/generics/MethodTypeVars.java +++ b/checker/tests/nullness/generics/MethodTypeVars.java @@ -6,11 +6,11 @@ */ public class MethodTypeVars { void m() { - // :: error: (type.arguments.not.inferred) + // :: error: [type.arguments.not.inferred] Object a = A.badMethod(null); Object b = A.badMethod(new Object()); - // :: error: (type.arguments.not.inferred) + // :: error: [type.arguments.not.inferred] A.goodMethod(null); A.goodMethod(new Object()); } diff --git a/checker/tests/nullness/generics/MethodTypeVars5.java b/checker/tests/nullness/generics/MethodTypeVars5.java index 27a8d7f9b9d8..dc366ffb01ab 100644 --- a/checker/tests/nullness/generics/MethodTypeVars5.java +++ b/checker/tests/nullness/generics/MethodTypeVars5.java @@ -48,12 +48,12 @@ String doit3b2() { } String doit3c() { - // :: error: (return) :: error: (type.arguments.not.inferred) + // :: error: [return] :: error: [type.arguments.not.inferred] return doit3(new B<@Nullable String>("Hi")); } void doit3d() { - // :: error: (assignment) :: error: (type.arguments.not.inferred) + // :: error: [assignment] :: error: [type.arguments.not.inferred] @NonNull String s = doit3(new B<@Nullable String>("Hi")); } @@ -79,7 +79,7 @@ void doit3e2() { String doit4() { // Passing the null argument has an impact on the inferred type argument: // the type variable appears as the top-level type. - // :: error: (return) :: error: (type.arguments.not.inferred) + // :: error: [return] :: error: [type.arguments.not.inferred] return doit4("Ha!", null); } diff --git a/checker/tests/nullness/generics/MethodTypeVars6.java b/checker/tests/nullness/generics/MethodTypeVars6.java index f93070b41e8d..78c09f80753a 100644 --- a/checker/tests/nullness/generics/MethodTypeVars6.java +++ b/checker/tests/nullness/generics/MethodTypeVars6.java @@ -45,7 +45,7 @@ class Test2 { class Test3 { APair<@NonNull X, @NonNull X> test1(@Nullable X p) { - // :: error: (type.arguments.not.inferred) + // :: error: [type.arguments.not.inferred] return APair.of(p, (X) null); } } @@ -53,10 +53,10 @@ class Test3 { class Test4 { APair<@Nullable String, Integer> psi = PairSub.of("Hi", 42); APair<@Nullable String, Integer> psi2 = PairSub.of(null, 42); - // :: error: (type.arguments.not.inferred) + // :: error: [type.arguments.not.inferred] APair psi3 = PairSub.of(null, 42); APair<@Nullable String, Integer> psisw = PairSubSwitching.ofPSS(42, null); - // :: error: (type.arguments.not.inferred) + // :: error: [type.arguments.not.inferred] APair psisw2 = PairSubSwitching.ofPSS(42, null); } diff --git a/checker/tests/nullness/generics/MethodTypeVars7.java b/checker/tests/nullness/generics/MethodTypeVars7.java index 29d28f72a0a8..4c38f2efcc6c 100644 --- a/checker/tests/nullness/generics/MethodTypeVars7.java +++ b/checker/tests/nullness/generics/MethodTypeVars7.java @@ -37,22 +37,22 @@ T validate4(@Nullable T value, T defaultValue) { } T validatefail(@Nullable T value, T defaultValue) { - // :: error: (return) + // :: error: [return] return ((value == null || !value.toString().isEmpty()) ? value : defaultValue); } T validate2fail(@Nullable T value, T defaultValue) { - // :: error: (return) + // :: error: [return] return ((value != null && value.toString().isEmpty()) ? defaultValue : value); } T validate3fail(@Nullable T value3, T defaultValue3) { - // :: error: (return) + // :: error: [return] return value3 == null ? value3 : defaultValue3; } T validate4fail(@Nullable T value, T defaultValue) { - // :: error: (return) + // :: error: [return] return value != null ? defaultValue : value; } diff --git a/checker/tests/nullness/generics/MixTypeAndDeclAnno.java b/checker/tests/nullness/generics/MixTypeAndDeclAnno.java index af48ea0554b0..9a1c7d980a97 100644 --- a/checker/tests/nullness/generics/MixTypeAndDeclAnno.java +++ b/checker/tests/nullness/generics/MixTypeAndDeclAnno.java @@ -6,33 +6,33 @@ class MixTypeAndDeclAnno { @NonNull T t; @android.annotation.NonNull T tdecl; - // :: error: (conflicting.annos) + // :: error: [conflicting.annos] @android.annotation.NonNull @Nullable T tdecl2; - // :: error: (conflicting.annos) + // :: error: [conflicting.annos] @android.annotation.NonNull @android.annotation.Nullable Object f1; - // :: error: (conflicting.annos) + // :: error: [conflicting.annos] @android.annotation.NonNull @Nullable Object f2; // Nullable applies to the array itself, while NonNull apply to components of the array. @android.annotation.Nullable @NonNull Object[] g; - // :: error: (conflicting.annos) + // :: error: [conflicting.annos] @android.annotation.Nullable Object @NonNull [] k; MixTypeAndDeclAnno( @NonNull T t, @android.annotation.NonNull T tdecl, - // :: error: (conflicting.annos) + // :: error: [conflicting.annos] @android.annotation.NonNull @android.annotation.Nullable Object f1, - // :: error: (conflicting.annos) + // :: error: [conflicting.annos] @android.annotation.NonNull @Nullable Object f2, - // :: error: (conflicting.annos) + // :: error: [conflicting.annos] @android.annotation.Nullable Object @NonNull [] k) { this.t = t; this.tdecl = tdecl; - // :: error: (conflicting.annos) + // :: error: [conflicting.annos] this.f1 = f1; - // :: error: (conflicting.annos) + // :: error: [conflicting.annos] this.f2 = f2; - // :: error: (conflicting.annos) + // :: error: [conflicting.annos] this.k = k; } } diff --git a/checker/tests/nullness/generics/MyMap.java b/checker/tests/nullness/generics/MyMap.java index f0313f6ae716..107fdef87200 100644 --- a/checker/tests/nullness/generics/MyMap.java +++ b/checker/tests/nullness/generics/MyMap.java @@ -5,7 +5,7 @@ // https://github.com/typetools/checker-framework/issues/173 public abstract class MyMap implements Map { @Override - // :: error: (contracts.postcondition) + // :: error: [contracts.postcondition] public @Nullable V put(K key, V value) { return null; } diff --git a/checker/tests/nullness/generics/NullableGeneric.java b/checker/tests/nullness/generics/NullableGeneric.java index 26eefa1389e5..f526b16c1431 100644 --- a/checker/tests/nullness/generics/NullableGeneric.java +++ b/checker/tests/nullness/generics/NullableGeneric.java @@ -11,9 +11,9 @@ public static class NullablePair { - // :: error: (initialization.field.uninitialized) + // :: error: [initialization.field.uninitialized] T t; @Nullable T nt; T m(boolean b, T p) { T r1 = b ? p : null; nt = r1; - // :: error: (assignment) + // :: error: [assignment] t = r1; - // :: error: (return) + // :: error: [return] return r1; } @@ -25,9 +25,9 @@ public static void main(String[] args) { T m2(boolean b, T p) { T r1 = b ? null : p; nt = r1; - // :: error: (assignment) + // :: error: [assignment] t = r1; - // :: error: (return) + // :: error: [return] return r1; } } diff --git a/checker/tests/nullness/generics/NullnessBound.java b/checker/tests/nullness/generics/NullnessBound.java index ed2467777c45..740314f4592d 100644 --- a/checker/tests/nullness/generics/NullnessBound.java +++ b/checker/tests/nullness/generics/NullnessBound.java @@ -10,7 +10,7 @@ public void test() { t2.add(null); Gen1<@NonNull String> t3; - // :: error: (type.argument) + // :: error: [type.argument] Gen2<@NonNull String> t4; } diff --git a/checker/tests/nullness/generics/RawTypesGenerics.java b/checker/tests/nullness/generics/RawTypesGenerics.java index 0ef4187b7e0c..b0b564413e59 100644 --- a/checker/tests/nullness/generics/RawTypesGenerics.java +++ b/checker/tests/nullness/generics/RawTypesGenerics.java @@ -15,7 +15,7 @@ void bar() { // ok Test y = new Test(); - // :: error: (type.argument) + // :: error: [type.argument] Test z = new Test<@Nullable Integer>(); } diff --git a/checker/tests/nullness/generics/TernaryGenerics.java b/checker/tests/nullness/generics/TernaryGenerics.java index 065da640a712..84dfda13ce1d 100644 --- a/checker/tests/nullness/generics/TernaryGenerics.java +++ b/checker/tests/nullness/generics/TernaryGenerics.java @@ -3,18 +3,18 @@ public class TernaryGenerics { class Generic1 { void cond(boolean b, T p) { - // :: error: (assignment) + // :: error: [assignment] @NonNull T r1 = b ? p : null; - // :: error: (assignment) + // :: error: [assignment] @NonNull T r2 = b ? null : p; } } class Generic2 { void cond(boolean b, T p) { - // :: error: (assignment) + // :: error: [assignment] @NonNull T r1 = b ? p : null; - // :: error: (assignment) + // :: error: [assignment] @NonNull T r2 = b ? null : p; } } @@ -23,26 +23,26 @@ class Generic3 { void cond(boolean b, @Nullable T p) { @Nullable T r1 = b ? p : null; @Nullable T r2 = b ? null : p; - // :: error: (assignment) + // :: error: [assignment] @NonNull T r3 = b ? null : p; } } void array(boolean b) { String[] s = b ? new String[] {""} : null; - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] s.toString(); } void generic(boolean b, Generic1 p) { Generic1 s = b ? p : null; - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] s.toString(); } void primarray(boolean b) { long[] result = b ? null : new long[10]; - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] result.toString(); } } diff --git a/checker/tests/nullness/generics/WellformedBounds.java b/checker/tests/nullness/generics/WellformedBounds.java index 152b9467c472..392c191a15b0 100644 --- a/checker/tests/nullness/generics/WellformedBounds.java +++ b/checker/tests/nullness/generics/WellformedBounds.java @@ -2,7 +2,7 @@ class Param { // Field f needs to be set, because the upper bound is @Initialized - // :: error: (initialization.field.uninitialized) + // :: error: [initialization.field.uninitialized] T f; void foo() { @@ -11,13 +11,13 @@ void foo() { } } -// :: error: (type.argument) +// :: error: [type.argument] class Invalid> { void bar(S s) { s.foo(); } - // :: error: (type.argument) + // :: error: [type.argument] > void foobar(M p) {} } @@ -26,14 +26,14 @@ interface ParamI {} class Invalid2< S extends Number & - // :: error: (type.argument) + // :: error: [type.argument] ParamI<@Nullable Object>> {} class Invalid3 { < M extends Number & - // :: error: (type.argument) + // :: error: [type.argument] ParamI<@Nullable Object>> void foobar(M p) {} } diff --git a/checker/tests/nullness/generics/WildcardAnnos.java b/checker/tests/nullness/generics/WildcardAnnos.java index 680747195d34..38c6ca8ae29a 100644 --- a/checker/tests/nullness/generics/WildcardAnnos.java +++ b/checker/tests/nullness/generics/WildcardAnnos.java @@ -2,7 +2,7 @@ import org.checkerframework.checker.nullness.qual.*; public class WildcardAnnos { - // :: error: (bound) + // :: error: [bound] @Nullable List<@Nullable ? extends @NonNull Object> l1 = null; @Nullable List<@NonNull ? extends @Nullable Object> l2 = null; @@ -13,10 +13,10 @@ public class WildcardAnnos { // The bounds need to have the same annotations because capture conversion // converts the type argument to just Object. - // :: error: (super.wildcard) + // :: error: [super.wildcard] @Nullable List<@Nullable ? super @NonNull Object> l3b = null; - // :: error: (bound) + // :: error: [bound] @Nullable List<@NonNull ? super @Nullable String> l4 = null; @Nullable List l5 = null; @@ -27,12 +27,12 @@ public class WildcardAnnos { void asParam(List p) {} - // :: error: (conflicting.annos) + // :: error: [conflicting.annos] @Nullable List<@Nullable @NonNull ? extends @Nullable Object> l6 = null; - // :: error: (conflicting.annos) + // :: error: [conflicting.annos] @Nullable List<@Nullable @NonNull ? super @NonNull String> l7 = null; - // :: error: (conflicting.annos) + // :: error: [conflicting.annos] @Nullable List l8 = null; - // :: error: (conflicting.annos) + // :: error: [conflicting.annos] @Nullable List l9 = null; } diff --git a/checker/tests/nullness/generics/WildcardOverride.java b/checker/tests/nullness/generics/WildcardOverride.java index 243ecc4dcbf5..a2420da2134f 100644 --- a/checker/tests/nullness/generics/WildcardOverride.java +++ b/checker/tests/nullness/generics/WildcardOverride.java @@ -17,7 +17,7 @@ public int transform(List function) { } interface ToOverride2 { - // :: error: (bound) + // :: error: [bound] public abstract int transform(List<@NonNull ? super T> function); } diff --git a/checker/tests/nullness/generics/WildcardSubtyping.java b/checker/tests/nullness/generics/WildcardSubtyping.java index 116edd150acf..ca63926eda1a 100644 --- a/checker/tests/nullness/generics/WildcardSubtyping.java +++ b/checker/tests/nullness/generics/WildcardSubtyping.java @@ -44,10 +44,10 @@ class MyGeneric<@NonNull T extends @Nullable Number> {} class UseMyGeneric { MyGeneric wildcardUnbounded = new MyGeneric<>(); - // :: error: (assignment) + // :: error: [assignment] MyGeneric wildcardOutsideUB = wildcardUnbounded; MyGeneric wildcardInsideUB = wildcardOutsideUB; - // :: error: (assignment) + // :: error: [assignment] MyGeneric wildcardInsideUB2 = wildcardUnbounded; MyGeneric wildcardInsideUBNullable = wildcardOutsideUB; diff --git a/checker/tests/nullness/generics/WildcardSubtyping2.java b/checker/tests/nullness/generics/WildcardSubtyping2.java index 2edb1f938659..9768f4c9ccb5 100644 --- a/checker/tests/nullness/generics/WildcardSubtyping2.java +++ b/checker/tests/nullness/generics/WildcardSubtyping2.java @@ -19,7 +19,7 @@ class MyGenericEB<@NonNull T extends @NonNull MyClass> {} class UseMyGenericEB { MyGenericEB<@NonNull MyCloneClass> nonNull = new MyGenericEB<>(); - // :: error: (type.argument) :: error: (type.arguments.not.inferred) + // :: error: [type.argument] :: error: [type.arguments.not.inferred] MyGenericEB<@Nullable MyCloneClass> nullable = new MyGenericEB<>(); MyGenericEB interfaceNN = nonNull; diff --git a/checker/tests/nullness/generics/WildcardSuper.java b/checker/tests/nullness/generics/WildcardSuper.java index 8629e8bc2a0b..1c42ec44d25d 100644 --- a/checker/tests/nullness/generics/WildcardSuper.java +++ b/checker/tests/nullness/generics/WildcardSuper.java @@ -4,28 +4,28 @@ public class WildcardSuper { void testWithSuper(Cell cell) { - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] cell.get().toString(); } void testWithContradiction(Cell cell) { - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] cell.get().toString(); } @DefaultQualifier(Nullable.class) void testWithImplicitNullable(@NonNull Cell cell) { - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] cell.get().toString(); } void testWithExplicitNullable(Cell<@Nullable ? extends @Nullable String> cell) { - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] cell.get().toString(); } void testWithDoubleNullable(Cell<@Nullable ? extends @Nullable String> cell) { - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] cell.get().toString(); } diff --git a/checker/tests/nullness/init/AnonymousInit.java b/checker/tests/nullness/init/AnonymousInit.java index 984217f99e44..6fe18e4f8dac 100644 --- a/checker/tests/nullness/init/AnonymousInit.java +++ b/checker/tests/nullness/init/AnonymousInit.java @@ -3,7 +3,7 @@ public class AnonymousInit { Object o1 = new Object() { - // :: error: (initialization.field.uninitialized) + // :: error: [initialization.field.uninitialized] Object s; public String toString() { diff --git a/checker/tests/nullness/init/InstanceOf.java b/checker/tests/nullness/init/InstanceOf.java index 7affe40ce4e0..d2424ac65dae 100644 --- a/checker/tests/nullness/init/InstanceOf.java +++ b/checker/tests/nullness/init/InstanceOf.java @@ -15,11 +15,11 @@ class OtherPpt extends Ppt {} public class InstanceOf { void foo(PptTopLevel.@UnknownInitialization(PptTopLevel.class) Ppt ppt) { - // :: error: (method.invocation) + // :: error: [method.invocation] ppt.method(); if (ppt instanceof PptTopLevel.OtherPpt) { PptTopLevel.OtherPpt pslice = (PptTopLevel.OtherPpt) ppt; - // :: error: (method.invocation) + // :: error: [method.invocation] String samp_str = " s" + pslice.method(); } } diff --git a/checker/tests/nullness/init/Issue1044.java b/checker/tests/nullness/init/Issue1044.java index 8a8d72c220d6..c437eeb65662 100644 --- a/checker/tests/nullness/init/Issue1044.java +++ b/checker/tests/nullness/init/Issue1044.java @@ -6,26 +6,26 @@ public class Issue1044 { static class Inner1 { - // :: error: (initialization.field.uninitialized) + // :: error: [initialization.field.uninitialized] V f; } static class Inner2<@Nullable T extends @Nullable Object> { - // :: error: (initialization.field.uninitialized) + // :: error: [initialization.field.uninitialized] @NonNull T f; } static class Inner3 { V f; - // :: error: (initialization.fields.uninitialized) + // :: error: [initialization.fields.uninitialized] Inner3() {} } static class Inner4<@Nullable T extends @Nullable Object> { @NonNull T f; - // :: error: (initialization.fields.uninitialized) + // :: error: [initialization.fields.uninitialized] Inner4() {} } @@ -50,14 +50,14 @@ static class Inner8<@Nullable T extends @Nullable Object> { } static class Inner9 { - // :: error: (initialization.field.uninitialized) + // :: error: [initialization.field.uninitialized] V f; } static class Inner10 { V f; - // :: error: (initialization.fields.uninitialized) + // :: error: [initialization.fields.uninitialized] Inner10() {} } diff --git a/checker/tests/nullness/init/Issue1120.java b/checker/tests/nullness/init/Issue1120.java index a090b63bbdb8..c201d7097676 100644 --- a/checker/tests/nullness/init/Issue1120.java +++ b/checker/tests/nullness/init/Issue1120.java @@ -22,7 +22,7 @@ final class Issue1120Sub extends Issue1120Super { Issue1120Sub(int i) { // this is @UnderInitialization(A.class) this.party(); - // :: error: (method.invocation) + // :: error: [method.invocation] this.bar(); g = new Object(); } diff --git a/checker/tests/nullness/init/Issue1347.java b/checker/tests/nullness/init/Issue1347.java index b473f2ea5223..db12a96218c0 100644 --- a/checker/tests/nullness/init/Issue1347.java +++ b/checker/tests/nullness/init/Issue1347.java @@ -16,7 +16,7 @@ public class Issue1347 { this.o = new Object(); } - // :: error: (initialization.fields.uninitialized) + // :: error: [initialization.fields.uninitialized] Issue1347(T t, String s) { this.t = t; this.o = new Object(); diff --git a/checker/tests/nullness/init/Issue3407.java b/checker/tests/nullness/init/Issue3407.java index a3ad600660d3..018bebbf1d89 100644 --- a/checker/tests/nullness/init/Issue3407.java +++ b/checker/tests/nullness/init/Issue3407.java @@ -10,7 +10,7 @@ String getFoo() { var anon = new Object() { String bar() { - // :: error: (method.invocation) + // :: error: [method.invocation] return Issue3407.this.getFoo().substring(1); } }; diff --git a/checker/tests/nullness/init/Issue408Init.java b/checker/tests/nullness/init/Issue408Init.java index bfa60a230cfd..a20279e8f08d 100644 --- a/checker/tests/nullness/init/Issue408Init.java +++ b/checker/tests/nullness/init/Issue408Init.java @@ -19,7 +19,7 @@ static class Baz extends Bar { @Override String doFoo(@UnderInitialization Baz this) { - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] return myString.toLowerCase(); } } diff --git a/checker/tests/nullness/init/Issue409.java b/checker/tests/nullness/init/Issue409.java index ccfdf25119ef..b612ed4f4675 100644 --- a/checker/tests/nullness/init/Issue409.java +++ b/checker/tests/nullness/init/Issue409.java @@ -23,7 +23,7 @@ public void call() { MyProc p = new MyProc(); // This call is illegal. It passes an @UnderInitialization outer this, but MyProc.call is // declared to take an @Initialized outer this (whith is the default type). - // :: error: (method.invocation) + // :: error: [method.invocation] p.call(); foo = "hello"; } diff --git a/checker/tests/nullness/init/Issue779.java b/checker/tests/nullness/init/Issue779.java index 97e49c2ee2dd..56a2e762655f 100644 --- a/checker/tests/nullness/init/Issue779.java +++ b/checker/tests/nullness/init/Issue779.java @@ -20,7 +20,7 @@ class B extends A { Object f = new Object(); void foo(@UnderInitialization(A.class) B this) { - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] System.out.println("foo B " + this.f.toString()); } } diff --git a/checker/tests/nullness/init/Issue904.java b/checker/tests/nullness/init/Issue904.java index f8c2806a64eb..7d0331fa6a30 100644 --- a/checker/tests/nullness/init/Issue904.java +++ b/checker/tests/nullness/init/Issue904.java @@ -7,7 +7,7 @@ public class Issue904 { new Runnable() { @Override public void run() { - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] mBar.toString(); } }; diff --git a/checker/tests/nullness/init/RawMethodInvocation.java b/checker/tests/nullness/init/RawMethodInvocation.java index 910953cf119a..0036342e2018 100644 --- a/checker/tests/nullness/init/RawMethodInvocation.java +++ b/checker/tests/nullness/init/RawMethodInvocation.java @@ -17,12 +17,12 @@ void init_b(@UnknownInitialization RawMethodInvocation this) { b = ""; } - // :: error: (initialization.fields.uninitialized) + // :: error: [initialization.fields.uninitialized] RawMethodInvocation(Byte constructor_inits_b) { init_b(); } - // :: error: (initialization.fields.uninitialized) + // :: error: [initialization.fields.uninitialized] RawMethodInvocation(byte constructor_inits_b) { b = ""; init_b(); @@ -40,7 +40,7 @@ void init_ab(@UnknownInitialization RawMethodInvocation this) { RawMethodInvocation(long constructor_escapes_raw) { a = ""; - // :: error: (method.invocation) + // :: error: [method.invocation] nonRawMethod(); b = ""; } diff --git a/checker/tests/nullness/init/RawTypesInit.java b/checker/tests/nullness/init/RawTypesInit.java index 61aeac888ce9..16f61c8d7093 100644 --- a/checker/tests/nullness/init/RawTypesInit.java +++ b/checker/tests/nullness/init/RawTypesInit.java @@ -11,16 +11,16 @@ class Bad { @NonNull String field; public Bad() { - // :: error: (method.invocation) + // :: error: [method.invocation] this.init(); // error - // :: error: (method.invocation) + // :: error: [method.invocation] init(); // error this.field = "field"; // valid - // :: error: (assignment) + // :: error: [assignment] this.field = null; // error field = "field"; // valid - // :: error: (assignment) + // :: error: [assignment] field = null; // error } @@ -40,22 +40,22 @@ public A() { } public void init(@UnknownInitialization A this) { - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] output(this.field.length()); } public void initExpl2(@UnknownInitialization A this) { - // :: error: (argument) + // :: error: [argument] output(this.field); } public void initImpl1(@UnknownInitialization A this) { - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] output(field.length()); } public void initImpl2(@UnknownInitialization A this) { - // :: error: (argument) + // :: error: [argument] output(field); } } @@ -65,30 +65,30 @@ class B extends A { public B() { super(); - // :: error: (assignment) + // :: error: [assignment] this.otherField = null; // error this.otherField = "otherField"; // valid } @Override public void init(@UnknownInitialization B this) { - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] output(this.field.length()); // error (TODO: substitution) super.init(); // valid } public void initImpl1(@UnknownInitialization B this) { - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] output(field.length()); // error (TODO: substitution) } public void initExpl2(@UnknownInitialization B this) { - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] output(this.otherField.length()); // error } public void initImpl2(@UnknownInitialization B this) { - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] output(otherField.length()); // error } @@ -105,12 +105,12 @@ void otherRaw(@UnknownInitialization B this) { class C extends B { - // :: error: (initialization.field.uninitialized) + // :: error: [initialization.field.uninitialized] @NonNull String[] strings; @Override public void init(@UnknownInitialization C this) { - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] output(this.strings.length); // error System.out.println(); // valid } @@ -135,7 +135,7 @@ class MyTest { } void myTest(@UnknownInitialization MyTest this) { - // :: error: (unboxing.of.nullable) + // :: error: [unboxing.of.nullable] i = i + 1; } } @@ -145,7 +145,7 @@ class AllFieldsInitialized { Integer startTime = 0; public AllFieldsInitialized() { - // :: error: (method.invocation) + // :: error: [method.invocation] nonRawMethod(); } @@ -153,7 +153,7 @@ public void nonRawMethod() {} } class AFSIICell { - // :: error: (initialization.field.uninitialized) + // :: error: [initialization.field.uninitialized] AllFieldsSetInInitializer afsii; } @@ -163,18 +163,18 @@ class AllFieldsSetInInitializer { public AllFieldsSetInInitializer() { elapsedMillis = 0; - // :: error: (method.invocation) + // :: error: [method.invocation] nonRawMethod(); // error startTime = 0; - // :: error: (method.invocation) + // :: error: [method.invocation] nonRawMethod(); // error - // :: error: (initialization.field.write.initialized) + // :: error: [initialization.field.write.initialized] new AFSIICell().afsii = this; } - // :: error: (initialization.fields.uninitialized) + // :: error: [initialization.fields.uninitialized] public AllFieldsSetInInitializer(boolean b) { - // :: error: (method.invocation) + // :: error: [method.invocation] nonRawMethod(); // error } @@ -190,7 +190,7 @@ public ConstructorInvocations(int v) { public ConstructorInvocations() { this(0); - // :: error: (method.invocation) + // :: error: [method.invocation] nonRawMethod(); // invalid } @@ -210,7 +210,7 @@ public MethodAccess() { void cast(@UnknownInitialization Object... args) { @SuppressWarnings("rawtypes") - // :: error: (assignment) + // :: error: [assignment] Object[] argsNonRaw1 = args; @SuppressWarnings("cast") @@ -220,7 +220,7 @@ void cast(@UnknownInitialization Object... args) { class RawAfterConstructorBad { Object o; - // :: error: (initialization.fields.uninitialized) + // :: error: [initialization.fields.uninitialized] RawAfterConstructorBad() {} } @@ -233,7 +233,7 @@ class RawAfterConstructorOK1 { class RawAfterConstructorOK2 { Integer a; - // :: error: (initialization.fields.uninitialized) + // :: error: [initialization.fields.uninitialized] RawAfterConstructorOK2() {} } @@ -246,14 +246,14 @@ class InitInHelperMethod { InitInHelperMethod(short constructor_inits_ab) { a = 1; b = 1; - // :: error: (method.invocation) + // :: error: [method.invocation] nonRawMethod(); } InitInHelperMethod(boolean constructor_inits_a) { a = 1; init_b(); - // :: error: (method.invocation) + // :: error: [method.invocation] nonRawMethod(); } @@ -261,13 +261,13 @@ class InitInHelperMethod { @EnsuresNonNull("b") void init_b(@UnknownInitialization InitInHelperMethod this) { b = 2; - // :: error: (method.invocation) + // :: error: [method.invocation] nonRawMethod(); } InitInHelperMethod(int constructor_inits_none) { init_ab(); - // :: error: (method.invocation) + // :: error: [method.invocation] nonRawMethod(); } @@ -275,7 +275,7 @@ void init_b(@UnknownInitialization InitInHelperMethod this) { void init_ab(@UnknownInitialization InitInHelperMethod this) { a = 1; b = 2; - // :: error: (method.invocation) + // :: error: [method.invocation] nonRawMethod(); } diff --git a/checker/tests/nullness/init/Uninit.java b/checker/tests/nullness/init/Uninit.java index 3ac1787c4d73..1934b1d7ce67 100644 --- a/checker/tests/nullness/init/Uninit.java +++ b/checker/tests/nullness/init/Uninit.java @@ -1,4 +1,4 @@ public class Uninit { - // :: error: (initialization.field.uninitialized) + // :: error: [initialization.field.uninitialized] Object a; } diff --git a/checker/tests/nullness/init/Uninit10.java b/checker/tests/nullness/init/Uninit10.java index 8179491a93d1..2489ea4e79ff 100644 --- a/checker/tests/nullness/init/Uninit10.java +++ b/checker/tests/nullness/init/Uninit10.java @@ -4,14 +4,14 @@ public class Uninit10 { @NonNull String[] strings; - // :: error: (initialization.fields.uninitialized) + // :: error: [initialization.fields.uninitialized] Uninit10() {} public class Inner { @NonNull String[] stringsInner; - // :: error: (initialization.fields.uninitialized) + // :: error: [initialization.fields.uninitialized] Inner() {} } } diff --git a/checker/tests/nullness/init/Uninit11.java b/checker/tests/nullness/init/Uninit11.java index fa0f1d8911e6..c25afc71f967 100644 --- a/checker/tests/nullness/init/Uninit11.java +++ b/checker/tests/nullness/init/Uninit11.java @@ -16,7 +16,7 @@ public class Uninit11 { // parameter disambiguate_overloads is just to distinguish the overloaded constructors public @DoesNotUseF Uninit11(int disambiguate_overloads) {} - // :: error: (initialization.fields.uninitialized) + // :: error: [initialization.fields.uninitialized] public Uninit11(boolean disambiguate_overloads) {} public Uninit11(long x) { diff --git a/checker/tests/nullness/init/Uninit12.java b/checker/tests/nullness/init/Uninit12.java index 5d30e1f2853f..7a69846a64ab 100644 --- a/checker/tests/nullness/init/Uninit12.java +++ b/checker/tests/nullness/init/Uninit12.java @@ -5,7 +5,7 @@ public class Uninit12 { - // :: error: (initialization.static.field.uninitialized) + // :: error: [initialization.static.field.uninitialized] static Object f; public Uninit12() { diff --git a/checker/tests/nullness/init/Uninit4.java b/checker/tests/nullness/init/Uninit4.java index 45fcb9bb70c6..628874e591b7 100644 --- a/checker/tests/nullness/init/Uninit4.java +++ b/checker/tests/nullness/init/Uninit4.java @@ -5,7 +5,7 @@ class Mam { } class BadSon { - // :: error: (initialization.field.uninitialized) + // :: error: [initialization.field.uninitialized] Object b; } @@ -16,7 +16,7 @@ class GoodSon { class WeirdSon { Object b; - // :: error: (initialization.fields.uninitialized) + // :: error: [initialization.fields.uninitialized] WeirdSon() { super(); } @@ -25,7 +25,7 @@ class WeirdSon { class Daughter { Object b; - // :: error: (initialization.fields.uninitialized) + // :: error: [initialization.fields.uninitialized] Daughter() {} Daughter(Object val) { diff --git a/checker/tests/nullness/init/Uninit5.java b/checker/tests/nullness/init/Uninit5.java index 9a2c0781abcc..bd10e96458e3 100644 --- a/checker/tests/nullness/init/Uninit5.java +++ b/checker/tests/nullness/init/Uninit5.java @@ -1,4 +1,4 @@ public class Uninit5 { - // :: error: (initialization.field.uninitialized) + // :: error: [initialization.field.uninitialized] String x; } diff --git a/checker/tests/nullness/java-unsound/Figure3.java b/checker/tests/nullness/java-unsound/Figure3.java index 6e3a6529df8b..e9ecffe01dd3 100644 --- a/checker/tests/nullness/java-unsound/Figure3.java +++ b/checker/tests/nullness/java-unsound/Figure3.java @@ -3,7 +3,7 @@ static class Type { class Constraint extends Type {} Constraint bad() { - // :: error: (return) + // :: error: [return] return null; } diff --git a/checker/tests/nullness/java-unsound/Figure6.java b/checker/tests/nullness/java-unsound/Figure6.java index 2399a9649126..d604cc73dd12 100644 --- a/checker/tests/nullness/java-unsound/Figure6.java +++ b/checker/tests/nullness/java-unsound/Figure6.java @@ -14,7 +14,7 @@ class Constraint {} A coerce(B t) { Constraint constraint = null; - // :: error: (argument) + // :: error: [argument] return upcast(constraint).curry(t); } } diff --git a/checker/tests/nullness/java17/InferSwitchExpr.java b/checker/tests/nullness/java17/InferSwitchExpr.java index dd6933b84b37..c716fd7acace 100644 --- a/checker/tests/nullness/java17/InferSwitchExpr.java +++ b/checker/tests/nullness/java17/InferSwitchExpr.java @@ -20,13 +20,13 @@ List singletonList(T t) { case A -> { if (a) { if (b) { - // :: error: (type.arguments.not.inferred) + // :: error: [type.arguments.not.inferred] yield singletonList(null); } - // :: error: (type.arguments.not.inferred) + // :: error: [type.arguments.not.inferred] yield singletonList(null); } - // :: error: (type.arguments.not.inferred) + // :: error: [type.arguments.not.inferred] yield singletonList(null); } case B -> null; diff --git a/checker/tests/nullness/java17/NullnessSwitchArrows.java b/checker/tests/nullness/java17/NullnessSwitchArrows.java index 08983be671d1..6fe1915ca5f3 100644 --- a/checker/tests/nullness/java17/NullnessSwitchArrows.java +++ b/checker/tests/nullness/java17/NullnessSwitchArrows.java @@ -21,7 +21,7 @@ void method1() { default -> throw new IllegalStateException("Invalid day: " + day); } - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] o.toString(); } diff --git a/checker/tests/nullness/java17/NullnessSwitchExpressionLambda.java b/checker/tests/nullness/java17/NullnessSwitchExpressionLambda.java index 61685d40ddef..43ac0fbef8f2 100644 --- a/checker/tests/nullness/java17/NullnessSwitchExpressionLambda.java +++ b/checker/tests/nullness/java17/NullnessSwitchExpressionLambda.java @@ -13,7 +13,7 @@ void switchExprLambda() { default -> null; }; Object o = f.apply(new NullnessSwitchExpressionLambda()); - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] o.toString(); } } diff --git a/checker/tests/nullness/java17/NullnessSwitchExpressions.java b/checker/tests/nullness/java17/NullnessSwitchExpressions.java index ecf5accb6bbd..22d8caccc7f1 100644 --- a/checker/tests/nullness/java17/NullnessSwitchExpressions.java +++ b/checker/tests/nullness/java17/NullnessSwitchExpressions.java @@ -21,7 +21,7 @@ void method1() { default -> throw new IllegalStateException("Invalid day: " + day); }; - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] o.toString(); } @@ -57,7 +57,7 @@ void method3() { default -> throw new IllegalStateException("Invalid day: " + day); }; - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] o.toString(); } } diff --git a/checker/tests/nullness/java17/NullnessSwitchStatementRules.java b/checker/tests/nullness/java17/NullnessSwitchStatementRules.java index 9c375f64cbbd..ef98a575f64e 100644 --- a/checker/tests/nullness/java17/NullnessSwitchStatementRules.java +++ b/checker/tests/nullness/java17/NullnessSwitchStatementRules.java @@ -36,7 +36,7 @@ void method(int selector) { case 1: field = null; case 2: - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] field.toString(); } } diff --git a/checker/tests/nullness/java17/SwitchExpressionInvariant.java b/checker/tests/nullness/java17/SwitchExpressionInvariant.java index 839a37594d61..7c96c0fe949f 100644 --- a/checker/tests/nullness/java17/SwitchExpressionInvariant.java +++ b/checker/tests/nullness/java17/SwitchExpressionInvariant.java @@ -10,16 +10,16 @@ void method( List<@NonNull String> nonnullStrings, List<@Nullable String> nullableStrings, int fenum) { List<@NonNull String> list = - // :: error: (assignment) + // :: error: [assignment] switch (fenum) { - // :: error: (switch.expression) + // :: error: [switch.expression] case 1 -> nonnullStrings; default -> nullableStrings; }; List<@Nullable String> list2 = switch (fenum) { - // :: error: (switch.expression) + // :: error: [switch.expression] case 1 -> nonnullStrings; default -> nullableStrings; }; diff --git a/checker/tests/nullness/java17/SwitchExpressionTypeArgInference.java b/checker/tests/nullness/java17/SwitchExpressionTypeArgInference.java index 58ca103d5b74..8975e99fb750 100644 --- a/checker/tests/nullness/java17/SwitchExpressionTypeArgInference.java +++ b/checker/tests/nullness/java17/SwitchExpressionTypeArgInference.java @@ -9,8 +9,8 @@ T method(T t) { void test1(int i, @Nullable String nullable) { @NonNull String s = - // :: error: (assignment) - // :: error: (type.arguments.not.inferred) + // :: error: [assignment] + // :: error: [type.arguments.not.inferred] method( switch (i) { case 0: diff --git a/checker/tests/nullness/java17/SwitchTestIssue5412.java b/checker/tests/nullness/java17/SwitchTestIssue5412.java index c41acbbd2410..db45050a0f4f 100644 --- a/checker/tests/nullness/java17/SwitchTestIssue5412.java +++ b/checker/tests/nullness/java17/SwitchTestIssue5412.java @@ -32,7 +32,7 @@ public String foo1a(MyEnum b) { // good. default -> null; }; - // :: error: (return) + // :: error: [return] return s; } @@ -87,7 +87,7 @@ public String foo4a(MyEnum b) { default: break; } - // :: error: (return) + // :: error: [return] return aString; } @@ -109,7 +109,7 @@ public String foo4b(MyEnum b) { aString = null; break; } - // :: error: (return) + // :: error: [return] return aString; } diff --git a/checker/tests/nullness/java21/NullableSwitchSelector.java b/checker/tests/nullness/java21/NullableSwitchSelector.java index 29f1845f53a8..ce7ec0d6195b 100644 --- a/checker/tests/nullness/java21/NullableSwitchSelector.java +++ b/checker/tests/nullness/java21/NullableSwitchSelector.java @@ -13,20 +13,20 @@ static String formatterPatternSwitch1(@Nullable Object obj) { return switch (obj) { case Integer i -> obj.toString(); case String s -> String.format("String %s", s); - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] case null -> obj.toString(); default -> obj.toString(); }; } static String formatterPatternSwitch2(@Nullable Object obj) { - // :: error: (switching.nullable) + // :: error: [switching.nullable] return switch (obj) { case Integer i -> obj.toString(); case String s -> String.format("String %s", s); // TODO: If obj is null, this case isn't reachable, because a null pointer exception happens // at the selector expression. - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] default -> obj.toString(); }; } @@ -35,7 +35,7 @@ static String formatterPatternSwitch3(@Nullable Object obj) { return switch (obj) { case Integer i -> obj.toString(); case String s -> String.format("String %s", s); - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] case null, default -> obj.toString(); }; } diff --git a/checker/tests/nullness/java21/SimpleCaseGuard.java b/checker/tests/nullness/java21/SimpleCaseGuard.java index cda1f49aed16..cf3340342063 100644 --- a/checker/tests/nullness/java21/SimpleCaseGuard.java +++ b/checker/tests/nullness/java21/SimpleCaseGuard.java @@ -19,11 +19,11 @@ void test2(Object obj, boolean b) { @NonNull String z = field; } case String s -> { - // :: error: (assignment) + // :: error: [assignment] @NonNull String z = field; } default -> { - // :: error: (assignment) + // :: error: [assignment] @NonNull String z = field; } } diff --git a/checker/tests/nullness/java8/DefaultMethods.java b/checker/tests/nullness/java8/DefaultMethods.java index 80f9addca588..a5ffe6519ef2 100644 --- a/checker/tests/nullness/java8/DefaultMethods.java +++ b/checker/tests/nullness/java8/DefaultMethods.java @@ -1,11 +1,11 @@ interface DefaultMethods { default void method(String param) { - // :: error: (assignment) + // :: error: [assignment] param = null; String s = null; - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] s.toString(); // Ensure dataflow is running diff --git a/checker/tests/nullness/java8/Issue1000.java b/checker/tests/nullness/java8/Issue1000.java index 6e0ad7ea9df2..4c282b6bf9a7 100644 --- a/checker/tests/nullness/java8/Issue1000.java +++ b/checker/tests/nullness/java8/Issue1000.java @@ -12,7 +12,7 @@ String orElseAppliedToNonNull(Optional opt) { } String orElseAppliedToNullable(Optional opt) { - // :: error: (return) + // :: error: [return] return opt.orElse(null); } } diff --git a/checker/tests/nullness/java8/Issue1633.java b/checker/tests/nullness/java8/Issue1633.java index ea661257d56b..9e9adbb4b59c 100644 --- a/checker/tests/nullness/java8/Issue1633.java +++ b/checker/tests/nullness/java8/Issue1633.java @@ -13,7 +13,7 @@ public class Issue1633 { // supplyNonNull is a supplier that does not return null. void foo1(Optional1633 o, Supplier<@Nullable String> supplyNullable) { - // :: error: (argument) + // :: error: [argument] @Nullable String str = o.orElseGetUnannotated(supplyNullable); } @@ -26,7 +26,7 @@ void foo2nw(Optional1633 o, Supplier<@Nullable String> supplyNullable) { } void foo3(Optional1633 o, Supplier<@Nullable String> supplyNullable) { - // :: error: (argument) + // :: error: [argument] @Nullable String str2 = o.orElseGetNonNull(supplyNullable); } @@ -40,13 +40,13 @@ void foo4nw(Optional1633 o, Supplier<@Nullable String> supplyNullable) { void foo41(Optional1633 o) { // This is a false postive because inference doesn't work with poly qualifiers. - // :: error: (return) + // :: error: [return] @Nullable String str3 = o.orElseGetPolyNull(() -> null); } void foo41nw(Optional1633 o) { // This is a false postive because inference doesn't work with poly qualifiers. - // :: error: (return) + // :: error: [return] @Nullable String str3 = o.orElseGetPolyNullNoWildcard(() -> null); } @@ -55,12 +55,12 @@ void foo5(Optional1633 o, Supplier<@NonNull String> supplyNonNull) { } void foo6(Optional1633 o, Supplier<@NonNull String> supplyNonNull) { - // :: error: (assignment) + // :: error: [assignment] @NonNull String str1 = o.orElseGetNullable(supplyNonNull); } void foo6nw(Optional1633 o, Supplier<@NonNull String> supplyNonNull) { - // :: error: (assignment) + // :: error: [assignment] @NonNull String str1 = o.orElseGetNullableNoWildcard(supplyNonNull); } diff --git a/checker/tests/nullness/java8/Issue579.java b/checker/tests/nullness/java8/Issue579.java index 7e25ded77803..a01ac4940300 100644 --- a/checker/tests/nullness/java8/Issue579.java +++ b/checker/tests/nullness/java8/Issue579.java @@ -18,7 +18,7 @@ public int compare(T a, T b) { @Override public Comparator thenComparing(Comparator other) { - // :: warning: (nulltest.redundant) + // :: warning: [nulltest.redundant] return new Issue579<>(real == null ? other : real.thenComparing(other)); } } diff --git a/checker/tests/nullness/java8/UnionTypeBug.java b/checker/tests/nullness/java8/UnionTypeBug.java index 4140e30dcdc4..9dfffdf1cb7b 100644 --- a/checker/tests/nullness/java8/UnionTypeBug.java +++ b/checker/tests/nullness/java8/UnionTypeBug.java @@ -14,10 +14,10 @@ void method() { badBoy(); - // :: warning: (nullness.on.exception.parameter) + // :: warning: [nullness.on.exception.parameter] } catch (@NonNull InnerException1 | @NonNull InnerException2 e) { - // :: warning: (nullness.on.exception.parameter) + // :: warning: [nullness.on.exception.parameter] } catch (@NonNull InnerException3 | @NonNull InnerException4 e) { } diff --git a/checker/tests/nullness/java8/lambda/Dataflow.java b/checker/tests/nullness/java8/lambda/Dataflow.java index 49946fce85f6..ae32c771587d 100644 --- a/checker/tests/nullness/java8/lambda/Dataflow.java +++ b/checker/tests/nullness/java8/lambda/Dataflow.java @@ -6,7 +6,7 @@ public class Dataflow { void context() { FunctionDF<@Nullable Object, Object> o = a -> { - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] a.toString(); a = ""; a.toString(); diff --git a/checker/tests/nullness/java8/lambda/FinalLocalVariables.java b/checker/tests/nullness/java8/lambda/FinalLocalVariables.java index aa04782bfe92..075efb00c879 100644 --- a/checker/tests/nullness/java8/lambda/FinalLocalVariables.java +++ b/checker/tests/nullness/java8/lambda/FinalLocalVariables.java @@ -15,7 +15,7 @@ class LambdaEnclosing { FunctionLE f0 = s -> { local1.toString(); - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] local2.toString(); return ""; }; @@ -28,7 +28,7 @@ class LambdaEnclosing { FunctionLE f0 = s -> { local1.toString(); - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] local2.toString(); return ""; }; @@ -41,7 +41,7 @@ class LambdaEnclosing { FunctionLE f0 = s2 -> { local1.toString(); - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] local2.toString(); return ""; }; @@ -55,7 +55,7 @@ void context() { FunctionLE f1 = s -> { local1.toString(); - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] local2.toString(); class Inner { @@ -68,7 +68,7 @@ void context2() { local1.toString(); local2.toString(); local3.toString(); - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] local4.toString(); return ""; @@ -88,7 +88,7 @@ public String toString() { local1.toString(); local2.toString(); local3.toString(); - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] local4.toString(); return ""; diff --git a/checker/tests/nullness/java8/lambda/Issue572.java b/checker/tests/nullness/java8/lambda/Issue572.java index d0ec0a0042cb..adf43fc1050c 100644 --- a/checker/tests/nullness/java8/lambda/Issue572.java +++ b/checker/tests/nullness/java8/lambda/Issue572.java @@ -10,7 +10,7 @@ static C biApply(BiFunction f, A a, B b) { } public A konst(@NonNull A a, @Nullable B b) { - // :: error: (argument) + // :: error: [argument] return biApply(((first, second) -> first), a, b); } } diff --git a/checker/tests/nullness/java8/lambda/LambdaInit.java b/checker/tests/nullness/java8/lambda/LambdaInit.java index 6a5ffc3cb659..2783e7b417c4 100644 --- a/checker/tests/nullness/java8/lambda/LambdaInit.java +++ b/checker/tests/nullness/java8/lambda/LambdaInit.java @@ -19,12 +19,12 @@ public class LambdaInit { String f1b; FunctionInit ff0 = s -> { - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] f1.toString(); - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] f1b.toString(); f2.toString(); - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] f3.toString(); return ""; }; @@ -38,10 +38,10 @@ public class LambdaInit { f4 = ""; FunctionInit ff0 = s -> { - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] f1.toString(); f2.toString(); - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] f3.toString(); f4.toString(); return ""; @@ -55,10 +55,10 @@ public class LambdaInit { f5 = ""; FunctionInit ff0 = s -> { - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] f1.toString(); f2.toString(); - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] f3.toString(); f5.toString(); return ""; @@ -71,7 +71,7 @@ public class LambdaInit { @Override public String toString() { // BUG: this should not yield a warning. - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] f1.toString(); f2.toString(); return ""; @@ -84,7 +84,7 @@ void method() { s -> { f1.toString(); f2.toString(); - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] f3.toString(); return ""; }; @@ -96,7 +96,7 @@ class Nested { s -> { f1.toString(); f2.toString(); - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] f3.toString(); return ""; }; @@ -110,7 +110,7 @@ class Nested { s -> { f1.toString(); f2.toString(); - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] f3.toString(); f4.toString(); return ""; @@ -125,7 +125,7 @@ class Nested { s -> { f1.toString(); f2.toString(); - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] f3.toString(); f5.toString(); return ""; @@ -137,7 +137,7 @@ void method() { s -> { f1.toString(); f2.toString(); - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] f3.toString(); return ""; }; @@ -149,16 +149,16 @@ void method() { s -> { Consumer ff0 = s2 -> { - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] f1.toString(); f2.toString(); - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] f3.toString(); }; }; // Tests for static initializers. - // :: error: (initialization.static.field.uninitialized) + // :: error: [initialization.static.field.uninitialized] static String sf1; static String sf2 = ""; static @Nullable String sf3 = ""; @@ -167,13 +167,13 @@ void method() { s -> { // This is an issue with static initializers in general - // // :: error: (dereference.of.nullable) + // // :: error: [dereference.of.nullable] sf1.toString(); // This is an issue with static initializers in general - // // :: error: (dereference.of.nullable) + // // :: error: [dereference.of.nullable] sf1b.toString(); sf2.toString(); - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] sf3.toString(); return ""; }; @@ -189,10 +189,10 @@ void method() { s -> { // This is an issue with static initializers in general - // // :: error: (dereference.of.nullable) + // // :: error: [dereference.of.nullable] sf1.toString(); sf2.toString(); - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] sf3.toString(); sf4.toString(); return ""; diff --git a/checker/tests/nullness/java8/lambda/LambdaNullness.java b/checker/tests/nullness/java8/lambda/LambdaNullness.java index a0d5c0fcdf66..77c713e6e725 100644 --- a/checker/tests/nullness/java8/lambda/LambdaNullness.java +++ b/checker/tests/nullness/java8/lambda/LambdaNullness.java @@ -35,7 +35,7 @@ public class LambdaNullness { Supplier f2a = () -> 42; // No parameters, expression body - // :: error: (return) + // :: error: [return] Supplier f2b = () -> null; // No parameters, expression body @@ -48,7 +48,7 @@ public class LambdaNullness { // No parameters, block body with return Supplier<@Nullable Integer> f4b = () -> { - // :: error: (assignment) + // :: error: [assignment] @NonNull String s = null; return null; @@ -69,7 +69,7 @@ public class LambdaNullness { for (int i = 1; i < 10; i++) { result *= i; } - // :: error: (return) + // :: error: [return] return null; } }; @@ -79,7 +79,7 @@ public class LambdaNullness { // Single declared-type parameter FunctionNull<@Nullable String, String> f9 = - // :: error: (lambda.param) + // :: error: [lambda.param] (@NonNull String x) -> { return x + ""; }; @@ -92,7 +92,7 @@ public class LambdaNullness { BiFunctionNull f16 = (@Nullable Integer x, final Integer y) -> { x = null; - // :: error: (unboxing.of.nullable) + // :: error: [unboxing.of.nullable] return x + y; }; @@ -102,7 +102,7 @@ public class LambdaNullness { // Infer based on context. FunctionNull<@Nullable String, String> fn = (s) -> { - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] s.toString(); return ""; }; diff --git a/checker/tests/nullness/java8/lambda/Parameters.java b/checker/tests/nullness/java8/lambda/Parameters.java index 5960174dc74e..35649d21fabd 100644 --- a/checker/tests/nullness/java8/lambda/Parameters.java +++ b/checker/tests/nullness/java8/lambda/Parameters.java @@ -13,20 +13,20 @@ interface NNConsumer { class LambdaParam { NullConsumer fn1 = - // :: error: (lambda.param) + // :: error: [lambda.param] (@NonNull String i) -> {}; NullConsumer fn2 = (@Nullable String i) -> {}; - // :: error: (lambda.param) + // :: error: [lambda.param] NullConsumer fn3 = (String i) -> {}; NNConsumer fn4 = (String i) -> {}; NNConsumer fn5 = (@Nullable String i) -> {}; NNConsumer fn6 = (@NonNull String i) -> {}; { - // :: error: (lambda.param) + // :: error: [lambda.param] NullConsumer fn1 = (@NonNull String i) -> {}; NullConsumer fn2 = (@Nullable String i) -> {}; - // :: error: (lambda.param) + // :: error: [lambda.param] NullConsumer fn3 = (String i) -> {}; NNConsumer fn4 = (String i) -> {}; NNConsumer fn5 = (@Nullable String i) -> {}; @@ -34,10 +34,10 @@ class LambdaParam { } static { - // :: error: (lambda.param) + // :: error: [lambda.param] NullConsumer fn1 = (@NonNull String i) -> {}; NullConsumer fn2 = (@Nullable String i) -> {}; - // :: error: (lambda.param) + // :: error: [lambda.param] NullConsumer fn3 = (String i) -> {}; NNConsumer fn4 = (String i) -> {}; NNConsumer fn5 = (@Nullable String i) -> {}; @@ -46,10 +46,10 @@ class LambdaParam { static void foo() { NullConsumer fn1 = - // :: error: (lambda.param) + // :: error: [lambda.param] (@NonNull String i) -> {}; NullConsumer fn2 = (@Nullable String i) -> {}; - // :: error: (lambda.param) + // :: error: [lambda.param] NullConsumer fn3 = (String i) -> {}; NNConsumer fn4 = (String i) -> {}; NNConsumer fn5 = (@Nullable String i) -> {}; @@ -58,10 +58,10 @@ static void foo() { void bar() { NullConsumer fn1 = - // :: error: (lambda.param) + // :: error: [lambda.param] (@NonNull String i) -> {}; NullConsumer fn2 = (@Nullable String i) -> {}; - // :: error: (lambda.param) + // :: error: [lambda.param] NullConsumer fn3 = (String i) -> {}; NNConsumer fn4 = (String i) -> {}; NNConsumer fn5 = (@Nullable String i) -> {}; diff --git a/checker/tests/nullness/java8/lambda/ParametersInBody.java b/checker/tests/nullness/java8/lambda/ParametersInBody.java index 3fdccd707764..116c46dd8625 100644 --- a/checker/tests/nullness/java8/lambda/ParametersInBody.java +++ b/checker/tests/nullness/java8/lambda/ParametersInBody.java @@ -12,21 +12,21 @@ interface NNConsumerLPB { class LambdaParamBody { - // :: error: (lambda.param) + // :: error: [lambda.param] ConsumerLPB fn0 = (String i) -> i.toString(); ConsumerLPB fn2 = (@Nullable String i) -> { - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] i.toString(); }; ConsumerLPB fn3 = - // :: error: (lambda.param) + // :: error: [lambda.param] (String i) -> { i.toString(); }; ConsumerLPB fn3b = (i) -> { - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] i.toString(); }; @@ -40,7 +40,7 @@ class LambdaParamBody { }; NNConsumerLPB fn5 = (@Nullable String i) -> { - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] i.toString(); }; NNConsumerLPB fn6 = diff --git a/checker/tests/nullness/java8/lambda/ParametersInBodyGenerics.java b/checker/tests/nullness/java8/lambda/ParametersInBodyGenerics.java index 2f7e17ff3239..45658bb90a15 100644 --- a/checker/tests/nullness/java8/lambda/ParametersInBodyGenerics.java +++ b/checker/tests/nullness/java8/lambda/ParametersInBodyGenerics.java @@ -13,21 +13,21 @@ interface NonNullConsumer { } void test() { - // :: error: (lambda.param) + // :: error: [lambda.param] NullableConsumer fn0 = (List i) -> i.get(0).toString(); NullableConsumer fn2 = (List<@Nullable String> i) -> { - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] i.get(0).toString(); }; NullableConsumer fn3 = - // :: error: (lambda.param) + // :: error: [lambda.param] (List i) -> { i.get(0).toString(); }; NullableConsumer fn3b = (i) -> { - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] i.get(0).toString(); }; diff --git a/checker/tests/nullness/java8/lambda/ReceiversLambda.java b/checker/tests/nullness/java8/lambda/ReceiversLambda.java index 3a76f11bb605..7852310ccd75 100644 --- a/checker/tests/nullness/java8/lambda/ReceiversLambda.java +++ b/checker/tests/nullness/java8/lambda/ReceiversLambda.java @@ -13,21 +13,21 @@ interface FunctionRT { class ReceiverTest { - // :: error: (method.invocation) + // :: error: [method.invocation] FunctionRT f1 = s -> this.toString(); - // :: error: (method.invocation) + // :: error: [method.invocation] FunctionRT f2 = s -> super.toString(); - // :: error: (nullness.on.receiver) + // :: error: [nullness.on.receiver] void context1(@NonNull ReceiverTest this) { SupplierR s = () -> this; } - // :: error: (nullness.on.receiver) + // :: error: [nullness.on.receiver] void context2(@Nullable ReceiverTest this) { // TODO: This is bug that is not specific to lambdas // https://github.com/typetools/checker-framework/issues/352 - // :: error: (return) + // :: error: [return] SupplierR s = () -> this; } } diff --git a/checker/tests/nullness/java8/lambda/RefinedLocalInLambda.java b/checker/tests/nullness/java8/lambda/RefinedLocalInLambda.java index b9370f609e94..2c6d1dfd4b47 100644 --- a/checker/tests/nullness/java8/lambda/RefinedLocalInLambda.java +++ b/checker/tests/nullness/java8/lambda/RefinedLocalInLambda.java @@ -12,7 +12,7 @@ public static void main(String[] args) { } public static void printIntegersGreaterThan(@Nullable Integer limit) { - // :: error: (unboxing.of.nullable) + // :: error: [unboxing.of.nullable] printIntegersWithPredicate(i -> i > limit); // type-checking fails if (limit == null) { return; diff --git a/checker/tests/nullness/java8/lambda/Returns.java b/checker/tests/nullness/java8/lambda/Returns.java index 339d762ab2fb..068097d333b2 100644 --- a/checker/tests/nullness/java8/lambda/Returns.java +++ b/checker/tests/nullness/java8/lambda/Returns.java @@ -20,11 +20,11 @@ interface SupplierRe { class MetaReturn { - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] ConsumerSupplier t1 = () -> (s) -> s.toString(); ConsumerSupplier t2 = () -> { - // :: error: (lambda.param) + // :: error: [lambda.param] return (String s) -> { s.toString(); }; @@ -32,7 +32,7 @@ class MetaReturn { SupplierSupplier t3 = () -> { - // :: error: (return) + // :: error: [return] return () -> null; }; diff --git a/checker/tests/nullness/java8/lambda/Shadowed.java b/checker/tests/nullness/java8/lambda/Shadowed.java index aa2b665ddfe9..dca38e8c1d95 100644 --- a/checker/tests/nullness/java8/lambda/Shadowed.java +++ b/checker/tests/nullness/java8/lambda/Shadowed.java @@ -14,7 +14,7 @@ public class Shadowed { ConsumerS c = s -> { - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] s.toString(); class Inner { diff --git a/checker/tests/nullness/java8/methodref/AssignmentContextTest.java b/checker/tests/nullness/java8/methodref/AssignmentContextTest.java index 0e157ef81ce7..97931a7d1837 100644 --- a/checker/tests/nullness/java8/methodref/AssignmentContextTest.java +++ b/checker/tests/nullness/java8/methodref/AssignmentContextTest.java @@ -11,12 +11,12 @@ interface FunctionAC2 { public class AssignmentContextTest { // Test assign FunctionAC f1 = String::toString; - // :: error: (methodref.receiver) + // :: error: [methodref.receiver] FunctionAC2 f2 = String::toString; // Test casts Object o1 = (Object) (FunctionAC) String::toString; - // :: error: (methodref.receiver) + // :: error: [methodref.receiver] Object o2 = (Object) (FunctionAC2) String::toString; void take(FunctionAC f) { @@ -26,7 +26,7 @@ void take(FunctionAC f) { void take2(FunctionAC2 f) { // Test argument assingment - // :: error: (methodref.receiver) + // :: error: [methodref.receiver] take2(String::toString); } @@ -37,7 +37,7 @@ FunctionAC supply() { FunctionAC2 supply2() { // Test return assingment - // :: error: (methodref.receiver) + // :: error: [methodref.receiver] return String::toString; } } diff --git a/checker/tests/nullness/java8/methodref/ClassTypeArgInference.java b/checker/tests/nullness/java8/methodref/ClassTypeArgInference.java index 2de548525ba7..f34c6e682cb2 100644 --- a/checker/tests/nullness/java8/methodref/ClassTypeArgInference.java +++ b/checker/tests/nullness/java8/methodref/ClassTypeArgInference.java @@ -3,11 +3,11 @@ public class ClassTypeArgInference { public static void main(String[] args) { Gen o = new Gen<>(""); - // :: error: (type.arguments.not.inferred) + // :: error: [type.arguments.not.inferred] Factory f = Gen::make; - // :: error: (methodref.param) + // :: error: [methodref.param] Factory f2 = Gen::make; - // :: error: (methodref.receiver) :: error: (methodref.return) + // :: error: [methodref.receiver] :: error: [methodref.return] Factory f3 = Gen<@Nullable String>::make; f2.make(o, null).toString(); } diff --git a/checker/tests/nullness/java8/methodref/FromByteCode.java b/checker/tests/nullness/java8/methodref/FromByteCode.java index 663a7f79da86..d93bf19c04f5 100644 --- a/checker/tests/nullness/java8/methodref/FromByteCode.java +++ b/checker/tests/nullness/java8/methodref/FromByteCode.java @@ -9,6 +9,6 @@ public class FromByteCode { FunctionBC f1 = String::toString; // Make sure there aren't any issues generating an error with a method from byte code - // :: error: (methodref.param) + // :: error: [methodref.param] FunctionBC<@Nullable String, String> f2 = String::new; } diff --git a/checker/tests/nullness/java8/methodref/GroundTargetTypeLub.java b/checker/tests/nullness/java8/methodref/GroundTargetTypeLub.java index 9e1625169a32..7746874687e3 100644 --- a/checker/tests/nullness/java8/methodref/GroundTargetTypeLub.java +++ b/checker/tests/nullness/java8/methodref/GroundTargetTypeLub.java @@ -15,10 +15,10 @@ class GroundTargetType { } Supplier fn = GroundTargetType::myMethod; - // :: error: (methodref.return) + // :: error: [methodref.return] Supplier fn2 = GroundTargetType::myMethod; // Supplier2 - // :: error: (methodref.return) + // :: error: [methodref.return] Supplier2 fn3 = GroundTargetType::myMethod; } diff --git a/checker/tests/nullness/java8/methodref/MemberReferences.java b/checker/tests/nullness/java8/methodref/MemberReferences.java index 125b63fcbe42..1f5823d9b52d 100644 --- a/checker/tests/nullness/java8/methodref/MemberReferences.java +++ b/checker/tests/nullness/java8/methodref/MemberReferences.java @@ -8,22 +8,22 @@ void context(References c) { FuncA funcA1 = References::aMethod1; // No error, covariant parameters FuncA funcA2 = References::aMethod2; - // :: error: (methodref.return) + // :: error: [methodref.return] FuncA funcA3 = References::aMethod3; - // :: error: (methodref.return) + // :: error: [methodref.return] FuncA funcA4 = References::aMethod4; - // :: error: (methodref.param) + // :: error: [methodref.param] FuncB funcB1 = References::aMethod1; // No error FuncB funcB2 = References::aMethod2; - // :: error: (methodref.return) :: error: (methodref.param) + // :: error: [methodref.return] :: error: [methodref.param] FuncB funcB3 = References::aMethod3; - // :: error: (methodref.return) + // :: error: [methodref.return] FuncB funcB4 = References::aMethod4; FuncA typeArg1 = References::<@NonNull String>aMethod5; - // :: error: (methodref.param) + // :: error: [methodref.param] FuncB typeArg2 = References::<@NonNull String>aMethod5; } diff --git a/checker/tests/nullness/java8/methodref/PolyNullness.java b/checker/tests/nullness/java8/methodref/PolyNullness.java index a793919a793b..07bd1a898ba9 100644 --- a/checker/tests/nullness/java8/methodref/PolyNullness.java +++ b/checker/tests/nullness/java8/methodref/PolyNullness.java @@ -24,11 +24,11 @@ static String nonPoly(String in) { void context() { PolyFunc f1 = Context::poly; - // :: error: (methodref.param) + // :: error: [methodref.param] PolyFunc f2 = Context::nonPoly; NonNullFunc f3 = Context::poly; - // :: error: (methodref.return) + // :: error: [methodref.return] MixedFunc f4 = Context::poly; } } diff --git a/checker/tests/nullness/java8/methodref/Postconditions.java b/checker/tests/nullness/java8/methodref/Postconditions.java index cf53f38ea85d..17421c1b0791 100644 --- a/checker/tests/nullness/java8/methodref/Postconditions.java +++ b/checker/tests/nullness/java8/methodref/Postconditions.java @@ -27,7 +27,7 @@ static boolean overrideAssertFunc2(final @Nullable Object param) { void context() { AssertFunc f = AssertionTest::override; - // :: error: (methodref.receiver.postcondition) + // :: error: [methodref.receiver.postcondition] AssertFunc2 f2 = AssertionTest::overrideAssertFunc2; } } diff --git a/checker/tests/nullness/java8/methodref/ReceiversMethodref.java b/checker/tests/nullness/java8/methodref/ReceiversMethodref.java index 883007c48c66..abbfc76ac362 100644 --- a/checker/tests/nullness/java8/methodref/ReceiversMethodref.java +++ b/checker/tests/nullness/java8/methodref/ReceiversMethodref.java @@ -21,50 +21,50 @@ interface Bound { } class MyClass { - // :: error: (nullness.on.receiver) + // :: error: [nullness.on.receiver] void take(@NonNull MyClass this) {} - // :: error: (nullness.on.receiver) + // :: error: [nullness.on.receiver] void context1(@Nullable MyClass this, @NonNull MyClass my1, @Nullable MyClass my2) { Unbound1 u1 = MyClass::take; - // :: error: (methodref.receiver) + // :: error: [methodref.receiver] Unbound2 u2 = MyClass::take; Bound b1 = my1::take; - // :: error: (methodref.receiver.bound) + // :: error: [methodref.receiver.bound] Bound b2 = my2::take; - // :: error: (methodref.receiver.bound) + // :: error: [methodref.receiver.bound] Bound b11 = this::take; } - // :: error: (nullness.on.receiver) + // :: error: [nullness.on.receiver] void context2(@NonNull MyClass this) { Bound b21 = this::take; } class MySubClass extends MyClass { - // :: error: (nullness.on.receiver) + // :: error: [nullness.on.receiver] void context1(@Nullable MySubClass this) { - // :: error: (methodref.receiver.bound) + // :: error: [methodref.receiver.bound] Bound b = super::take; } - // :: error: (nullness.on.receiver) + // :: error: [nullness.on.receiver] void context2(@NonNull MySubClass this) { Bound b = super::take; } class Nested { - // :: error: (nullness.on.receiver) + // :: error: [nullness.on.receiver] void context1(@Nullable Nested this) { - // :: error: (methodref.receiver.bound) + // :: error: [methodref.receiver.bound] Bound b = MySubClass.super::take; } - // :: error: (nullness.on.receiver) + // :: error: [nullness.on.receiver] void context2(@NonNull Nested this) { Bound b = MySubClass.super::take; } @@ -74,20 +74,20 @@ void context2(@NonNull Nested this) { class Outer { class Inner1 { - // :: error: (nullness.on.receiver) + // :: error: [nullness.on.receiver] Inner1(@Nullable Outer Outer.this) {} } class Inner2 { - // :: error: (nullness.on.receiver) + // :: error: [nullness.on.receiver] Inner2(@NonNull Outer Outer.this) {} } - // :: error: (nullness.on.receiver) + // :: error: [nullness.on.receiver] void context(@Nullable Outer this) { // This one is unbound and needs an Outer as a param Supplier1 f1 = Inner1::new; - // :: error: (methodref.receiver.bound) + // :: error: [methodref.receiver.bound] Supplier1 f2 = Inner2::new; // Supplier1 f = /*4*/Inner::new; diff --git a/checker/tests/nullness/java8/methodref/TestGenFunc.java b/checker/tests/nullness/java8/methodref/TestGenFunc.java index 9b5d9440fade..303a641cde70 100644 --- a/checker/tests/nullness/java8/methodref/TestGenFunc.java +++ b/checker/tests/nullness/java8/methodref/TestGenFunc.java @@ -22,14 +22,14 @@ interface FuncNonNullParam { } void context() { - // :: error: (type.arguments.not.inferred) + // :: error: [type.arguments.not.inferred] FuncNullableParam f = TestGenFunc::nonNullReturn; - // :: error: (type.arguments.not.inferred) + // :: error: [type.arguments.not.inferred] FuncNonNullParam f2 = TestGenFunc::nonNullReturn; } void context2() { - // :: error: (type.arguments.not.inferred) + // :: error: [type.arguments.not.inferred] FuncNullableParam f = TestGenFunc::nonNullParameter; FuncNonNullParam f2 = TestGenFunc::nonNullParameter; } diff --git a/checker/tests/nullness/java8inference/Issue1084.java b/checker/tests/nullness/java8inference/Issue1084.java index be1622b821b0..cad82b4c2505 100644 --- a/checker/tests/nullness/java8inference/Issue1084.java +++ b/checker/tests/nullness/java8inference/Issue1084.java @@ -8,7 +8,7 @@ class MyOpt { throw new RuntimeException(); } - // :: error: (type.argument) + // :: error: [type.argument] static MyOpt of(S p) { throw new RuntimeException(); } diff --git a/checker/tests/nullness/java8inference/Issue1630.java b/checker/tests/nullness/java8inference/Issue1630.java index 0b3e2286eee6..3a8822e22a4b 100644 --- a/checker/tests/nullness/java8inference/Issue1630.java +++ b/checker/tests/nullness/java8inference/Issue1630.java @@ -19,7 +19,7 @@ public static List f2(@Nullable List xs) { return xs != null // TODO: we could refine the type of filter is the postconditions of the predicate // is @EnsuresNonNull("#1"). - // :: error: (type.arguments.not.inferred) + // :: error: [type.arguments.not.inferred] ? xs.stream().map(Issue1630::toString).filter(Objects::nonNull).collect(Collectors.toList()) : Collections.emptyList(); } diff --git a/checker/tests/nullness/java8inference/Issue2235.java b/checker/tests/nullness/java8inference/Issue2235.java index 6ce8743b642f..d3b4fa3999b4 100644 --- a/checker/tests/nullness/java8inference/Issue2235.java +++ b/checker/tests/nullness/java8inference/Issue2235.java @@ -18,7 +18,7 @@ public static Holder make(T t) { public static void main(String[] args) throws Exception { // Null is hidden via nested calls, but assigned to a non-null type: - // :: error: (type.arguments.not.inferred) + // :: error: [type.arguments.not.inferred] Holder> h = Holder.make(Holder.make(null)); // NullPointerException will fire here: h.t.t.toString(); diff --git a/checker/tests/nullness/java8inference/Issue887.java b/checker/tests/nullness/java8inference/Issue887.java index 1d18314607bc..632a1dd104bf 100644 --- a/checker/tests/nullness/java8inference/Issue887.java +++ b/checker/tests/nullness/java8inference/Issue887.java @@ -7,7 +7,7 @@ public abstract class Issue887 { void test() { - // :: error: (type.arguments.not.inferred) + // :: error: [type.arguments.not.inferred] method(foo(null).get(0)); methodNullable(fooNullable(null).get(0)); } diff --git a/checker/tests/nullness/jdkannotations/HashtableTest.java b/checker/tests/nullness/jdkannotations/HashtableTest.java index 5a742c118e54..7bea4f180bcc 100644 --- a/checker/tests/nullness/jdkannotations/HashtableTest.java +++ b/checker/tests/nullness/jdkannotations/HashtableTest.java @@ -5,13 +5,13 @@ public class HashtableTest { public static void main(String[] args) { - // :: error: (type.arguments.not.inferred) :: error: (type.argument) + // :: error: [type.arguments.not.inferred] :: error: [type.argument] Hashtable<@Nullable Integer, String> ht1 = new Hashtable<>(); // Suffers null pointer exception ht1.put(null, "hello"); - // :: error: (type.arguments.not.inferred) :: error: (type.argument) + // :: error: [type.arguments.not.inferred] :: error: [type.argument] Hashtable ht2 = new Hashtable<>(); // Suffers null pointer exception diff --git a/checker/tests/nullness/jdkannotations/Issue1142.java b/checker/tests/nullness/jdkannotations/Issue1142.java index f375d7019039..6ff09c32bc3c 100644 --- a/checker/tests/nullness/jdkannotations/Issue1142.java +++ b/checker/tests/nullness/jdkannotations/Issue1142.java @@ -6,7 +6,7 @@ public class Issue1142 { void foo() { - // :: error: (type.argument) :: error: (type.arguments.not.inferred) + // :: error: [type.argument] :: error: [type.arguments.not.inferred] ConcurrentHashMap chm1 = new ConcurrentHashMap<>(); chm1.put(1, null); } diff --git a/checker/tests/nullness/jdkannotations/TreeSetTest.java b/checker/tests/nullness/jdkannotations/TreeSetTest.java index bd20e6084472..d97e4e624e5f 100644 --- a/checker/tests/nullness/jdkannotations/TreeSetTest.java +++ b/checker/tests/nullness/jdkannotations/TreeSetTest.java @@ -10,7 +10,7 @@ public class TreeSetTest { public static void main(String[] args) { - // :: error: (type.argument) + // :: error: [type.argument] TreeSet<@Nullable Integer> ts = new TreeSet<>(); // This throws a null pointer exception diff --git a/checker/tests/optional/DisjointRangeTest.java b/checker/tests/optional/DisjointRangeTest.java index bf2b48f1d13f..f76fe3ac2b26 100644 --- a/checker/tests/optional/DisjointRangeTest.java +++ b/checker/tests/optional/DisjointRangeTest.java @@ -17,7 +17,7 @@ void foo() { } { Optional opt = baz(); - // :: error: (method.invocation) + // :: error: [method.invocation] opt.get(); } } diff --git a/checker/tests/optional/EnsuresPresentIfTest.java b/checker/tests/optional/EnsuresPresentIfTest.java index 3212c2889a38..085b8a25dfdb 100644 --- a/checker/tests/optional/EnsuresPresentIfTest.java +++ b/checker/tests/optional/EnsuresPresentIfTest.java @@ -6,7 +6,7 @@ public class EnsuresPresentIfTest { - // :: warning: (optional.field) + // :: warning: [optional.field] private Optional optId = Optional.of("abc"); @Pure @@ -79,7 +79,7 @@ void client() { if (hasPresentId8()) { optId.get(); } - // :: error: (method.invocation) + // :: error: [method.invocation] optId.get(); } } diff --git a/checker/tests/optional/FlowSensitivity.java b/checker/tests/optional/FlowSensitivity.java index 69a05d9230cb..48f5e713ec91 100644 --- a/checker/tests/optional/FlowSensitivity.java +++ b/checker/tests/optional/FlowSensitivity.java @@ -5,7 +5,7 @@ public class FlowSensitivity { String noCheck(Optional opt) { - // :: error: (method.invocation) + // :: error: [method.invocation] return opt.get(); } diff --git a/checker/tests/optional/IfPresentRefinement.java b/checker/tests/optional/IfPresentRefinement.java index 1b828bddb152..e61d00ed06f4 100644 --- a/checker/tests/optional/IfPresentRefinement.java +++ b/checker/tests/optional/IfPresentRefinement.java @@ -12,7 +12,7 @@ void m2(Optional o) { } void m3(Optional o) { - // :: error: (method.invocation) + // :: error: [method.invocation] o.ifPresentOrElse(s -> o.get(), () -> o.get()); } } diff --git a/checker/tests/optional/JdkCheck.java b/checker/tests/optional/JdkCheck.java index fbef1974c017..7c0f919cd307 100644 --- a/checker/tests/optional/JdkCheck.java +++ b/checker/tests/optional/JdkCheck.java @@ -34,7 +34,7 @@ String getTest1(@Present Optional pos) { } String getTest2(Optional mos) { - // :: error: (method.invocation) + // :: error: [method.invocation] return mos.get(); } @@ -47,17 +47,17 @@ Optional ofTestMNn(String s) { } @Present Optional ofTestPNble(@Nullable String s) { - // TODO :: error: (of.nullable.argument) :: error: (return) + // TODO :: error: [of.nullable.argument] :: error: [return] return Optional.of(s); } Optional ofTestMNble(@Nullable String s) { - // TODO :: error: (of.nullable.argument) :: error: (return) + // TODO :: error: [of.nullable.argument] :: error: [return] return Optional.of(s); } @Present Optional ofNullableTestPNble(@Nullable String s) { - // :: error: (return) + // :: error: [return] return Optional.ofNullable(s); } diff --git a/checker/tests/optional/JdkCheck11.java b/checker/tests/optional/JdkCheck11.java index e27485b86683..08039ee8030a 100644 --- a/checker/tests/optional/JdkCheck11.java +++ b/checker/tests/optional/JdkCheck11.java @@ -19,12 +19,12 @@ String orElseThrowTest1(@Present Optional pos) { } String orElseThrowTest2(Optional mos) { - // :: error: (method.invocation) + // :: error: [method.invocation] return mos.orElseThrow(); } String orElseThrowTestFlow(Optional mos) { - // :: error: (method.invocation) + // :: error: [method.invocation] mos.orElseThrow(); return mos.get(); } diff --git a/checker/tests/optional/LambdaMethodCallValue.java b/checker/tests/optional/LambdaMethodCallValue.java index f02150d069e4..1802baf88620 100644 --- a/checker/tests/optional/LambdaMethodCallValue.java +++ b/checker/tests/optional/LambdaMethodCallValue.java @@ -15,7 +15,7 @@ void test(OptContainer container, List strs) { void test2(OptContainer container, List strs) { if (container.getOpt().isPresent()) { - // :: error: (method.invocation) + // :: error: [method.invocation] strs.forEach(s -> container.getOptImpure().get()); } } @@ -34,7 +34,7 @@ void test4(OptContainer container, List strs) { strs.forEach( s -> { container.sideEffect(); - // :: error: (method.invocation) + // :: error: [method.invocation] container.getOpt().get(); // Not ok }); } @@ -53,7 +53,7 @@ void test5(OptContainer container, List strs) { void test6(OptContainer container) { if (container.getOpt().isPresent()) { - // :: error: (method.invocation) + // :: error: [method.invocation] container.forEach(s -> container.getOpt().get()); } } diff --git a/checker/tests/optional/Marks1Partial.java b/checker/tests/optional/Marks1Partial.java index 56e58f1a9a60..a7ea8393b91e 100644 --- a/checker/tests/optional/Marks1Partial.java +++ b/checker/tests/optional/Marks1Partial.java @@ -14,19 +14,19 @@ public class Marks1Partial { @SuppressWarnings("optional.parameter") void simpleEqualsCheck(Optional o1) { - // :: warning: (optional.null.comparison) + // :: warning: [optional.null.comparison] if (o1 != null) { System.out.println("Don't compare optionals (lhs) to null literals."); } - // :: warning: (optional.null.comparison) + // :: warning: [optional.null.comparison] if (null != o1) { System.out.println("Don't compare optionals (rhs) to null literals."); } - // :: warning: (optional.null.comparison) + // :: warning: [optional.null.comparison] if (o1 == null) { System.out.println("Don't compare optionals (lhs) to null literals."); } - // :: warning: (optional.null.comparison) + // :: warning: [optional.null.comparison] if (null == o1) { System.out.println("Don't compare optionals (rhs) to null literals."); } @@ -34,7 +34,7 @@ void simpleEqualsCheck(Optional o1) { @SuppressWarnings("optional.parameter") void moreComplexEqualsChecks(Optional o1) { - // :: warning: (optional.null.comparison) + // :: warning: [optional.null.comparison] if (o1 != null || 1 + 2 == 4) { System.out.println("Don't compare optionals (lhs) to null literals."); } @@ -42,7 +42,7 @@ void moreComplexEqualsChecks(Optional o1) { @SuppressWarnings("optional.parameter") void checkAgainstOptionalField() { - // :: warning: (optional.null.comparison) + // :: warning: [optional.null.comparison] if (this.getOptField() != null || 1 + 2 == 4) { System.out.println("Don't compare optionals (lhs) to null literals."); } @@ -53,26 +53,26 @@ public Optional getOptField() { } public void assignOptField() { - // :: warning: (optional.null.assignment) + // :: warning: [optional.null.assignment] optField = null; } public void assignOptionalDeclaration() { - // :: warning: (optional.null.assignment) + // :: warning: [optional.null.assignment] Optional os1 = null; Optional os2; if (Math.random() > 0.5) { os2 = Optional.of("hello"); } else { - // :: warning: (optional.null.assignment) + // :: warning: [optional.null.assignment] os2 = null; } - // :: warning: (optional.null.assignment) + // :: warning: [optional.null.assignment] Optional os3 = Math.random() > 0.5 ? Optional.of("hello") : null; } public Optional returnNullOptional() { - // :: warning: (optional.null.assignment) + // :: warning: [optional.null.assignment] return (null); } } diff --git a/checker/tests/optional/Marks2.java b/checker/tests/optional/Marks2.java index dbaf829d876e..a51c581f4dd1 100644 --- a/checker/tests/optional/Marks2.java +++ b/checker/tests/optional/Marks2.java @@ -19,7 +19,7 @@ String getName() { String customerNameByID(List custList, int custID) { Optional opt = custList.stream().filter(c -> c.getID() == custID).findFirst(); - // :: error: (method.invocation) + // :: error: [method.invocation] return opt.get().getName(); } } diff --git a/checker/tests/optional/Marks3a.java b/checker/tests/optional/Marks3a.java index 0dff3b0619ee..6d9760312e26 100644 --- a/checker/tests/optional/Marks3a.java +++ b/checker/tests/optional/Marks3a.java @@ -26,17 +26,17 @@ String getNameImpure() { String customerNameByID_acceptable(List custList, int custID) { Optional opt = custList.stream().filter(c -> c.getID() == custID).findFirst(); - // :: warning: (prefer.map.and.orelse) + // :: warning: [prefer.map.and.orelse] String s = opt.isPresent() ? opt.get().getNameImpure() : "UNKNOWN"; - // :: warning: (prefer.map.and.orelse) + // :: warning: [prefer.map.and.orelse] return opt.isPresent() ? opt.get().getName() : "UNKNOWN"; } String customerNameByID_acceptable2(List custList, int custID) { Optional opt = custList.stream().filter(c -> c.getID() == custID).findFirst(); - // :: warning: (prefer.map.and.orelse) + // :: warning: [prefer.map.and.orelse] return !opt.isPresent() ? "UNKNOWN" : opt.get().getName(); } @@ -44,7 +44,7 @@ String customerNameByID_acceptable3(List custList, int custID) { Optional opt = custList.stream().filter(c -> c.getID() == custID).findFirst(); String customerName; - // :: warning: (prefer.map.and.orelse) + // :: warning: [prefer.map.and.orelse] if (opt.isPresent()) { customerName = opt.get().getName(); } else { diff --git a/checker/tests/optional/Marks3aJdk11.java b/checker/tests/optional/Marks3aJdk11.java index 74dafae10509..efc7d06e922f 100644 --- a/checker/tests/optional/Marks3aJdk11.java +++ b/checker/tests/optional/Marks3aJdk11.java @@ -23,7 +23,7 @@ String getName() { String customerNameByID_acceptable3(List custList, int custID) { Optional opt = custList.stream().filter(c -> c.getID() == custID).findFirst(); - // :: warning: (prefer.map.and.orelse) + // :: warning: [prefer.map.and.orelse] return opt.isEmpty() ? "UNKNOWN" : opt.get().getName(); } } diff --git a/checker/tests/optional/Marks3b.java b/checker/tests/optional/Marks3b.java index 877cf3e90f6e..33ee51287440 100644 --- a/checker/tests/optional/Marks3b.java +++ b/checker/tests/optional/Marks3b.java @@ -15,7 +15,7 @@ void runTask(Task t) {} Executor executor = new Executor(); void bad(Optional oTask) { - // :: warning: (prefer.ifpresent) + // :: warning: [prefer.ifpresent] if (oTask.isPresent()) { executor.runTask(oTask.get()); } diff --git a/checker/tests/optional/Marks3bJdk11.java b/checker/tests/optional/Marks3bJdk11.java index feae955395fe..39ed3c67b360 100644 --- a/checker/tests/optional/Marks3bJdk11.java +++ b/checker/tests/optional/Marks3bJdk11.java @@ -17,14 +17,14 @@ void runTask(Task t) {} Executor executor = new Executor(); void bad2(Optional oTask) { - // :: warning: (prefer.ifpresent) + // :: warning: [prefer.ifpresent] if (!oTask.isEmpty()) { executor.runTask(oTask.get()); } } void bad3(Optional oTask) { - // :: warning: (prefer.ifpresent) + // :: warning: [prefer.ifpresent] if (oTask.isEmpty()) { } else { executor.runTask(oTask.get()); diff --git a/checker/tests/optional/Marks3c.java b/checker/tests/optional/Marks3c.java index fc1e803dd5c0..a526010400a6 100644 --- a/checker/tests/optional/Marks3c.java +++ b/checker/tests/optional/Marks3c.java @@ -34,19 +34,19 @@ Optional getOptCustomerPure() { String customerNameByID1(Optional opt) { // better: return opt.map(Customer::getName).orElse("UNKNOWN"); - // :: warning: (prefer.map.and.orelse) + // :: warning: [prefer.map.and.orelse] return opt.isPresent() ? opt.get().getName() : "UNKNOWN"; } String customerNameByID2(List custList, int custID) { Optional opt = custList.stream().filter(c -> c.getID() == custID).findFirst(); // better: return opt.map(Customer::getName).orElse("UNKNOWN"); - // :: warning: (prefer.map.and.orelse) + // :: warning: [prefer.map.and.orelse] return opt.isPresent() ? opt.get().getName() : "UNKNOWN"; } void main(Optional optCustomer) { - // :: warning: (prefer.map) + // :: warning: [prefer.map] if (optCustomer.isPresent()) { Customer c = identity(optCustomer.get()); } else { @@ -58,7 +58,7 @@ void main(Optional optCustomer) { System.out.println("hello world"); } - // :: warning: (prefer.map) + // :: warning: [prefer.map] if (!optCustomer.isPresent()) { } else { Customer c = identity(optCustomer.get()); @@ -75,7 +75,7 @@ void m1() { } void m2() { - // :: warning: (prefer.map) + // :: warning: [prefer.map] if (getOptCustomerPure().isPresent()) { Customer c = identity(getOptCustomerPure().get()); } else { diff --git a/checker/tests/optional/Marks4.java b/checker/tests/optional/Marks4.java index 87f6eabe094b..cd52f1d38690 100644 --- a/checker/tests/optional/Marks4.java +++ b/checker/tests/optional/Marks4.java @@ -12,17 +12,17 @@ String getDefault() { } String process_bad(String s) { - // :: warning: (introduce.eliminate) + // :: warning: [introduce.eliminate] return Optional.ofNullable(s).orElseGet(this::getDefault); } String process_bad2(String s) { - // :: warning: (introduce.eliminate) + // :: warning: [introduce.eliminate] return Optional.empty().orElseGet(this::getDefault); } String process_bad3(String s) { - // :: warning: (introduce.eliminate) + // :: warning: [introduce.eliminate] return Optional.of(s).orElseGet(this::getDefault); } @@ -31,22 +31,22 @@ String process_good(String s) { } String m1(String s) { - // :: warning: (introduce.eliminate) + // :: warning: [introduce.eliminate] return Optional.ofNullable(s).orElseGet(this::getDefault) + "hello"; } boolean m2(String s) { - // :: warning: (introduce.eliminate) + // :: warning: [introduce.eliminate] return Objects.equals("hello", Optional.ofNullable(s).orElseGet(this::getDefault)); } boolean m3(String s) { - // :: warning: (introduce.eliminate) + // :: warning: [introduce.eliminate] return "hello" == Optional.ofNullable(s).orElseGet(this::getDefault); } String m4(String s) { - // :: warning: (introduce.eliminate) + // :: warning: [introduce.eliminate] return Optional.ofNullable(s).map(Object::toString).orElseGet(this::getDefault); } @@ -54,7 +54,7 @@ String m5(String s) { return Optional.ofNullable(s) .map(Object::toString) .map(Object::toString) - // :: warning: (introduce.eliminate) + // :: warning: [introduce.eliminate] .orElseGet(this::getDefault); } } diff --git a/checker/tests/optional/Marks5.java b/checker/tests/optional/Marks5.java index 3427c049057b..3e7f0c6f45f2 100644 --- a/checker/tests/optional/Marks5.java +++ b/checker/tests/optional/Marks5.java @@ -37,7 +37,7 @@ Optional clever2(Optional first, Optional se // there. Optional moreClever(Optional first, Optional second) { Optional result = - // :: error: (argument) + // :: error: [argument] first.map(b -> second.map(b::add).orElse(b)).map(Optional::of).orElse(second); return result; } diff --git a/checker/tests/optional/Marks6.java b/checker/tests/optional/Marks6.java index 4d780a5b4131..7cdf832b1757 100644 --- a/checker/tests/optional/Marks6.java +++ b/checker/tests/optional/Marks6.java @@ -7,10 +7,10 @@ /** Test cases for Rule #6: "Avoid using Optional in fields, method parameters, and collections." */ public class Marks6 { - // :: warning: (optional.field) + // :: warning: [optional.field] Optional optionalField = Optional.ofNullable(null); - // :: warning: (optional.parameter) + // :: warning: [optional.parameter] void optionalParameter(Optional arg) {} Optional okUses() { @@ -19,11 +19,11 @@ Optional okUses() { } void illegalInstantiations() { - // :: warning: (optional.as.element.type) + // :: warning: [optional.as.element.type] List> los = new ArrayList<>(); - // :: warning: (optional.as.element.type) + // :: warning: [optional.as.element.type] List> los2 = new ArrayList>(); - // :: warning: (optional.as.element.type) + // :: warning: [optional.as.element.type] Set> sos = new HashSet<>(); } } diff --git a/checker/tests/optional/Marks7.java b/checker/tests/optional/Marks7.java index c3d677caaf9c..ef512cbc8d0f 100644 --- a/checker/tests/optional/Marks7.java +++ b/checker/tests/optional/Marks7.java @@ -11,9 +11,9 @@ public class Marks7 { void illegalInstantiations() { - // :: warning: (optional.collection) + // :: warning: [optional.collection] Optional> ols = Optional.of(new ArrayList()); - // :: warning: (optional.collection) + // :: warning: [optional.collection] Optional> oss = Optional.of(new HashSet()); } } diff --git a/checker/tests/optional/NestedMethod.java b/checker/tests/optional/NestedMethod.java index 957c632e33cf..f4e970a77cda 100644 --- a/checker/tests/optional/NestedMethod.java +++ b/checker/tests/optional/NestedMethod.java @@ -18,7 +18,7 @@ void Foo() { foo.stream() .map(String::length) .max(Integer::compare) - // :: error: (method.invocation) + // :: error: [method.invocation] .get(); }; r.run(); diff --git a/checker/tests/optional/NestedOptionalTest.java b/checker/tests/optional/NestedOptionalTest.java index f32733b7d0cc..0c4055cdc537 100644 --- a/checker/tests/optional/NestedOptionalTest.java +++ b/checker/tests/optional/NestedOptionalTest.java @@ -6,7 +6,7 @@ class NestedOptional { Object field; @SuppressWarnings("optional.parameter") - // :: warning: (optional.nesting) + // :: warning: [optional.nesting] Optional bar(Optional> optOptStr) { if (optOptStr.isPresent()) { return optOptStr.get(); @@ -16,16 +16,16 @@ Optional bar(Optional> optOptStr) { void foo() { // Explicitly providing a type annotation triggers the error - // :: warning: (optional.nesting) + // :: warning: [optional.nesting] var x = Optional.of(Optional.of("foo")); // I expect an error here. - // :: warning: (optional.nesting) + // :: warning: [optional.nesting] bar(Optional.of(Optional.of("bar"))); - // :: warning: (optional.nesting) + // :: warning: [optional.nesting] field = Optional.of(Optional.of("baz")); - // :: warning: (optional.collection) + // :: warning: [optional.collection] field = Optional.of(Collections.singleton("baz")); } } diff --git a/checker/tests/optional/NonEmptyParentFieldTest.java b/checker/tests/optional/NonEmptyParentFieldTest.java index 15d578fde1b6..8e15f01c3fbf 100644 --- a/checker/tests/optional/NonEmptyParentFieldTest.java +++ b/checker/tests/optional/NonEmptyParentFieldTest.java @@ -23,7 +23,7 @@ class ChildOne extends ParentOne { // Check for fields one level up (direct superclass) void m1() { - // :: error: (method.invocation) + // :: error: [method.invocation] parentEmptyList.stream().max(Integer::compareTo).get(); parentNEList.stream().max(Integer::compareTo).get(); // OK @@ -31,7 +31,7 @@ void m1() { // Check for field more than one level up (non-direct superclass) void m2() { - // :: error: (method.invocation) + // :: error: [method.invocation] grandParentEmptyList.stream().max(Integer::compareTo).get(); grandParentNEList.stream().max(Integer::compareTo).get(); // OK @@ -42,7 +42,7 @@ class ChildTwo extends ParentTwo { // Check for field more than one level up (non-direct superclass) void m1() { - // :: error: (method.invocation) + // :: error: [method.invocation] grandParentEmptyList.stream().max(Integer::compareTo).get(); grandParentNEList.stream().max(Integer::compareTo).get(); // OK diff --git a/checker/tests/optional/OptionalBoxed.java b/checker/tests/optional/OptionalBoxed.java index 766d10ff4288..0186de5fd343 100644 --- a/checker/tests/optional/OptionalBoxed.java +++ b/checker/tests/optional/OptionalBoxed.java @@ -5,20 +5,20 @@ class OptionalBoxed { - // :: warning: (optional.field) + // :: warning: [optional.field] OptionalDouble aField; - // :: warning: (optional.parameter) + // :: warning: [optional.parameter] void m(OptionalInt aParam) { - // :: warning: (introduce.eliminate) + // :: warning: [introduce.eliminate] int x = OptionalLong.of(1L).hashCode(); - // :: warning: (introduce.eliminate) + // :: warning: [introduce.eliminate] long y = OptionalLong.of(1L).orElse(2L); - // :: warning: (introduce.eliminate) + // :: warning: [introduce.eliminate] boolean b = Optional.empty().isPresent(); - // :: warning: (introduce.eliminate) + // :: warning: [introduce.eliminate] OptionalDouble.empty().ifPresent(d -> {}); - // :: warning: (introduce.eliminate) + // :: warning: [introduce.eliminate] boolean b4 = OptionalLong.empty().isPresent(); } } diff --git a/checker/tests/optional/OptionalClosureTest.java b/checker/tests/optional/OptionalClosureTest.java index f659fdd330bf..88a8fa904fda 100644 --- a/checker/tests/optional/OptionalClosureTest.java +++ b/checker/tests/optional/OptionalClosureTest.java @@ -10,7 +10,7 @@ public Function test() { if (opt.isPresent()) { // We *should* issue an error here. It's no good that opt is @Present here; it might be // @MaybePresent at the time of invocation, for which get() is illegal. - // :: error: (method.invocation) + // :: error: [method.invocation] return str -> opt.get(); } return str -> "Hello"; diff --git a/checker/tests/optional/OptionalMapMethodReference.java b/checker/tests/optional/OptionalMapMethodReference.java index 85642d9e9c9c..e26ad5f65db1 100644 --- a/checker/tests/optional/OptionalMapMethodReference.java +++ b/checker/tests/optional/OptionalMapMethodReference.java @@ -12,7 +12,7 @@ Optional getString() { Optional o = getString(); @Present Optional oInt; if (o.isPresent()) { - // :: error: (assignment) + // :: error: [assignment] oInt = o.map(this::convertNull); oInt = o.map(this::convertPoly); return o.map(this::convert); diff --git a/checker/tests/optional/OptionalRelyGuaranteeTest.java b/checker/tests/optional/OptionalRelyGuaranteeTest.java index 0310d7cdd082..a314b1241210 100644 --- a/checker/tests/optional/OptionalRelyGuaranteeTest.java +++ b/checker/tests/optional/OptionalRelyGuaranteeTest.java @@ -10,7 +10,7 @@ void a(ContainerWrapper wrapper) { if (!wrapper.getStrs().isEmpty()) { b("test", wrapper); } - // :: error: (assignment) + // :: error: [assignment] @NonEmpty List ne = wrapper.getStrs(); } diff --git a/checker/tests/optional/OptionalVariableScopeTest.java b/checker/tests/optional/OptionalVariableScopeTest.java index a069b3de5546..bb45560d3ee7 100644 --- a/checker/tests/optional/OptionalVariableScopeTest.java +++ b/checker/tests/optional/OptionalVariableScopeTest.java @@ -24,12 +24,12 @@ void m1() { void m2() { Optional opt = getOpt(); { - // :: error: (method.invocation) + // :: error: [method.invocation] opt.get(); - // :: error: (method.invocation) + // :: error: [method.invocation] getOpt().get(); Optional anotherOpt = getOpt(); - // :: error: (method.invocation) + // :: error: [method.invocation] anotherOpt.get(); } } diff --git a/checker/tests/optional/OuterClassTest.java b/checker/tests/optional/OuterClassTest.java index 5802cbd9683c..027734e268cb 100644 --- a/checker/tests/optional/OuterClassTest.java +++ b/checker/tests/optional/OuterClassTest.java @@ -20,7 +20,7 @@ void invalidGet() { emptyStrs.stream() .map(String::length) .max(Integer::compare) - // :: error: (method.invocation) + // :: error: [method.invocation] .get(); } diff --git a/checker/tests/optional/RequiresPresentTest.java b/checker/tests/optional/RequiresPresentTest.java index 0c2b2d2b1d4d..e7c3099e8f47 100644 --- a/checker/tests/optional/RequiresPresentTest.java +++ b/checker/tests/optional/RequiresPresentTest.java @@ -3,16 +3,16 @@ public class RequiresPresentTest { - // :: warning: (optional.field) + // :: warning: [optional.field] Optional field1 = Optional.of("abc"); - // :: warning: (optional.field) + // :: warning: [optional.field] Optional field2 = Optional.empty(); @RequiresPresent("field1") void method1() { field1.get().length(); // OK, field1 is known to be present (non-empty) this.field1.get().length(); // OK, field1 is known to be present (non-empty) - // :: error: (method.invocation) + // :: error: [method.invocation] field2.get().length(); // error, might throw NoSuchElementException } @@ -26,18 +26,18 @@ void method3() { field1 = Optional.of("abc"); method1(); // OK, satisfied method precondition. field1 = Optional.empty(); - // :: error: (contracts.precondition) + // :: error: [contracts.precondition] method1(); // error, does not satisfy method precondition. } - // :: warning: (optional.field) + // :: warning: [optional.field] protected Optional field; @RequiresPresent("field") public void requiresPresentField() {} public void clientFail(RequiresPresentTest arg1) { - // :: error: (contracts.precondition) + // :: error: [contracts.precondition] arg1.requiresPresentField(); } @@ -66,7 +66,7 @@ void method5() { method4(); // OK, both preconditions now hold at this point. field1 = Optional.empty(); - // :: error: (contracts.precondition) + // :: error: [contracts.precondition] method4(); // error, field1 is no longer present. } } diff --git a/checker/tests/optional/ShadowingMethodCalls.java b/checker/tests/optional/ShadowingMethodCalls.java index 7bd2c58ef45e..da497442dde7 100644 --- a/checker/tests/optional/ShadowingMethodCalls.java +++ b/checker/tests/optional/ShadowingMethodCalls.java @@ -33,13 +33,13 @@ void callSuperAndCheckSuper() { void callSuperAndCheckThis() { super.setF(); - // :: error: (method.invocation) + // :: error: [method.invocation] this.f.get(); } void callThisAndCheckThis() { this.setF(); - // :: error: (method.invocation) + // :: error: [method.invocation] this.f.get(); super.f.get(); } diff --git a/checker/tests/optional/SubtypeCheck.java b/checker/tests/optional/SubtypeCheck.java index 2ac3cec73e75..56cf9ca3c6c0 100644 --- a/checker/tests/optional/SubtypeCheck.java +++ b/checker/tests/optional/SubtypeCheck.java @@ -9,7 +9,7 @@ public class SubtypeCheck { void foo(@MaybePresent Optional mp, @Present Optional p) { @MaybePresent Optional mp2 = mp; @MaybePresent Optional mp3 = p; - // :: error: (assignment) + // :: error: [assignment] @Present Optional p2 = mp; @Present Optional p3 = p; } diff --git a/checker/tests/regex/AllowedTypes.java b/checker/tests/regex/AllowedTypes.java index ffb1ef5bb36c..e9ba3b3a41f9 100644 --- a/checker/tests/regex/AllowedTypes.java +++ b/checker/tests/regex/AllowedTypes.java @@ -21,15 +21,15 @@ abstract static class MyMatchResult implements MatchResult {} @Regex MyMatchResult mp; - // :: error: (anno.on.irrelevant) + // :: error: [anno.on.irrelevant] @Regex List l; - // :: error: (anno.on.irrelevant) + // :: error: [anno.on.irrelevant] ArrayList<@Regex Double> al; - // :: error: (anno.on.irrelevant) + // :: error: [anno.on.irrelevant] @Regex int i; - // :: error: (anno.on.irrelevant) + // :: error: [anno.on.irrelevant] @Regex boolean b; - // :: error: (anno.on.irrelevant) + // :: error: [anno.on.irrelevant] @Regex Integer i2; void testAllowedTypes() { @@ -40,17 +40,17 @@ void testAllowedTypes() { @Regex char c; @Regex Object o; - // :: error: (anno.on.irrelevant) + // :: error: [anno.on.irrelevant] @Regex List l; // error - // :: error: (anno.on.irrelevant) + // :: error: [anno.on.irrelevant] ArrayList<@Regex Double> al; // error - // :: error: (anno.on.irrelevant) + // :: error: [anno.on.irrelevant] @Regex int i; // error - // :: error: (anno.on.irrelevant) + // :: error: [anno.on.irrelevant] @Regex boolean b; // error @Regex String regex = "a"; - // :: error: (compound.assignment) + // :: error: [compound.assignment] regex += "("; String nonRegex = "a"; diff --git a/checker/tests/regex/Constructors.java b/checker/tests/regex/Constructors.java index 1421bc578345..1aec7c0e0b50 100644 --- a/checker/tests/regex/Constructors.java +++ b/checker/tests/regex/Constructors.java @@ -15,13 +15,13 @@ public void testAnonymousConstructor(String s) { Constructors m = new Constructors(null); - // :: error: (argument) + // :: error: [argument] new MyConstructors(s); - // :: error: (argument) + // :: error: [argument] new MyConstructors(s) {}; - // :: error: (argument) + // :: error: [argument] m.new MyConstructors(s); - // :: error: (argument) + // :: error: [argument] m.new MyConstructors(s) {}; } } diff --git a/checker/tests/regex/GenericsBoundsRange.java b/checker/tests/regex/GenericsBoundsRange.java index 763cbdbd550b..7bc319935001 100644 --- a/checker/tests/regex/GenericsBoundsRange.java +++ b/checker/tests/regex/GenericsBoundsRange.java @@ -17,15 +17,15 @@ public GenericsBoundsRange(T t) { // T has at least 1 group so the above 2 group calls are good // however, T MAY or MAY NOT have 2 or 3 groups, so issue an error - // :: error: (group.count) + // :: error: [group.count] matcher.group(2); - // :: error: (group.count) + // :: error: [group.count] matcher.group(3); // T definitely does not have 4 groups, issue an error - // :: error: (group.count) + // :: error: [group.count] matcher.group(4); } } diff --git a/checker/tests/regex/GenericsEnclosing.java b/checker/tests/regex/GenericsEnclosing.java index 04a2f3e047ea..40478bda2566 100644 --- a/checker/tests/regex/GenericsEnclosing.java +++ b/checker/tests/regex/GenericsEnclosing.java @@ -18,11 +18,11 @@ class EInner2 { void bar() { String s = f; f = "hi"; - // :: error: (assignment) + // :: error: [assignment] f = "\\ no regex("; m("hi!"); - // :: error: (argument) + // :: error: [argument] m("\\ no regex("); } } diff --git a/checker/tests/regex/GroupCounts.java b/checker/tests/regex/GroupCounts.java index 917af13af0e1..dc9861b039bf 100644 --- a/checker/tests/regex/GroupCounts.java +++ b/checker/tests/regex/GroupCounts.java @@ -16,13 +16,13 @@ void testGroupCount() { @Regex(2) String s10 = "()()(())"; @Regex(3) String s11 = "()()(())"; - // :: error: (assignment) + // :: error: [assignment] @Regex(2) String s6 = "nonregex("; // error - // :: error: (assignment) + // :: error: [assignment] @Regex(1) String s8 = "abc"; // error - // :: error: (assignment) + // :: error: [assignment] @Regex(3) String s12 = "()()"; // error - // :: error: (assignment) + // :: error: [assignment] @Regex(4) String s13 = "(())()"; // error } @@ -32,13 +32,13 @@ void testPatternCompileGroupCount(@Regex String r, @Regex(3) String r3, @Regex(5 @Regex Pattern p2 = Pattern.compile(r5); @Regex Pattern p3 = Pattern.compile(r); - // :: error: (assignment) + // :: error: [assignment] @Regex(6) Pattern p4 = Pattern.compile(r5); // error - // :: error: (assignment) + // :: error: [assignment] @Regex(6) Pattern p4a = Pattern.compile(r5, 0); // error - // :: error: (assignment) + // :: error: [assignment] @Regex(6) Pattern p5 = Pattern.compile(r3); // error - // :: error: (assignment) + // :: error: [assignment] @Regex(6) Pattern p5a = Pattern.compile(r3, 0); // error // Make sure Pattern.compile still works when passed an @UnknownRegex String @@ -54,11 +54,11 @@ void testConcatenationGroupCount(@Regex String r, @Regex(3) String r3, @Regex(5) @Regex(3) String s2 = r + r3; @Regex(8) String s3 = r3 + r5; - // :: error: (assignment) + // :: error: [assignment] @Regex(1) String s4 = r + r; - // :: error: (assignment) + // :: error: [assignment] @Regex(4) String s5 = r + r3; - // :: error: (assignment) + // :: error: [assignment] @Regex(9) String s6 = r3 + r5; } @@ -66,27 +66,27 @@ void testCompoundConcatenationWithGroups( @Regex String s0, @Regex(1) String s1, @Regex(3) String s3) { s0 += s0; @Regex String test0 = s0; - // :: error: (assignment) + // :: error: [assignment] @Regex(1) String test01 = s0; s0 += s1; @Regex(1) String test1 = s0; - // :: error: (assignment) + // :: error: [assignment] @Regex(2) String test12 = s0; s1 += s3; @Regex(4) String test4 = s1; - // :: error: (assignment) + // :: error: [assignment] @Regex(5) String test45 = s1; } void testAsRegexGroupCounts(String s) { @Regex String test1 = RegexUtil.asRegex(s); - // :: error: (assignment) + // :: error: [assignment] @Regex(1) String test2 = RegexUtil.asRegex(s); @Regex(3) String test3 = RegexUtil.asRegex(s, 3); - // :: error: (assignment) + // :: error: [assignment] @Regex(4) String test4 = RegexUtil.asRegex(s, 3); } @@ -96,27 +96,27 @@ void testMatcherGroupCounts( m0.group(0); m0.start(0); - // :: error: (group.count) + // :: error: [group.count] m0.end(1); - // :: error: (group.count) + // :: error: [group.count] m0.group(1); - // :: error: (group.count) + // :: error: [group.count] m0.start(1); m1.start(0); m1.start(1); - // :: error: (group.count) + // :: error: [group.count] m1.start(2); m4.start(0); m4.start(2); m4.start(4); - // :: error: (group.count) + // :: error: [group.count] m4.start(5); - // :: warning: (group.count.unknown) + // :: warning: [group.count.unknown] m0.start(n); } } diff --git a/checker/tests/regex/InvariantTypes.java b/checker/tests/regex/InvariantTypes.java index f86f21a1bad3..372ec9b7821b 100644 --- a/checker/tests/regex/InvariantTypes.java +++ b/checker/tests/regex/InvariantTypes.java @@ -16,13 +16,13 @@ public class InvariantTypes { // tested above: String[] sa = {"a"}; @Regex String[] rsa = {"a"}; String[] nrsa = {"(a"}; - // :: error: (array.initializer) :: error: (assignment) + // :: error: [array.initializer] :: error: [assignment] @Regex String[] rsaerr = {"(a"}; List ls = Arrays.asList("alice", "bob", "carol"); List<@Regex String> lrs = Arrays.asList("alice", "bob", "carol"); List lnrs = Arrays.asList("(alice", "bob", "carol"); - // :: error: (type.arguments.not.inferred) + // :: error: [type.arguments.not.inferred] List<@Regex String> lrserr = Arrays.asList("(alice", "bob", "carol"); void unqm(String[] sa) {} @@ -31,7 +31,7 @@ void rem(@Regex String[] rsa) {} void recalls() { unqm(new String[] {"a"}); - // TODOINVARR:: error: (argument) + // TODOINVARR:: error: [argument] unqm(new @Regex String[] {"a"}); rem(new String[] {"a"}); rem(new @Regex String[] {"a"}); @@ -39,12 +39,12 @@ void recalls() { void unqcalls() { unqm(new String[] {"a("}); - // TODOINVARR:: error: (argument) - // :: error: (array.initializer) + // TODOINVARR:: error: [argument] + // :: error: [array.initializer] unqm(new @Regex String[] {"a("}); - // :: error: (argument) + // :: error: [argument] rem(new String[] {"a("}); - // :: error: (array.initializer) + // :: error: [array.initializer] rem(new @Regex String[] {"a("}); } @@ -64,9 +64,9 @@ String[] retunqm(String[] sa) { void retunqcalls() { @Regex String[] re = mixedm(new String[] {"a("}); - // TODOINVARR:: error: (argument) + // TODOINVARR:: error: [argument] String[] u = retunqm(new String[] {"a"}); - // TODOINVARR:: error: (argument) + // TODOINVARR:: error: [argument] re = mixedm(new String[2]); } @@ -78,7 +78,7 @@ void listcalls() { lunqm(Arrays.asList("alice", "bob", "carol")); lrem(Arrays.asList("alice", "bob", "carol")); lunqm(Arrays.asList("(alice", "bob", "carol")); - // :: error: (type.arguments.not.inferred) + // :: error: [type.arguments.not.inferred] lrem(Arrays.asList("(alice", "bob", "carol")); } @@ -92,7 +92,7 @@ void listctrs() { new ReTests(Arrays.asList("alice", "bob", "carol"), 0); new ReTests(Arrays.asList("alice", "bob", "carol")); new ReTests(Arrays.asList("(alice", "bob", "carol"), 0); - // :: error: (type.arguments.not.inferred) + // :: error: [type.arguments.not.inferred] new ReTests(Arrays.asList("(alice", "bob", "carol")); } diff --git a/checker/tests/regex/Issue3267.java b/checker/tests/regex/Issue3267.java index 02010bdf36b9..fe3c9f9adbec 100644 --- a/checker/tests/regex/Issue3267.java +++ b/checker/tests/regex/Issue3267.java @@ -10,7 +10,7 @@ void foo(String s) { } else { } if (true) { - // :: error: (argument) + // :: error: [argument] Pattern.compile(s); } } diff --git a/checker/tests/regex/Issue3281.java b/checker/tests/regex/Issue3281.java index cd8e5b6de311..e939553739f2 100644 --- a/checker/tests/regex/Issue3281.java +++ b/checker/tests/regex/Issue3281.java @@ -13,7 +13,7 @@ public class Issue3281 { void m1(String s) { if (true) { - // :: error: (argument) + // :: error: [argument] Pattern.compile(s); } } @@ -21,7 +21,7 @@ void m1(String s) { void m2(String s) { RegexUtil.isRegex(s); if (true) { - // :: error: (argument) + // :: error: [argument] Pattern.compile(s); } } @@ -29,7 +29,7 @@ void m2(String s) { void m2f(String s) { RegexUtil.isRegex(s); if (true) { - // :: error: (assignment) + // :: error: [assignment] f = s; } } @@ -43,7 +43,7 @@ void m3(String s) { void m4(String s, String s2) { RegexUtil.isRegex(s); if (RegexUtil.isRegex(s2)) { - // :: error: (argument) + // :: error: [argument] Pattern.compile(s); } } @@ -51,7 +51,7 @@ void m4(String s, String s2) { void m4f(String s, String s2) { RegexUtil.isRegex(s); if (RegexUtil.isRegex(s2)) { - // :: error: (assignment) + // :: error: [assignment] f = s; } } @@ -59,7 +59,7 @@ void m4f(String s, String s2) { void m5f(String s, String s2) { RegexUtil.isRegex(s); if (b) { - // :: error: (assignment) + // :: error: [assignment] f = s; } } @@ -67,12 +67,12 @@ void m5f(String s, String s2) { void foo(String s1, String s2) { bar( RegexUtil.isRegex(s1), - // :: error: (argument) + // :: error: [argument] Pattern.compile(s1)); boolean b; bar( b = RegexUtil.isRegex(s2), - // :: error: (argument) + // :: error: [argument] Pattern.compile(s2)); } diff --git a/checker/tests/regex/LubRegex.java b/checker/tests/regex/LubRegex.java index b9a4a7c4ecf4..329ac8c06a98 100644 --- a/checker/tests/regex/LubRegex.java +++ b/checker/tests/regex/LubRegex.java @@ -9,7 +9,7 @@ void test1(@Regex(4) String s4, boolean b) { } @Regex(4) String test = s; - // :: error: (assignment) + // :: error: [assignment] @Regex(5) String test2 = s; } @@ -20,7 +20,7 @@ void test2(@Regex(2) String s2, @Regex(4) String s4, boolean b) { } @Regex(2) String test = s; - // :: error: (assignment) + // :: error: [assignment] @Regex(3) String test2 = s; } @@ -33,7 +33,7 @@ void test3(@Regex(6) String s6, boolean b) { } @Regex(6) String test = s; - // :: error: (assignment) + // :: error: [assignment] @Regex(7) String test2 = s; } @@ -46,7 +46,7 @@ void test4(@Regex(8) String s8, @Regex(9) String s9, boolean b) { } @Regex(8) String test = s; - // :: error: (assignment) + // :: error: [assignment] @Regex(9) String test2 = s; } @@ -60,7 +60,7 @@ void test5(@Regex(10) String s10, @Regex(11) String s11, boolean b) { } @Regex(11) String test = s; - // :: error: (assignment) + // :: error: [assignment] @Regex(12) String test2 = s; } } diff --git a/checker/tests/regex/MatcherGroupCount.java b/checker/tests/regex/MatcherGroupCount.java index 670309b377b4..c1e48ca2c333 100644 --- a/checker/tests/regex/MatcherGroupCount.java +++ b/checker/tests/regex/MatcherGroupCount.java @@ -21,18 +21,18 @@ public static void main(String[] args) { if (mat.matches()) { if (mat.groupCount() == 0) { System.out.println("Group: " + mat.group(0)); - // :: error: (group.count) + // :: error: [group.count] System.out.println("Group: " + mat.group(1)); } else { - // :: error: (group.count) + // :: error: [group.count] System.out.println("Group: " + mat.group(1)); } if (0 == mat.groupCount()) { System.out.println("Group: " + mat.group(0)); - // :: error: (group.count) + // :: error: [group.count] System.out.println("Group: " + mat.group(1)); } else { - // :: error: (group.count) + // :: error: [group.count] System.out.println("Group: " + mat.group(1)); } if (mat.groupCount() > 0) { @@ -43,44 +43,44 @@ public static void main(String[] args) { if (mat.groupCount() == 2) { System.out.println("Group: " + mat.group(1)); System.out.println("Group: " + mat.group(2)); - // :: error: (group.count) + // :: error: [group.count] System.out.println("Group: " + mat.group(3)); - // :: error: (group.count) + // :: error: [group.count] System.out.println("Group: " + mat.group(4)); } else { System.out.println("Group: " + mat.group(0)); - // :: error: (group.count) + // :: error: [group.count] System.out.println("Group: " + mat.group(1)); - // :: error: (group.count) + // :: error: [group.count] System.out.println("Group: " + mat.group(2)); - // :: error: (group.count) + // :: error: [group.count] System.out.println("Group: " + mat.group(3)); - // :: error: (group.count) + // :: error: [group.count] System.out.println("Group: " + mat.group(4)); } if (2 == mat.groupCount()) { System.out.println("Group: " + mat.group(1)); System.out.println("Group: " + mat.group(2)); - // :: error: (group.count) + // :: error: [group.count] System.out.println("Group: " + mat.group(3)); - // :: error: (group.count) + // :: error: [group.count] System.out.println("Group: " + mat.group(4)); } else { System.out.println("Group: " + mat.group(0)); - // :: error: (group.count) + // :: error: [group.count] System.out.println("Group: " + mat.group(1)); - // :: error: (group.count) + // :: error: [group.count] System.out.println("Group: " + mat.group(2)); - // :: error: (group.count) + // :: error: [group.count] System.out.println("Group: " + mat.group(3)); - // :: error: (group.count) + // :: error: [group.count] System.out.println("Group: " + mat.group(4)); } if (mat.groupCount() >= 2) { System.out.println("Group: " + mat.group(2)); } if (mat.groupCount() >= 2) { - // :: error: (group.count) + // :: error: [group.count] System.out.println("Group: " + mat.group(3)); } if (2 < mat.groupCount()) { @@ -90,7 +90,7 @@ public static void main(String[] args) { System.out.println("Group: " + mat.group(0)); } else { System.out.println("Group: " + mat.group(5)); - // :: error: (group.count) + // :: error: [group.count] System.out.println("Group: " + mat.group(6)); } } else { diff --git a/checker/tests/regex/Nested.java b/checker/tests/regex/Nested.java index fa868683fcef..8ef5ad89be5a 100644 --- a/checker/tests/regex/Nested.java +++ b/checker/tests/regex/Nested.java @@ -3,10 +3,10 @@ // TODO: @Regex is not allowed on arbitrary types. Find a better test case. public class Nested { - // :: error: (anno.on.irrelevant) + // :: error: [anno.on.irrelevant] OuterI.@Regex InnerA fa = new OuterI.@Regex InnerA() {}; - // :: error: (anno.on.irrelevant) + // :: error: [anno.on.irrelevant] OuterI.@Regex InnerB fb = new OuterI.@Regex InnerB() {}; } diff --git a/checker/tests/regex/PartialRegex.java b/checker/tests/regex/PartialRegex.java index 7ecd5b865667..b1adf8d06ab8 100644 --- a/checker/tests/regex/PartialRegex.java +++ b/checker/tests/regex/PartialRegex.java @@ -11,11 +11,11 @@ void m(@Regex String re, String non) { @Regex String test4 = l + l + r + r; @Regex String test5 = l + l + re + r + r; - // :: error: (assignment) + // :: error: [assignment] @Regex String fail1 = r + l; - // :: error: (assignment) + // :: error: [assignment] @Regex String fail2 = r + non + l; - // :: error: (assignment) + // :: error: [assignment] @Regex String fail3 = l + r + r; } } diff --git a/checker/tests/regex/RawTypeTest.java b/checker/tests/regex/RawTypeTest.java index 7a1c735f2441..9056b61f6282 100644 --- a/checker/tests/regex/RawTypeTest.java +++ b/checker/tests/regex/RawTypeTest.java @@ -96,7 +96,7 @@ public void m(MyList<@Regex String> l) {} } class C3 implements I2 { - // :: error: (override.param) :: error: (type.argument) + // :: error: [override.param] :: error: [type.argument] public void m(MyList l) {} } diff --git a/checker/tests/regex/RegexUtilClient.java b/checker/tests/regex/RegexUtilClient.java index 2884f9d79d0c..d641559ec5af 100644 --- a/checker/tests/regex/RegexUtilClient.java +++ b/checker/tests/regex/RegexUtilClient.java @@ -36,19 +36,19 @@ void unqualifiedRegexUtilNoParamsArg(String s) { void illegalName(String s) { if (IllegalName.isRegex(s, 2)) { - // :: error: (assignment) + // :: error: [assignment] @Regex(2) String s2 = s; } - // :: error: (assignment) + // :: error: [assignment] @Regex(2) String s2 = IllegalName.asRegex(s, 2); } void illegalNameRegexUtil(String s) { if (IllegalNameRegexUtil.isRegex(s, 2)) { - // :: error: (assignment) + // :: error: [assignment] @Regex(2) String s2 = s; } - // :: error: (assignment) + // :: error: [assignment] @Regex(2) String s2 = IllegalNameRegexUtil.asRegex(s, 2); } } diff --git a/checker/tests/regex/SimpleRegex.java b/checker/tests/regex/SimpleRegex.java index 03e60777ff42..91d95a4dc09b 100644 --- a/checker/tests/regex/SimpleRegex.java +++ b/checker/tests/regex/SimpleRegex.java @@ -10,19 +10,19 @@ void regString() { void validRegString() { @Regex String s1 = "validRegex"; - // :: error: (assignment) + // :: error: [assignment] @Regex String s2 = "(InvalidRegex"; // error } void compileCall() { Pattern.compile("test.*[^123]$"); - // :: error: (argument) + // :: error: [argument] Pattern.compile("$test.*[^123"); // error } void requireValidReg(@Regex String reg, String nonReg) { Pattern.compile(reg); - // :: error: (argument) + // :: error: [argument] Pattern.compile(nonReg); // error } @@ -31,18 +31,18 @@ void testAddition(@Regex String reg, String nonReg) { @Regex String s2 = reg + "d.*sf"; @Regex String s3 = reg + reg; - // :: error: (assignment) + // :: error: [assignment] @Regex String n1 = nonReg; // error - // :: error: (assignment) + // :: error: [assignment] @Regex String n2 = reg + "(df"; // error - // :: error: (assignment) + // :: error: [assignment] @Regex String n3 = reg + nonReg; // error - // :: error: (assignment) + // :: error: [assignment] @Regex String o1 = nonReg; // error - // :: error: (assignment) + // :: error: [assignment] @Regex String o2 = nonReg + "sdf"; // error - // :: error: (assignment) + // :: error: [assignment] @Regex String o3 = nonReg + reg; // error } @@ -51,7 +51,7 @@ void testAddition(@Regex String reg, String nonReg) { void testCompoundConcatenation() { takesRegex(regex); - // :: error: (compound.assignment) + // :: error: [compound.assignment] regex += ")"; // error takesRegex(regex); @@ -59,7 +59,7 @@ void testCompoundConcatenation() { // nonRegex is refined by flow to be a regular expression takesRegex(nonRegex); nonRegex += ")"; - // :: error: (argument) + // :: error: [argument] takesRegex(nonRegex); // error } @@ -69,9 +69,9 @@ void testChar() { @Regex char c1 = 'c'; @Regex Character c2 = 'c'; - // :: error: (assignment) + // :: error: [assignment] @Regex char c3 = '('; // error - // :: error: (assignment) + // :: error: [assignment] @Regex Character c4 = '('; // error } @@ -79,13 +79,13 @@ void testCharConcatenation() { @Regex String s1 = "rege" + 'x'; @Regex String s2 = 'r' + "egex"; - // :: error: (assignment) + // :: error: [assignment] @Regex String s4 = "rege" + '('; // error - // :: error: (assignment) + // :: error: [assignment] @Regex String s5 = "reg(" + 'x'; // error - // :: error: (assignment) + // :: error: [assignment] @Regex String s6 = '(' + "egex"; // error - // :: error: (assignment) + // :: error: [assignment] @Regex String s7 = 'r' + "ege("; // error } @@ -93,13 +93,13 @@ void testPatternLiteral() { Pattern.compile("non(", Pattern.LITERAL); Pattern.compile(foo("regex"), Pattern.LITERAL); - // :: error: (argument) + // :: error: [argument] Pattern.compile(foo("regex("), Pattern.LITERAL); // error - // :: error: (argument) + // :: error: [argument] Pattern.compile("non("); // error - // :: error: (argument) + // :: error: [argument] Pattern.compile(foo("regex")); // error - // :: error: (argument) + // :: error: [argument] Pattern.compile("non(", Pattern.CASE_INSENSITIVE); // error } @@ -115,13 +115,13 @@ public static String foo(@Regex String s) { // @Regex char @Regex [] ca3; // @Regex String[] s1; // - // // :: error: (type.invalid) + // // :: error: [type.invalid] // @Regex double[] da1; // error - // // :: error: (type.invalid) + // // :: error: [type.invalid] // double @Regex [] da2; // error - // // :: error: (type.invalid) + // // :: error: [type.invalid] // @Regex double @Regex [] da3; // error - // // :: error: (type.invalid) + // // :: error: [type.invalid] // String @Regex [] s2; // error // } @@ -133,9 +133,9 @@ public static String foo(@Regex String s) { // char @Regex [] c2 = {'(', 'r', 'e', 'g', 'e', 'x', ')', '.', '*'}; // char @Regex [] c3 = {r, 'e', 'g', 'e', 'x'}; // - // // :: error: (assignment) + // // :: error: [assignment] // char @Regex [] c4 = {'(', 'r', 'e', 'g', 'e', 'x'}; // error - // // :: error: (assignment) + // // :: error: [assignment] // char @Regex [] c5 = {c, '.', '*'}; // error // } } diff --git a/checker/tests/regex/TestIsRegex.java b/checker/tests/regex/TestIsRegex.java index 3ac4508ef998..56c69ee82ddb 100644 --- a/checker/tests/regex/TestIsRegex.java +++ b/checker/tests/regex/TestIsRegex.java @@ -13,7 +13,7 @@ void test1(String str1) throws Exception { void test2(String str2) throws Exception { if (!RegexUtil.isRegex(str2)) { - // :: error: (argument) + // :: error: [argument] Pattern.compile(str2); } } @@ -30,7 +30,7 @@ void test4(String str4) throws Exception { if (RegexUtil.isRegex(str4)) { Pattern.compile(str4); } else { - // :: error: (argument) + // :: error: [argument] Pattern.compile(str4); } } @@ -46,14 +46,14 @@ void test6(String str6) throws Exception { if (RegexUtil.isRegex(str6, 4)) { Pattern.compile(str6).matcher("4kdfj").group(4); } else { - // :: error: (argument) + // :: error: [argument] Pattern.compile(str6); } } void test7(String str7) throws Exception { if (RegexUtil.isRegex(str7, 5)) { - // :: error: (group.count) + // :: error: [group.count] Pattern.compile(str7).matcher("4kdfj").group(6); } } @@ -115,7 +115,7 @@ void test11(String s) throws Exception { @Regex(2) String l1 = RegexUtil.asRegex(s, 2); @Regex(1) String l2 = RegexUtil.asRegex(s, 2); @Regex String l3 = RegexUtil.asRegex(s, 2); - // :: error: (assignment) + // :: error: [assignment] @Regex(3) String l4 = RegexUtil.asRegex(s, 2); } diff --git a/checker/tests/regex/TestRegex.java b/checker/tests/regex/TestRegex.java index b38fbb150790..396aa6293d62 100644 --- a/checker/tests/regex/TestRegex.java +++ b/checker/tests/regex/TestRegex.java @@ -5,7 +5,7 @@ public class TestRegex { public void Concatenation2() { @Regex String a = "a"; - // :: error: (compound.assignment) + // :: error: [compound.assignment] a += "("; } } diff --git a/checker/tests/regex/TypeParamSubtype.java b/checker/tests/regex/TypeParamSubtype.java index f7fdbfc6d4a6..bb513a8dec41 100644 --- a/checker/tests/regex/TypeParamSubtype.java +++ b/checker/tests/regex/TypeParamSubtype.java @@ -4,12 +4,12 @@ public class TypeParamSubtype { // These are legal because null has type @Regex String // void nullRegexSubtype(Collection col) { - // // :: error: (argument) + // // :: error: [argument] // col.add(null); // } // // void nullSimpleSubtype(Collection col) { - // // :: error: (argument) + // // :: error: [argument] // col.add(null); // } diff --git a/checker/tests/regex/TypeVarMemberSelect.java b/checker/tests/regex/TypeVarMemberSelect.java index 88b90186a2c5..4275370fa0de 100644 --- a/checker/tests/regex/TypeVarMemberSelect.java +++ b/checker/tests/regex/TypeVarMemberSelect.java @@ -9,7 +9,7 @@ class Box { class TypeVarMemberSelect> { void test(V v) { - // :: error: (assignment) + // :: error: [assignment] @Regex(2) String local1 = v.t1; // Previously the type of the right-hand side would have been T which is wrong. This test diff --git a/checker/tests/regex_poly/PolyRegexTests.java b/checker/tests/regex_poly/PolyRegexTests.java index 7b6977499d7e..0947aade0499 100644 --- a/checker/tests/regex_poly/PolyRegexTests.java +++ b/checker/tests/regex_poly/PolyRegexTests.java @@ -14,7 +14,7 @@ public void testRegex(@Regex String str) { } public void testNonRegex(String str) { - // :: error: (assignment) + // :: error: [assignment] @Regex String s = method(str); // error } @@ -23,7 +23,7 @@ public void testInternRegex(@Regex String str) { } public void testInternNonRegex(String str) { - // :: error: (assignment) + // :: error: [assignment] @Regex String s = str.intern(); // error } @@ -32,7 +32,7 @@ public void testToStringRegex(@Regex String str) { } public void testToStringNonRegex(String str) { - // :: error: (assignment) + // :: error: [assignment] @Regex String s = str.toString(); // error } @@ -41,11 +41,11 @@ public void testToStringNonRegex(String str) { } public void testPolyRegexConcatErrors(@PolyRegex String polyReg, String nonPolyReg) { - // :: error: (assignment) + // :: error: [assignment] @PolyRegex String test1 = polyReg + nonPolyReg; // error - // :: error: (assignment) + // :: error: [assignment] @PolyRegex String test2 = nonPolyReg + polyReg; // error - // :: error: (assignment) + // :: error: [assignment] @PolyRegex String test3 = nonPolyReg + nonPolyReg; // error } @@ -56,16 +56,16 @@ public void testRegexPolyRegexConcat(@PolyRegex String polyReg, @Regex String re public void testRegexPolyRegexConcatErrors( @PolyRegex String polyReg, @Regex String reg, String str) { - // :: error: (assignment) + // :: error: [assignment] @PolyRegex String test1 = polyReg + str; // error - // :: error: (assignment) + // :: error: [assignment] @PolyRegex String test2 = str + polyReg; // error - // :: error: (assignment) + // :: error: [assignment] @PolyRegex String test3 = reg + str; // error - // :: error: (assignment) + // :: error: [assignment] @PolyRegex String test4 = str + reg; // error - // :: error: (assignment) + // :: error: [assignment] @PolyRegex String test5 = str + str; // error } diff --git a/checker/tests/resourceleak-customignoredexceptions/BasicTest.java b/checker/tests/resourceleak-customignoredexceptions/BasicTest.java index e6f41bcd2648..432f2a3e65bc 100644 --- a/checker/tests/resourceleak-customignoredexceptions/BasicTest.java +++ b/checker/tests/resourceleak-customignoredexceptions/BasicTest.java @@ -10,7 +10,7 @@ abstract class BasicTest { public void runtimeExceptionManuallyThrown() throws IOException { // this code is obviously wrong - // ::error: (required.method.not.called) + // ::error: [required.method.not.called] Closeable r = alloc(); if (true) { throw new RuntimeException(); @@ -20,7 +20,7 @@ public void runtimeExceptionManuallyThrown() throws IOException { public void runtimeExceptionFromMethod() throws IOException { // method() may throw RuntimeException, so this code is not OK - // ::error: (required.method.not.called) + // ::error: [required.method.not.called] Closeable r = alloc(); method(); r.close(); @@ -49,7 +49,7 @@ static class CustomNPESubtype extends NullPointerException { public void doNotIgnoreNPESubtype() throws IOException { // Only NullPointerException should be ignored, not its subtypes, since the options // specified "=java.lang.NullPointerException". - // ::error: (required.method.not.called) + // ::error: [required.method.not.called] Closeable r = alloc(); if (true) { throw CustomNPESubtype.INSTANCE; diff --git a/checker/tests/resourceleak-nocreatesmustcallfor/ConnectingServerSockets.java b/checker/tests/resourceleak-nocreatesmustcallfor/ConnectingServerSockets.java index 9f0df491594a..fde25afe79a4 100644 --- a/checker/tests/resourceleak-nocreatesmustcallfor/ConnectingServerSockets.java +++ b/checker/tests/resourceleak-nocreatesmustcallfor/ConnectingServerSockets.java @@ -11,25 +11,25 @@ class ConnectingServerSockets { static void simple_ss_test(SocketAddress sa) throws Exception { - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] ServerSocket s = new ServerSocket(); s.bind(sa); } static void simple_ss_test2(SocketAddress sa) throws Exception { - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] ServerSocket s = new ServerSocket(); // s.bind(sa); } static void simple_ss_test4(SocketAddress sa, int to) throws Exception { - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] ServerSocket s = new ServerSocket(); s.bind(sa, to); } static @MustCall({}) ServerSocket makeUnconnected() throws Exception { - // :: error: (return) + // :: error: [return] return new ServerSocket(); } diff --git a/checker/tests/resourceleak-nocreatesmustcallfor/ConnectingSockets.java b/checker/tests/resourceleak-nocreatesmustcallfor/ConnectingSockets.java index 201647c8ab52..6419417b9224 100644 --- a/checker/tests/resourceleak-nocreatesmustcallfor/ConnectingSockets.java +++ b/checker/tests/resourceleak-nocreatesmustcallfor/ConnectingSockets.java @@ -7,31 +7,31 @@ class ConnectingSockets { static void simple_ns_test(SocketAddress sa) throws Exception { - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] Socket s = new Socket(); s.bind(sa); } static void simple_ns_test2(SocketAddress sa) throws Exception { - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] Socket s = new Socket(); // s.bind(sa); } static void simple_ns_test3(SocketAddress sa) throws Exception { - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] Socket s = new Socket(); s.connect(sa); } static void simple_ns_test4(SocketAddress sa, int to) throws Exception { - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] Socket s = new Socket(); s.connect(sa, to); } static @MustCall({}) Socket makeUnconnected() throws Exception { - // :: error: (return) + // :: error: [return] return new Socket(); } diff --git a/checker/tests/resourceleak-nocreatesmustcallfor/CreatesMustCallForSimpler.java b/checker/tests/resourceleak-nocreatesmustcallfor/CreatesMustCallForSimpler.java index da43a22e75d0..250ce0f79f5a 100644 --- a/checker/tests/resourceleak-nocreatesmustcallfor/CreatesMustCallForSimpler.java +++ b/checker/tests/resourceleak-nocreatesmustcallfor/CreatesMustCallForSimpler.java @@ -17,7 +17,7 @@ void resetThis() {} void a() {} static @MustCall({}) CreatesMustCallForSimpler makeNoMC() { - // :: error: (return) + // :: error: [return] return new CreatesMustCallForSimpler(); } diff --git a/checker/tests/resourceleak-nocreatesmustcallfor/DifferentSWKeys.java b/checker/tests/resourceleak-nocreatesmustcallfor/DifferentSWKeys.java index 579cfc5b7120..877d891f652e 100644 --- a/checker/tests/resourceleak-nocreatesmustcallfor/DifferentSWKeys.java +++ b/checker/tests/resourceleak-nocreatesmustcallfor/DifferentSWKeys.java @@ -7,7 +7,7 @@ @SuppressWarnings("required.method.not.called") class DifferentSWKeys { void test(@Owning @MustCall("foo") Object obj) { - // :: warning: (unneeded.suppression) + // :: warning: [unneeded.suppression] @SuppressWarnings("mustcall") @MustCall("foo") Object bar = obj; } diff --git a/checker/tests/resourceleak-nocreatesmustcallfor/SocketContainer.java b/checker/tests/resourceleak-nocreatesmustcallfor/SocketContainer.java index b701fededf9a..2c4bae0f33a1 100644 --- a/checker/tests/resourceleak-nocreatesmustcallfor/SocketContainer.java +++ b/checker/tests/resourceleak-nocreatesmustcallfor/SocketContainer.java @@ -13,7 +13,7 @@ class SocketContainer { public SocketContainer(String host, int port) throws Exception { // Assignments to owning fields should not be permitted. - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] sock = new Socket(host, port); } @@ -21,7 +21,7 @@ public SocketContainer(String host, int port) throws Exception { public void reassign(String host, int port) throws Exception { sock.close(); // For the RHS, because the field can't take ownership - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] Socket sr = new Socket(host, port); // No warning for overwriting the field, since it can't take ownership! sock = sr; diff --git a/checker/tests/resourceleak-nolightweightownership/ACOwning.java b/checker/tests/resourceleak-nolightweightownership/ACOwning.java index c8c00786890e..2cbb79e43746 100644 --- a/checker/tests/resourceleak-nolightweightownership/ACOwning.java +++ b/checker/tests/resourceleak-nolightweightownership/ACOwning.java @@ -30,15 +30,15 @@ static void takeOwnershipWrong(@Owning Foo foo) {} } static void callGetNonOwningFoo() { - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] getNonOwningFoo(); } static void ownershipInCallee() { - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] Foo f = new Foo(); takeOwnership(f); - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] Foo g = new Foo(); noOwnership(g); } @@ -49,12 +49,12 @@ public Foo owningAtReturn() { } void owningAtReturnTest() { - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] Foo f = owningAtReturn(); } void ownershipTest() { - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] takeOwnership(new Foo()); } } diff --git a/checker/tests/resourceleak-noresourcealiases/MustCallAliasExamples.java b/checker/tests/resourceleak-noresourcealiases/MustCallAliasExamples.java index 889ea12e6d9a..91a7208347aa 100644 --- a/checker/tests/resourceleak-noresourcealiases/MustCallAliasExamples.java +++ b/checker/tests/resourceleak-noresourcealiases/MustCallAliasExamples.java @@ -14,7 +14,7 @@ void test_two_locals(String address) { Socket socket = null; try { socket = new Socket(address, 8000); - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] DataInputStream d = new DataInputStream(socket.getInputStream()); } catch (IOException e) { @@ -23,29 +23,29 @@ void test_two_locals(String address) { } } - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] void test_close_wrapper(@Owning InputStream b) throws IOException { DataInputStream d = new DataInputStream(b); d.close(); } void test_close_nonwrapper(@Owning InputStream b) throws IOException { - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] DataInputStream d = new DataInputStream(b); b.close(); } - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] void test_no_close(@Owning InputStream b) { - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] DataInputStream d = new DataInputStream(b); } - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] void test_no_assign(@Owning InputStream b) { - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] new DataInputStream( - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] new BufferedInputStream(b)); } diff --git a/checker/tests/resourceleak-noresourcealiases/MustCallAliasPassthroughLocal.java b/checker/tests/resourceleak-noresourcealiases/MustCallAliasPassthroughLocal.java index e2d4d057546a..374acceb04e7 100644 --- a/checker/tests/resourceleak-noresourcealiases/MustCallAliasPassthroughLocal.java +++ b/checker/tests/resourceleak-noresourcealiases/MustCallAliasPassthroughLocal.java @@ -10,12 +10,12 @@ class MustCallAliasPassthroughLocal extends FilterInputStream { MustCallAliasPassthroughLocal(File f) throws Exception { // This is safe - this MCA constructor of FilterInputStream means that the result of this // constructor - i.e. the caller - is taking ownership of this newly-created output stream. - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] super(new FileInputStream(f)); } static void test(File f) throws Exception { - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] new MustCallAliasPassthroughLocal(f); } diff --git a/checker/tests/resourceleak-permitinitializationleak/InstanceInitializer.java b/checker/tests/resourceleak-permitinitializationleak/InstanceInitializer.java index 5830a20f248c..2b86b116d08a 100644 --- a/checker/tests/resourceleak-permitinitializationleak/InstanceInitializer.java +++ b/checker/tests/resourceleak-permitinitializationleak/InstanceInitializer.java @@ -6,7 +6,7 @@ import org.checkerframework.checker.mustcall.qual.*; class InstanceInitializer { - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] private @Owning Socket s; private final int DEFAULT_PORT = 5; @@ -32,7 +32,7 @@ class InstanceInitializer { { try { - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] Socket s1 = new Socket(DEFAULT_ADDR, DEFAULT_PORT); } catch (Exception e) { } diff --git a/checker/tests/resourceleak-returns-receiver/ReturnsReceiverExamples.java b/checker/tests/resourceleak-returns-receiver/ReturnsReceiverExamples.java index dc33e374b182..6ba1cc7bf818 100644 --- a/checker/tests/resourceleak-returns-receiver/ReturnsReceiverExamples.java +++ b/checker/tests/resourceleak-returns-receiver/ReturnsReceiverExamples.java @@ -33,12 +33,12 @@ void CallMethodsInSequence2() { } void testFluentAPIWrong() { - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] makeFoo().b(); } void testFluentAPIWrong2() { - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] makeFoo(); } @@ -53,34 +53,34 @@ void invokeMethodWithCallA() { } void invokeMethodWithCallBWrong() { - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] makeFooFinalize2(); } void invokeMethodAndCallCWrong() { - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] makeFoo().c(); } void makeFooFinalizeWrong() { Foo m; - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] m = new Foo(); - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] Foo f = new Foo(); f.b(); } Foo ifElseWithReturnExit(boolean b, boolean c) { - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] Foo f1 = makeFoo(); - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] Foo f3 = new Foo(); - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] Foo f4 = new Foo(); if (b) { - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] Foo f2 = new Foo(); if (c) { f4.a(); @@ -89,7 +89,7 @@ Foo ifElseWithReturnExit(boolean b, boolean c) { } return f1; } else { - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] Foo f2 = new Foo(); f2 = new Foo(); f2.a(); diff --git a/checker/tests/resourceleak/ACExceptionalExitPointTest.java b/checker/tests/resourceleak/ACExceptionalExitPointTest.java index 1a2118b853af..5a9677384f7e 100644 --- a/checker/tests/resourceleak/ACExceptionalExitPointTest.java +++ b/checker/tests/resourceleak/ACExceptionalExitPointTest.java @@ -26,7 +26,7 @@ Foo makeFoo() { } void exceptionalExitWrong() throws Exception { - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] Foo fw = makeFoo(); throw new Exception(); } diff --git a/checker/tests/resourceleak/ACMethodInvocationTest.java b/checker/tests/resourceleak/ACMethodInvocationTest.java index b3c58d02936d..7b6b84aa9046 100644 --- a/checker/tests/resourceleak/ACMethodInvocationTest.java +++ b/checker/tests/resourceleak/ACMethodInvocationTest.java @@ -30,12 +30,12 @@ void CallMethodsInSequence() { } void testFluentAPIWrong() { - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] makeFoo().b(); } void testFluentAPIWrong2() { - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] makeFoo(); } @@ -44,7 +44,7 @@ void invokeMethodWithCallA() { } void invokeMethodAndCallCWrong() { - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] makeFoo().c(); } @@ -57,9 +57,9 @@ Foo returnMakeFoo() { Foo testField3; void testStoringInField() { - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] testField1 = makeFoo(); - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] testField2 = new Foo(); testField3 = makeFooFinalize(); diff --git a/checker/tests/resourceleak/ACOwning.java b/checker/tests/resourceleak/ACOwning.java index 6ab2f3ae14f8..1a6055ba747e 100644 --- a/checker/tests/resourceleak/ACOwning.java +++ b/checker/tests/resourceleak/ACOwning.java @@ -18,11 +18,11 @@ static void takeOwnership(@Owning Foo foo, Foo f) { static void noOwnership(Foo foo) {} - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] static void takeOwnershipWrong(@Owning Foo foo) {} static @NotOwning Foo getNonOwningFoo() { - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] return new Foo(); } @@ -32,9 +32,9 @@ static void callGetNonOwningFoo() { static void ownershipInCallee() { Foo f = new Foo(); - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] takeOwnership(f, new Foo()); - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] Foo g = new Foo(); noOwnership(g); } @@ -52,17 +52,17 @@ public Foo owningAtReturn() { } void owningAtReturnTest() { - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] Foo f = owningAtReturn(); } void ownershipTest() { - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] takeOwnership(new Foo(), makeFoo()); } @InheritableMustCall({}) - // :: error: (super.invocation) :: error: (inconsistent.mustcall.subtype) + // :: error: [super.invocation] :: error: [inconsistent.mustcall.subtype] private class SubFoo extends Foo { void test() { @@ -70,7 +70,7 @@ void test() { } void test2() { - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] Foo f = new Foo(); } diff --git a/checker/tests/resourceleak/ACRegularExitPointTest.java b/checker/tests/resourceleak/ACRegularExitPointTest.java index 30e995f27a76..ef923819be17 100644 --- a/checker/tests/resourceleak/ACRegularExitPointTest.java +++ b/checker/tests/resourceleak/ACRegularExitPointTest.java @@ -39,13 +39,13 @@ void makeFooFinalize() { } void testStoringInLocalWrong() { - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] Foo foo = makeFoo(); } void testStoringInLocalWrong2() { Foo f; - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] f = makeFoo(); } @@ -54,7 +54,7 @@ void testStoringInLocal() { } void testStoringInLocalWrong3() { - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] Foo foo = new Foo(); } @@ -75,7 +75,7 @@ void innerFuncWrong(Foo f) { Runnable r = new Runnable() { public void run() { - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] Foo g = new Foo(); } ; @@ -101,7 +101,7 @@ void innerfunc3() { f.a(); Function<@MustCall Foo, @CalledMethods("a") @MustCall Foo> innerfunc = st -> { - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] Foo fn1 = new Foo(); Foo fn2 = makeFoo(); fn2.a(); @@ -121,7 +121,7 @@ void ifElse(boolean b) { Foo f1 = new Foo(); f1.a(); } else { - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] Foo f2 = new Foo(); } } @@ -133,28 +133,28 @@ void ifElseWithDeclaration(boolean b) { f1 = new Foo(); f1.a(); } else { - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] f2 = new Foo(); } } void ifElseWithInitialization(boolean b) { - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] Foo f2 = new Foo(); Foo f11 = null; if (b) { f11 = makeFoo(); f11.a(); } else { - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] f2 = new Foo(); } } void ifWithInitialization(boolean b) { - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] Foo f1 = new Foo(); - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] Foo f2 = new Foo(); if (b) { f1.a(); @@ -175,7 +175,7 @@ void ifWithNullInitialization(boolean b) { f1 = new Foo(); f1.a(); } else { - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] f2 = new Foo(); } } @@ -187,16 +187,16 @@ void variableInitializedWithNull() { void testLoop() { Foo f = null; while (true) { - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] f = new Foo(); } } void overWrittingVarInLoop() { - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] Foo f = new Foo(); while (true) { - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] f = new Foo(); } } @@ -205,12 +205,12 @@ void loopWithNestedBranches(boolean b) { Foo frodo = null; while (true) { if (b) { - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] frodo = new Foo(); } else { // this is a known false positive, due to lack of path sensitivity in the // Called Methods Checker - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] frodo = new Foo(); frodo.a(); } @@ -218,7 +218,7 @@ void loopWithNestedBranches(boolean b) { } void replaceVarWithNull(boolean b, boolean c) { - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] Foo f = new Foo(); if (b) { f = null; @@ -254,12 +254,12 @@ void testFinallyBlock(boolean b) { } void testSubFoo() { - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] Foo f = new SubFoo(); } void testSubFoo2() { - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] SubFoo f = new SubFoo(); } } diff --git a/checker/tests/resourceleak/ACSocketTest.java b/checker/tests/resourceleak/ACSocketTest.java index 5f21df80e748..a992c2008399 100644 --- a/checker/tests/resourceleak/ACSocketTest.java +++ b/checker/tests/resourceleak/ACSocketTest.java @@ -26,7 +26,7 @@ Socket makeSocket(String address, int port) { void basicTest(String address, int port) { try { - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] Socket socket2 = new Socket(address, port); Socket specialSocket = new Socket(address, port); specialSocket.close(); @@ -47,7 +47,7 @@ void callMakeSocketAndClose(String address, int port) { } void callMakeSocket(String address, int port) { - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] Socket socket = makeSocket(address, port); } @@ -59,7 +59,7 @@ void ifElseWithDeclaration(String address, int port, boolean b) { s1 = new Socket(address, port); s1.close(); } else { - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] s2 = new Socket(address, port + 1); } } catch (IOException i) { @@ -80,11 +80,11 @@ void testLoop(String address, int port) { } void overWrittingVarInLoop(String address, int port) { - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] Socket s = makeSocket(address, port); while (true) { try { - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] s = new Socket(address, port); } catch (IOException e) { @@ -96,10 +96,10 @@ void loopWithNestedBranches(String address, int port, boolean b) { Socket s = null; while (true) { if (b) { - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] s = makeSocket(address, port); } else { - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] s = makeSocket(address, port); } } @@ -108,7 +108,7 @@ void loopWithNestedBranches(String address, int port, boolean b) { void replaceVarWithNull(String address, int port, boolean b, boolean c) { Socket s; try { - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] s = new Socket(address, port); } catch (IOException e) { @@ -125,7 +125,7 @@ void replaceVarWithNull(String address, int port, boolean b, boolean c) { void ownershipTransfer(String address, int port) { Socket s1 = null; try { - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] s1 = new Socket(address, port); } catch (IOException e) { @@ -139,7 +139,7 @@ void ownershipTransfer(String address, int port) { void test(String address, int port) { try { - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] Socket socket = new Socket(address, 80); PrintStream out = new PrintStream(socket.getOutputStream()); BufferedReader in = new BufferedReader(new InputStreamReader(socket.getInputStream())); @@ -157,11 +157,11 @@ void test(String address, int port) { // positives on containers that do not have must-call obligations on their component types). // :: error: type.argument void connectToLeader(AtomicReference socket) throws IOException { - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] if (socket.get() == null) { throw new IOException("Failed connect to "); } else { - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] sock = socket.get(); } } @@ -169,10 +169,10 @@ void connectToLeader(AtomicReference socket) throws IOException { Socket createSocket(boolean b, String address, int port) throws IOException { Socket sock; if (b) { - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] sock = new Socket(address, port); } else { - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] sock = new Socket(address, port); } @@ -287,7 +287,7 @@ public PrependableSocket(SocketImpl base) throws IOException { } void makePrependableSocket() throws IOException { - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] final PrependableSocket prependableSocket = new PrependableSocket(null); } diff --git a/checker/tests/resourceleak/BindChannel.java b/checker/tests/resourceleak/BindChannel.java index eed1fe714bc4..10a5ab04e787 100644 --- a/checker/tests/resourceleak/BindChannel.java +++ b/checker/tests/resourceleak/BindChannel.java @@ -20,7 +20,7 @@ static void test(InetSocketAddress addr, boolean b) { // the method below, which extracts the socket into a local variable, which can be // parsed as an CO target. ServerSocketChannel httpChannel = ServerSocketChannel.open(); - // :: error: (reset.not.owning) + // :: error: [reset.not.owning] httpChannel.socket().bind(addr); } catch (IOException io) { @@ -30,7 +30,7 @@ static void test(InetSocketAddress addr, boolean b) { static void test_lv(InetSocketAddress addr, boolean b) { try { ServerSocketChannel httpChannel = ServerSocketChannel.open(); - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] ServerSocket httpSock = httpChannel.socket(); httpSock.bind(addr); } catch (IOException io) { diff --git a/checker/tests/resourceleak/COAnonymousClass.java b/checker/tests/resourceleak/COAnonymousClass.java index 5e3752a7fd3c..c6f726637088 100644 --- a/checker/tests/resourceleak/COAnonymousClass.java +++ b/checker/tests/resourceleak/COAnonymousClass.java @@ -17,7 +17,7 @@ void other() { new Runnable() { @Override @CreatesMustCallFor("Foo.this") - // :: error: (creates.mustcall.for.override.invalid) + // :: error: [creates.mustcall.for.override.invalid] public void run() { resetFoo(); } @@ -31,11 +31,11 @@ void other2() { new Runnable() { @Override @CreatesMustCallFor("this") - // :: error: (creates.mustcall.for.invalid.target) - // :: error: (creates.mustcall.for.override.invalid) + // :: error: [creates.mustcall.for.invalid.target] + // :: error: [creates.mustcall.for.override.invalid] public void run() { // This error definitely must be issued, since Foo.this != this. - // :: error: (reset.not.owning) + // :: error: [reset.not.owning] resetFoo(); } }; diff --git a/checker/tests/resourceleak/COInSubtype.java b/checker/tests/resourceleak/COInSubtype.java index a19f971709cb..5137359a4d6a 100644 --- a/checker/tests/resourceleak/COInSubtype.java +++ b/checker/tests/resourceleak/COInSubtype.java @@ -12,7 +12,7 @@ void foo() {} // This is not supported, even though a sub-class may have must-call obligations. // This pattern is not used in realistic code, and supporting it hurts checker performance. @CreatesMustCallFor("this") - // :: error: (creates.mustcall.for.invalid.target) + // :: error: [creates.mustcall.for.invalid.target] void resetFoo() {} } @@ -22,7 +22,7 @@ void a() {} } static void test() { - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] @MustCall("a") Foo f = new Bar(); f.resetFoo(); } diff --git a/checker/tests/resourceleak/CheckFields.java b/checker/tests/resourceleak/CheckFields.java index b55c67de0f3b..d8f63bb8f78a 100644 --- a/checker/tests/resourceleak/CheckFields.java +++ b/checker/tests/resourceleak/CheckFields.java @@ -18,7 +18,7 @@ Foo makeFoo() { @InheritableMustCall("b") static class FooField { private final @Owning Foo finalOwningFoo; - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] private final @Owning Foo finalOwningFooWrong; private final Foo finalNotOwningFoo; private @Owning Foo owningFoo; @@ -28,20 +28,20 @@ static class FooField { public FooField() { this.finalOwningFoo = new Foo(); this.finalOwningFooWrong = new Foo(); - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] this.finalNotOwningFoo = new Foo(); } @CreatesMustCallFor void assingToOwningFieldWrong() { Foo f = new Foo(); - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] this.owningFoo = f; } @CreatesMustCallFor void assignToOwningFieldWrong2() { - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] this.owningFoo = new Foo(); } @@ -55,7 +55,7 @@ void assingToOwningField() { } void assingToFinalNotOwningField() { - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] Foo f = new Foo(); this.notOwningFoo = f; } @@ -81,7 +81,7 @@ void testField() { void testAccessField() { FooField fooField = new FooField(); - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] fooField.owningFoo = new Foo(); fooField.b(); } @@ -95,24 +95,24 @@ void testAccessField2() { } void testAccessFieldWrong() { - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] FooField fooField = new FooField(); - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] fooField.owningFoo = new Foo(); - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] fooField.notOwningFoo = new Foo(); } @CreatesMustCallFor("#1") void testAccessField_param(FooField fooField) { - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] fooField.owningFoo = new Foo(); fooField.b(); } - // :: error: (missing.creates.mustcall.for) + // :: error: [missing.creates.mustcall.for] void testAccessField_param_no_co(FooField fooField) { - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] fooField.owningFoo = new Foo(); fooField.b(); } @@ -121,11 +121,11 @@ static class NestedWrong { // Non-final owning fields also require the surrounding class to have an appropriate MC // annotation. - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] @Owning Foo foo; @CreatesMustCallFor("this") - // :: error: (creates.mustcall.for.invalid.target) + // :: error: [creates.mustcall.for.invalid.target] void initFoo() { if (this.foo == null) { this.foo = new Foo(); @@ -137,7 +137,7 @@ void initFoo() { static class NestedWrong2 { // Non-final owning fields also require the surrounding class to have an appropriate MC // annotation. - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] @Owning Foo foo; @CreatesMustCallFor("this") diff --git a/checker/tests/resourceleak/CloseableAndMore.java b/checker/tests/resourceleak/CloseableAndMore.java index f42340c62915..89b7b9435b2d 100644 --- a/checker/tests/resourceleak/CloseableAndMore.java +++ b/checker/tests/resourceleak/CloseableAndMore.java @@ -14,7 +14,7 @@ void foo() {} public void close() throws IOException {} public static void test_bad() { - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] try (CloseableAndMore c = new CloseableAndMore()) { // empty body } catch (Exception e) { diff --git a/checker/tests/resourceleak/ConnectingServerSockets.java b/checker/tests/resourceleak/ConnectingServerSockets.java index 35140757edcc..888d5fda3f05 100644 --- a/checker/tests/resourceleak/ConnectingServerSockets.java +++ b/checker/tests/resourceleak/ConnectingServerSockets.java @@ -7,7 +7,7 @@ class ConnectingServerSockets { static void simple_ss_test(SocketAddress sa) throws Exception { - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] ServerSocket s = new ServerSocket(); s.bind(sa); } @@ -18,7 +18,7 @@ static void simple_ss_test2(SocketAddress sa) throws Exception { } static void simple_ss_test4(SocketAddress sa, int to) throws Exception { - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] ServerSocket s = new ServerSocket(); s.bind(sa, to); } @@ -28,7 +28,7 @@ static void simple_ss_test4(SocketAddress sa, int to) throws Exception { } static void simple_ss_test5(SocketAddress sa) throws Exception { - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] ServerSocket s = makeUnconnected(); s.bind(sa); } @@ -39,7 +39,7 @@ static void simple_ss_test6(SocketAddress sa) throws Exception { } static void simple_ss_test8(SocketAddress sa, int to) throws Exception { - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] ServerSocket s = makeUnconnected(); s.bind(sa, to); } diff --git a/checker/tests/resourceleak/ConnectingSockets.java b/checker/tests/resourceleak/ConnectingSockets.java index 8d5b474ff7f7..efd5cfad5d5d 100644 --- a/checker/tests/resourceleak/ConnectingSockets.java +++ b/checker/tests/resourceleak/ConnectingSockets.java @@ -7,7 +7,7 @@ class ConnectingSockets { static void simple_ns_test(SocketAddress sa) throws Exception { - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] Socket s = new Socket(); s.bind(sa); } @@ -18,13 +18,13 @@ static void simple_ns_test2(SocketAddress sa) throws Exception { } static void simple_ns_test3(SocketAddress sa) throws Exception { - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] Socket s = new Socket(); s.connect(sa); } static void simple_ns_test4(SocketAddress sa, int to) throws Exception { - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] Socket s = new Socket(); s.connect(sa, to); } @@ -34,7 +34,7 @@ static void simple_ns_test4(SocketAddress sa, int to) throws Exception { } static void simple_ns_test5(SocketAddress sa) throws Exception { - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] Socket s = makeUnconnected(); s.bind(sa); } @@ -45,13 +45,13 @@ static void simple_ns_test6(SocketAddress sa) throws Exception { } static void simple_ns_test7(SocketAddress sa) throws Exception { - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] Socket s = makeUnconnected(); s.connect(sa); } static void simple_ns_test8(SocketAddress sa, int to) throws Exception { - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] Socket s = makeUnconnected(); s.connect(sa, to); } diff --git a/checker/tests/resourceleak/ConstructorAddsMustCall.java b/checker/tests/resourceleak/ConstructorAddsMustCall.java index 857078907a36..6191542f8690 100644 --- a/checker/tests/resourceleak/ConstructorAddsMustCall.java +++ b/checker/tests/resourceleak/ConstructorAddsMustCall.java @@ -16,7 +16,7 @@ static void useFoo() { // no obligation for this one Foo f1 = new Foo(); // obligation for this one - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] Foo f2 = new Foo("hi"); } } diff --git a/checker/tests/resourceleak/CreatesMustCallForIndirect.java b/checker/tests/resourceleak/CreatesMustCallForIndirect.java index 98c725aef199..3002a53d3cb2 100644 --- a/checker/tests/resourceleak/CreatesMustCallForIndirect.java +++ b/checker/tests/resourceleak/CreatesMustCallForIndirect.java @@ -16,7 +16,7 @@ void a() {} } public static void resetIndirect_no_anno(CreatesMustCallForIndirect r) { - // :: error: (reset.not.owning) + // :: error: [reset.not.owning] r.reset(); } @@ -26,7 +26,7 @@ public static void resetIndirect_anno(CreatesMustCallForIndirect r) { } public static void reset_local() { - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] CreatesMustCallForIndirect r = new CreatesMustCallForIndirect(); r.reset(); } @@ -38,21 +38,21 @@ public static void reset_local2() { } public static void reset_local3() { - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] CreatesMustCallForIndirect r = new CreatesMustCallForIndirect(); // Ideally, we'd issue a reset.not.owning error on the next line instead, but not being able // to parse the case and requiring it to be in a local var is okay too. - // :: error: (createsmustcallfor.target.unparseable) + // :: error: [createsmustcallfor.target.unparseable] ((CreatesMustCallForIndirect) r).reset(); } - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] public static void test(@Owning CreatesMustCallForIndirect r) { resetIndirect_anno(r); } public static void test2(CreatesMustCallForIndirect r) { - // :: error: (reset.not.owning) + // :: error: [reset.not.owning] resetIndirect_anno(r); } diff --git a/checker/tests/resourceleak/CreatesMustCallForInnerClass.java b/checker/tests/resourceleak/CreatesMustCallForInnerClass.java index 7cc29a7bf5aa..80ea06370fd6 100644 --- a/checker/tests/resourceleak/CreatesMustCallForInnerClass.java +++ b/checker/tests/resourceleak/CreatesMustCallForInnerClass.java @@ -14,9 +14,9 @@ void resetFoo() {} /** non-static inner class */ class Bar { @CreatesMustCallFor - // :: error: (creates.mustcall.for.invalid.target) + // :: error: [creates.mustcall.for.invalid.target] void bar() { - // :: error: (reset.not.owning) + // :: error: [reset.not.owning] resetFoo(); } } @@ -26,7 +26,7 @@ void callBar() { // If this call to bar() were permitted with no errors, this would be unsound. // b is in fact an owning pointer, but we don't track it as such because // Bar objects cannot have must-call obligations created for them. - // :: error: (reset.not.owning) + // :: error: [reset.not.owning] b.bar(); } } diff --git a/checker/tests/resourceleak/CreatesMustCallForOverride.java b/checker/tests/resourceleak/CreatesMustCallForOverride.java index d93dac41ed5c..b4930d67f2d6 100644 --- a/checker/tests/resourceleak/CreatesMustCallForOverride.java +++ b/checker/tests/resourceleak/CreatesMustCallForOverride.java @@ -7,7 +7,7 @@ class CreatesMustCallForOverride { @CreatesMustCallFor @Override - // :: error: (creates.mustcall.for.override.invalid) + // :: error: [creates.mustcall.for.override.invalid] public String toString() { return "this method could re-assign a field or do something else it shouldn't"; } @@ -15,7 +15,7 @@ public String toString() { public void a() {} public static void test_no_cast() { - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] CreatesMustCallForOverride co = new CreatesMustCallForOverride(); co.a(); co.toString(); diff --git a/checker/tests/resourceleak/CreatesMustCallForOverride2.java b/checker/tests/resourceleak/CreatesMustCallForOverride2.java index e0190fa27473..7948f8102c6a 100644 --- a/checker/tests/resourceleak/CreatesMustCallForOverride2.java +++ b/checker/tests/resourceleak/CreatesMustCallForOverride2.java @@ -43,7 +43,7 @@ public void a() { // this version isn't permitted, since it adds a new obligation @Override @CreatesMustCallFor("this.myFoo") - // :: error: (creates.mustcall.for.override.invalid) + // :: error: [creates.mustcall.for.override.invalid] public void b() {} } @@ -62,7 +62,7 @@ public void a() { @Override @CreatesMustCallFor("this.myFoo") @CreatesMustCallFor("this") - // :: error: (creates.mustcall.for.override.invalid) + // :: error: [creates.mustcall.for.override.invalid] public void b() {} } @@ -71,61 +71,61 @@ static class Thudless extends Thud { // annotation from Thud is inherited! @Override @CreatesMustCallFor("this") - // :: error: (creates.mustcall.for.override.invalid) + // :: error: [creates.mustcall.for.override.invalid] public void b() {} } static void test1() { - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] Foo foo = new Foo(); foo.a(); foo.b(); } static void test2() { - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] Foo foo = new Bar(); foo.a(); foo.b(); } static void test3() { - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] Foo foo = new Baz(); foo.a(); foo.b(); } static void test4() { - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] Foo foo = new Qux(); foo.a(); foo.b(); } static void test5() { - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] Bar foo = new Bar(); foo.a(); foo.b(); } static void test6() { - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] Baz foo = new Baz(); foo.a(); foo.b(); } static void test7() { - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] Qux foo = new Qux(); foo.a(); foo.b(); } static void test8() { - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] Foo foo = new Razz(); foo.a(); foo.b(); @@ -140,35 +140,35 @@ static void test9() { } static void test10() { - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] Foo foo = new Thud(); foo.a(); foo.b(); } static void test11() { - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] Thud foo = new Thud(); foo.a(); foo.b(); } static void test12() { - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] Foo foo = new Thudless(); foo.a(); foo.b(); } static void test13() { - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] Thud foo = new Thudless(); foo.a(); foo.b(); } static void test14() { - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] Thudless foo = new Thudless(); foo.a(); foo.b(); diff --git a/checker/tests/resourceleak/CreatesMustCallForRepeat.java b/checker/tests/resourceleak/CreatesMustCallForRepeat.java index 288ca1679092..3bcac521c991 100644 --- a/checker/tests/resourceleak/CreatesMustCallForRepeat.java +++ b/checker/tests/resourceleak/CreatesMustCallForRepeat.java @@ -17,26 +17,26 @@ void a() {} } static void test1() { - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] CreatesMustCallForRepeat cos1 = makeNoMC(); - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] CreatesMustCallForRepeat cos2 = makeNoMC(); @MustCall({}) CreatesMustCallForRepeat a = cos2; @MustCall({}) CreatesMustCallForRepeat a2 = cos2; cos2.a(); cos1.reset(cos2); - // :: error: (assignment) + // :: error: [assignment] @CalledMethods({"reset"}) CreatesMustCallForRepeat b = cos1; @CalledMethods({}) CreatesMustCallForRepeat c = cos1; @CalledMethods({}) CreatesMustCallForRepeat d = cos2; - // :: error: (assignment) + // :: error: [assignment] @CalledMethods({"a"}) CreatesMustCallForRepeat e = cos2; } static void test3() { - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] CreatesMustCallForRepeat cos = new CreatesMustCallForRepeat(); - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] CreatesMustCallForRepeat cos2 = new CreatesMustCallForRepeat(); cos.a(); cos.reset(cos2); @@ -44,7 +44,7 @@ static void test3() { static void test4() { CreatesMustCallForRepeat cos = new CreatesMustCallForRepeat(); - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] CreatesMustCallForRepeat cos2 = new CreatesMustCallForRepeat(); cos.a(); cos.reset(cos2); @@ -52,7 +52,7 @@ static void test4() { } static void test5() { - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] CreatesMustCallForRepeat cos = new CreatesMustCallForRepeat(); CreatesMustCallForRepeat cos2 = new CreatesMustCallForRepeat(); cos.a(); diff --git a/checker/tests/resourceleak/CreatesMustCallForSimple.java b/checker/tests/resourceleak/CreatesMustCallForSimple.java index 83a0f01d5091..b004c4ea19da 100644 --- a/checker/tests/resourceleak/CreatesMustCallForSimple.java +++ b/checker/tests/resourceleak/CreatesMustCallForSimple.java @@ -19,27 +19,27 @@ void a() {} } static void test1() { - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] CreatesMustCallForSimple cos = makeNoMC(); @MustCall({}) CreatesMustCallForSimple a = cos; cos.reset(); - // :: error: (assignment) + // :: error: [assignment] @CalledMethods({"reset"}) CreatesMustCallForSimple b = cos; @CalledMethods({}) CreatesMustCallForSimple c = cos; } static void test2() { - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] CreatesMustCallForSimple cos = makeNoMC(); @MustCall({}) CreatesMustCallForSimple a = cos; cos.resetThis(); - // :: error: (assignment) + // :: error: [assignment] @CalledMethods({"resetThis"}) CreatesMustCallForSimple b = cos; @CalledMethods({}) CreatesMustCallForSimple c = cos; } static void test3() { - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] CreatesMustCallForSimple cos = new CreatesMustCallForSimple(); cos.a(); cos.resetThis(); @@ -67,7 +67,7 @@ static void test6(boolean b) { } static void test7(boolean b) { - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] CreatesMustCallForSimple cos = new CreatesMustCallForSimple(); cos.a(); if (b) { diff --git a/checker/tests/resourceleak/CreatesMustCallForSimpler.java b/checker/tests/resourceleak/CreatesMustCallForSimpler.java index efbdbeffa8b1..5da8f03e8ad1 100644 --- a/checker/tests/resourceleak/CreatesMustCallForSimpler.java +++ b/checker/tests/resourceleak/CreatesMustCallForSimpler.java @@ -19,11 +19,11 @@ void a() {} } static void test1() { - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] CreatesMustCallForSimpler cos = makeNoMC(); @MustCall({}) CreatesMustCallForSimpler a = cos; cos.reset(); - // :: error: (assignment) + // :: error: [assignment] @CalledMethods({"reset"}) CreatesMustCallForSimpler b = cos; @CalledMethods({}) CreatesMustCallForSimpler c = cos; } diff --git a/checker/tests/resourceleak/CreatesMustCallForTargets.java b/checker/tests/resourceleak/CreatesMustCallForTargets.java index a63cbb0f63b0..ce6375372dba 100644 --- a/checker/tests/resourceleak/CreatesMustCallForTargets.java +++ b/checker/tests/resourceleak/CreatesMustCallForTargets.java @@ -10,8 +10,8 @@ class CreatesMustCallForTargets { @Owning InputStream is1; @CreatesMustCallFor - // :: error: (createsmustcallfor.target.unparseable) - // :: error: (incompatible.creates.mustcall.for) + // :: error: [createsmustcallfor.target.unparseable] + // :: error: [incompatible.creates.mustcall.for] static void resetObj1(CreatesMustCallForTargets r) throws Exception { if (r.is1 == null) { r.is1 = new FileInputStream("foo.txt"); @@ -19,7 +19,7 @@ static void resetObj1(CreatesMustCallForTargets r) throws Exception { } @CreatesMustCallFor("#2") - // :: error: (incompatible.creates.mustcall.for) + // :: error: [incompatible.creates.mustcall.for] static void resetObj2(CreatesMustCallForTargets r, CreatesMustCallForTargets other) throws Exception { if (r.is1 == null) { @@ -43,7 +43,7 @@ void resetObj4(CreatesMustCallForTargets this, CreatesMustCallForTargets other) } @CreatesMustCallFor - // :: error: (incompatible.creates.mustcall.for) + // :: error: [incompatible.creates.mustcall.for] void resetObj5(CreatesMustCallForTargets this, CreatesMustCallForTargets other) throws Exception { if (other.is1 == null) { other.is1 = new FileInputStream("foo.txt"); @@ -51,8 +51,8 @@ void resetObj5(CreatesMustCallForTargets this, CreatesMustCallForTargets other) } @CreatesMustCallFor("#2") - // :: error: (createsmustcallfor.target.unparseable) - // :: error: (incompatible.creates.mustcall.for) + // :: error: [createsmustcallfor.target.unparseable] + // :: error: [incompatible.creates.mustcall.for] void resetObj6(CreatesMustCallForTargets this, CreatesMustCallForTargets other) throws Exception { if (other.is1 == null) { other.is1 = new FileInputStream("foo.txt"); @@ -72,14 +72,14 @@ void a() throws Exception { } @CreatesMustCallFor("#1") - // :: error: (creates.mustcall.for.invalid.target) + // :: error: [creates.mustcall.for.invalid.target] static void testBadCreates(Object o) {} static class BadCreatesField { @Owning Object o; @CreatesMustCallFor("this.o") - // :: error: (creates.mustcall.for.invalid.target) + // :: error: [creates.mustcall.for.invalid.target] void badCreatesOnField() {} } } diff --git a/checker/tests/resourceleak/DifferentSWKeys.java b/checker/tests/resourceleak/DifferentSWKeys.java index a1a2eae1adf3..d95054dda87f 100644 --- a/checker/tests/resourceleak/DifferentSWKeys.java +++ b/checker/tests/resourceleak/DifferentSWKeys.java @@ -7,7 +7,7 @@ @SuppressWarnings("required.method.not.called") class DifferentSWKeys { void test(@Owning @MustCall("foo") Object obj) { - // :: warning: (unneeded.suppression) + // :: warning: [unneeded.suppression] @SuppressWarnings("mustcall") @MustCall("foo") Object bar = obj; } @@ -21,7 +21,7 @@ void test2(@Owning @MustCall("foo") Object obj) { void test3(@Owning @MustCall("foo") Object obj) { // test that the option-specific suppression key doesn't work @SuppressWarnings("mustcallnocreatesmustcallfor") - // :: error: (assignment) + // :: error: [assignment] @MustCall({}) Object bar = obj; } } diff --git a/checker/tests/resourceleak/Enclosing.java b/checker/tests/resourceleak/Enclosing.java index 3998cd3da77d..f2c59d70757d 100644 --- a/checker/tests/resourceleak/Enclosing.java +++ b/checker/tests/resourceleak/Enclosing.java @@ -9,11 +9,11 @@ void a() {} } static class Nested { - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] @Owning Foo foo; @CreatesMustCallFor("this") - // :: error: (creates.mustcall.for.invalid.target) + // :: error: [creates.mustcall.for.invalid.target] void initFoo() { if (this.foo == null) { this.foo = new Foo(); diff --git a/checker/tests/resourceleak/EnhancedFor.java b/checker/tests/resourceleak/EnhancedFor.java index 2f2afcac14b7..eba0b483a74a 100644 --- a/checker/tests/resourceleak/EnhancedFor.java +++ b/checker/tests/resourceleak/EnhancedFor.java @@ -33,7 +33,7 @@ void test3(List list) { // a method return type). Both this error and the type.argument error // above can be suppressed by writing @MustCall on the Socket type, as in // test4 below (but note that this will make call sites difficult to verify). - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] for (Socket s : list) {} } diff --git a/checker/tests/resourceleak/FileDescriptorTest.java b/checker/tests/resourceleak/FileDescriptorTest.java index 5a91d5c10200..29467d5bad81 100644 --- a/checker/tests/resourceleak/FileDescriptorTest.java +++ b/checker/tests/resourceleak/FileDescriptorTest.java @@ -9,7 +9,7 @@ public abstract class FileDescriptorTest { // not caught; therefore, file might still be open. public static void readPropertiesFile(File from) throws IOException { // This is a false positive. - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] RandomAccessFile file = new RandomAccessFile(from, "rws"); FileInputStream in = null; try { @@ -30,7 +30,7 @@ public static void readPropertiesFile(File from) throws IOException { // This warning is a false positive, and should be resolved at the same time as the warning // above. public void sameScenario_noFD() throws IOException { - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] Socket sock = createSocket(); InputStream in = null; try { diff --git a/checker/tests/resourceleak/FilesTest.java b/checker/tests/resourceleak/FilesTest.java index 755f249514a4..4acf4d66b833 100644 --- a/checker/tests/resourceleak/FilesTest.java +++ b/checker/tests/resourceleak/FilesTest.java @@ -6,7 +6,7 @@ public class FilesTest { void bad(Path p) throws IOException { - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] Stream s = Files.list(p); } diff --git a/checker/tests/resourceleak/FinallyThrowsException.java b/checker/tests/resourceleak/FinallyThrowsException.java index f51d34f2a480..4168bab3fdf2 100644 --- a/checker/tests/resourceleak/FinallyThrowsException.java +++ b/checker/tests/resourceleak/FinallyThrowsException.java @@ -15,7 +15,7 @@ abstract class FinallyThrowsException { public @Owning Closeable test1() throws IOException { // Resource leak: the allocated resource is lost when the exception is thrown try { - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] return alloc(); } finally { throw new IOException(); @@ -34,7 +34,7 @@ abstract class FinallyThrowsException { public @Owning Closeable test3() throws IOException { // Resource leak: the allocated resource is lost if x.close() throws try (Closeable x = alloc()) { - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] return alloc(); } } @@ -77,7 +77,7 @@ abstract class FinallyThrowsException { // exception. The cause of the false positive is the same control-flow merge described in // IfBranch.test1(), although the merge is more subtle: both returns have an edge to the // implicit `finally { x.close(); }` of the try-with-resources block. - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] public @Owning @Nullable Closeable test7(@Owning Closeable r1) throws IOException { try (Closeable x = alloc()) { if (choice()) { @@ -122,10 +122,10 @@ abstract class FinallyThrowsException { // This exhibits one false positive on r1 (see test7) and one true positive on r2 (see test3). // The true positive might be very surprising because the same code is resource-leak-free when // it does not appear under try-with-resources (see test8). - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] public @Owning Closeable test9(@Owning Closeable r1) throws IOException { try (Closeable x = alloc()) { - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] Closeable r2 = alloc(); if (r2 == null) { return r1; diff --git a/checker/tests/resourceleak/HBaseReport1.java b/checker/tests/resourceleak/HBaseReport1.java index ef486c86c449..3998c45bcc19 100644 --- a/checker/tests/resourceleak/HBaseReport1.java +++ b/checker/tests/resourceleak/HBaseReport1.java @@ -11,7 +11,7 @@ class HBaseReport1 { public static void test(String fileName) { FileWriter fstream; try { - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] fstream = new FileWriter(fileName); } catch (IOException e) { return; diff --git a/checker/tests/resourceleak/IfBranch.java b/checker/tests/resourceleak/IfBranch.java index 8d148abe9be2..9823c3e62c1d 100644 --- a/checker/tests/resourceleak/IfBranch.java +++ b/checker/tests/resourceleak/IfBranch.java @@ -25,7 +25,7 @@ abstract class IfBranch { // Checker and instead track called methods for each alias alongside obligations in // MustCallConsistencyAnalyzer. // - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] public @Owning @Nullable Closeable test1(@Owning Closeable r1) throws IOException { Closeable result; if (choice()) { diff --git a/checker/tests/resourceleak/InputOutputStreams.java b/checker/tests/resourceleak/InputOutputStreams.java index 1b0d56d4e1ee..854020d97779 100644 --- a/checker/tests/resourceleak/InputOutputStreams.java +++ b/checker/tests/resourceleak/InputOutputStreams.java @@ -27,7 +27,7 @@ void test_close_sock(@Owning Socket sock) throws IOException { // and third case our checker has to verify that close is called on the underlying resource. // So, because sock.getInputStream() can throw IOException, "is" can be null, then sock will // remain open. So, it's a true positive warning. - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] void test_close_is(@Owning Socket sock) throws IOException { InputStream is = null; OutputStream os = null; @@ -52,14 +52,14 @@ void test_close_os_old(@Owning Socket sock) throws IOException { } void test_close_os() throws IOException { - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] Socket sock = newSocket(); InputStream is = sock.getInputStream(); OutputStream os = sock.getOutputStream(); os.close(); } - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] void test_close_os2(@Owning Socket sock) throws IOException { OutputStream os = null; InputStream is = null; @@ -93,7 +93,7 @@ void test_close_os3_old(@Owning Socket sock) throws IOException { } void test_close_os3() throws IOException { - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] Socket sock = newSocket(); OutputStream os = null; try { @@ -135,7 +135,7 @@ void test_close_os4_old(@Owning Socket sock) throws IOException { // the resource. So, it analyzes a path through the "then" branch of the conditional, // where sock.close() is not invoked, and reports an error. void test_close_os4() throws IOException { - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] Socket sock = newSocket(); OutputStream os = null; try { @@ -153,7 +153,7 @@ void test_close_os4() throws IOException { } } - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] void test_close_buff(@Owning Socket sock) throws IOException { BufferedOutputStream buff = null; try { diff --git a/checker/tests/resourceleak/InstanceInitializer.java b/checker/tests/resourceleak/InstanceInitializer.java index 23f74afd5ec3..a370c0447651 100644 --- a/checker/tests/resourceleak/InstanceInitializer.java +++ b/checker/tests/resourceleak/InstanceInitializer.java @@ -6,7 +6,7 @@ import org.checkerframework.checker.mustcall.qual.*; class InstanceInitializer { - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] private @Owning Socket s; private final int DEFAULT_PORT = 5; @@ -16,7 +16,7 @@ class InstanceInitializer { try { // This assignment is OK, because it's the first assignment. // However, the Resource Leak Checker issues a false positive warning. - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] s = new Socket(DEFAULT_ADDR, DEFAULT_PORT); } catch (Exception e) { } @@ -26,7 +26,7 @@ class InstanceInitializer { try { // This assignment is not OK, because it's a reassignment without satisfying the // mustcall obligations of the previous value of `s`. - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] s = new Socket(DEFAULT_ADDR, DEFAULT_PORT); } catch (Exception e) { } @@ -34,7 +34,7 @@ class InstanceInitializer { { try { - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] Socket s1 = new Socket(DEFAULT_ADDR, DEFAULT_PORT); } catch (Exception e) { } @@ -50,7 +50,7 @@ class InstanceInitializer { } public InstanceInitializer() throws Exception { - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] s = new Socket(DEFAULT_ADDR, DEFAULT_PORT); } } diff --git a/checker/tests/resourceleak/ManualMustCallEmptyOnConstructor.java b/checker/tests/resourceleak/ManualMustCallEmptyOnConstructor.java index 627917119298..a397aa0886d1 100644 --- a/checker/tests/resourceleak/ManualMustCallEmptyOnConstructor.java +++ b/checker/tests/resourceleak/ManualMustCallEmptyOnConstructor.java @@ -12,7 +12,7 @@ class ManualMustCallEmptyOnConstructor { static class Foo { final @Owning InputStream is; - // :: error: (inconsistent.constructor.type) + // :: error: [inconsistent.constructor.type] @MustCall({}) Foo(@Owning InputStream is) { this.is = is; } diff --git a/checker/tests/resourceleak/MultipleMethodParamsMustCallAliasTest.java b/checker/tests/resourceleak/MultipleMethodParamsMustCallAliasTest.java index 3766c42f6c6d..fd3d8c0fdb8a 100644 --- a/checker/tests/resourceleak/MultipleMethodParamsMustCallAliasTest.java +++ b/checker/tests/resourceleak/MultipleMethodParamsMustCallAliasTest.java @@ -39,7 +39,7 @@ void testMultiMethodParamsCorrect3(@Owning InputStream in1, @Owning InputStream } } - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] void testMultiMethodParamsWrong1(@Owning InputStream in1, @Owning InputStream in2) throws IOException { @@ -48,7 +48,7 @@ void testMultiMethodParamsWrong1(@Owning InputStream in1, @Owning InputStream in in1.close(); } - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] void testMultiMethodParamsWrong2(@Owning InputStream in1, @Owning InputStream in2) throws IOException { @@ -57,9 +57,9 @@ void testMultiMethodParamsWrong2(@Owning InputStream in1, @Owning InputStream in in2.close(); } - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] void testMultiMethodParamsWrong3(@Owning InputStream in1) throws IOException { - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] Socket socket = new Socket("address", 12); ReplicaInputStreams r = new ReplicaInputStreams(in1, socket.getInputStream()); } @@ -82,7 +82,7 @@ class ReplicaInputStreams implements Closeable { @EnsuresCalledMethods( value = {"this.in1", "this.in2"}, methods = {"close"}) - // :: error: (contracts.exceptional.postcondition) + // :: error: [contracts.exceptional.postcondition] public void close() throws IOException { in1.close(); in2.close(); diff --git a/checker/tests/resourceleak/MustCallAliasExamples.java b/checker/tests/resourceleak/MustCallAliasExamples.java index ded1e1efad55..715b0b996db5 100644 --- a/checker/tests/resourceleak/MustCallAliasExamples.java +++ b/checker/tests/resourceleak/MustCallAliasExamples.java @@ -30,12 +30,12 @@ void test_close_nonwrapper(@Owning InputStream b) throws IOException { b.close(); } - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] void test_no_close(@Owning InputStream b) { DataInputStream d = new DataInputStream(b); } - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] void test_no_assign(@Owning InputStream b) { new DataInputStream(new BufferedInputStream(b)); } diff --git a/checker/tests/resourceleak/MustCallAliasImplWrong1.java b/checker/tests/resourceleak/MustCallAliasImplWrong1.java index 927ed93d927b..4037ec20575d 100644 --- a/checker/tests/resourceleak/MustCallAliasImplWrong1.java +++ b/checker/tests/resourceleak/MustCallAliasImplWrong1.java @@ -10,7 +10,7 @@ public class MustCallAliasImplWrong1 implements Closeable { final @Owning Closeable foo; - // :: error: (mustcallalias.out.of.scope) + // :: error: [mustcallalias.out.of.scope] public @MustCallAlias MustCallAliasImplWrong1(@MustCallAlias Closeable foo) { this.foo = null; } diff --git a/checker/tests/resourceleak/MustCallAliasImplWrong2.java b/checker/tests/resourceleak/MustCallAliasImplWrong2.java index 9647cd0fd0c5..7c25ae91276e 100644 --- a/checker/tests/resourceleak/MustCallAliasImplWrong2.java +++ b/checker/tests/resourceleak/MustCallAliasImplWrong2.java @@ -10,12 +10,12 @@ public class MustCallAliasImplWrong2 implements Closeable { final /*@Owning*/ Closeable foo; - // :: error: (mustcallalias.out.of.scope) + // :: error: [mustcallalias.out.of.scope] public @MustCallAlias MustCallAliasImplWrong2(@MustCallAlias Closeable foo) { // The following error isn't really desirable, but occurs because the special case // in the Must Call Checker for assigning @MustCallAlias parameters to @Owning fields // is not triggered. - // :: error: (assignment) + // :: error: [assignment] this.foo = foo; } diff --git a/checker/tests/resourceleak/MustCallAliasLayeredStreams.java b/checker/tests/resourceleak/MustCallAliasLayeredStreams.java index 536580e65a81..bdab667fb544 100644 --- a/checker/tests/resourceleak/MustCallAliasLayeredStreams.java +++ b/checker/tests/resourceleak/MustCallAliasLayeredStreams.java @@ -14,7 +14,7 @@ public InputStream createInputStream(String filename) throws FileNotFoundExcepti // non-owning, and the caller of createInputStream is the owner of all of these streams. cache = new DataInputStream( - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] new BufferedInputStream(new FileInputStream(new File(filename)))); } return cache; diff --git a/checker/tests/resourceleak/MustCallAliasNoAnnoOnConstructor.java b/checker/tests/resourceleak/MustCallAliasNoAnnoOnConstructor.java index 1c2570e6b4de..3d622a623800 100644 --- a/checker/tests/resourceleak/MustCallAliasNoAnnoOnConstructor.java +++ b/checker/tests/resourceleak/MustCallAliasNoAnnoOnConstructor.java @@ -9,7 +9,7 @@ public class MustCallAliasNoAnnoOnConstructor { final @Owning InputStream is; - // :: warning: (mustcallalias.method.return.and.param) + // :: warning: [mustcallalias.method.return.and.param] @MustCallAlias MustCallAliasNoAnnoOnConstructor(InputStream p, boolean b) throws Exception { if (b) { throw new Exception("an exception!"); diff --git a/checker/tests/resourceleak/MustCallAliasPassthroughChain.java b/checker/tests/resourceleak/MustCallAliasPassthroughChain.java index ca681315414c..ea1cc4f2cde1 100644 --- a/checker/tests/resourceleak/MustCallAliasPassthroughChain.java +++ b/checker/tests/resourceleak/MustCallAliasPassthroughChain.java @@ -34,19 +34,19 @@ class MustCallAliasPassthroughChain { return s; } - // :: error: (mustcallalias.out.of.scope) + // :: error: [mustcallalias.out.of.scope] static @MustCallAlias InputStream chain_bad1(@MustCallAlias InputStream is) { InputStream s = withMCA(chain1(is)); return null; } - // :: error: (mustcallalias.out.of.scope) + // :: error: [mustcallalias.out.of.scope] static @MustCallAlias InputStream chain_bad2(@MustCallAlias InputStream is) { withMCA(chain1(is)); return null; } - // :: error: (mustcallalias.out.of.scope) + // :: error: [mustcallalias.out.of.scope] static @MustCallAlias InputStream chain_bad3(@MustCallAlias InputStream is, boolean b) { return b ? null : withMCA(chain1(is)); } diff --git a/checker/tests/resourceleak/MustCallAliasPassthroughLocal.java b/checker/tests/resourceleak/MustCallAliasPassthroughLocal.java index b4c3814a4b3d..51bf57ffe8f7 100644 --- a/checker/tests/resourceleak/MustCallAliasPassthroughLocal.java +++ b/checker/tests/resourceleak/MustCallAliasPassthroughLocal.java @@ -12,7 +12,7 @@ class MustCallAliasPassthroughLocal extends FilterInputStream { } static void test(File f) throws Exception { - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] new MustCallAliasPassthroughLocal(f); } diff --git a/checker/tests/resourceleak/MustCallAliasPassthroughWrong1.java b/checker/tests/resourceleak/MustCallAliasPassthroughWrong1.java index 8403b9f07cbe..2cfddddcbd33 100644 --- a/checker/tests/resourceleak/MustCallAliasPassthroughWrong1.java +++ b/checker/tests/resourceleak/MustCallAliasPassthroughWrong1.java @@ -7,7 +7,7 @@ import org.checkerframework.checker.mustcall.qual.*; class MustCallAliasPassthroughWrong1 extends FilterInputStream { - // :: error: (mustcallalias.out.of.scope) + // :: error: [mustcallalias.out.of.scope] @MustCallAlias MustCallAliasPassthroughWrong1(@MustCallAlias InputStream is) { super(null); } diff --git a/checker/tests/resourceleak/MustCallAliasPassthroughWrong2.java b/checker/tests/resourceleak/MustCallAliasPassthroughWrong2.java index 451efe6d4727..4cc3528ea051 100644 --- a/checker/tests/resourceleak/MustCallAliasPassthroughWrong2.java +++ b/checker/tests/resourceleak/MustCallAliasPassthroughWrong2.java @@ -10,7 +10,7 @@ import org.checkerframework.checker.mustcall.qual.*; class MustCallAliasPassthroughWrong2 extends FilterInputStream { - // :: error: (mustcallalias.out.of.scope) + // :: error: [mustcallalias.out.of.scope] @MustCallAlias MustCallAliasPassthroughWrong2(@MustCallAlias InputStream is) throws Exception { super(null); // The following error isn't really desirable, but occurs because the special case diff --git a/checker/tests/resourceleak/MustCallAliasPassthroughWrong3.java b/checker/tests/resourceleak/MustCallAliasPassthroughWrong3.java index d2119c04075d..2bfd64ae2984 100644 --- a/checker/tests/resourceleak/MustCallAliasPassthroughWrong3.java +++ b/checker/tests/resourceleak/MustCallAliasPassthroughWrong3.java @@ -6,9 +6,9 @@ class MustCallAliasPassthroughWrong3 { - // :: warning: (mustcallalias.method.return.and.param) + // :: warning: [mustcallalias.method.return.and.param] static InputStream missingMCA(@MustCallAlias InputStream is) { - // :: error: (return) + // :: error: [return] return is; } @@ -16,7 +16,7 @@ static InputStream missingMCA(@MustCallAlias InputStream is) { return is; } - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] void use_bad(@Owning InputStream is) throws Exception { InputStream is2 = missingMCA(is); is2.close(); diff --git a/checker/tests/resourceleak/MustCallAliasPassthroughWrong4.java b/checker/tests/resourceleak/MustCallAliasPassthroughWrong4.java index d72419fc0a45..353f52246426 100644 --- a/checker/tests/resourceleak/MustCallAliasPassthroughWrong4.java +++ b/checker/tests/resourceleak/MustCallAliasPassthroughWrong4.java @@ -9,7 +9,7 @@ import org.checkerframework.checker.mustcall.qual.*; class MustCallAliasPassthroughWrong4 extends FilterInputStream { - // :: error: (mustcallalias.out.of.scope) + // :: error: [mustcallalias.out.of.scope] @MustCallAlias MustCallAliasPassthroughWrong4(@MustCallAlias InputStream is) throws Exception { super(null); is.close(); diff --git a/checker/tests/resourceleak/MustCallAliasReturnAndParamSimple.java b/checker/tests/resourceleak/MustCallAliasReturnAndParamSimple.java index df7329b5910b..2dd783e5b9ae 100644 --- a/checker/tests/resourceleak/MustCallAliasReturnAndParamSimple.java +++ b/checker/tests/resourceleak/MustCallAliasReturnAndParamSimple.java @@ -15,7 +15,7 @@ public class MustCallAliasReturnAndParamSimple { return this; } - // :: warning: (mustcallalias.method.return.and.param) + // :: warning: [mustcallalias.method.return.and.param] @MustCallAlias MustCallAliasReturnAndParamSimple someIncorrectlyAnnotatedFluentMethod( MustCallAliasReturnAndParamSimple this) { return this; @@ -39,14 +39,14 @@ public void close() throws IOException { return new MustCallAliasReturnAndParamSimple(is, false); } - // :: warning: (mustcallalias.method.return.and.param) + // :: warning: [mustcallalias.method.return.and.param] public static MustCallAliasReturnAndParamSimple mcaneFactory2(@MustCallAlias InputStream is) throws Exception { - // :: error: (return) + // :: error: [return] return new MustCallAliasReturnAndParamSimple(is, false); } - // :: warning: (mustcallalias.method.return.and.param) + // :: warning: [mustcallalias.method.return.and.param] public static @MustCallAlias MustCallAliasReturnAndParamSimple mcaneFactory3(InputStream is) throws Exception { return new MustCallAliasReturnAndParamSimple(is, false); diff --git a/checker/tests/resourceleak/MustCallAliasSubstitution.java b/checker/tests/resourceleak/MustCallAliasSubstitution.java index f9bb837cfc41..f3a03394a711 100644 --- a/checker/tests/resourceleak/MustCallAliasSubstitution.java +++ b/checker/tests/resourceleak/MustCallAliasSubstitution.java @@ -8,7 +8,7 @@ class MustCallAliasSubstitution { - // :: error: (mustcallalias.out.of.scope) + // :: error: [mustcallalias.out.of.scope] static @MustCallAlias Closeable example(@MustCallAlias Closeable p) throws IOException { p.close(); return new Socket("localhost", 5000); diff --git a/checker/tests/resourceleak/MustCloseIntoObject.java b/checker/tests/resourceleak/MustCloseIntoObject.java index 6c6455ad23ec..4bcc2009fed3 100644 --- a/checker/tests/resourceleak/MustCloseIntoObject.java +++ b/checker/tests/resourceleak/MustCloseIntoObject.java @@ -5,7 +5,7 @@ class MustCloseIntoObject { void test() throws Exception { - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] Object o = new Socket("", 0); } } diff --git a/checker/tests/resourceleak/NonFinalFieldOnlyOverwrittenIfNull.java b/checker/tests/resourceleak/NonFinalFieldOnlyOverwrittenIfNull.java index 7b1140e1e78b..5bbff94446c9 100644 --- a/checker/tests/resourceleak/NonFinalFieldOnlyOverwrittenIfNull.java +++ b/checker/tests/resourceleak/NonFinalFieldOnlyOverwrittenIfNull.java @@ -30,20 +30,20 @@ void set_after_close(String fn, boolean b) throws IOException { @CreatesMustCallFor void set_error(String fn, boolean b) throws FileNotFoundException { if (b) { - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] is = new FileInputStream(fn); } } // These three methods are copies of the three above, without the appropriate annotation. - // :: error: (missing.creates.mustcall.for) + // :: error: [missing.creates.mustcall.for] void set2(String fn) throws FileNotFoundException { if (is == null) { is = new FileInputStream(fn); } } - // :: error: (missing.creates.mustcall.for) + // :: error: [missing.creates.mustcall.for] void set_after_close2(String fn, boolean b) throws IOException { if (b) { is.close(); @@ -51,10 +51,10 @@ void set_after_close2(String fn, boolean b) throws IOException { } } - // :: error: (missing.creates.mustcall.for) + // :: error: [missing.creates.mustcall.for] void set_error2(String fn, boolean b) throws FileNotFoundException { if (b) { - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] is = new FileInputStream(fn); } } @@ -80,7 +80,7 @@ void close() throws Exception { } public static void test_leak() throws Exception { - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] NonFinalFieldOnlyOverwrittenIfNull n = new NonFinalFieldOnlyOverwrittenIfNull(); n.close(); n.set_after_close("bar.txt", true); diff --git a/checker/tests/resourceleak/NonFinalFieldOnlyOverwrittenIfNull2.java b/checker/tests/resourceleak/NonFinalFieldOnlyOverwrittenIfNull2.java index 7fdde063e1d4..71038d8c954c 100644 --- a/checker/tests/resourceleak/NonFinalFieldOnlyOverwrittenIfNull2.java +++ b/checker/tests/resourceleak/NonFinalFieldOnlyOverwrittenIfNull2.java @@ -30,7 +30,7 @@ void set_after_close(String fn, boolean b) throws IOException { @CreatesMustCallFor void set_error(String fn, boolean b) throws FileNotFoundException { if (b) { - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] is = new FileInputStream(fn); } } @@ -58,7 +58,7 @@ void close() throws Exception { } public static void test_leak() throws Exception { - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] NonFinalFieldOnlyOverwrittenIfNull2 n = new NonFinalFieldOnlyOverwrittenIfNull2(); n.set("foo.txt"); n.close(); diff --git a/checker/tests/resourceleak/OwnershipWithExceptions.java b/checker/tests/resourceleak/OwnershipWithExceptions.java index 76aa88978383..10a739b5fa01 100644 --- a/checker/tests/resourceleak/OwnershipWithExceptions.java +++ b/checker/tests/resourceleak/OwnershipWithExceptions.java @@ -28,7 +28,7 @@ void closeSocket(@Owning @MustCall("close") Socket t) { static class ManualExample2 { void example(String myHost, int myPort) throws Exception { // Error: `s` is not closed on all paths - // ::error: (required.method.not.called) + // ::error: [required.method.not.called] Socket s = new Socket(myHost, myPort); // `closeSocket` does not have to close `s` when it throws IOException. @@ -56,7 +56,7 @@ void transferHasNoObligationsOnException(@Owning Closeable resource) throws IOEx throw new IOException(); } - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] void transferAndIgnoreExceptionWithoutClosing(@Owning Closeable zzz) { try { transfer(zzz); @@ -81,12 +81,12 @@ boolean transferAndIgnoreExceptionCorrectly(@Owning Closeable resource) { // the called method throws. So, this is not correct: if transfer(resource) // throws an exception, it leaks the resource. void noExceptionHandling() throws IOException { - // ::error: (required.method.not.called) + // ::error: [required.method.not.called] Closeable resource = alloc(); - // ::error: (assignment) + // ::error: [assignment] @CalledMethods("close") Closeable a = resource; transfer(resource); - // ::error: (assignment) + // ::error: [assignment] @CalledMethods("close") Closeable b = resource; } @@ -98,7 +98,7 @@ class FinalOwnedField implements Closeable { // Field assignments in constructors are special. When the constructor // exits by exception, the field becomes permanently inaccessible, and // therefore the allocated resource is leaked. - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] resource = alloc(); if (arbitraryChoice()) { throw new IOException(); @@ -154,7 +154,7 @@ class FinalOwnedField implements Closeable { @EnsuresCalledMethods( value = "this.resource", methods = {"close"}) - // ::error: (contracts.exceptional.postcondition) + // ::error: [contracts.exceptional.postcondition] public void close() throws IOException { throw new IOException(); } @@ -172,7 +172,7 @@ class TwoOwnedFields implements Closeable { // Field assignments in constructors are special. When the constructor // exits by exception, the field becomes permanently inaccessible, and // therefore the allocated resource is leaked. - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] resource = alloc(); if (arbitraryChoice()) { throw new IOException(); @@ -229,7 +229,7 @@ class TwoOwnedFields implements Closeable { @EnsuresCalledMethods( value = {"this.resource", "this.unused"}, methods = {"close"}) - // ::error: (contracts.exceptional.postcondition) + // ::error: [contracts.exceptional.postcondition] public void close() throws IOException { if (unused != null) unused.close(); if (resource != null) resource.close(); diff --git a/checker/tests/resourceleak/OwningAndEnsuresCalledMethodsOnException.java b/checker/tests/resourceleak/OwningAndEnsuresCalledMethodsOnException.java index e9da8f2f5162..4a31ba55ae8d 100644 --- a/checker/tests/resourceleak/OwningAndEnsuresCalledMethodsOnException.java +++ b/checker/tests/resourceleak/OwningAndEnsuresCalledMethodsOnException.java @@ -33,13 +33,13 @@ public OwningAndEnsuresCalledMethodsOnException() throws IOException { // OK: the good delegate constructor will either take ownership or close the argument // This will issue a false positive warning due to // https://github.com/typetools/checker-framework/issues/6270 - // ::error: (required.method.not.called) + // ::error: [required.method.not.called] this(new Resource()); } public OwningAndEnsuresCalledMethodsOnException(int x) throws IOException { // WRONG: the bad delegate constructor does not close the argument on exception - // ::error: (required.method.not.called) + // ::error: [required.method.not.called] this(new Resource(), x); } @@ -47,13 +47,13 @@ static void exampleUseInNormalMethod1() throws IOException { // OK: the constructor will either take ownership or close the argument // This will issue a false positive warning due to // https://github.com/typetools/checker-framework/issues/6270 - // ::error: (required.method.not.called) + // ::error: [required.method.not.called] new OwningAndEnsuresCalledMethodsOnException(new Resource()); } static void exampleUseInNormalMethod2() throws IOException { // WRONG: the bad constructor does not close the argument on exception - // ::error: (required.method.not.called) + // ::error: [required.method.not.called] new OwningAndEnsuresCalledMethodsOnException(new Resource(), 0); } diff --git a/checker/tests/resourceleak/OwningEnsuresCalledMethods.java b/checker/tests/resourceleak/OwningEnsuresCalledMethods.java index fc213630995d..0e5bccd6b102 100644 --- a/checker/tests/resourceleak/OwningEnsuresCalledMethods.java +++ b/checker/tests/resourceleak/OwningEnsuresCalledMethods.java @@ -22,7 +22,7 @@ public class OwningEnsuresCalledMethods { @Owning Socket con; @EnsuresCalledMethods(value = "this.con", methods = "close") - // ::error: (contracts.postcondition) + // ::error: [contracts.postcondition] void dispose() { closeCon(con); } diff --git a/checker/tests/resourceleak/RLLambda.java b/checker/tests/resourceleak/RLLambda.java index 92409a677423..f2e8b14841e8 100644 --- a/checker/tests/resourceleak/RLLambda.java +++ b/checker/tests/resourceleak/RLLambda.java @@ -30,7 +30,7 @@ void innerfunc3() { f.a(); Function<@MustCall Foo, @CalledMethods("a") @MustCall Foo> innerfunc = st -> { - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] Foo fn1 = new Foo(); Foo fn2 = makeFoo(); fn2.a(); diff --git a/checker/tests/resourceleak/ReplicaInputStreams.java b/checker/tests/resourceleak/ReplicaInputStreams.java index fde88672bfe7..272f76c3b3e9 100644 --- a/checker/tests/resourceleak/ReplicaInputStreams.java +++ b/checker/tests/resourceleak/ReplicaInputStreams.java @@ -20,7 +20,7 @@ public ReplicaInputStreams(@Owning InputStream i1, @Owning InputStream i2) { @EnsuresCalledMethods( value = {"this.in1", "this.in2"}, methods = {"close"}) - // :: error: (contracts.exceptional.postcondition) + // :: error: [contracts.exceptional.postcondition] public void close() throws IOException { in1.close(); in2.close(); diff --git a/checker/tests/resourceleak/RequiresCalledMethodsTest.java b/checker/tests/resourceleak/RequiresCalledMethodsTest.java index 6558275f868f..90955bf0356d 100644 --- a/checker/tests/resourceleak/RequiresCalledMethodsTest.java +++ b/checker/tests/resourceleak/RequiresCalledMethodsTest.java @@ -25,19 +25,19 @@ void overwriteFooCorrect() { @CreatesMustCallFor("this") void overwriteFooWrong() { - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] this.foo = new Foo(); } @CreatesMustCallFor("this") void overwriteFooWithoutReleasing() { - // :: error: (contracts.precondition) + // :: error: [contracts.precondition] overwriteFooCorrect(); } void releaseThenOverwriteFoo() { releaseFoo(); - // :: error: (reset.not.owning) + // :: error: [reset.not.owning] overwriteFooCorrect(); } diff --git a/checker/tests/resourceleak/ReturnOwningObject.java b/checker/tests/resourceleak/ReturnOwningObject.java index e597899ca50f..e0f65bd01661 100644 --- a/checker/tests/resourceleak/ReturnOwningObject.java +++ b/checker/tests/resourceleak/ReturnOwningObject.java @@ -17,7 +17,7 @@ void a() {} } public static void useGetFoo() { - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] Object obj = getFoo(); } } diff --git a/checker/tests/resourceleak/SimpleSocketExample.java b/checker/tests/resourceleak/SimpleSocketExample.java index 2dd35698335e..7cbad7adcf88 100644 --- a/checker/tests/resourceleak/SimpleSocketExample.java +++ b/checker/tests/resourceleak/SimpleSocketExample.java @@ -6,7 +6,7 @@ class SimpleSocketExample { void basicTest(String address, int port) { try { - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] Socket socket2 = new Socket(address, port); Socket specialSocket = new Socket(address, port); specialSocket.close(); diff --git a/checker/tests/resourceleak/SneakyDrop.java b/checker/tests/resourceleak/SneakyDrop.java index 3ed6a3906b80..50556c0371b3 100644 --- a/checker/tests/resourceleak/SneakyDrop.java +++ b/checker/tests/resourceleak/SneakyDrop.java @@ -13,7 +13,7 @@ public static void sneakyDrop(@Owning T value) {} public static void main(String[] args) throws Exception { Resource x = new Resource(); - // :: error: (type.arguments.not.inferred) + // :: error: [type.arguments.not.inferred] sneakyDrop(x); } @@ -25,7 +25,7 @@ public static void main2(String[] args) throws Exception { sneakyDrop2(x); } - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] public static void sneakyDrop3(@Owning T value) {} public static void main3(String[] args) throws Exception { @@ -37,11 +37,11 @@ public static void sneakyDrop4(@Owning T value) {} public static void main4(String[] args) throws Exception { Resource x = new Resource(); - // :: error: (type.arguments.not.inferred) + // :: error: [type.arguments.not.inferred] sneakyDrop4(x); } - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] public static void sneakyDrop5(@Owning T value) {} public static void main5(String[] args) throws Exception { diff --git a/checker/tests/resourceleak/SocketContainer.java b/checker/tests/resourceleak/SocketContainer.java index 63ac7a214746..420d76ae8654 100644 --- a/checker/tests/resourceleak/SocketContainer.java +++ b/checker/tests/resourceleak/SocketContainer.java @@ -14,10 +14,10 @@ class SocketContainer { public SocketContainer(String host, int port) throws Exception { // It should be okay to assign to uninitialized owning fields in the constructor. // But it isn't! Why? - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] sock = new Socket(host, port); // It's definitely not okay to do it twice! - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] sock = new Socket(host, port); } diff --git a/checker/tests/resourceleak/SocketNullOverwrite.java b/checker/tests/resourceleak/SocketNullOverwrite.java index e1aa4b68d5ca..cd64ee51bab3 100644 --- a/checker/tests/resourceleak/SocketNullOverwrite.java +++ b/checker/tests/resourceleak/SocketNullOverwrite.java @@ -6,7 +6,7 @@ class SocketNullOverwrite { void replaceVarWithNull(String address, int port) { try { - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] Socket s = new Socket(address, port); s = null; } catch (IOException e) { diff --git a/checker/tests/resourceleak/StaticOwningField.java b/checker/tests/resourceleak/StaticOwningField.java index 101664cab72a..61cbb8fe7315 100644 --- a/checker/tests/resourceleak/StaticOwningField.java +++ b/checker/tests/resourceleak/StaticOwningField.java @@ -26,24 +26,24 @@ public void close() { // Static field - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] private static @Owning @MustCall("close") PrintStream ps_static; - // :: error: (missing.creates.mustcall.for) + // :: error: [missing.creates.mustcall.for] static void m_static() throws IOException { ps_static.close(); ps_static = new PrintStream("filename.txt"); } - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] private static @Owning @MustCall("close") PrintStream ps_static_initialized1 = newPrintStreamWithoutExceptions(); - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] private static @Owning @MustCall("close") PrintStream ps_static_initialized2; static { - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] ps_static_initialized2 = newPrintStreamWithoutExceptions(); } diff --git a/checker/tests/resourceleak/StaticOwningFieldOtherClass.java b/checker/tests/resourceleak/StaticOwningFieldOtherClass.java index d4ff42d3ad7f..89ca967a00b9 100644 --- a/checker/tests/resourceleak/StaticOwningFieldOtherClass.java +++ b/checker/tests/resourceleak/StaticOwningFieldOtherClass.java @@ -6,15 +6,15 @@ public class StaticOwningFieldOtherClass {} abstract class HasStaticOwningField { - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] public static @Owning FileWriter log = null; } class TestUtils { - // :: error: (missing.creates.mustcall.for) + // :: error: [missing.creates.mustcall.for] public static void setLog(String filename) { try { - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] HasStaticOwningField.log = new FileWriter(filename); } catch (IOException ioe) { throw new UncheckedIOException("Cannot write file " + filename, ioe); diff --git a/checker/tests/resourceleak/TernaryExpressions.java b/checker/tests/resourceleak/TernaryExpressions.java index 1caa69aec4bc..e2fd09efcf6b 100644 --- a/checker/tests/resourceleak/TernaryExpressions.java +++ b/checker/tests/resourceleak/TernaryExpressions.java @@ -28,10 +28,10 @@ void testTernaryAssigned(boolean b) { Foo ternary1 = b ? new Foo() : makeFoo(); ternary1.a(); - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] Foo ternary2 = b ? new Foo() : makeFoo(); - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] Foo x = new Foo(); Foo ternary3 = b ? new Foo() : x; ternary3.a(); @@ -42,14 +42,14 @@ void testTernaryAssigned(boolean b) { takeOwnership(b ? new Foo() : makeFoo()); - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] Foo x2 = new Foo(); takeOwnership(b ? x2 : null); int i = 10; Foo ternaryInLoop = null; while (i > 0) { - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] ternaryInLoop = b ? null : new Foo(); i--; } @@ -63,12 +63,12 @@ void testTernaryAssigned(boolean b) { * variable */ void testTernaryCastUnassigned(boolean b) { - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] if ((b ? new Foo() : null) != null) { b = !b; } - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] if ((b ? makeFoo() : null) != null) { b = !b; } @@ -79,7 +79,7 @@ void testTernaryCastUnassigned(boolean b) { } x.a(); - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] if (((Foo) new Foo()) != null) { b = !b; } @@ -100,7 +100,7 @@ Foo testTernaryReturnOk(boolean b) { @Owning Foo testTernaryReturnBad(boolean b) { - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] Foo x = new Foo(); return b ? x : makeFoo(); } @@ -112,7 +112,7 @@ static class Sub1 extends Object {} static class Sub2 extends Object {} static void testTernarySubtyping(boolean b) { - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] Object toStringAndClone = b ? new Sub1() : new Sub2(); // at this point, for soundness, we should be responsible for calling both toString and // clone on obj... diff --git a/checker/tests/resourceleak/TryWithResourcesMultiResources.java b/checker/tests/resourceleak/TryWithResourcesMultiResources.java index 33c45597acce..6998f9ddc236 100644 --- a/checker/tests/resourceleak/TryWithResourcesMultiResources.java +++ b/checker/tests/resourceleak/TryWithResourcesMultiResources.java @@ -23,7 +23,7 @@ public void close() throws IOException { // If "new OuterResource" throws an exception, then the socket won't be released. public void multiResourcesWrong(String address, int port) { - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] try (OuterResource outer = new OuterResource(new Socket(address, port))) { } catch (Exception e) { diff --git a/checker/tests/resourceleak/TryWithResourcesVariable.java b/checker/tests/resourceleak/TryWithResourcesVariable.java index f1e44cc1fd10..ac6f1fd4434e 100644 --- a/checker/tests/resourceleak/TryWithResourcesVariable.java +++ b/checker/tests/resourceleak/TryWithResourcesVariable.java @@ -32,7 +32,7 @@ static void test3(InetSocketAddress isa) { } } - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] static void test4(@Owning InputStream i1, @Owning InputStream i2) { try { try (i2) {} @@ -76,7 +76,7 @@ void disposer() { static void closeFinalFieldUnsupported() throws Exception { // This is a false positive (i.e., there is no resource leak), but our checker reports a // warning since it does not support this coding pattern. - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] FinalResourceField finalResourceField = new FinalResourceField(); try (finalResourceField.socketField) {} } @@ -95,7 +95,7 @@ void disposer() { static void closeWrapperUnsupported() throws Exception { // This is a false positive (i.e., there is no resource leak), but our checker reports a // warning since it does not support this coding pattern. - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] FinalResourceFieldWrapper finalResourceFieldWrapper = new FinalResourceFieldWrapper(); try (finalResourceFieldWrapper.frField.socketField) {} } diff --git a/checker/tests/resourceleak/TwoResourcesECM.java b/checker/tests/resourceleak/TwoResourcesECM.java index f325ce7cedf0..dfa42c4ab9a1 100644 --- a/checker/tests/resourceleak/TwoResourcesECM.java +++ b/checker/tests/resourceleak/TwoResourcesECM.java @@ -24,8 +24,8 @@ class TwoResourcesECM { @EnsuresCalledMethods( value = {"this.s1", "this.s2"}, methods = {"close"}) - // :: error: (contracts.postcondition) - // :: error: (contracts.exceptional.postcondition) + // :: error: [contracts.postcondition] + // :: error: [contracts.exceptional.postcondition] public void dispose() throws IOException { s1.close(); s2.close(); diff --git a/checker/tests/resourceleak/UnconnectedSocketAlias.java b/checker/tests/resourceleak/UnconnectedSocketAlias.java index af6b8531062a..60fa1b4038fa 100644 --- a/checker/tests/resourceleak/UnconnectedSocketAlias.java +++ b/checker/tests/resourceleak/UnconnectedSocketAlias.java @@ -5,7 +5,7 @@ class UnconnectedSocketAlias { void test(SocketAddress sa) throws Exception { - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] Socket s = new Socket(); Socket t = s; t.close(); diff --git a/checker/tests/resourceleak/WrapperStreamPoly.java b/checker/tests/resourceleak/WrapperStreamPoly.java index dd3a90cc7367..a01c9c67e4aa 100644 --- a/checker/tests/resourceleak/WrapperStreamPoly.java +++ b/checker/tests/resourceleak/WrapperStreamPoly.java @@ -11,7 +11,7 @@ void test_no_close_needed(@Owning ByteArrayInputStream b) { DataInputStream d = new DataInputStream(b); } - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] void test_close_needed(@Owning InputStream b) { DataInputStream d = new DataInputStream(b); } diff --git a/checker/tests/resourceleak/ZookeeperByteBufferInputStream.java b/checker/tests/resourceleak/ZookeeperByteBufferInputStream.java index 852a239d4084..379ba7bcc78a 100644 --- a/checker/tests/resourceleak/ZookeeperByteBufferInputStream.java +++ b/checker/tests/resourceleak/ZookeeperByteBufferInputStream.java @@ -10,12 +10,12 @@ import org.checkerframework.checker.mustcall.qual.MustCall; @MustCall({}) -// :: error: (inconsistent.mustcall.subtype) +// :: error: [inconsistent.mustcall.subtype] public class ZookeeperByteBufferInputStream extends InputStream { ByteBuffer bb; - // :: error: (super.invocation) + // :: error: [super.invocation] public ZookeeperByteBufferInputStream(ByteBuffer bb) { this.bb = bb; } diff --git a/checker/tests/resourceleak/ZookeeperReport1.java b/checker/tests/resourceleak/ZookeeperReport1.java index 52b0067f919e..f916c2e047c4 100644 --- a/checker/tests/resourceleak/ZookeeperReport1.java +++ b/checker/tests/resourceleak/ZookeeperReport1.java @@ -44,7 +44,7 @@ static void use1() throws IOException { } static void use2(SocketAddress endpoint) throws IOException { - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] Socket s = createSocket(); s.connect(endpoint); } @@ -54,7 +54,7 @@ static void use3() throws IOException { } static void use4(SocketAddress endpoint) throws IOException { - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] Socket s = createSocket2(); s.connect(endpoint); } @@ -64,7 +64,7 @@ static void use5(boolean b) throws IOException { } static void use6(SocketAddress endpoint, boolean b) throws IOException { - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] Socket s = createSocket3(b); s.connect(endpoint); } diff --git a/checker/tests/resourceleak/ZookeeperReport1a.java b/checker/tests/resourceleak/ZookeeperReport1a.java index 83524b6365c9..9de63c8bd53b 100644 --- a/checker/tests/resourceleak/ZookeeperReport1a.java +++ b/checker/tests/resourceleak/ZookeeperReport1a.java @@ -45,7 +45,7 @@ static void use1() throws IOException { } static void use2(SocketAddress endpoint) throws IOException { - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] Socket s = createSocket(); s.connect(endpoint); } @@ -55,7 +55,7 @@ static void use3() throws IOException { } static void use4(SocketAddress endpoint) throws IOException { - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] Socket s = createSocket2(); s.connect(endpoint); } @@ -65,7 +65,7 @@ static void use5(boolean b) throws IOException { } static void use6(SocketAddress endpoint, boolean b) throws IOException { - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] Socket s = createSocket3(b); s.connect(endpoint); } diff --git a/checker/tests/resourceleak/java17/SwitchExpressions.java b/checker/tests/resourceleak/java17/SwitchExpressions.java index f44671e2c761..eae5bba9c186 100644 --- a/checker/tests/resourceleak/java17/SwitchExpressions.java +++ b/checker/tests/resourceleak/java17/SwitchExpressions.java @@ -33,14 +33,14 @@ void testSwitchAssigned(int i) { }; switch1.a(); - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] Foo switch2 = switch (i) { case 3 -> new Foo(); default -> makeFoo(); }; - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] Foo x = new Foo(); Foo switch3 = switch (i) { @@ -63,7 +63,7 @@ void testSwitchAssigned(int i) { default -> makeFoo(); }); - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] Foo x2 = new Foo(); takeOwnership( switch (i) { @@ -74,7 +74,7 @@ void testSwitchAssigned(int i) { int j = 10; Foo switchInLoop = null; while (j > 0) { - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] switchInLoop = switch (i) { case 3 -> null; @@ -96,7 +96,7 @@ void testSwitchAssigned(int i) { * variable */ void testSwitchCastUnassigned(int i) { - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] if ((switch (i) { case 3 -> new Foo(); default -> null; @@ -105,7 +105,7 @@ void testSwitchCastUnassigned(int i) { i = -i; } - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] if (switch (i) { case 3 -> makeFoo(); default -> null; @@ -124,7 +124,7 @@ void testSwitchCastUnassigned(int i) { } x.a(); - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] if (((Foo) new Foo()) != null) { i = -i; } @@ -156,7 +156,7 @@ Foo testSwitchReturnOk(int i) { @Owning Foo testSwitchReturnBad(int i) { - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] Foo x = new Foo(); return switch (i) { case 3 -> x; @@ -171,7 +171,7 @@ static class Sub1 extends Object {} static class Sub2 extends Object {} static void testSwitchSubtyping(int i) { - // :: error: (required.method.not.called) + // :: error: [required.method.not.called] Object toStringAndClone = switch (i) { case 3 -> new Sub1(); diff --git a/checker/tests/signature/CanonicalNameNonEmptyTest.java b/checker/tests/signature/CanonicalNameNonEmptyTest.java index 91720c6c442c..3a751eaff77b 100644 --- a/checker/tests/signature/CanonicalNameNonEmptyTest.java +++ b/checker/tests/signature/CanonicalNameNonEmptyTest.java @@ -22,7 +22,7 @@ public class CanonicalNameNonEmptyTest { if (s.isEmpty()) { return null; } else { - // :: error: (return) + // :: error: [return] return s; } } diff --git a/checker/tests/signature/ClassGetNameBinaryName.java b/checker/tests/signature/ClassGetNameBinaryName.java index 6b562f675ae5..06a09b001b69 100644 --- a/checker/tests/signature/ClassGetNameBinaryName.java +++ b/checker/tests/signature/ClassGetNameBinaryName.java @@ -18,48 +18,48 @@ class TestGetName { @DotSeparatedIdentifiers String s4a = Boolean.class.getName(); - // :: error: (assignment) + // :: error: [assignment] @PrimitiveType String s4b = Boolean.class.getName(); - // :: error: (assignment) + // :: error: [assignment] @DotSeparatedIdentifiers String s12 = Nested.class.getName(); - // :: error: (assignment) + // :: error: [assignment] @DotSeparatedIdentifiers String s13 = Inner.class.getName(); // Primitive types @PrimitiveType String prim1 = int.class.getName(); - // :: error: (assignment) + // :: error: [assignment] @DotSeparatedIdentifiers String prim2 = int.class.getName(); @PrimitiveType String prim3 = boolean.class.getName(); - // :: error: (assignment) + // :: error: [assignment] @DotSeparatedIdentifiers String prim4 = boolean.class.getName(); - // :: error: (assignment) + // :: error: [assignment] @DotSeparatedIdentifiers String prim5 = void.class.getName(); - // :: error: (assignment) + // :: error: [assignment] @PrimitiveType String prim6 = void.class.getName(); // Arrays - // :: error: (assignment) + // :: error: [assignment] @DotSeparatedIdentifiers String s6 = int[].class.getName(); - // :: error: (assignment) + // :: error: [assignment] @DotSeparatedIdentifiers String s7 = int[][].class.getName(); - // :: error: (assignment) + // :: error: [assignment] @DotSeparatedIdentifiers String s8 = boolean[].class.getName(); - // :: error: (assignment) + // :: error: [assignment] @DotSeparatedIdentifiers String s9 = Integer[].class.getName(); - // :: error: (assignment) + // :: error: [assignment] @DotSeparatedIdentifiers String s10 = Boolean[].class.getName(); } @@ -73,48 +73,48 @@ class TestGetCanonicalName { @CanonicalNameAndBinaryName String s4a = Boolean.class.getCanonicalName(); - // :: error: (assignment) + // :: error: [assignment] @PrimitiveType String s4b = Boolean.class.getCanonicalName(); - // :: error: (assignment) + // :: error: [assignment] @CanonicalNameAndBinaryName String s12 = Nested.class.getCanonicalName(); - // :: error: (assignment) + // :: error: [assignment] @CanonicalNameAndBinaryName String s13 = Inner.class.getName(); // Primitive types @PrimitiveType String prim1 = int.class.getCanonicalName(); - // :: error: (assignment) + // :: error: [assignment] @CanonicalNameAndBinaryName String prim2 = int.class.getCanonicalName(); @PrimitiveType String prim3 = boolean.class.getCanonicalName(); - // :: error: (assignment) + // :: error: [assignment] @CanonicalNameAndBinaryName String prim4 = boolean.class.getCanonicalName(); - // :: error: (assignment) + // :: error: [assignment] @CanonicalNameAndBinaryName String prim5 = void.class.getCanonicalName(); - // :: error: (assignment) + // :: error: [assignment] @PrimitiveType String prim6 = void.class.getCanonicalName(); // Arrays - // :: error: (assignment) + // :: error: [assignment] @CanonicalNameAndBinaryName String s6 = int[].class.getCanonicalName(); - // :: error: (assignment) + // :: error: [assignment] @CanonicalNameAndBinaryName String s7 = int[][].class.getCanonicalName(); - // :: error: (assignment) + // :: error: [assignment] @CanonicalNameAndBinaryName String s8 = boolean[].class.getCanonicalName(); - // :: error: (assignment) + // :: error: [assignment] @CanonicalNameAndBinaryName String s9 = Integer[].class.getCanonicalName(); - // :: error: (assignment) + // :: error: [assignment] @CanonicalNameAndBinaryName String s10 = Boolean[].class.getCanonicalName(); } } diff --git a/checker/tests/signature/Conversion.java b/checker/tests/signature/Conversion.java index 4dfceda24231..5fa98ce42f22 100644 --- a/checker/tests/signature/Conversion.java +++ b/checker/tests/signature/Conversion.java @@ -12,42 +12,42 @@ class CharChar { } @InternalForm String binaryNameToInternalFormWRONG1(@BinaryName String bn) { - // :: error: (return) + // :: error: [return] return bn.replace('/', '.'); } @InternalForm String binaryNameToInternalFormWRONG2(@BinaryName String bn) { - // :: error: (return) + // :: error: [return] return bn.replace(':', '/'); } @InternalForm String binaryNameToInternalFormWRONG3(String bn) { - // :: error: (return) + // :: error: [return] return bn.replace('.', '/'); } @BinaryName String internalFormToBinaryNameWRONG1(@InternalForm String iform) { - // :: error: (return) + // :: error: [return] return iform.replace('.', '/'); } @BinaryName String internalFormToBinaryNameWRONG2(@InternalForm String iform) { - // :: error: (return) + // :: error: [return] return iform.replace('/', ':'); } @BinaryName String internalFormToBinaryNameWRONG3(String iform) { - // :: error: (return) + // :: error: [return] return iform.replace('/', '.'); } @DotSeparatedIdentifiers String binaryNameToDotSeparatedIdentifiers(@BinaryName String bn) { - // :: error: (return) + // :: error: [return] return bn.replace('$', '.'); } @FullyQualifiedName String binaryNameToFullyQualifiedName(@BinaryName String bn) { - // :: error: (return) + // :: error: [return] return bn.replace('$', '.'); } } @@ -62,42 +62,42 @@ class CharSequenceCharSequence { } @InternalForm String binaryNameToInternalFormWRONG1(@BinaryName String bn) { - // :: error: (return) + // :: error: [return] return bn.replace("/", "."); } @InternalForm String binaryNameToInternalFormWRONG2(@BinaryName String bn) { - // :: error: (return) + // :: error: [return] return bn.replace(":", "/"); } @InternalForm String binaryNameToInternalFormWRONG3(String bn) { - // :: error: (return) + // :: error: [return] return bn.replace(".", "/"); } @BinaryName String internalFormToBinaryNameWRONG1(@InternalForm String iform) { - // :: error: (return) + // :: error: [return] return iform.replace(".", "/"); } @BinaryName String internalFormToBinaryNameWRONG2(@InternalForm String iform) { - // :: error: (return) + // :: error: [return] return iform.replace("/", ":"); } @BinaryName String internalFormToBinaryNameWRONG3(String iform) { - // :: error: (return) + // :: error: [return] return iform.replace("/", "."); } @DotSeparatedIdentifiers String binaryNameToDotSeparatedIdentifiers(@BinaryName String bn) { - // :: error: (return) + // :: error: [return] return bn.replace("$", "."); } @FullyQualifiedName String binaryNameToFullyQualifiedName(@BinaryName String bn) { - // :: error: (return) + // :: error: [return] return bn.replace("$", "."); } } diff --git a/checker/tests/signature/PolySignatureTest2.java b/checker/tests/signature/PolySignatureTest2.java index 7c69beb1ed18..b1e2bec940bc 100644 --- a/checker/tests/signature/PolySignatureTest2.java +++ b/checker/tests/signature/PolySignatureTest2.java @@ -12,7 +12,7 @@ public class PolySignatureTest2 { } @DotSeparatedIdentifiers String m2(@DotSeparatedIdentifiers Name n) { - // :: error: (return) + // :: error: [return] return n.toString(); } } diff --git a/checker/tests/signature/SignatureConcatenation.java b/checker/tests/signature/SignatureConcatenation.java index c9bef1bb6a3f..9b4853c1a005 100644 --- a/checker/tests/signature/SignatureConcatenation.java +++ b/checker/tests/signature/SignatureConcatenation.java @@ -3,7 +3,7 @@ public class SignatureConcatenation { @ClassGetSimpleName String m(@ClassGetSimpleName String arg1, @ClassGetSimpleName String arg2) { - // :: error: (return) + // :: error: [return] return arg1 + arg2; } } diff --git a/checker/tests/signature/SignatureTypeFactoryTest.java b/checker/tests/signature/SignatureTypeFactoryTest.java index 3ecd87c87fab..76aa14ee2cc5 100644 --- a/checker/tests/signature/SignatureTypeFactoryTest.java +++ b/checker/tests/signature/SignatureTypeFactoryTest.java @@ -110,7 +110,7 @@ void m() { us = s1; fqn = s1; cgn = s1; - // :: error: (assignment) + // :: error: [assignment] fd = s1; iform = s1; sn = s1; @@ -121,29 +121,29 @@ void m() { us = s2; fqn = s2; cgn = s2; - // :: error: (assignment) + // :: error: [assignment] fd = s2; - // :: error: (assignment) + // :: error: [assignment] iform = s2; - // :: error: (assignment) + // :: error: [assignment] sn = s2; bn = s2; fbn = s2; - // :: error: (assignment) + // :: error: [assignment] i = s2; us = s3; fqn = s3; cgn = s3; - // :: error: (assignment) + // :: error: [assignment] fd = s3; - // :: error: (assignment) + // :: error: [assignment] iform = s3; - // :: error: (assignment) + // :: error: [assignment] sn = s3; bn = s3; fbn = s3; - // :: error: (assignment) + // :: error: [assignment] i = s3; us = s4; @@ -157,91 +157,91 @@ void m() { i = s4; us = s5; - // :: error: (assignment) + // :: error: [assignment] fqn = s5; cgn = s5; fd = s5; - // :: error: (assignment) + // :: error: [assignment] iform = s5; - // :: error: (assignment) + // :: error: [assignment] sn = s5; - // :: error: (assignment) + // :: error: [assignment] bn = s5; - // :: error: (assignment) + // :: error: [assignment] fbn = s5; - // :: error: (assignment) + // :: error: [assignment] i = s5; us = s6; - // :: error: (assignment) + // :: error: [assignment] fqn = s6; - // :: error: (assignment) + // :: error: [assignment] cgn = s6; fd = s6; - // :: error: (assignment) + // :: error: [assignment] iform = s6; - // :: error: (assignment) + // :: error: [assignment] sn = s6; - // :: error: (assignment) + // :: error: [assignment] bn = s6; - // :: error: (assignment) + // :: error: [assignment] fbn = s6; - // :: error: (assignment) + // :: error: [assignment] i = s6; us = s7; - // :: error: (assignment) + // :: error: [assignment] fqn = s7; - // :: error: (assignment) + // :: error: [assignment] cgn = s7; - // :: error: (assignment) + // :: error: [assignment] fd = s7; iform = s7; - // :: error: (assignment) + // :: error: [assignment] sn = s7; - // :: error: (assignment) + // :: error: [assignment] bn = s7; - // :: error: (assignment) + // :: error: [assignment] fbn = s7; - // :: error: (assignment) + // :: error: [assignment] i = s7; us = s8; - // :: error: (assignment) + // :: error: [assignment] fqn = s8; - // :: error: (assignment) + // :: error: [assignment] cgn = s8; - // :: error: (assignment) + // :: error: [assignment] fd = s8; - // :: error: (assignment) + // :: error: [assignment] iform = s8; - // :: error: (assignment) + // :: error: [assignment] sn = s8; - // :: error: (assignment) + // :: error: [assignment] bn = s8; - // :: error: (assignment) + // :: error: [assignment] fbn = s8; - // :: error: (assignment) + // :: error: [assignment] i = s8; us = s9; fqn = s9; cgn = s9; - // :: error: (assignment) + // :: error: [assignment] fd = s9; - // :: error: (assignment) + // :: error: [assignment] iform = s9; - // :: error: (assignment) + // :: error: [assignment] sn = s9; bn = s9; fbn = s9; - // :: error: (assignment) + // :: error: [assignment] i = s9; us = s10; fqn = s10; cgn = s10; - // :: error: (assignment) + // :: error: [assignment] fd = s10; iform = s10; sn = s10; @@ -261,188 +261,188 @@ void m() { us = s12; fqn = s12; - // :: error: (assignment) + // :: error: [assignment] cgn = s12; - // :: error: (assignment) + // :: error: [assignment] fd = s12; - // :: error: (assignment) + // :: error: [assignment] iform = s12; - // :: error: (assignment) + // :: error: [assignment] sn = s12; - // :: error: (assignment) + // :: error: [assignment] bn = s12; fbn = s12; - // :: error: (assignment) + // :: error: [assignment] i = s12; us = s13; fqn = s13; - // :: error: (assignment) + // :: error: [assignment] cgn = s13; - // :: error: (assignment) + // :: error: [assignment] fd = s13; - // :: error: (assignment) + // :: error: [assignment] iform = s13; - // :: error: (assignment) + // :: error: [assignment] sn = s13; - // :: error: (assignment) + // :: error: [assignment] bn = s13; fbn = s13; - // :: error: (assignment) + // :: error: [assignment] i = s13; us = s14; - // :: error: (assignment) + // :: error: [assignment] fqn = s14; - // :: error: (assignment) + // :: error: [assignment] cgn = s14; fd = s14; - // :: error: (assignment) + // :: error: [assignment] iform = s14; - // :: error: (assignment) + // :: error: [assignment] sn = s14; - // :: error: (assignment) + // :: error: [assignment] bn = s14; - // :: error: (assignment) + // :: error: [assignment] fbn = s14; - // :: error: (assignment) + // :: error: [assignment] i = s14; us = s15; - // :: error: (assignment) + // :: error: [assignment] fqn = s15; - // :: error: (assignment) + // :: error: [assignment] cgn = s15; - // :: error: (assignment) + // :: error: [assignment] fd = s15; - // :: error: (assignment) + // :: error: [assignment] iform = s15; sn = s15; - // :: error: (assignment) + // :: error: [assignment] bn = s15; - // :: error: (assignment) + // :: error: [assignment] fbn = s15; - // :: error: (assignment) + // :: error: [assignment] i = s15; us = s16; - // :: error: (assignment) + // :: error: [assignment] fqn = s16; - // :: error: (assignment) + // :: error: [assignment] cgn = s16; - // :: error: (assignment) + // :: error: [assignment] fd = s16; - // :: error: (assignment) + // :: error: [assignment] iform = s16; sn = s16; - // :: error: (assignment) + // :: error: [assignment] bn = s16; - // :: error: (assignment) + // :: error: [assignment] fbn = s16; - // :: error: (assignment) + // :: error: [assignment] i = s16; us = s17; - // :: error: (assignment) + // :: error: [assignment] fqn = s17; - // :: error: (assignment) + // :: error: [assignment] cgn = s17; - // :: error: (assignment) + // :: error: [assignment] fd = s17; - // :: error: (assignment) + // :: error: [assignment] iform = s17; sn = s17; - // :: error: (assignment) + // :: error: [assignment] bn = s17; - // :: error: (assignment) + // :: error: [assignment] fbn = s17; - // :: error: (assignment) + // :: error: [assignment] i = s17; us = s18; - // :: error: (assignment) + // :: error: [assignment] fqn = s18; - // :: error: (assignment) + // :: error: [assignment] cgn = s18; - // :: error: (assignment) + // :: error: [assignment] fd = s18; - // :: error: (assignment) + // :: error: [assignment] iform = s18; - // :: error: (assignment) + // :: error: [assignment] sn = s18; - // :: error: (assignment) + // :: error: [assignment] bn = s18; - // :: error: (assignment) + // :: error: [assignment] fbn = s18; - // :: error: (assignment) + // :: error: [assignment] i = s18; us = s19; - // :: error: (assignment) + // :: error: [assignment] fqn = s19; - // :: error: (assignment) + // :: error: [assignment] cgn = s19; - // :: error: (assignment) + // :: error: [assignment] fd = s19; - // :: error: (assignment) + // :: error: [assignment] iform = s19; - // :: error: (assignment) + // :: error: [assignment] sn = s19; - // :: error: (assignment) + // :: error: [assignment] bn = s19; - // :: error: (assignment) + // :: error: [assignment] fbn = s19; - // :: error: (assignment) + // :: error: [assignment] i = s19; us = s20; fqn = s20; cgn = s20; - // :: error: (assignment) + // :: error: [assignment] fd = s20; - // :: error: (assignment) + // :: error: [assignment] iform = s20; sn = s20; - // :: error: (assignment) + // :: error: [assignment] bn = s20; fbn = s20; - // :: error: (assignment) + // :: error: [assignment] i = s20; us = s21; - // :: error: (assignment) + // :: error: [assignment] fqn = s21; - // :: error: (assignment) + // :: error: [assignment] cgn = s21; - // :: error: (assignment) + // :: error: [assignment] fd = s21; - // :: error: (assignment) + // :: error: [assignment] iform = s21; - // :: error: (assignment) + // :: error: [assignment] sn = s21; - // :: error: (assignment) + // :: error: [assignment] bn = s21; - // :: error: (assignment) + // :: error: [assignment] fbn = s21; - // :: error: (assignment) + // :: error: [assignment] i = s21; us = s22; - // :: error: (assignment) + // :: error: [assignment] fqn = s22; - // :: error: (assignment) + // :: error: [assignment] cgn = s22; - // :: error: (assignment) + // :: error: [assignment] fd = s22; - // :: error: (assignment) + // :: error: [assignment] iform = s22; - // :: error: (assignment) + // :: error: [assignment] sn = s22; - // :: error: (assignment) + // :: error: [assignment] bn = s22; - // :: error: (assignment) + // :: error: [assignment] fbn = s22; - // :: error: (assignment) + // :: error: [assignment] i = s22; // Examples from the manual start here @@ -450,27 +450,27 @@ void m() { us = t13; fqn = t13; cgn = t13; - // :: error: (assignment) + // :: error: [assignment] fd = t13; - // :: error: (assignment) + // :: error: [assignment] iform = t13; sn = t13; - // :: error: (assignment) + // :: error: [assignment] bn = t13; fbn = t13; - // :: error: (assignment) + // :: error: [assignment] i = t13; us = t14; fqn = t14; - // :: error: (assignment) + // :: error: [assignment] cgn = t14; - // :: error: (assignment) + // :: error: [assignment] fd = t14; - // :: error: (assignment) + // :: error: [assignment] iform = t14; sn = t14; - // :: error: (assignment) + // :: error: [assignment] bn = t14; // t14 is int[][] us = t1; @@ -484,25 +484,25 @@ void m() { i = t1; us = t12; - // :: error: (assignment) + // :: error: [assignment] fqn = t12; cgn = t12; fd = t12; - // :: error: (assignment) + // :: error: [assignment] iform = t12; - // :: error: (assignment) + // :: error: [assignment] sn = t12; - // :: error: (assignment) + // :: error: [assignment] bn = t12; - // :: error: (assignment) + // :: error: [assignment] fbn = t12; - // :: error: (assignment) + // :: error: [assignment] i = t12; us = t5; fqn = t5; cgn = t5; - // :: error: (assignment) + // :: error: [assignment] fd = t5; iform = t5; sn = t5; @@ -511,466 +511,466 @@ void m() { i = t5; us = t2; - // :: error: (assignment) + // :: error: [assignment] fqn = t2; - // :: error: (assignment) + // :: error: [assignment] cgn = t2; fd = t2; - // :: error: (assignment) + // :: error: [assignment] iform = t2; - // :: error: (assignment) + // :: error: [assignment] sn = t2; - // :: error: (assignment) + // :: error: [assignment] bn = t2; - // :: error: (assignment) + // :: error: [assignment] fbn = t2; - // :: error: (assignment) + // :: error: [assignment] i = t2; us = t6; fqn = t6; - // :: error: (assignment) + // :: error: [assignment] cgn = t6; - // :: error: (assignment) + // :: error: [assignment] fd = t6; - // :: error: (assignment) + // :: error: [assignment] iform = t6; sn = t6; - // :: error: (assignment) + // :: error: [assignment] bn = t6; fbn = t6; - // :: error: (assignment) + // :: error: [assignment] i = t6; us = t7; - // :: error: (assignment) + // :: error: [assignment] fqn = t7; cgn = t7; fd = t7; - // :: error: (assignment) + // :: error: [assignment] iform = t7; - // :: error: (assignment) + // :: error: [assignment] sn = t7; - // :: error: (assignment) + // :: error: [assignment] bn = t7; - // :: error: (assignment) + // :: error: [assignment] fbn = t7; - // :: error: (assignment) + // :: error: [assignment] i = t7; us = t29; - // :: error: (assignment) + // :: error: [assignment] fqn = t29; - // :: error: (assignment) + // :: error: [assignment] cgn = t29; - // :: error: (assignment) + // :: error: [assignment] fd = t29; - // :: error: (assignment) + // :: error: [assignment] iform = t29; sn = t29; - // :: error: (assignment) + // :: error: [assignment] bn = t29; - // :: error: (assignment) + // :: error: [assignment] fbn = t29; - // :: error: (assignment) + // :: error: [assignment] i = t29; us = t33; - // :: error: (assignment) + // :: error: [assignment] fqn = t33; - // :: error: (assignment) + // :: error: [assignment] cgn = t33; - // :: error: (assignment) + // :: error: [assignment] fd = t33; - // :: error: (assignment) + // :: error: [assignment] iform = t33; sn = t33; - // :: error: (assignment) + // :: error: [assignment] bn = t33; - // :: error: (assignment) + // :: error: [assignment] fbn = t33; - // :: error: (assignment) + // :: error: [assignment] i = t33; us = t15; fqn = t15; cgn = t15; - // :: error: (assignment) + // :: error: [assignment] fd = t15; - // :: error: (assignment) + // :: error: [assignment] iform = t15; - // :: error: (assignment) + // :: error: [assignment] sn = t15; bn = t15; fbn = t15; - // :: error: (assignment) + // :: error: [assignment] i = t15; us = t16; fqn = t16; - // :: error: (assignment) + // :: error: [assignment] cgn = t16; - // :: error: (assignment) + // :: error: [assignment] fd = t16; - // :: error: (assignment) + // :: error: [assignment] iform = t16; - // :: error: (assignment) + // :: error: [assignment] sn = t16; - // :: error: (assignment) + // :: error: [assignment] bn = t16; // t16 is java.lang.Integer[] us = t22; - // :: error: (assignment) + // :: error: [assignment] fqn = t22; - // :: error: (assignment) + // :: error: [assignment] cgn = t22; - // :: error: (assignment) + // :: error: [assignment] fd = t22; iform = t22; - // :: error: (assignment) + // :: error: [assignment] sn = t22; - // :: error: (assignment) + // :: error: [assignment] bn = t22; - // :: error: (assignment) + // :: error: [assignment] fbn = t22; - // :: error: (assignment) + // :: error: [assignment] i = t22; us = t23; - // :: error: (assignment) + // :: error: [assignment] fqn = t23; - // :: error: (assignment) + // :: error: [assignment] cgn = t23; - // :: error: (assignment) + // :: error: [assignment] fd = t23; - // :: error: (assignment) + // :: error: [assignment] iform = t23; // t23 is java/lang/Integer[] - // :: error: (assignment) + // :: error: [assignment] sn = t23; - // :: error: (assignment) + // :: error: [assignment] bn = t23; - // :: error: (assignment) + // :: error: [assignment] fbn = t23; - // :: error: (assignment) + // :: error: [assignment] i = t23; us = t3; - // :: error: (assignment) + // :: error: [assignment] fqn = t3; - // :: error: (assignment) + // :: error: [assignment] cgn = t3; fd = t3; - // :: error: (assignment) + // :: error: [assignment] iform = t3; - // :: error: (assignment) + // :: error: [assignment] sn = t3; - // :: error: (assignment) + // :: error: [assignment] bn = t3; - // :: error: (assignment) + // :: error: [assignment] fbn = t3; - // :: error: (assignment) + // :: error: [assignment] i = t3; us = t8; - // :: error: (assignment) + // :: error: [assignment] fqn = t8; cgn = t8; - // :: error: (assignment) + // :: error: [assignment] fd = t8; - // :: error: (assignment) + // :: error: [assignment] iform = t8; - // :: error: (assignment) + // :: error: [assignment] sn = t8; - // :: error: (assignment) + // :: error: [assignment] bn = t8; - // :: error: (assignment) + // :: error: [assignment] fbn = t8; - // :: error: (assignment) + // :: error: [assignment] i = t8; us = t9; - // :: error: (assignment) + // :: error: [assignment] fqn = t9; - // :: error: (assignment) + // :: error: [assignment] cgn = t9; fd = t9; - // :: error: (assignment) + // :: error: [assignment] iform = t9; - // :: error: (assignment) + // :: error: [assignment] sn = t9; - // :: error: (assignment) + // :: error: [assignment] bn = t9; - // :: error: (assignment) + // :: error: [assignment] fbn = t9; - // :: error: (assignment) + // :: error: [assignment] i = t9; us = t24; - // :: error: (assignment) + // :: error: [assignment] fqn = t24; - // :: error: (assignment) + // :: error: [assignment] cgn = t24; - // :: error: (assignment) + // :: error: [assignment] fd = t24; iform = t24; - // :: error: (assignment) + // :: error: [assignment] sn = t24; - // :: error: (assignment) + // :: error: [assignment] bn = t24; - // :: error: (assignment) + // :: error: [assignment] fbn = t24; - // :: error: (assignment) + // :: error: [assignment] i = t24; us = t25; - // :: error: (assignment) + // :: error: [assignment] fqn = t25; - // :: error: (assignment) + // :: error: [assignment] cgn = t25; - // :: error: (assignment) + // :: error: [assignment] fd = t25; - // :: error: (assignment) + // :: error: [assignment] iform = t25; // rhs is pakkage/Outer$Inner[] - // :: error: (assignment) + // :: error: [assignment] sn = t25; - // :: error: (assignment) + // :: error: [assignment] bn = t25; - // :: error: (assignment) + // :: error: [assignment] fbn = t25; - // :: error: (assignment) + // :: error: [assignment] i = t25; us = t28; - // :: error: (assignment) + // :: error: [assignment] fqn = t28; - // :: error: (assignment) + // :: error: [assignment] cgn = t28; - // :: error: (assignment) + // :: error: [assignment] fd = t28; iform = t28; - // :: error: (assignment) + // :: error: [assignment] sn = t28; - // :: error: (assignment) + // :: error: [assignment] bn = t28; - // :: error: (assignment) + // :: error: [assignment] fbn = t28; - // :: error: (assignment) + // :: error: [assignment] i = t28; us = t27; - // :: error: (assignment) + // :: error: [assignment] fqn = t27; - // :: error: (assignment) + // :: error: [assignment] cgn = t27; fd = t27; - // :: error: (assignment) + // :: error: [assignment] iform = t27; - // :: error: (assignment) + // :: error: [assignment] sn = t27; - // :: error: (assignment) + // :: error: [assignment] bn = t27; - // :: error: (assignment) + // :: error: [assignment] fbn = t27; - // :: error: (assignment) + // :: error: [assignment] i = t27; us = t26; fqn = t26; cgn = t26; - // :: error: (assignment) + // :: error: [assignment] fd = t26; - // :: error: (assignment) + // :: error: [assignment] iform = t26; - // :: error: (assignment) + // :: error: [assignment] sn = t26; bn = t26; fbn = t26; - // :: error: (assignment) + // :: error: [assignment] i = t26; us = t32; - // :: error: (assignment) + // :: error: [assignment] fqn = t32; - // :: error: (assignment) + // :: error: [assignment] cgn = t32; - // :: error: (assignment) + // :: error: [assignment] fd = t32; - // :: error: (assignment) + // :: error: [assignment] iform = t32; // t32 is array - // :: error: (assignment) + // :: error: [assignment] sn = t32; - // :: error: (assignment) + // :: error: [assignment] bn = t32; - // :: error: (assignment) + // :: error: [assignment] fbn = t32; - // :: error: (assignment) + // :: error: [assignment] i = t32; us = t30; fqn = t30; - // :: error: (assignment) + // :: error: [assignment] cgn = t30; - // :: error: (assignment) + // :: error: [assignment] fd = t30; - // :: error: (assignment) + // :: error: [assignment] iform = t30; - // :: error: (assignment) + // :: error: [assignment] sn = t30; - // :: error: (assignment) + // :: error: [assignment] bn = t30; // rhs is array us = t31; - // :: error: (assignment) + // :: error: [assignment] fqn = t31; cgn = t31; - // :: error: (assignment) + // :: error: [assignment] fd = t31; - // :: error: (assignment) + // :: error: [assignment] iform = t31; - // :: error: (assignment) + // :: error: [assignment] sn = t31; - // :: error: (assignment) + // :: error: [assignment] bn = t31; - // :: error: (assignment) + // :: error: [assignment] fbn = t31; - // :: error: (assignment) + // :: error: [assignment] i = t31; us = t34; fqn = t34; cgn = t34; - // :: error: (assignment) + // :: error: [assignment] fd = t34; - // :: error: (assignment) + // :: error: [assignment] iform = t34; - // :: error: (assignment) + // :: error: [assignment] sn = t34; bn = t34; fbn = t34; - // :: error: (assignment) + // :: error: [assignment] i = t34; us = t17; fqn = t17; cgn = t17; - // :: error: (assignment) + // :: error: [assignment] fd = t17; - // :: error: (assignment) + // :: error: [assignment] iform = t17; - // :: error: (assignment) + // :: error: [assignment] sn = t17; bn = t17; fbn = t17; - // :: error: (assignment) + // :: error: [assignment] i = t17; us = t18; fqn = t18; - // :: error: (assignment) + // :: error: [assignment] cgn = t18; - // :: error: (assignment) + // :: error: [assignment] fd = t18; - // :: error: (assignment) + // :: error: [assignment] iform = t18; - // :: error: (assignment) + // :: error: [assignment] sn = t18; - // :: error: (assignment) + // :: error: [assignment] bn = t18; // t18 is pakkage.Outer.Inner[] us = t19; fqn = t19; cgn = t19; - // :: error: (assignment) + // :: error: [assignment] fd = t19; - // :: error: (assignment) + // :: error: [assignment] iform = t19; - // :: error: (assignment) + // :: error: [assignment] sn = t19; bn = t19; fbn = t19; - // :: error: (assignment) + // :: error: [assignment] i = t19; us = t21; fqn = t21; - // :: error: (assignment) + // :: error: [assignment] cgn = t21; - // :: error: (assignment) + // :: error: [assignment] fd = t21; - // :: error: (assignment) + // :: error: [assignment] iform = t21; - // :: error: (assignment) + // :: error: [assignment] sn = t21; - // :: error: (assignment) + // :: error: [assignment] bn = t21; // t21 is pakkage.Outer$Inner[] us = t20; - // :: error: (assignment) + // :: error: [assignment] fqn = t20; - // :: error: (assignment) + // :: error: [assignment] cgn = t20; - // :: error: (assignment) + // :: error: [assignment] fd = t20; - // :: error: (assignment) + // :: error: [assignment] iform = t20; - // :: error: (assignment) + // :: error: [assignment] sn = t20; - // :: error: (assignment) + // :: error: [assignment] bn = t20; - // :: error: (assignment) + // :: error: [assignment] fbn = t20; - // :: error: (assignment) + // :: error: [assignment] i = t20; us = t10; - // :: error: (assignment) + // :: error: [assignment] fqn = t10; cgn = t10; - // :: error: (assignment) + // :: error: [assignment] fd = t10; - // :: error: (assignment) + // :: error: [assignment] iform = t10; - // :: error: (assignment) + // :: error: [assignment] sn = t10; - // :: error: (assignment) + // :: error: [assignment] bn = t10; - // :: error: (assignment) + // :: error: [assignment] fbn = t10; - // :: error: (assignment) + // :: error: [assignment] i = t10; us = t4; - // :: error: (assignment) + // :: error: [assignment] fqn = t4; - // :: error: (assignment) + // :: error: [assignment] cgn = t4; fd = t4; - // :: error: (assignment) + // :: error: [assignment] iform = t4; - // :: error: (assignment) + // :: error: [assignment] sn = t4; - // :: error: (assignment) + // :: error: [assignment] bn = t4; - // :: error: (assignment) + // :: error: [assignment] fbn = t4; - // :: error: (assignment) + // :: error: [assignment] i = t4; us = t11; - // :: error: (assignment) + // :: error: [assignment] fqn = t11; - // :: error: (assignment) + // :: error: [assignment] cgn = t11; fd = t11; - // :: error: (assignment) + // :: error: [assignment] iform = t11; - // :: error: (assignment) + // :: error: [assignment] sn = t11; - // :: error: (assignment) + // :: error: [assignment] bn = t11; - // :: error: (assignment) + // :: error: [assignment] fbn = t11; - // :: error: (assignment) + // :: error: [assignment] i = t11; } } diff --git a/checker/tests/signedness-unchecked-defaults/TestUncheckedByteCode.java b/checker/tests/signedness-unchecked-defaults/TestUncheckedByteCode.java index 762c14e7698d..e9130441d0bc 100644 --- a/checker/tests/signedness-unchecked-defaults/TestUncheckedByteCode.java +++ b/checker/tests/signedness-unchecked-defaults/TestUncheckedByteCode.java @@ -6,15 +6,15 @@ public class TestUncheckedByteCode { void test(UncheckedByteCode param, Integer i) { field = param.getCT(); - // :: error: (argument) + // :: error: [argument] field = param.getInt(1); // Signedness Checker doesn't default boxed primitives correctly. // https://github.com/typetools/checker-framework/issues/797 - // :: error: (argument) + // :: error: [argument] field = param.getInteger(i); - // :: error: (argument) + // :: error: [argument] field = param.getObject(new Object()); - // :: error: (argument) + // :: error: [argument] field = param.getString("hello"); field = param.identity("hello"); } diff --git a/checker/tests/signedness/AnnoBeforeModifier.java b/checker/tests/signedness/AnnoBeforeModifier.java index 2e4177fe605a..097109e5909f 100644 --- a/checker/tests/signedness/AnnoBeforeModifier.java +++ b/checker/tests/signedness/AnnoBeforeModifier.java @@ -3,12 +3,12 @@ public class AnnoBeforeModifier { - // :: warning: (type.anno.before.modifier) + // :: warning: [type.anno.before.modifier] @Unsigned public int i = 0; public @Unsigned int j = 0; - // :: warning: (type.anno.before.modifier) + // :: warning: [type.anno.before.modifier] public @Unsigned final int k = 0; @SuppressWarnings("foobar") @@ -19,10 +19,10 @@ public class AnnoBeforeModifier { @SuppressWarnings("foobar") @Unsigned public int n = 0; - // TODO: :: warning: (type.anno.before.modifier) + // TODO: :: warning: [type.anno.before.modifier] public @SuppressWarnings("foobar") @Unsigned final int o = 0; - // :: warning: (type.anno.before.decl.anno) :: warning: (type.anno.before.modifier) + // :: warning: [type.anno.before.decl.anno] :: warning: [type.anno.before.modifier] public @Unsigned @SuppressWarnings("foobar") final int p = 0; public @SuppressWarnings("foobar") final @Unsigned int q = 0; @@ -34,7 +34,7 @@ public class AnnoBeforeModifier { public @SuppressWarnings("foobar") final int t = 0; - // :: warning: (type.anno.before.modifier) + // :: warning: [type.anno.before.modifier] @Unsigned public int iMethod() { return 0; } @@ -43,7 +43,7 @@ public class AnnoBeforeModifier { return 0; } - // :: warning: (type.anno.before.modifier) + // :: warning: [type.anno.before.modifier] public @Unsigned final int kMethod() { return 0; } @@ -62,12 +62,12 @@ public class AnnoBeforeModifier { return 0; } - // TODO: :: warning: (type.anno.before.modifier) + // TODO: :: warning: [type.anno.before.modifier] public @SuppressWarnings("foobar") @Unsigned final int oMethod() { return 0; } - // :: warning: (type.anno.before.decl.anno) :: warning: (type.anno.before.modifier) + // :: warning: [type.anno.before.decl.anno] :: warning: [type.anno.before.modifier] public @Unsigned @SuppressWarnings("foobar") final int pMethod() { return 0; } diff --git a/checker/tests/signedness/BinaryOperations.java b/checker/tests/signedness/BinaryOperations.java index 06064a79bace..c3c0f4cc5fa5 100644 --- a/checker/tests/signedness/BinaryOperations.java +++ b/checker/tests/signedness/BinaryOperations.java @@ -11,52 +11,52 @@ public void DivModTest( @Unsigned int unsignedresult; @UnknownSignedness int unknownresult; - // :: error: (operation.unsignedrhs) + // :: error: [operation.unsignedrhs] unknownresult = unknown / unsigned; - // :: error: (operation.unsignedlhs) + // :: error: [operation.unsignedlhs] unknownresult = unsigned / unknown; - // :: error: (operation.unsignedlhs) + // :: error: [operation.unsignedlhs] unsignedresult = unsigned / constant; - // :: error: (operation.unsignedrhs) + // :: error: [operation.unsignedrhs] unsignedresult = constant / unsigned; - // :: error: (operation.unsignedrhs) + // :: error: [operation.unsignedrhs] unknownresult = unknown / polysigned; - // :: error: (operation.unsignedlhs) + // :: error: [operation.unsignedlhs] unknownresult = polysigned / unknown; - // :: error: (operation.unsignedlhs) + // :: error: [operation.unsignedlhs] unknownresult = polysigned / constant; - // :: error: (operation.unsignedrhs) + // :: error: [operation.unsignedrhs] unknownresult = constant / polysigned; - // :: error: (operation.unsignedrhs) + // :: error: [operation.unsignedrhs] unknownresult = unknown % unsigned; - // :: error: (operation.unsignedlhs) + // :: error: [operation.unsignedlhs] unknownresult = unsigned % unknown; - // :: error: (operation.unsignedrhs) + // :: error: [operation.unsignedrhs] unknownresult = unknown % polysigned; - // :: error: (operation.unsignedlhs) + // :: error: [operation.unsignedlhs] unknownresult = polysigned % unknown; - // :: error: (operation.unsignedlhs) + // :: error: [operation.unsignedlhs] unsignedresult = unsigned % constant; - // :: error: (operation.unsignedrhs) + // :: error: [operation.unsignedrhs] unsignedresult = constant % unsigned; - // :: error: (operation.unsignedlhs) + // :: error: [operation.unsignedlhs] unknownresult = polysigned % constant; - // :: error: (operation.unsignedrhs) + // :: error: [operation.unsignedrhs] unknownresult = constant % polysigned; } @@ -71,22 +71,22 @@ public void SignedRightShiftTest( @UnknownSignedness int unknownresult; int result; - // :: error: (shift.signed) + // :: error: [shift.signed] unsignedresult = unsigned >> constant; result = constant >> unsigned; - // :: error: (shift.signed) + // :: error: [shift.signed] polysignedresult = polysigned >> constant; result = constant >> polysigned; - // :: error: (shift.signed) + // :: error: [shift.signed] unsignedresult = unsigned >> unknown; unknownresult = unknown >> unsigned; - // :: error: (shift.signed) + // :: error: [shift.signed] polysignedresult = polysigned >> unknown; unknownresult = unknown >> polysigned; @@ -102,22 +102,22 @@ public void UnsignedRightShiftTest( @UnknownSignedness int unknownresult; int result; - // :: error: (shift.unsigned) + // :: error: [shift.unsigned] result = signed >>> constant; result = constant >>> signed; - // :: error: (shift.unsigned) + // :: error: [shift.unsigned] result = signed >>> unknown; unknownresult = unknown >>> signed; - // :: error: (shift.unsigned) + // :: error: [shift.unsigned] polysignedresult = polysigned >>> constant; result = constant >>> polysigned; - // :: error: (shift.unsigned) + // :: error: [shift.unsigned] polysignedresult = polysigned >>> unknown; unknownresult = unknown >>> polysigned; diff --git a/checker/tests/signedness/BitPatternOperations.java b/checker/tests/signedness/BitPatternOperations.java index b144138cc2cd..481618bdf2aa 100644 --- a/checker/tests/signedness/BitPatternOperations.java +++ b/checker/tests/signedness/BitPatternOperations.java @@ -23,21 +23,21 @@ void allowedUses(double d, float f, @BitPattern long bits, @BitPattern int patte } void forbiddenUses(@BitPattern long bits, @BitPattern int pattern) { - // :: error: (operation.bitpattern) + // :: error: [operation.bitpattern] long sum = bits + 1L; - // :: error: (operation.bitpattern) + // :: error: [operation.bitpattern] long difference = 2L - bits; - // :: error: (operation.bitpattern) + // :: error: [operation.bitpattern] int product = pattern * 3; - // :: error: (compound.assignment.bitpattern) + // :: error: [compound.assignment.bitpattern] bits += 4L; - // :: error: (compound.assignment.bitpattern) + // :: error: [compound.assignment.bitpattern] pattern -= 1; - // :: error: (unary.bitpattern) + // :: error: [unary.bitpattern] bits++; - // :: error: (unary.bitpattern) + // :: error: [unary.bitpattern] --pattern; - // :: error: (bitpattern.concat) + // :: error: [bitpattern.concat] String s = bits + ""; } } diff --git a/checker/tests/signedness/BoxedPrimitives.java b/checker/tests/signedness/BoxedPrimitives.java index b3a899c425e7..4f62df21ce85 100644 --- a/checker/tests/signedness/BoxedPrimitives.java +++ b/checker/tests/signedness/BoxedPrimitives.java @@ -13,16 +13,16 @@ public class BoxedPrimitives { void argSigned(@Signed int x) { si = x; sbi = x; - // :: error: (assignment) + // :: error: [assignment] ui = x; - // :: error: (assignment) + // :: error: [assignment] ubi = x; } void argUnsigned(@Unsigned int x) { - // :: error: (assignment) + // :: error: [assignment] si = x; - // :: error: (assignment) + // :: error: [assignment] sbi = x; ui = x; ubi = x; @@ -31,16 +31,16 @@ void argUnsigned(@Unsigned int x) { void argSignedBoxed(@Signed Integer x) { si = x; sbi = x; - // :: error: (assignment) + // :: error: [assignment] ui = x; - // :: error: (assignment) + // :: error: [assignment] ubi = x; } void argUnsignedBoxed(@Unsigned Integer x) { - // :: error: (assignment) + // :: error: [assignment] si = x; - // :: error: (assignment) + // :: error: [assignment] sbi = x; ui = x; ubi = x; @@ -51,21 +51,21 @@ void client() { argSignedBoxed(si); argSigned(sbi); argSignedBoxed(sbi); - // :: error: (argument) + // :: error: [argument] argUnsigned(si); - // :: error: (argument) + // :: error: [argument] argUnsignedBoxed(si); - // :: error: (argument) + // :: error: [argument] argUnsigned(sbi); - // :: error: (argument) + // :: error: [argument] argUnsignedBoxed(sbi); - // :: error: (argument) + // :: error: [argument] argSigned(ui); - // :: error: (argument) + // :: error: [argument] argSignedBoxed(ui); - // :: error: (argument) + // :: error: [argument] argSigned(ubi); - // :: error: (argument) + // :: error: [argument] argSignedBoxed(ubi); argUnsigned(ui); argUnsignedBoxed(ui); diff --git a/checker/tests/signedness/CastedShifts.java b/checker/tests/signedness/CastedShifts.java index d82b9f048d8d..4538945fd99f 100644 --- a/checker/tests/signedness/CastedShifts.java +++ b/checker/tests/signedness/CastedShifts.java @@ -22,10 +22,10 @@ public void CastedIntShifts(@Unsigned int unsigned, @Signed int signed) { // Shifting right by 25, now the MSB matters. byteRes = (@Unsigned byte) (unsigned >>> 25); - // :: error: (shift.signed) + // :: error: [shift.signed] byteRes = (@Unsigned byte) (unsigned >> 25); - // :: error: (shift.unsigned) + // :: error: [shift.unsigned] byteRes = (@Signed byte) (signed >>> 25); byteRes = (@Signed byte) (signed >> 25); @@ -53,10 +53,10 @@ public void CastedIntShifts(@Unsigned int unsigned, @Signed int signed) { // Shifting right by 17, now the MSB matters. shortRes = (@Unsigned short) (unsigned >>> 17); - // :: error: (shift.signed) + // :: error: [shift.signed] shortRes = (@Unsigned short) (unsigned >> 17); - // :: error: (shift.unsigned) + // :: error: [shift.unsigned] shortRes = (@Signed short) (signed >>> 17); shortRes = (@Signed short) (signed >> 17); @@ -72,10 +72,10 @@ public void CastedIntShifts(@Unsigned int unsigned, @Signed int signed) { // Now shift signedness matters again intRes = (@Unsigned int) (unsigned >>> 1); - // :: error: (shift.signed) + // :: error: [shift.signed] intRes = (@Unsigned int) (unsigned >> 1); - // :: error: (shift.unsigned) + // :: error: [shift.unsigned] intRes = (@Signed int) (signed >>> 1); intRes = (@Signed int) (signed >> 1); @@ -91,10 +91,10 @@ public void CastedIntShifts(@Unsigned int unsigned, @Signed int signed) { // Now shift signedness matters again longRes = (@Unsigned long) (unsigned >>> 1); - // :: error: (shift.signed) + // :: error: [shift.signed] longRes = (@Unsigned long) (unsigned >> 1); - // :: error: (shift.unsigned) + // :: error: [shift.unsigned] longRes = (@Signed long) (signed >>> 1); longRes = (@Signed long) (signed >> 1); @@ -122,10 +122,10 @@ public void CastedIntShifts(@Unsigned int unsigned, @Signed int signed) { // Shifting right by 25, now the MSB matters. byteRes = (@Unsigned byte) ((unsigned >>> 25)); - // :: error: (shift.signed) + // :: error: [shift.signed] byteRes = (@Unsigned byte) ((unsigned >> 25)); - // :: error: (shift.unsigned) + // :: error: [shift.unsigned] byteRes = (@Signed byte) ((signed >>> 25)); byteRes = (@Signed byte) ((signed >> 25)); @@ -139,10 +139,10 @@ public void CastedIntShifts(@Unsigned int unsigned, @Signed int signed) { // Now shift signedness matters again intRes = (@Unsigned int) ((unsigned >>> 1)); - // :: error: (shift.signed) + // :: error: [shift.signed] intRes = (@Unsigned int) ((unsigned >> 1)); - // :: error: (shift.unsigned) + // :: error: [shift.unsigned] intRes = (@Signed int) ((signed >>> 1)); intRes = (@Signed int) ((signed >> 1)); @@ -157,10 +157,10 @@ public void CastedIntShifts(@Unsigned int unsigned, @Signed int signed) { // Now shift signedness matters again intRes = (@Unsigned int) ((unsigned >>> 33)); - // :: error: (shift.signed) + // :: error: [shift.signed] intRes = (@Unsigned int) ((unsigned >> 33)); - // :: error: (shift.unsigned) + // :: error: [shift.unsigned] intRes = (@Signed int) ((signed >>> 33)); intRes = (@Signed int) ((signed >> 33)); @@ -190,10 +190,10 @@ public void CastedLongShifts(@Unsigned long unsigned, @Signed long signed) { // Shifting right by 57, now the MSB matters. byteRes = (@Unsigned byte) (unsigned >>> 57); - // :: error: (shift.signed) + // :: error: [shift.signed] byteRes = (@Unsigned byte) (unsigned >> 57); - // :: error: (shift.unsigned) + // :: error: [shift.unsigned] byteRes = (@Signed byte) (signed >>> 57); byteRes = (@Signed byte) (signed >> 57); @@ -217,7 +217,7 @@ public void CastedLongShifts(@Unsigned long unsigned, @Signed long signed) { // Shifting right by 57, now the MSB matters. charRes = (char) (unsigned >>> 57); - // :: error: (shift.signed) + // :: error: [shift.signed] charRes = (char) (unsigned >> 57); // Shifting right by zero should behave as assignment @@ -242,10 +242,10 @@ public void CastedLongShifts(@Unsigned long unsigned, @Signed long signed) { // Shifting right by 49, now the MSB matters. shortRes = (@Unsigned short) (unsigned >>> 49); - // :: error: (shift.signed) + // :: error: [shift.signed] shortRes = (@Unsigned short) (unsigned >> 49); - // :: error: (shift.unsigned) + // :: error: [shift.unsigned] shortRes = (@Signed short) (signed >>> 49); shortRes = (@Signed short) (signed >> 49); @@ -273,10 +273,10 @@ public void CastedLongShifts(@Unsigned long unsigned, @Signed long signed) { // Shifting right by 33, now the MSB matters. intRes = (@Unsigned int) (unsigned >>> 33); - // :: error: (shift.signed) + // :: error: [shift.signed] intRes = (@Unsigned int) (unsigned >> 33); - // :: error: (shift.unsigned) + // :: error: [shift.unsigned] intRes = (@Signed int) (signed >>> 33); intRes = (@Signed int) (signed >> 33); @@ -292,10 +292,10 @@ public void CastedLongShifts(@Unsigned long unsigned, @Signed long signed) { // Now shift signedness matters again longRes = (@Unsigned long) (unsigned >>> 1); - // :: error: (shift.signed) + // :: error: [shift.signed] longRes = (@Unsigned long) (unsigned >> 1); - // :: error: (shift.unsigned) + // :: error: [shift.unsigned] longRes = (@Signed long) (signed >>> 1); longRes = (@Signed long) (signed >> 1); @@ -323,10 +323,10 @@ public void CastedLongShifts(@Unsigned long unsigned, @Signed long signed) { // Shifting right by 9, now the MSB matters. byteRes = (@Unsigned byte) ((unsigned >>> 57)); - // :: error: (shift.signed) + // :: error: [shift.signed] byteRes = (@Unsigned byte) ((unsigned >> 57)); - // :: error: (shift.unsigned) + // :: error: [shift.unsigned] byteRes = (@Signed byte) ((signed >>> 57)); byteRes = (@Signed byte) ((signed >> 57)); @@ -340,10 +340,10 @@ public void CastedLongShifts(@Unsigned long unsigned, @Signed long signed) { // Now shift signedness matters again longRes = (@Unsigned long) ((unsigned >>> 1)); - // :: error: (shift.signed) + // :: error: [shift.signed] longRes = (@Unsigned long) ((unsigned >> 1)); - // :: error: (shift.unsigned) + // :: error: [shift.unsigned] longRes = (@Signed long) ((signed >>> 1)); longRes = (@Signed long) ((signed >> 1)); @@ -358,10 +358,10 @@ public void CastedLongShifts(@Unsigned long unsigned, @Signed long signed) { // Now shift signedness matters again longRes = (@Unsigned long) ((unsigned >>> 65)); - // :: error: (shift.signed) + // :: error: [shift.signed] longRes = (@Unsigned long) ((unsigned >> 65)); - // :: error: (shift.unsigned) + // :: error: [shift.unsigned] longRes = (@Signed long) ((signed >>> 65)); longRes = (@Signed long) ((signed >> 65)); diff --git a/checker/tests/signedness/CharComparisons.java b/checker/tests/signedness/CharComparisons.java index 860a5026b7fb..8ac9c57d07dd 100644 --- a/checker/tests/signedness/CharComparisons.java +++ b/checker/tests/signedness/CharComparisons.java @@ -5,25 +5,25 @@ public class CharComparisons { @Unsigned byte b; void unsignedComparison(char c, @Unsigned byte b) { - // :: error: (comparison.unsignedrhs) + // :: error: [comparison.unsignedrhs] boolean res = c > b; - // :: error: (comparison.unsignedrhs) + // :: error: [comparison.unsignedrhs] res = c >= b; - // :: error: (comparison.unsignedrhs) + // :: error: [comparison.unsignedrhs] res = c < b; - // :: error: (comparison.unsignedrhs) + // :: error: [comparison.unsignedrhs] res = c <= b; res = c == b; } void unsignedComparisonFields() { - // :: error: (comparison.unsignedrhs) + // :: error: [comparison.unsignedrhs] boolean res = this.c > this.b; - // :: error: (comparison.unsignedrhs) + // :: error: [comparison.unsignedrhs] res = this.c >= this.b; - // :: error: (comparison.unsignedrhs) + // :: error: [comparison.unsignedrhs] res = this.c < this.b; - // :: error: (comparison.unsignedrhs) + // :: error: [comparison.unsignedrhs] res = this.c <= this.b; res = this.c == this.b; } diff --git a/checker/tests/signedness/Comparisons.java b/checker/tests/signedness/Comparisons.java index 680c003cdcf9..ebbb2c142c0e 100644 --- a/checker/tests/signedness/Comparisons.java +++ b/checker/tests/signedness/Comparisons.java @@ -7,52 +7,52 @@ public void ComparisonTest( boolean testRes; - // :: error: (comparison.unsignedlhs) + // :: error: [comparison.unsignedlhs] testRes = unsigned < unknown; - // :: error: (comparison.unsignedlhs) + // :: error: [comparison.unsignedlhs] testRes = polysigned < unknown; - // :: error: (comparison.unsignedrhs) + // :: error: [comparison.unsignedrhs] testRes = unknown < unsigned; - // :: error: (comparison.unsignedrhs) + // :: error: [comparison.unsignedrhs] testRes = unknown < polysigned; - // :: error: (comparison.unsignedlhs) + // :: error: [comparison.unsignedlhs] testRes = unsigned <= unknown; - // :: error: (comparison.unsignedlhs) + // :: error: [comparison.unsignedlhs] testRes = polysigned <= unknown; - // :: error: (comparison.unsignedrhs) + // :: error: [comparison.unsignedrhs] testRes = unknown <= unsigned; - // :: error: (comparison.unsignedrhs) + // :: error: [comparison.unsignedrhs] testRes = unknown <= polysigned; - // :: error: (comparison.unsignedlhs) + // :: error: [comparison.unsignedlhs] testRes = unsigned > unknown; - // :: error: (comparison.unsignedlhs) + // :: error: [comparison.unsignedlhs] testRes = polysigned > unknown; - // :: error: (comparison.unsignedrhs) + // :: error: [comparison.unsignedrhs] testRes = unknown > unsigned; - // :: error: (comparison.unsignedrhs) + // :: error: [comparison.unsignedrhs] testRes = unknown > polysigned; - // :: error: (comparison.unsignedlhs) + // :: error: [comparison.unsignedlhs] testRes = unsigned >= unknown; - // :: error: (comparison.unsignedrhs) + // :: error: [comparison.unsignedrhs] testRes = unknown >= unsigned; - // :: error: (comparison.unsignedlhs) + // :: error: [comparison.unsignedlhs] testRes = polysigned >= unknown; - // :: error: (comparison.unsignedrhs) + // :: error: [comparison.unsignedrhs] testRes = unknown >= polysigned; } @@ -60,16 +60,16 @@ public void EqualsTest(@Unsigned int unsigned, @Signed int signed) { boolean testRes; - // :: error: (comparison.mixed.unsignedlhs) + // :: error: [comparison.mixed.unsignedlhs] testRes = unsigned == signed; - // :: error: (comparison.mixed.unsignedrhs) + // :: error: [comparison.mixed.unsignedrhs] testRes = signed == unsigned; - // :: error: (comparison.mixed.unsignedlhs) + // :: error: [comparison.mixed.unsignedlhs] testRes = unsigned != signed; - // :: error: (comparison.mixed.unsignedrhs) + // :: error: [comparison.mixed.unsignedrhs] testRes = signed != unsigned; } } diff --git a/checker/tests/signedness/CompoundAssignmentsSignedness.java b/checker/tests/signedness/CompoundAssignmentsSignedness.java index 8ff92c21ec1a..b5e0949cea1b 100644 --- a/checker/tests/signedness/CompoundAssignmentsSignedness.java +++ b/checker/tests/signedness/CompoundAssignmentsSignedness.java @@ -8,62 +8,62 @@ public void DivModTest( @UnknownSignedness int unknown, @SignednessGlb int constant) { - // :: error: (compound.assignment.unsigned.expression) + // :: error: [compound.assignment.unsigned.expression] unknown /= unsigned; - // :: error: (compound.assignment.unsigned.variable) - // :: error: (compound.assignment) + // :: error: [compound.assignment.unsigned.variable] + // :: error: [compound.assignment] unsigned /= unknown; - // :: error: (compound.assignment.unsigned.variable) + // :: error: [compound.assignment.unsigned.variable] unsigned /= constant; - // :: error: (compound.assignment.unsigned.expression) - // :: error: (compound.assignment) + // :: error: [compound.assignment.unsigned.expression] + // :: error: [compound.assignment] constant /= unsigned; - // :: error: (compound.assignment.unsigned.expression) + // :: error: [compound.assignment.unsigned.expression] unknown /= polysigned; - // :: error: (compound.assignment.unsigned.variable) - // :: error: (compound.assignment) + // :: error: [compound.assignment.unsigned.variable] + // :: error: [compound.assignment] polysigned /= unknown; - // :: error: (compound.assignment.unsigned.variable) - // :: error: (compound.assignment) + // :: error: [compound.assignment.unsigned.variable] + // :: error: [compound.assignment] polysigned /= constant; - // :: error: (compound.assignment.unsigned.expression) - // :: error: (compound.assignment) + // :: error: [compound.assignment.unsigned.expression] + // :: error: [compound.assignment] constant /= polysigned; - // :: error: (compound.assignment.unsigned.expression) + // :: error: [compound.assignment.unsigned.expression] unknown %= unsigned; - // :: error: (compound.assignment.unsigned.variable) - // :: error: (compound.assignment) + // :: error: [compound.assignment.unsigned.variable] + // :: error: [compound.assignment] unsigned %= unknown; - // :: error: (compound.assignment.unsigned.expression) + // :: error: [compound.assignment.unsigned.expression] unknown %= polysigned; - // :: error: (compound.assignment.unsigned.variable) - // :: error: (compound.assignment) + // :: error: [compound.assignment.unsigned.variable] + // :: error: [compound.assignment] polysigned %= unknown; - // :: error: (compound.assignment.unsigned.variable) + // :: error: [compound.assignment.unsigned.variable] unsigned %= constant; - // :: error: (compound.assignment.unsigned.expression) - // :: error: (compound.assignment) + // :: error: [compound.assignment.unsigned.expression] + // :: error: [compound.assignment] constant %= unsigned; - // :: error: (compound.assignment.unsigned.variable) - // :: error: (compound.assignment) + // :: error: [compound.assignment.unsigned.variable] + // :: error: [compound.assignment] polysigned %= constant; - // :: error: (compound.assignment.unsigned.expression) - // :: error: (compound.assignment) + // :: error: [compound.assignment.unsigned.expression] + // :: error: [compound.assignment] constant %= polysigned; } @@ -73,22 +73,22 @@ public void SignedRightShiftTest( @UnknownSignedness int unknown, @SignednessGlb int constant) { - // :: error: (compound.assignment.shift.signed) + // :: error: [compound.assignment.shift.signed] unsigned >>= constant; constant >>= unsigned; - // :: error: (compound.assignment.shift.signed) + // :: error: [compound.assignment.shift.signed] polysigned >>= constant; constant >>= polysigned; - // :: error: (compound.assignment.shift.signed) + // :: error: [compound.assignment.shift.signed] unsigned >>= unknown; unknown >>= unsigned; - // :: error: (compound.assignment.shift.signed) + // :: error: [compound.assignment.shift.signed] polysigned >>= unknown; unknown >>= polysigned; @@ -100,22 +100,22 @@ public void UnsignedRightShiftTest( @UnknownSignedness int unknown, @SignednessGlb int constant) { - // :: error: (compound.assignment.shift.unsigned) + // :: error: [compound.assignment.shift.unsigned] signed >>>= constant; constant >>>= signed; - // :: error: (compound.assignment.shift.unsigned) + // :: error: [compound.assignment.shift.unsigned] signed >>>= unknown; unknown >>>= signed; - // :: error: (compound.assignment.shift.unsigned) + // :: error: [compound.assignment.shift.unsigned] polysigned >>>= constant; constant >>>= polysigned; - // :: error: (compound.assignment.shift.unsigned) + // :: error: [compound.assignment.shift.unsigned] polysigned >>>= unknown; unknown >>>= polysigned; @@ -155,12 +155,12 @@ public void LeftShiftTest( public void mixedTest(@Unsigned int unsigned, @Signed int signed) { - // :: error: (compound.assignment.mixed.unsigned.variable) - // :: error: (compound.assignment) + // :: error: [compound.assignment.mixed.unsigned.variable] + // :: error: [compound.assignment] unsigned += signed; - // :: error: (compound.assignment.mixed.unsigned.expression) - // :: error: (compound.assignment) + // :: error: [compound.assignment.mixed.unsigned.expression] + // :: error: [compound.assignment] signed += unsigned; } } diff --git a/checker/tests/signedness/ConstantTests.java b/checker/tests/signedness/ConstantTests.java index 55b50a13acb2..ff5c81f7d7d5 100644 --- a/checker/tests/signedness/ConstantTests.java +++ b/checker/tests/signedness/ConstantTests.java @@ -24,10 +24,10 @@ void m() { int s1 = 0xFFFFFFFE; @UnknownSignedness int y = s1 / 2; - // :: error: (operation.unsignedlhs) + // :: error: [operation.unsignedlhs] @UnknownSignedness int z = (uint_negative_one) / -2; - // :: error: (operation.unsignedlhs) + // :: error: [operation.unsignedlhs] @UnknownSignedness int w = u1lit / 2; } } diff --git a/checker/tests/signedness/DefaultsSignedness.java b/checker/tests/signedness/DefaultsSignedness.java index d282698b9578..a2e2ce6344ad 100644 --- a/checker/tests/signedness/DefaultsSignedness.java +++ b/checker/tests/signedness/DefaultsSignedness.java @@ -12,7 +12,7 @@ public void ConstantTest() { conByte = testByte; - // :: error: (assignment) + // :: error: [assignment] botByte = testByte; // Test shorts with literal values @@ -23,7 +23,7 @@ public void ConstantTest() { conShort = testShort; - // :: error: (assignment) + // :: error: [assignment] botShort = testShort; // Test ints with literal values @@ -34,7 +34,7 @@ public void ConstantTest() { conInt = testInt; - // :: error: (assignment) + // :: error: [assignment] botInt = testInt; // Test longs with literal values @@ -45,7 +45,7 @@ public void ConstantTest() { conLong = testLong; - // :: error: (assignment) + // :: error: [assignment] botLong = testLong; } @@ -69,7 +69,7 @@ public void SignedTest( sinByte = testByte; - // :: error: (assignment) + // :: error: [assignment] conByte = testByte; // Test shorts @@ -78,7 +78,7 @@ public void SignedTest( sinShort = testShort; - // :: error: (assignment) + // :: error: [assignment] conShort = testShort; // Test ints @@ -87,7 +87,7 @@ public void SignedTest( sinInt = testInt; - // :: error: (assignment) + // :: error: [assignment] conInt = testInt; // Test longs @@ -96,17 +96,17 @@ public void SignedTest( sinLong = testLong; - // :: error: (assignment) + // :: error: [assignment] conLong = testLong; // Test floats - // :: error: (anno.on.irrelevant) + // :: error: [anno.on.irrelevant] @Signed float sinFloat; sinFloat = testFloat; // Test doubles - // :: error: (anno.on.irrelevant) + // :: error: [anno.on.irrelevant] @Signed double sinDouble; sinDouble = testDouble; @@ -118,7 +118,7 @@ public void SignedTest( sinBoxedByte = testBoxedByte; - // // :: error: (assignment) + // // :: error: [assignment] conBoxedByte = testBoxedByte; // Test boxed shorts @@ -127,7 +127,7 @@ public void SignedTest( sinBoxedShort = testBoxedShort; - // // :: error: (assignment) + // // :: error: [assignment] conBoxedShort = testBoxedShort; // Test boxed Integers @@ -136,7 +136,7 @@ public void SignedTest( sinBoxedInteger = testBoxedInteger; - // // :: error: (assignment) + // // :: error: [assignment] conBoxedInteger = testBoxedInteger; // Test boxed Longs @@ -145,7 +145,7 @@ public void SignedTest( sinBoxedLong = testBoxedLong; - // // :: error: (assignment) + // // :: error: [assignment] conBoxedLong = testBoxedLong; */ } @@ -166,7 +166,7 @@ public void UnknownSignedness(Object testObj, @Unsigned int unsigned, @Signed in unkObj = testObj; - // :: error: (assignment) + // :: error: [assignment] unsinObj = testObj; } diff --git a/checker/tests/signedness/IrrelevantAnnotationsTest.java b/checker/tests/signedness/IrrelevantAnnotationsTest.java index b165a50223c9..0c0b1f758308 100644 --- a/checker/tests/signedness/IrrelevantAnnotationsTest.java +++ b/checker/tests/signedness/IrrelevantAnnotationsTest.java @@ -3,10 +3,10 @@ public final class IrrelevantAnnotationsTest { - // :: error: (anno.on.irrelevant) + // :: error: [anno.on.irrelevant] @Signed Boolean b1; - // :: error: (anno.on.irrelevant) + // :: error: [anno.on.irrelevant] @Unsigned Boolean b2; @Signed Object o1; diff --git a/checker/tests/signedness/Issue2543.java b/checker/tests/signedness/Issue2543.java index a6c25d880b3e..7a7702e737a9 100644 --- a/checker/tests/signedness/Issue2543.java +++ b/checker/tests/signedness/Issue2543.java @@ -6,7 +6,7 @@ public class Issue2543 { public static @PolySigned int rotateRightPart1(@PolySigned int i, int distance) { - // :: error: (shift.unsigned) + // :: error: [shift.unsigned] return i >>> distance; } @@ -15,12 +15,12 @@ public class Issue2543 { } public static @PolySigned int rotateRight(@PolySigned int i, int distance) { - // :: error: (shift.unsigned) + // :: error: [shift.unsigned] return (i >>> distance) | (i << -distance); } public static @Signed int rotateRightSignedPart1(@Signed int i, int distance) { - // :: error: (shift.unsigned) + // :: error: [shift.unsigned] return i >>> distance; } @@ -29,7 +29,7 @@ public class Issue2543 { } public static @Signed int rotateRightSigned(@Signed int i, int distance) { - // :: error: (shift.unsigned) + // :: error: [shift.unsigned] return (i >>> distance) | (i << -distance); } @@ -38,7 +38,7 @@ public class Issue2543 { } public static @Unsigned int rotateRightUnknownSignedness(@UnknownSignedness int i, int distance) { - // :: error: (return) + // :: error: [return] return (i >>> distance) | (i << -distance); } } diff --git a/checker/tests/signedness/JdkConstantsTest.java b/checker/tests/signedness/JdkConstantsTest.java index 62b842f6868a..e241446c3f62 100644 --- a/checker/tests/signedness/JdkConstantsTest.java +++ b/checker/tests/signedness/JdkConstantsTest.java @@ -3,12 +3,12 @@ public class JdkConstantsTest { static @PolySigned int integerMinValue(@PolySigned int value) { - // :: error: (return) + // :: error: [return] return Integer.MIN_VALUE; } static @PolySigned int flip(@PolySigned int value) { - // :: error: (return) + // :: error: [return] return value ^ Integer.MIN_VALUE; } } diff --git a/checker/tests/signedness/LiteralCast.java b/checker/tests/signedness/LiteralCast.java index 4c39828500d8..f7ed0c0e43f2 100644 --- a/checker/tests/signedness/LiteralCast.java +++ b/checker/tests/signedness/LiteralCast.java @@ -12,48 +12,48 @@ void m() { testCompile(2); // manifest literals are treated as @SignednessGlb testCompile(-2); - // :: error: (argument) + // :: error: [argument] testCompile((@Signed int) 2); testCompile((@Unsigned int) 2); testCompile((int) 2); testCompile((@m int) 2); requireSigned((@Signed int) 2); - // :: error: (argument) + // :: error: [argument] requireSigned((@Unsigned int) 2); requireSigned((int) 2); requireSigned((@m int) 2); - // :: warning: (cast.unsafe) + // :: warning: [cast.unsafe] requireSigned((@Signed int) u); - // :: error: (argument) + // :: error: [argument] requireSigned((@Unsigned int) u); - // :: error: (argument) + // :: error: [argument] requireSigned((int) u); - // :: error: (argument) + // :: error: [argument] requireSigned((@m int) u); requireSigned((@Signed int) s); - // :: error: (argument) :: warning: (cast.unsafe) + // :: error: [argument] :: warning: [cast.unsafe] requireSigned((@Unsigned int) s); requireSigned((int) s); requireSigned((@m int) s); - // :: error: (argument) + // :: error: [argument] requireUnsigned((@Signed int) 2); requireUnsigned((@Unsigned int) 2); requireUnsigned((int) 2); requireUnsigned((@m int) 2); - // :: error: (argument) :: warning: (cast.unsafe) + // :: error: [argument] :: warning: [cast.unsafe] requireUnsigned((@Signed int) u); requireUnsigned((@Unsigned int) u); requireUnsigned((int) u); requireUnsigned((@m int) u); - // :: error: (argument) + // :: error: [argument] requireUnsigned((@Signed int) s); - // :: warning: (cast.unsafe) + // :: warning: [cast.unsafe] requireUnsigned((@Unsigned int) s); - // :: error: (argument) + // :: error: [argument] requireUnsigned((int) s); - // :: error: (argument) + // :: error: [argument] requireUnsigned((@m int) s); } diff --git a/checker/tests/signedness/LocalVarDefaults.java b/checker/tests/signedness/LocalVarDefaults.java index a42237b57b9b..c4cd5db1688e 100644 --- a/checker/tests/signedness/LocalVarDefaults.java +++ b/checker/tests/signedness/LocalVarDefaults.java @@ -8,7 +8,7 @@ void methodInt(@Unsigned int unsignedInt, @Signed int signedInt) { int local2 = signedInt; } - // :: error: (anno.on.irrelevant) + // :: error: [anno.on.irrelevant] void methodDouble(@Unsigned double unsigned, @Signed double signed) { double local = unsigned; double local2 = signed; @@ -19,7 +19,7 @@ void methodInteger(@Unsigned Integer unsignedInt, @Signed Integer signedInt) { Integer local2 = signedInt; } - // :: error: (anno.on.irrelevant) + // :: error: [anno.on.irrelevant] void methodDoubleWrapper(@Unsigned Double unsigned, @Signed Double signed) { Double local = unsigned; Double local2 = signed; diff --git a/checker/tests/signedness/LowerUpperBound.java b/checker/tests/signedness/LowerUpperBound.java index 0f28eb7dd593..ac6d393595ff 100644 --- a/checker/tests/signedness/LowerUpperBound.java +++ b/checker/tests/signedness/LowerUpperBound.java @@ -16,22 +16,22 @@ public void LowerUpperBoundTest( unkTest = unknown + unknown; - // :: error: (assignment) + // :: error: [assignment] sinTest = unknown + unknown; unkTest = unknown + signed; - // :: error: (assignment) + // :: error: [assignment] sinTest = unknown + signed; sinTest = signed + signed; - // :: error: (assignment) + // :: error: [assignment] conTest = signed + signed; sinTest = signed + constant; - // :: error: (assignment) + // :: error: [assignment] conTest = signed + constant; } } diff --git a/checker/tests/signedness/MaskedShifts.java b/checker/tests/signedness/MaskedShifts.java index 2bedaa100b0a..1759a968427f 100644 --- a/checker/tests/signedness/MaskedShifts.java +++ b/checker/tests/signedness/MaskedShifts.java @@ -27,10 +27,10 @@ public void MaskedAndShifts(@Unsigned int unsigned, @Signed int signed) { // Now the right-most introduced bit matters testRes = (unsigned >>> 8) & 0x1FFFFFF; - // :: error: (shift.signed) + // :: error: [shift.signed] testRes = (unsigned >> 8) & 0x1FFFFFF; - // :: error: (shift.unsigned) + // :: error: [shift.unsigned] testRes = (signed >>> 8) & 0x1FFFFFF; testRes = (signed >> 8) & 0x1FFFFFF; @@ -40,10 +40,10 @@ public void MaskedAndShifts(@Unsigned int unsigned, @Signed int signed) { // Now the left-most introduced bit matters testRes = (unsigned >>> 8) & 0x90FFFFFF; - // :: error: (shift.signed) + // :: error: [shift.signed] testRes = (unsigned >> 8) & 0x90FFFFFF; - // :: error: (shift.unsigned) + // :: error: [shift.unsigned] testRes = (signed >>> 8) & 0x90FFFFFF; testRes = (signed >> 8) & 0x90FFFFFF; @@ -51,10 +51,10 @@ public void MaskedAndShifts(@Unsigned int unsigned, @Signed int signed) { testRes = (unsigned >>> 8) & 0xFFFFFFFF; - // :: error: (shift.signed) + // :: error: [shift.signed] testRes = (unsigned >> 8) & 0xFFFFFFFF; - // :: error: (shift.unsigned) + // :: error: [shift.unsigned] testRes = (signed >>> 8) & 0xFFFFFFFF; testRes = (signed >> 8) & 0xFFFFFFFF; @@ -72,10 +72,10 @@ public void MaskedAndShifts(@Unsigned int unsigned, @Signed int signed) { testRes = unsigned >>> 8 & 0xFFFFFFFF; - // :: error: (shift.signed) + // :: error: [shift.signed] testRes = unsigned >> 8 & 0xFFFFFFFF; - // :: error: (shift.unsigned) + // :: error: [shift.unsigned] testRes = signed >>> 8 & 0xFFFFFFFF; testRes = signed >> 8 & 0xFFFFFFFF; @@ -93,10 +93,10 @@ public void MaskedAndShifts(@Unsigned int unsigned, @Signed int signed) { testRes = ((unsigned >>> 8)) & 0xFFFFFFFF; - // :: error: (shift.signed) + // :: error: [shift.signed] testRes = ((unsigned >> 8)) & 0xFFFFFFFF; - // :: error: (shift.unsigned) + // :: error: [shift.unsigned] testRes = ((signed >>> 8)) & 0xFFFFFFFF; testRes = ((signed >> 8)) & 0xFFFFFFFF; @@ -114,10 +114,10 @@ public void MaskedAndShifts(@Unsigned int unsigned, @Signed int signed) { testRes = 0xFFFFFFFF & (unsigned >>> 8); - // :: error: (shift.signed) + // :: error: [shift.signed] testRes = 0xFFFFFFFF & (unsigned >> 8); - // :: error: (shift.unsigned) + // :: error: [shift.unsigned] testRes = 0xFFFFFFFF & (signed >>> 8); testRes = 0xFFFFFFFF & (signed >> 8); @@ -135,10 +135,10 @@ public void MaskedAndShifts(@Unsigned int unsigned, @Signed int signed) { testRes = 0xFFFFFFFF & unsigned >>> 8; - // :: error: (shift.signed) + // :: error: [shift.signed] testRes = 0xFFFFFFFF & unsigned >> 8; - // :: error: (shift.unsigned) + // :: error: [shift.unsigned] testRes = 0xFFFFFFFF & signed >>> 8; testRes = 0xFFFFFFFF & signed >> 8; @@ -156,10 +156,10 @@ public void MaskedAndShifts(@Unsigned int unsigned, @Signed int signed) { testRes = unsigned >>> 8 & (0xFFFFFFFF); - // :: error: (shift.signed) + // :: error: [shift.signed] testRes = unsigned >> 8 & (0xFFFFFFFF); - // :: error: (shift.unsigned) + // :: error: [shift.unsigned] testRes = signed >>> 8 & (0xFFFFFFFF); testRes = signed >> 8 & (0xFFFFFFFF); @@ -177,10 +177,10 @@ public void MaskedAndShifts(@Unsigned int unsigned, @Signed int signed) { testRes = unsigned >>> 8 & ((0xFFFFFFFF)); - // :: error: (shift.signed) + // :: error: [shift.signed] testRes = unsigned >> 8 & ((0xFFFFFFFF)); - // :: error: (shift.unsigned) + // :: error: [shift.unsigned] testRes = signed >>> 8 & ((0xFFFFFFFF)); testRes = signed >> 8 & ((0xFFFFFFFF)); } @@ -210,10 +210,10 @@ public void MaskedOrShifts(@Unsigned int unsigned, @Signed int signed) { // The right-most introduced bit now matters. testRes = (unsigned >>> 8) | 0xFE000000; - // :: error: (shift.signed) + // :: error: [shift.signed] testRes = (unsigned >> 8) | 0xFE000000; - // :: error: (shift.unsigned) + // :: error: [shift.unsigned] testRes = (signed >>> 8) | 0xFE000000; testRes = (signed >> 8) | 0xFE000000; @@ -223,10 +223,10 @@ public void MaskedOrShifts(@Unsigned int unsigned, @Signed int signed) { // Now the left-most introduced bit matters testRes = (unsigned >>> 8) | 0x8F000000; - // :: error: (shift.signed) + // :: error: [shift.signed] testRes = (unsigned >> 8) | 0x8F000000; - // :: error: (shift.unsigned) + // :: error: [shift.unsigned] testRes = (signed >>> 8) | 0x8F000000; testRes = (signed >> 8) | 0x8F000000; @@ -234,10 +234,10 @@ public void MaskedOrShifts(@Unsigned int unsigned, @Signed int signed) { testRes = (unsigned >>> 8) | 0x0; - // :: error: (shift.signed) + // :: error: [shift.signed] testRes = (unsigned >> 8) | 0x0; - // :: error: (shift.unsigned) + // :: error: [shift.unsigned] testRes = (signed >>> 8) | 0x0; testRes = (signed >> 8) | 0x0; @@ -255,10 +255,10 @@ public void MaskedOrShifts(@Unsigned int unsigned, @Signed int signed) { testRes = unsigned >>> 8 | 0x0; - // :: error: (shift.signed) + // :: error: [shift.signed] testRes = unsigned >> 8 | 0x0; - // :: error: (shift.unsigned) + // :: error: [shift.unsigned] testRes = signed >>> 8 | 0x0; testRes = signed >> 8 | 0x0; @@ -276,10 +276,10 @@ public void MaskedOrShifts(@Unsigned int unsigned, @Signed int signed) { testRes = ((unsigned >>> 8)) | 0x0; - // :: error: (shift.signed) + // :: error: [shift.signed] testRes = ((unsigned >> 8)) | 0x0; - // :: error: (shift.unsigned) + // :: error: [shift.unsigned] testRes = ((signed >>> 8)) | 0x0; testRes = ((signed >> 8)) | 0x0; @@ -297,10 +297,10 @@ public void MaskedOrShifts(@Unsigned int unsigned, @Signed int signed) { testRes = 0x0 | (unsigned >>> 8); - // :: error: (shift.signed) + // :: error: [shift.signed] testRes = 0x0 | (unsigned >> 8); - // :: error: (shift.unsigned) + // :: error: [shift.unsigned] testRes = 0x0 | (signed >>> 8); testRes = 0x0 | (signed >> 8); @@ -318,10 +318,10 @@ public void MaskedOrShifts(@Unsigned int unsigned, @Signed int signed) { testRes = unsigned >>> 8 | (0x0); - // :: error: (shift.signed) + // :: error: [shift.signed] testRes = unsigned >> 8 | (0x0); - // :: error: (shift.unsigned) + // :: error: [shift.unsigned] testRes = signed >>> 8 | (0x0); testRes = signed >> 8 | (0x0); @@ -339,10 +339,10 @@ public void MaskedOrShifts(@Unsigned int unsigned, @Signed int signed) { testRes = unsigned >>> 8 | ((0x0)); - // :: error: (shift.signed) + // :: error: [shift.signed] testRes = unsigned >> 8 | ((0x0)); - // :: error: (shift.unsigned) + // :: error: [shift.unsigned] testRes = signed >>> 8 | ((0x0)); testRes = signed >> 8 | ((0x0)); } diff --git a/checker/tests/signedness/ObjectCasts.java b/checker/tests/signedness/ObjectCasts.java index fbb0c47dddc1..c517a8f9f63e 100644 --- a/checker/tests/signedness/ObjectCasts.java +++ b/checker/tests/signedness/ObjectCasts.java @@ -10,7 +10,7 @@ Integer castObjectToInteger1(Object o) { } Integer castObjectToInteger2(@Unsigned Object o) { - // :: error: (return) + // :: error: [return] return (Integer) o; } @@ -23,7 +23,7 @@ Integer castObjectToInteger3(@Signed Object o) { } @Signed Integer castObjectToInteger5(@Unsigned Object o) { - // :: error: (return) + // :: error: [return] return (Integer) o; } @@ -32,7 +32,7 @@ Integer castObjectToInteger3(@Signed Object o) { } @Unsigned Integer castObjectToInteger7(Object o) { - // :: error: (return) + // :: error: [return] return (Integer) o; } @@ -41,7 +41,7 @@ Integer castObjectToInteger3(@Signed Object o) { } @Unsigned Integer castObjectToInteger9(@Signed Object o) { - // :: error: (return) + // :: error: [return] return (Integer) o; } @@ -50,7 +50,7 @@ Object castIntegerToObject1(Integer o) { } Object castIntegerToObject2(@Unsigned Integer o) { - // :: error: (return) + // :: error: [return] return (Object) o; } @@ -63,7 +63,7 @@ Object castIntegerToObject3(@Signed Integer o) { } @Signed Object castIntegerToObject5(@Unsigned Integer o) { - // :: error: (return) + // :: error: [return] return (Object) o; } @@ -72,7 +72,7 @@ Object castIntegerToObject3(@Signed Integer o) { } @Unsigned Object castIntegerToObject7(Integer o) { - // :: error: (return) + // :: error: [return] return (Object) o; } @@ -81,7 +81,7 @@ Object castIntegerToObject3(@Signed Integer o) { } @Unsigned Object castIntegerToObject9(@Signed Integer o) { - // :: error: (return) + // :: error: [return] return (Object) o; } diff --git a/checker/tests/signedness/Operations.java b/checker/tests/signedness/Operations.java index 8dd068dff58a..6dfaa8dbcfb2 100644 --- a/checker/tests/signedness/Operations.java +++ b/checker/tests/signedness/Operations.java @@ -6,16 +6,16 @@ public void DivModTest(@Unsigned int unsigned) { @UnknownSignedness int testRes; - // :: error: (operation.unsignedlhs) + // :: error: [operation.unsignedlhs] testRes = unsigned / 1; - // :: error: (operation.unsignedrhs) + // :: error: [operation.unsignedrhs] testRes = 1 / unsigned; - // :: error: (operation.unsignedlhs) + // :: error: [operation.unsignedlhs] testRes = unsigned % 1; - // :: error: (operation.unsignedrhs) + // :: error: [operation.unsignedrhs] testRes = 1 % unsigned; } @@ -23,7 +23,7 @@ public void SignedRightShiftTest(@Unsigned int unsigned) { @UnknownSignedness int testRes; - // :: error: (shift.signed) + // :: error: [shift.signed] testRes = unsigned >> 1; } @@ -31,7 +31,7 @@ public void UnsignedRightShiftTest(@Signed int signed) { @UnknownSignedness int testRes; - // :: error: (shift.unsigned) + // :: error: [shift.unsigned] testRes = signed >>> 1; } @@ -39,40 +39,40 @@ public void BinaryOperationTest(@Unsigned int unsigned, @Signed int signed) { @UnknownSignedness int testRes; - // :: error: (operation.mixed.unsignedlhs) + // :: error: [operation.mixed.unsignedlhs] testRes = unsigned * signed; - // :: error: (operation.mixed.unsignedrhs) + // :: error: [operation.mixed.unsignedrhs] testRes = signed * unsigned; - // :: error: (operation.mixed.unsignedlhs) + // :: error: [operation.mixed.unsignedlhs] testRes = unsigned + signed; - // :: error: (operation.mixed.unsignedrhs) + // :: error: [operation.mixed.unsignedrhs] testRes = signed + unsigned; - // :: error: (operation.mixed.unsignedlhs) + // :: error: [operation.mixed.unsignedlhs] testRes = unsigned - signed; - // :: error: (operation.mixed.unsignedrhs) + // :: error: [operation.mixed.unsignedrhs] testRes = signed - unsigned; - // :: error: (operation.mixed.unsignedlhs) + // :: error: [operation.mixed.unsignedlhs] testRes = unsigned & signed; - // :: error: (operation.mixed.unsignedrhs) + // :: error: [operation.mixed.unsignedrhs] testRes = signed & unsigned; - // :: error: (operation.mixed.unsignedlhs) + // :: error: [operation.mixed.unsignedlhs] testRes = unsigned ^ signed; - // :: error: (operation.mixed.unsignedrhs) + // :: error: [operation.mixed.unsignedrhs] testRes = signed ^ unsigned; - // :: error: (operation.mixed.unsignedlhs) + // :: error: [operation.mixed.unsignedlhs] testRes = unsigned | signed; - // :: error: (operation.mixed.unsignedrhs) + // :: error: [operation.mixed.unsignedrhs] testRes = signed | unsigned; } } diff --git a/checker/tests/signedness/PolymorphicReturnType.java b/checker/tests/signedness/PolymorphicReturnType.java index 58cff4565b80..1a45eccb4d86 100644 --- a/checker/tests/signedness/PolymorphicReturnType.java +++ b/checker/tests/signedness/PolymorphicReturnType.java @@ -6,7 +6,7 @@ public class PolymorphicReturnType { public @PolySigned byte get() { - // :: error: (return) + // :: error: [return] return 0; } } diff --git a/checker/tests/signedness/RestrictedPolymorphism.java b/checker/tests/signedness/RestrictedPolymorphism.java index d37fa32b82e5..733bcae3e84f 100644 --- a/checker/tests/signedness/RestrictedPolymorphism.java +++ b/checker/tests/signedness/RestrictedPolymorphism.java @@ -11,9 +11,9 @@ public void foo(@PolySigned Object a, @PolySigned Object b) {} void client() { foo(sn, sn); - // :: error: (argument) + // :: error: [argument] foo(sn, un); - // :: error: (argument) + // :: error: [argument] foo(un, sn); foo(un, un); } diff --git a/checker/tests/signedness/SignednessAssignments.java b/checker/tests/signedness/SignednessAssignments.java index f4900804c656..8b2f67087f05 100644 --- a/checker/tests/signedness/SignednessAssignments.java +++ b/checker/tests/signedness/SignednessAssignments.java @@ -37,13 +37,13 @@ void assignmentsByte() { } void assignmentsShort() { - // :: error: (assignment) + // :: error: [assignment] @SignedPositive short i1 = sb; - // :: error: (assignment) + // :: error: [assignment] @SignedPositive short i2 = ub; - // :: error: (assignment) + // :: error: [assignment] @SignedPositive short i3 = sB; - // :: error: (assignment) + // :: error: [assignment] @SignedPositive short i4 = uB; @Signed short i9 = ss; @@ -66,22 +66,22 @@ void assignmentsChar() { } void assignmentsInt() { - // :: error: (assignment) + // :: error: [assignment] @SignedPositive int i1 = sb; - // :: error: (assignment) + // :: error: [assignment] @SignedPositive int i2 = ub; - // :: error: (assignment) + // :: error: [assignment] @SignedPositive int i3 = sB; - // :: error: (assignment) + // :: error: [assignment] @SignedPositive int i4 = uB; - // :: error: (assignment) + // :: error: [assignment] @SignedPositive int i9 = ss; - // :: error: (assignment) + // :: error: [assignment] @SignedPositive int i10 = us; - // :: error: (assignment) + // :: error: [assignment] @SignedPositive int i11 = sS; - // :: error: (assignment) + // :: error: [assignment] @SignedPositive int i12 = uS; @Signed int i13 = si; @@ -96,31 +96,31 @@ void assignmentsInt() { } void assignmentsLong() { - // :: error: (assignment) + // :: error: [assignment] @SignedPositive long i1 = sb; - // :: error: (assignment) + // :: error: [assignment] @SignedPositive long i2 = ub; - // :: error: (assignment) + // :: error: [assignment] @SignedPositive long i3 = sB; - // :: error: (assignment) + // :: error: [assignment] @SignedPositive long i4 = uB; - // :: error: (assignment) + // :: error: [assignment] @SignedPositive long i9 = ss; - // :: error: (assignment) + // :: error: [assignment] @SignedPositive long i10 = us; - // :: error: (assignment) + // :: error: [assignment] @SignedPositive long i11 = sS; - // :: error: (assignment) + // :: error: [assignment] @SignedPositive long i12 = uS; - // :: error: (assignment) + // :: error: [assignment] @SignedPositive long i13 = si; - // :: error: (assignment) + // :: error: [assignment] @SignedPositive long i14 = ui; - // :: error: (assignment) + // :: error: [assignment] @SignedPositive long i15 = sI; - // :: error: (assignment) + // :: error: [assignment] @SignedPositive long i16 = uI; @Signed long i17 = sl; diff --git a/checker/tests/signedness/SignednessCast.java b/checker/tests/signedness/SignednessCast.java index 4375c8e7c08b..f2962cf277ab 100644 --- a/checker/tests/signedness/SignednessCast.java +++ b/checker/tests/signedness/SignednessCast.java @@ -33,7 +33,7 @@ Serializable maybeNumber(String name) { } catch (final Exception e) { throw new IllegalArgumentException("Could not find instruction: " + name, e); } - // :: error: (return) + // :: error: [return] return i; } } diff --git a/checker/tests/signedness/SignednessEquals.java b/checker/tests/signedness/SignednessEquals.java index 5709ac70f6e4..3e82173b7f05 100644 --- a/checker/tests/signedness/SignednessEquals.java +++ b/checker/tests/signedness/SignednessEquals.java @@ -35,30 +35,30 @@ public class SignednessEquals { void nonIntegralEquality() { so.equals(sn); - // :: error: (comparison.mixed.unsignedrhs) + // :: error: [comparison.mixed.unsignedrhs] so.equals(un); - // :: error: (comparison.mixed.unsignedlhs) + // :: error: [comparison.mixed.unsignedlhs] uo.equals(sn); uo.equals(un); Objects.equals(so, sn); - // :: error: (comparison.mixed.unsignedrhs) + // :: error: [comparison.mixed.unsignedrhs] Objects.equals(so, un); - // :: error: (comparison.mixed.unsignedlhs) + // :: error: [comparison.mixed.unsignedlhs] Objects.equals(uo, sn); Objects.equals(uo, un); sI.equals(sn); - // :: error: (comparison.mixed.unsignedrhs) + // :: error: [comparison.mixed.unsignedrhs] sI.equals(un); - // :: error: (comparison.mixed.unsignedlhs) + // :: error: [comparison.mixed.unsignedlhs] uI.equals(sn); uI.equals(un); Objects.equals(sI, sn); - // :: error: (comparison.mixed.unsignedrhs) + // :: error: [comparison.mixed.unsignedrhs] Objects.equals(sI, un); - // :: error: (comparison.mixed.unsignedlhs) + // :: error: [comparison.mixed.unsignedlhs] Objects.equals(uI, sn); Objects.equals(uI, un); } @@ -66,30 +66,30 @@ void nonIntegralEquality() { void integralEquality() { so.equals(sS); - // :: error: (comparison.mixed.unsignedrhs) + // :: error: [comparison.mixed.unsignedrhs] so.equals(uS); - // :: error: (comparison.mixed.unsignedlhs) + // :: error: [comparison.mixed.unsignedlhs] uo.equals(sS); uo.equals(uS); Objects.equals(so, sS); - // :: error: (comparison.mixed.unsignedrhs) + // :: error: [comparison.mixed.unsignedrhs] Objects.equals(so, uS); - // :: error: (comparison.mixed.unsignedlhs) + // :: error: [comparison.mixed.unsignedlhs] Objects.equals(uo, sS); Objects.equals(uo, uS); sB.equals(sS); - // :: error: (comparison.mixed.unsignedrhs) + // :: error: [comparison.mixed.unsignedrhs] sB.equals(uS); - // :: error: (comparison.mixed.unsignedlhs) + // :: error: [comparison.mixed.unsignedlhs] uB.equals(sS); uB.equals(uS); Objects.equals(sB, sS); - // :: error: (comparison.mixed.unsignedrhs) + // :: error: [comparison.mixed.unsignedrhs] Objects.equals(sB, uS); - // :: error: (comparison.mixed.unsignedlhs) + // :: error: [comparison.mixed.unsignedlhs] Objects.equals(uB, sS); Objects.equals(uB, uS); } diff --git a/checker/tests/signedness/SignednessManualExample.java b/checker/tests/signedness/SignednessManualExample.java index 6f45522c4949..39f9bcd2267a 100644 --- a/checker/tests/signedness/SignednessManualExample.java +++ b/checker/tests/signedness/SignednessManualExample.java @@ -12,7 +12,7 @@ public class SignednessManualExample { void m() { int w = s1 / s2; // OK: result is 2, which is correct for -2 / -1 - // :: error: (operation.unsignedlhs) + // :: error: [operation.unsignedlhs] int x = u1 / u2; // ERROR: result is 2, which is incorrect for (2^32 - 2) / (2^32 - 1) } @@ -24,7 +24,7 @@ void m() { void m2() { int y = s3 % s4; // OK: result is -1, which is correct for -1 % 5 - // :: error: (operation.unsignedlhs) + // :: error: [operation.unsignedlhs] int z = u3 % u4; // ERROR: result is -1, which is incorrect for (2^32 - 1) % 5 = 2 } diff --git a/checker/tests/signedness/SignednessNumberCasts.java b/checker/tests/signedness/SignednessNumberCasts.java index cf80bbeb052f..aa31f7e05bda 100644 --- a/checker/tests/signedness/SignednessNumberCasts.java +++ b/checker/tests/signedness/SignednessNumberCasts.java @@ -4,7 +4,7 @@ public class SignednessNumberCasts { Double d2; void test(MyClass o, MyClass signed) { - // :: error: (assignment) + // :: error: [assignment] @Signed int i = (Integer) o.get(); @Signed int i2 = (Integer) signed.get(); Double d = (Double) o.get(); diff --git a/checker/tests/signedness/StringConcat.java b/checker/tests/signedness/StringConcat.java index c9b6d684735b..aeee6f9359d5 100644 --- a/checker/tests/signedness/StringConcat.java +++ b/checker/tests/signedness/StringConcat.java @@ -2,7 +2,7 @@ public class StringConcat { public String doConcat(@Unsigned int i, String s) { - // :: error: (unsigned.concat) + // :: error: [unsigned.concat] return s + i; } } diff --git a/checker/tests/signedness/TestPrintln.java b/checker/tests/signedness/TestPrintln.java index 2e0823fcf373..61d9f6aaf285 100644 --- a/checker/tests/signedness/TestPrintln.java +++ b/checker/tests/signedness/TestPrintln.java @@ -10,10 +10,10 @@ public static void main(String[] args) { @Unsigned int a = Integer.parseUnsignedInt("2147483647"); System.out.println(a); @Unsigned int b = Integer.parseUnsignedInt("2147483648"); - // :: error: (argument) + // :: error: [argument] System.out.println(b); @Unsigned int c = Integer.parseUnsignedInt("4000000000"); - // :: error: (argument) + // :: error: [argument] System.out.println(c); } } diff --git a/checker/tests/signedness/UnsignedConcat.java b/checker/tests/signedness/UnsignedConcat.java index f1459ced6f42..fd84ce1d60c9 100644 --- a/checker/tests/signedness/UnsignedConcat.java +++ b/checker/tests/signedness/UnsignedConcat.java @@ -10,17 +10,17 @@ public class UnsignedConcat { @Signed int signedInt = -2; void test1(char c, Character charObj) { - // :: error: (unsigned.concat) + // :: error: [unsigned.concat] String s1 = "" + unsignedShort; - // :: error: (unsigned.concat) + // :: error: [unsigned.concat] String s2 = "" + unsignedInt; - // :: error: (unsigned.concat) + // :: error: [unsigned.concat] String s1b = unsignedShort + ""; - // :: error: (unsigned.concat) + // :: error: [unsigned.concat] String s2b = "" + unsignedInt + ""; String s3 = "" + signedShort; String s4 = "" + signedInt; - // :: error: (unsigned.concat) + // :: error: [unsigned.concat] String s5 = "" + unknownInt; String s6 = "" + -1; @@ -29,13 +29,13 @@ void test1(char c, Character charObj) { } void test2(String s, char c, Character charObj) { - // :: error: (unsigned.concat) + // :: error: [unsigned.concat] s += unsignedShort; - // :: error: (unsigned.concat) + // :: error: [unsigned.concat] s += +unsignedInt; s += "" + signedShort; s += signedInt; - // :: error: (unsigned.concat) + // :: error: [unsigned.concat] s += unknownInt; s += 9; s += c; diff --git a/checker/tests/signedness/Utils.java b/checker/tests/signedness/Utils.java index 9874213b3456..dd31c4c213b1 100644 --- a/checker/tests/signedness/Utils.java +++ b/checker/tests/signedness/Utils.java @@ -15,22 +15,22 @@ public void getTests( @Signed byte[] sbyteArr, ByteBuffer b) { - // :: error: (assignment) + // :: error: [assignment] sint = SignednessUtil.getUnsignedInt(b); uint = SignednessUtil.getUnsignedInt(b); - // :: error: (assignment) + // :: error: [assignment] sshort = SignednessUtil.getUnsignedShort(b); ushort = SignednessUtil.getUnsignedShort(b); - // :: error: (assignment) + // :: error: [assignment] sbyte = SignednessUtil.getUnsigned(b); ubyte = SignednessUtil.getUnsigned(b); - // :: error: (argument) + // :: error: [argument] SignednessUtil.getUnsigned(b, sbyteArr); SignednessUtil.getUnsigned(b, ubyteArr); @@ -48,46 +48,46 @@ public void compTests( int res; - // :: error: (argument) + // :: error: [argument] res = Long.compareUnsigned(slong, slong); - // :: error: (argument) + // :: error: [argument] res = Long.compareUnsigned(slong, ulong); - // :: error: (argument) + // :: error: [argument] res = Long.compareUnsigned(ulong, slong); res = Long.compareUnsigned(ulong, ulong); - // :: error: (argument) + // :: error: [argument] res = Integer.compareUnsigned(sint, sint); - // :: error: (argument) + // :: error: [argument] res = Integer.compareUnsigned(sint, uint); - // :: error: (argument) + // :: error: [argument] res = Integer.compareUnsigned(uint, sint); res = Integer.compareUnsigned(uint, uint); - // :: error: (argument) + // :: error: [argument] res = SignednessUtil.compareUnsigned(sshort, sshort); - // :: error: (argument) + // :: error: [argument] res = SignednessUtil.compareUnsigned(sshort, ushort); - // :: error: (argument) + // :: error: [argument] res = SignednessUtil.compareUnsigned(ushort, sshort); res = SignednessUtil.compareUnsigned(ushort, ushort); - // :: error: (argument) + // :: error: [argument] res = SignednessUtil.compareUnsigned(sbyte, sbyte); - // :: error: (argument) + // :: error: [argument] res = SignednessUtil.compareUnsigned(sbyte, ubyte); - // :: error: (argument) + // :: error: [argument] res = SignednessUtil.compareUnsigned(ubyte, sbyte); res = SignednessUtil.compareUnsigned(ubyte, ubyte); @@ -105,42 +105,42 @@ public void stringTests( String res; - // :: error: (argument) + // :: error: [argument] res = Long.toUnsignedString(slong); res = Long.toUnsignedString(ulong); - // :: error: (argument) + // :: error: [argument] res = Long.toUnsignedString(slong, 10); res = Long.toUnsignedString(ulong, 10); - // :: error: (argument) + // :: error: [argument] res = Integer.toUnsignedString(sint); res = Integer.toUnsignedString(uint); - // :: error: (argument) + // :: error: [argument] res = Integer.toUnsignedString(sint, 10); res = Integer.toUnsignedString(uint, 10); - // :: error: (argument) + // :: error: [argument] res = SignednessUtil.toUnsignedString(sshort); res = SignednessUtil.toUnsignedString(ushort); - // :: error: (argument) + // :: error: [argument] res = SignednessUtil.toUnsignedString(sshort, 10); res = SignednessUtil.toUnsignedString(ushort, 10); - // :: error: (argument) + // :: error: [argument] res = SignednessUtil.toUnsignedString(sbyte); res = SignednessUtil.toUnsignedString(ubyte); - // :: error: (argument) + // :: error: [argument] res = SignednessUtil.toUnsignedString(sbyte, 10); res = SignednessUtil.toUnsignedString(ubyte, 10); diff --git a/checker/tests/signedness/UtilsJava8.java b/checker/tests/signedness/UtilsJava8.java index 2527bd91764a..8aaeae751ac1 100644 --- a/checker/tests/signedness/UtilsJava8.java +++ b/checker/tests/signedness/UtilsJava8.java @@ -16,92 +16,92 @@ public void annotatedJDKTests( int resInt; long resLong; - // :: error: (argument) + // :: error: [argument] resString = Long.toUnsignedString(slong, 10); resString = Long.toUnsignedString(ulong, 10); - // :: error: (argument) + // :: error: [argument] resString = Long.toUnsignedString(slong); resString = Long.toUnsignedString(ulong); - // :: error: (assignment) + // :: error: [assignment] slong = Long.parseUnsignedLong(s, 10); ulong = Long.parseUnsignedLong(s, 10); - // :: error: (assignment) + // :: error: [assignment] slong = Long.parseUnsignedLong(s); ulong = Long.parseUnsignedLong(s); - // :: error: (argument) + // :: error: [argument] resInt = Long.compareUnsigned(slong, slong); - // :: error: (argument) + // :: error: [argument] resInt = Long.compareUnsigned(slong, ulong); - // :: error: (argument) + // :: error: [argument] resInt = Long.compareUnsigned(ulong, slong); resInt = Long.compareUnsigned(ulong, ulong); - // :: error: (argument) + // :: error: [argument] ulong = Long.divideUnsigned(slong, slong); - // :: error: (argument) + // :: error: [argument] ulong = Long.divideUnsigned(slong, ulong); - // :: error: (argument) + // :: error: [argument] ulong = Long.divideUnsigned(ulong, slong); - // :: error: (assignment) + // :: error: [assignment] slong = Long.divideUnsigned(ulong, ulong); ulong = Long.divideUnsigned(ulong, ulong); - // :: error: (argument) + // :: error: [argument] ulong = Long.remainderUnsigned(slong, slong); - // :: error: (argument) + // :: error: [argument] ulong = Long.remainderUnsigned(slong, ulong); - // :: error: (argument) + // :: error: [argument] ulong = Long.remainderUnsigned(ulong, slong); - // :: error: (assignment) + // :: error: [assignment] slong = Long.remainderUnsigned(ulong, ulong); ulong = Long.remainderUnsigned(ulong, ulong); - // :: error: (argument) + // :: error: [argument] resString = Integer.toUnsignedString(sint, 10); resString = Integer.toUnsignedString(uint, 10); - // :: error: (argument) + // :: error: [argument] resString = Integer.toUnsignedString(sint); resString = Integer.toUnsignedString(uint); - // :: error: (assignment) + // :: error: [assignment] sint = Integer.parseUnsignedInt(s, 10); uint = Integer.parseUnsignedInt(s, 10); - // :: error: (assignment) + // :: error: [assignment] sint = Integer.parseUnsignedInt(s); uint = Integer.parseUnsignedInt(s); - // :: error: (argument) + // :: error: [argument] resInt = Integer.compareUnsigned(sint, sint); - // :: error: (argument) + // :: error: [argument] resInt = Integer.compareUnsigned(sint, uint); - // :: error: (argument) + // :: error: [argument] resInt = Integer.compareUnsigned(uint, sint); resInt = Integer.compareUnsigned(uint, uint); @@ -110,30 +110,30 @@ public void annotatedJDKTests( ulong = Integer.toUnsignedLong(uint); - // :: error: (argument) + // :: error: [argument] uint = Integer.divideUnsigned(sint, sint); - // :: error: (argument) + // :: error: [argument] uint = Integer.divideUnsigned(sint, uint); - // :: error: (argument) + // :: error: [argument] uint = Integer.divideUnsigned(uint, sint); - // :: error: (assignment) + // :: error: [assignment] sint = Integer.divideUnsigned(uint, uint); uint = Integer.divideUnsigned(uint, uint); - // :: error: (argument) + // :: error: [argument] uint = Integer.remainderUnsigned(sint, sint); - // :: error: (argument) + // :: error: [argument] uint = Integer.remainderUnsigned(sint, uint); - // :: error: (argument) + // :: error: [argument] uint = Integer.remainderUnsigned(uint, sint); - // :: error: (assignment) + // :: error: [assignment] sint = Integer.remainderUnsigned(uint, uint); uint = Integer.remainderUnsigned(uint, uint); diff --git a/checker/tests/signedness/ValueIntegration.java b/checker/tests/signedness/ValueIntegration.java index ede42e05e6d7..f7429d23916e 100644 --- a/checker/tests/signedness/ValueIntegration.java +++ b/checker/tests/signedness/ValueIntegration.java @@ -23,33 +23,33 @@ public void ByteValRules( ptest = c; stest = upure; - // :: error: (assignment) + // :: error: [assignment] gtest = upure; - // :: error: (assignment) + // :: error: [assignment] ptest = upure; stest = umixed; - // :: error: (assignment) + // :: error: [assignment] gtest = umixed; - // :: error: (assignment) + // :: error: [assignment] ptest = umixed; stest = spure; - // :: error: (assignment) + // :: error: [assignment] gtest = spure; - // :: error: (assignment) + // :: error: [assignment] ptest = spure; stest = smixed; - // :: error: (assignment) + // :: error: [assignment] gtest = smixed; - // :: error: (assignment) + // :: error: [assignment] ptest = smixed; stest = bmixed; - // :: error: (assignment) + // :: error: [assignment] gtest = bmixed; - // :: error: (assignment) + // :: error: [assignment] ptest = bmixed; } @@ -71,33 +71,33 @@ public void CharValRules( ptest = c; stest = upure; - // XX error: (assignment) + // XX error: [assignment] gtest = upure; - // XX error: (assignment) + // XX error: [assignment] ptest = upure; stest = umixed; - // XX error: (assignment) + // XX error: [assignment] gtest = umixed; - // XX error: (assignment) + // XX error: [assignment] ptest = umixed; stest = spure; - // XX error: (assignment) + // XX error: [assignment] gtest = spure; - // XX error: (assignment) + // XX error: [assignment] ptest = spure; stest = smixed; - // XX error: (assignment) + // XX error: [assignment] gtest = smixed; - // XX error: (assignment) + // XX error: [assignment] ptest = smixed; stest = bmixed; - // XX error: (assignment) + // XX error: [assignment] gtest = bmixed; - // XX error: (assignment) + // XX error: [assignment] ptest = bmixed; } */ @@ -118,33 +118,33 @@ public void ShortValRules( ptest = c; stest = upure; - // :: error: (assignment) + // :: error: [assignment] gtest = upure; - // :: error: (assignment) + // :: error: [assignment] ptest = upure; stest = umixed; - // :: error: (assignment) + // :: error: [assignment] gtest = umixed; - // :: error: (assignment) + // :: error: [assignment] ptest = umixed; stest = spure; - // :: error: (assignment) + // :: error: [assignment] gtest = spure; - // :: error: (assignment) + // :: error: [assignment] ptest = spure; stest = smixed; - // :: error: (assignment) + // :: error: [assignment] gtest = smixed; - // :: error: (assignment) + // :: error: [assignment] ptest = smixed; stest = bmixed; - // :: error: (assignment) + // :: error: [assignment] gtest = bmixed; - // :: error: (assignment) + // :: error: [assignment] ptest = bmixed; } @@ -164,33 +164,33 @@ public void IntValRules( ptest = c; stest = upure; - // :: error: (assignment) + // :: error: [assignment] gtest = upure; - // :: error: (assignment) + // :: error: [assignment] ptest = upure; stest = umixed; - // :: error: (assignment) + // :: error: [assignment] gtest = umixed; - // :: error: (assignment) + // :: error: [assignment] ptest = umixed; stest = spure; - // :: error: (assignment) + // :: error: [assignment] gtest = spure; - // :: error: (assignment) + // :: error: [assignment] ptest = spure; stest = smixed; - // :: error: (assignment) + // :: error: [assignment] gtest = smixed; - // :: error: (assignment) + // :: error: [assignment] ptest = smixed; stest = bmixed; - // :: error: (assignment) + // :: error: [assignment] gtest = bmixed; - // :: error: (assignment) + // :: error: [assignment] ptest = bmixed; } @@ -208,21 +208,21 @@ public void LongValRules( ptest = c; stest = spure; - // :: error: (assignment) + // :: error: [assignment] gtest = spure; - // :: error: (assignment) + // :: error: [assignment] ptest = spure; stest = smixed; - // :: error: (assignment) + // :: error: [assignment] gtest = smixed; - // :: error: (assignment) + // :: error: [assignment] ptest = smixed; stest = bmixed; - // :: error: (assignment) + // :: error: [assignment] gtest = bmixed; - // :: error: (assignment) + // :: error: [assignment] ptest = bmixed; } @@ -252,33 +252,33 @@ public void ByteRangeRules( ptest = pc; stest = upure; - // :: error: (assignment) + // :: error: [assignment] gtest = upure; - // :: error: (assignment) + // :: error: [assignment] ptest = upure; stest = umixed; - // :: error: (assignment) + // :: error: [assignment] gtest = umixed; - // :: error: (assignment) + // :: error: [assignment] ptest = umixed; stest = spure; - // :: error: (assignment) + // :: error: [assignment] gtest = spure; - // :: error: (assignment) + // :: error: [assignment] ptest = spure; stest = smixed; - // :: error: (assignment) + // :: error: [assignment] gtest = smixed; - // :: error: (assignment) + // :: error: [assignment] ptest = smixed; stest = bmixed; - // :: error: (assignment) + // :: error: [assignment] gtest = bmixed; - // :: error: (assignment) + // :: error: [assignment] ptest = bmixed; } @@ -310,33 +310,33 @@ public void CharRangeRules( ptest = pc; stest = upure; - // XX error: (assignment) + // XX error: [assignment] gtest = upure; - // XX error: (assignment) + // XX error: [assignment] ptest = upure; stest = umixed; - // XX error: (assignment) + // XX error: [assignment] gtest = umixed; - // XX error: (assignment) + // XX error: [assignment] ptest = umixed; stest = spure; - // XX error: (assignment) + // XX error: [assignment] gtest = spure; - // XX error: (assignment) + // XX error: [assignment] ptest = spure; stest = smixed; - // XX error: (assignment) + // XX error: [assignment] gtest = smixed; - // XX error: (assignment) + // XX error: [assignment] ptest = smixed; stest = bmixed; - // XX error: (assignment) + // XX error: [assignment] gtest = bmixed; - // XX error: (assignment) + // XX error: [assignment] ptest = bmixed; } */ @@ -367,33 +367,33 @@ public void ShortRangeRules( ptest = pc; stest = upure; - // :: error: (assignment) + // :: error: [assignment] gtest = upure; - // :: error: (assignment) + // :: error: [assignment] ptest = upure; stest = umixed; - // :: error: (assignment) + // :: error: [assignment] gtest = umixed; - // :: error: (assignment) + // :: error: [assignment] ptest = umixed; stest = spure; - // :: error: (assignment) + // :: error: [assignment] gtest = spure; - // :: error: (assignment) + // :: error: [assignment] ptest = spure; stest = smixed; - // :: error: (assignment) + // :: error: [assignment] gtest = smixed; - // :: error: (assignment) + // :: error: [assignment] ptest = smixed; stest = bmixed; - // :: error: (assignment) + // :: error: [assignment] gtest = bmixed; - // :: error: (assignment) + // :: error: [assignment] ptest = bmixed; } @@ -423,33 +423,33 @@ public void IntRangeRules( ptest = pc; stest = upure; - // :: error: (assignment) + // :: error: [assignment] gtest = upure; - // :: error: (assignment) + // :: error: [assignment] ptest = upure; stest = umixed; - // :: error: (assignment) + // :: error: [assignment] gtest = umixed; - // :: error: (assignment) + // :: error: [assignment] ptest = umixed; stest = spure; - // :: error: (assignment) + // :: error: [assignment] gtest = spure; - // :: error: (assignment) + // :: error: [assignment] ptest = spure; stest = smixed; - // :: error: (assignment) + // :: error: [assignment] gtest = smixed; - // :: error: (assignment) + // :: error: [assignment] ptest = smixed; stest = bmixed; - // :: error: (assignment) + // :: error: [assignment] gtest = bmixed; - // :: error: (assignment) + // :: error: [assignment] ptest = bmixed; } @@ -477,21 +477,21 @@ public void LongRangeRules( ptest = pc; stest = spure; - // :: error: (assignment) + // :: error: [assignment] gtest = spure; - // :: error: (assignment) + // :: error: [assignment] ptest = spure; stest = smixed; - // :: error: (assignment) + // :: error: [assignment] gtest = smixed; - // :: error: (assignment) + // :: error: [assignment] ptest = smixed; stest = bmixed; - // :: error: (assignment) + // :: error: [assignment] gtest = bmixed; - // :: error: (assignment) + // :: error: [assignment] ptest = bmixed; } } diff --git a/checker/tests/signedness/WideningConversion.java b/checker/tests/signedness/WideningConversion.java index 7fd0676af424..2c339d3342c0 100644 --- a/checker/tests/signedness/WideningConversion.java +++ b/checker/tests/signedness/WideningConversion.java @@ -36,28 +36,28 @@ void plus() { si = si1 + si2; si = c1 + c2; - // :: error: (assignment) + // :: error: [assignment] si = c1 + ui2; - // :: error: (assignment) + // :: error: [assignment] si = ui1 + c2; - // :: error: (assignment) + // :: error: [assignment] si = ui1 + ui2; @Unsigned int ui; ui = c1 + c2; - // :: error: (assignment) + // :: error: [assignment] ui = c1 + i2; - // :: error: (assignment) + // :: error: [assignment] ui = i1 + c2; - // :: error: (assignment) + // :: error: [assignment] ui = i1 + i2; ui = c1 + c2; - // :: error: (assignment) + // :: error: [assignment] ui = c1 + si2; - // :: error: (assignment) + // :: error: [assignment] ui = si1 + c2; - // :: error: (assignment) + // :: error: [assignment] ui = si1 + si2; ui = c1 + c2; @@ -90,11 +90,11 @@ void plus() { } void to_string() { - // :: error: (unsigned.concat) + // :: error: [unsigned.concat] String s1 = "" + us1; - // :: error: (argument) + // :: error: [argument] String s2 = String.valueOf(us2); - // :: error: (argument) + // :: error: [argument] String s3 = Short.toString(us1); } } diff --git a/checker/tests/signedness/java17/Issue6100.java b/checker/tests/signedness/java17/Issue6100.java index def40af15ec4..b2c59efc59eb 100644 --- a/checker/tests/signedness/java17/Issue6100.java +++ b/checker/tests/signedness/java17/Issue6100.java @@ -7,7 +7,7 @@ public record Issue6100(List<@NonNegative Integer> bar) { public Issue6100 { List<@NonNegative Integer> b = bar; - // :: error: (assignment) + // :: error: [assignment] List b2 = bar; if (bar.size() < 0) { throw new IllegalArgumentException(); diff --git a/checker/tests/sqlquotes/SqlQuotesConcat.java b/checker/tests/sqlquotes/SqlQuotesConcat.java index 13b78068fa1e..e9edc0ac8ee9 100644 --- a/checker/tests/sqlquotes/SqlQuotesConcat.java +++ b/checker/tests/sqlquotes/SqlQuotesConcat.java @@ -6,69 +6,69 @@ public class SqlQuotesConcat { void oddOddConcat() { @SqlOddQuotes String odd1 = "asd''f'asdf''"; @SqlOddQuotes String odd2 = "''asdf''''asdf'asdf'asdf'asdf"; - // :: error: (assignment) + // :: error: [assignment] @SqlOddQuotes String oddResult1 = odd1 + odd2; @SqlEvenQuotes String evenResult1 = odd1 + odd2; - // :: error: (compound.assignment) + // :: error: [compound.assignment] odd1 += odd2; - // :: error: (compound.assignment) + // :: error: [compound.assignment] odd2 += odd1; @SqlOddQuotes String odd3 = "'asdf"; @SqlOddQuotes String odd4 = "', "; - // :: error: (assignment) + // :: error: [assignment] @SqlOddQuotes String oddResult2 = odd3 + odd4; @SqlEvenQuotes String evenResult2 = odd3 + odd4; - // :: error: (compound.assignment) + // :: error: [compound.assignment] odd3 += odd4; - // :: error: (compound.assignment) + // :: error: [compound.assignment] odd4 += odd3; } void oddEvenConcat() { @SqlOddQuotes String odd1 = "asd''f'asdf''"; @SqlEvenQuotes String even1 = "'''a'sdf"; - // :: error: (assignment) + // :: error: [assignment] @SqlEvenQuotes String evenResult1 = odd1 + even1; @SqlOddQuotes String oddResult1 = odd1 + even1; odd1 += even1; - // :: error: (compound.assignment) + // :: error: [compound.assignment] even1 += odd1; @SqlOddQuotes String odd2 = "'asdf"; @SqlEvenQuotes String even2 = "', asdf '"; - // :: error: (assignment) + // :: error: [assignment] @SqlEvenQuotes String evenResult2 = odd2 + even2; @SqlOddQuotes String oddResult2 = odd2 + even2; odd2 += even2; - // :: error: (compound.assignment) + // :: error: [compound.assignment] even2 += odd2; } void evenOddConcat() { @SqlOddQuotes String odd1 = "asd''f'asdf''"; @SqlEvenQuotes String even1 = "'''a'sdf"; - // :: error: (assignment) + // :: error: [assignment] @SqlEvenQuotes String evenResult1 = even1 + odd1; @SqlOddQuotes String oddResult1 = even1 + odd1; odd1 += even1; - // :: error: (compound.assignment) + // :: error: [compound.assignment] even1 += odd1; @SqlOddQuotes String odd2 = "'asdf"; @SqlEvenQuotes String even2 = "', asdf '"; - // :: error: (assignment) + // :: error: [assignment] @SqlEvenQuotes String evenResult2 = even2 + odd2; @SqlOddQuotes String oddResult2 = even2 + odd2; odd2 += even2; - // :: error: (compound.assignment) + // :: error: [compound.assignment] even2 += odd2; } void evenEvenConcat() { @SqlEvenQuotes String even1 = "''''asdf''asd'f''asdf''''asdf'asdf''"; @SqlEvenQuotes String even2 = "''asdf"; - // :: error: (assignment) + // :: error: [assignment] @SqlOddQuotes String oddResult1 = even1 + even2; @SqlEvenQuotes String evenResult1 = even1 + even2; even1 += even2; @@ -76,7 +76,7 @@ void evenEvenConcat() { @SqlEvenQuotes String even3 = "'a''sdf'"; @SqlEvenQuotes String even4 = "'asdf''asdf'asdf'asdf'''"; - // :: error: (assignment) + // :: error: [assignment] @SqlOddQuotes String oddResult2 = even3 + even4; @SqlEvenQuotes String evenResult2 = even3 + even4; even3 += even4; @@ -85,38 +85,38 @@ void evenEvenConcat() { void withTopConcat(@SqlQuotesUnknown String top) { @SqlOddQuotes String odd1 = "'asdf"; - // :: error: (assignment) + // :: error: [assignment] @SqlOddQuotes String oddResult1 = odd1 + top; - // :: error: (assignment) + // :: error: [assignment] @SqlEvenQuotes String evenResult1 = odd1 + top; String topResult1 = odd1 + top; - // :: error: (assignment) + // :: error: [assignment] @SqlOddQuotes String oddResult2 = top + odd1; - // :: error: (assignment) + // :: error: [assignment] @SqlEvenQuotes String evenResult2 = top + odd1; String topResult2 = top + odd1; - // :: error: (compound.assignment) + // :: error: [compound.assignment] odd1 += top; top += odd1; @SqlEvenQuotes String even1 = "'a''sdf'"; - // :: error: (assignment) + // :: error: [assignment] @SqlOddQuotes String oddResult3 = even1 + top; - // :: error: (assignment) + // :: error: [assignment] @SqlEvenQuotes String evenResult3 = even1 + top; String topResult3 = even1 + top; - // :: error: (assignment) + // :: error: [assignment] @SqlOddQuotes String oddResult4 = top + even1; - // :: error: (assignment) + // :: error: [assignment] @SqlEvenQuotes String evenResult4 = top + even1; String topResult4 = top + even1; - // :: error: (compound.assignment) + // :: error: [compound.assignment] even1 += top; top += even1; - // :: error: (assignment) + // :: error: [assignment] @SqlOddQuotes String oddResult5 = top + top; - // :: error: (assignment) + // :: error: [assignment] @SqlEvenQuotes String evenResult5 = top + top; String topResult5 = top + top; top += top; diff --git a/checker/tests/sqlquotes/SqlQuotesRegex.java b/checker/tests/sqlquotes/SqlQuotesRegex.java index c9263f815129..bdba46453dab 100644 --- a/checker/tests/sqlquotes/SqlQuotesRegex.java +++ b/checker/tests/sqlquotes/SqlQuotesRegex.java @@ -4,26 +4,26 @@ public class SqlQuotesRegex { void oddQuotes() { - // :: error: (assignment) + // :: error: [assignment] @SqlOddQuotes String none = "asdf"; @SqlOddQuotes String one = "asdf'asdf"; - // :: error: (assignment) + // :: error: [assignment] @SqlOddQuotes String two = "'asdf'"; @SqlOddQuotes String three = "'asdf'asdf'"; - // :: error: (assignment) + // :: error: [assignment] @SqlOddQuotes String manyEven = "'asdf''asdf'asdf'asdf'''"; @SqlOddQuotes String manyOdd = "''asdf'asdf'''asdf'asdf''"; } void evenQuotes() { @SqlEvenQuotes String none = ""; - // :: error: (assignment) + // :: error: [assignment] @SqlEvenQuotes String one = "'asdf"; @SqlEvenQuotes String two = "''asdf"; - // :: error: (assignment) + // :: error: [assignment] @SqlEvenQuotes String three = "asdf'asdf''"; @SqlEvenQuotes String manyEven = "''asdf''asdf'asdf''asdf'asdf"; - // :: error: (assignment) + // :: error: [assignment] @SqlEvenQuotes String manyOdd = "asdf''''asdf'asdf'asdf'asdf"; } } diff --git a/checker/tests/stubparser-nullness/MultidimentionalArrayAnnotationTest.java b/checker/tests/stubparser-nullness/MultidimentionalArrayAnnotationTest.java index b507141df3d2..cef4e53839ca 100644 --- a/checker/tests/stubparser-nullness/MultidimentionalArrayAnnotationTest.java +++ b/checker/tests/stubparser-nullness/MultidimentionalArrayAnnotationTest.java @@ -52,16 +52,16 @@ void callTomethod1() { */ void callTomethod2() { obj1 = method2(); - // :: error: (assignment) + // :: error: [assignment] obj2 = method2(); obj3 = method2(); obj4 = method2(); - // :: error: (assignment) + // :: error: [assignment] obj5 = method2(); - // :: error: (assignment) + // :: error: [assignment] obj6 = method2(); obj7 = method2(); - // :: error: (assignment) + // :: error: [assignment] obj8 = method2(); } @@ -71,15 +71,15 @@ void callTomethod2() { void callTomethod3() { obj1 = method3(); obj2 = method3(); - // :: error: (assignment) + // :: error: [assignment] obj3 = method3(); obj4 = method3(); - // :: error: (assignment) + // :: error: [assignment] obj5 = method3(); obj6 = method3(); - // :: error: (assignment) + // :: error: [assignment] obj7 = method3(); - // :: error: (assignment) + // :: error: [assignment] obj8 = method3(); } @@ -90,14 +90,14 @@ void callTomethod4() { obj1 = method4(); obj2 = method4(); obj3 = method4(); - // :: error: (assignment) + // :: error: [assignment] obj4 = method4(); obj5 = method4(); - // :: error: (assignment) + // :: error: [assignment] obj6 = method4(); - // :: error: (assignment) + // :: error: [assignment] obj7 = method4(); - // :: error: (assignment) + // :: error: [assignment] obj8 = method4(); } @@ -106,18 +106,18 @@ void callTomethod4() { */ void callTomethod5() { obj1 = method5(); - // :: error: (assignment) + // :: error: [assignment] obj2 = method5(); - // :: error: (assignment) + // :: error: [assignment] obj3 = method5(); obj4 = method5(); - // :: error: (assignment) + // :: error: [assignment] obj5 = method5(); - // :: error: (assignment) + // :: error: [assignment] obj6 = method5(); - // :: error: (assignment) + // :: error: [assignment] obj7 = method5(); - // :: error: (assignment) + // :: error: [assignment] obj8 = method5(); } @@ -126,18 +126,18 @@ void callTomethod5() { */ void callTomethod6() { obj1 = method6(); - // :: error: (assignment) + // :: error: [assignment] obj2 = method6(); obj3 = method6(); - // :: error: (assignment) + // :: error: [assignment] obj4 = method6(); - // :: error: (assignment) + // :: error: [assignment] obj5 = method6(); - // :: error: (assignment) + // :: error: [assignment] obj6 = method6(); - // :: error: (assignment) + // :: error: [assignment] obj7 = method6(); - // :: error: (assignment) + // :: error: [assignment] obj8 = method6(); } @@ -147,17 +147,17 @@ void callTomethod6() { void callTomethod7() { obj1 = method7(); obj2 = method7(); - // :: error: (assignment) + // :: error: [assignment] obj3 = method7(); - // :: error: (assignment) + // :: error: [assignment] obj4 = method7(); - // :: error: (assignment) + // :: error: [assignment] obj5 = method7(); - // :: error: (assignment) + // :: error: [assignment] obj6 = method7(); - // :: error: (assignment) + // :: error: [assignment] obj7 = method7(); - // :: error: (assignment) + // :: error: [assignment] obj8 = method7(); } @@ -166,19 +166,19 @@ void callTomethod7() { */ void callTomethod8() { obj1 = method8(); - // :: error: (assignment) + // :: error: [assignment] obj2 = method8(); - // :: error: (assignment) + // :: error: [assignment] obj3 = method8(); - // :: error: (assignment) + // :: error: [assignment] obj4 = method8(); - // :: error: (assignment) + // :: error: [assignment] obj5 = method8(); - // :: error: (assignment) + // :: error: [assignment] obj6 = method8(); - // :: error: (assignment) + // :: error: [assignment] obj7 = method8(); - // :: error: (assignment) + // :: error: [assignment] obj8 = method8(); } diff --git a/checker/tests/stubparser-nullness/NoExplicitAnnotations.java b/checker/tests/stubparser-nullness/NoExplicitAnnotations.java index 56542622082b..008b9868bc81 100644 --- a/checker/tests/stubparser-nullness/NoExplicitAnnotations.java +++ b/checker/tests/stubparser-nullness/NoExplicitAnnotations.java @@ -55,10 +55,10 @@ void use( nble = sub2.method2(); nn = sub2.method2(); nble = sub3.method3(); - // :: error: (assignment) + // :: error: [assignment] nn = sub3.method3(); - // :: error: (assignment) + // :: error: [assignment] nn = nble; } } diff --git a/checker/tests/stubparser-nullness/VarargConstructorParameterAnnotationTest.java b/checker/tests/stubparser-nullness/VarargConstructorParameterAnnotationTest.java index 71a3d4dd0d39..52aa97203f62 100644 --- a/checker/tests/stubparser-nullness/VarargConstructorParameterAnnotationTest.java +++ b/checker/tests/stubparser-nullness/VarargConstructorParameterAnnotationTest.java @@ -10,7 +10,7 @@ public void strArraysNonNull(@NonNull String[] parameter) { } public void strArraysNullable(@Nullable String[] parameter) { - // :: error: (argument) + // :: error: [argument] new ProcessBuilder(parameter); } @@ -19,7 +19,7 @@ public void strVarargNonNull(@NonNull String... parameter) { } public void strVarargNullable(@Nullable String... parameter) { - // :: error: (argument) + // :: error: [argument] new ProcessBuilder(parameter); } } diff --git a/checker/tests/stubparser-records/RecordUsage.java b/checker/tests/stubparser-records/RecordUsage.java index adbafe2e00be..bcb225f2a0da 100644 --- a/checker/tests/stubparser-records/RecordUsage.java +++ b/checker/tests/stubparser-records/RecordUsage.java @@ -4,7 +4,7 @@ class PairUsage { public void makePairs() { PairRecord a = new PairRecord("key", "value"); PairRecord b = new PairRecord(null); - // :: error: (assignment) + // :: error: [assignment] @NonNull Object o = a.value(); PairRecord p = new PairRecord("key", null); } @@ -12,13 +12,13 @@ public void makePairs() { public void makeStubbed() { RecordStubbed r = new RecordStubbed("a", "b", 7); RecordStubbed r1 = new RecordStubbed("a", "b", null); - // :: error: (argument) + // :: error: [argument] RecordStubbed r2 = new RecordStubbed((String) null, "b", null); - // :: error: (argument) + // :: error: [argument] RecordStubbed r3 = new RecordStubbed("a", null, null); @NonNull Object o = r.nxx(); @NonNull Object o2 = r.nsxx(); - // :: error: (assignment) + // :: error: [assignment] @NonNull Object o3 = r.xnn(); } } diff --git a/checker/tests/stubparser-tainting/FakeOverrideFormalParameter.java-TODO b/checker/tests/stubparser-tainting/FakeOverrideFormalParameter.java-TODO index 7bcf103d5f2c..aac8f39ed8f0 100644 --- a/checker/tests/stubparser-tainting/FakeOverrideFormalParameter.java-TODO +++ b/checker/tests/stubparser-tainting/FakeOverrideFormalParameter.java-TODO @@ -56,26 +56,26 @@ class FakeOverrideFPClient { mid.requiresTaintedInt(u); sub.requiresTaintedInt(u); - // :: error: (argument) + // :: error: [argument] sup.requiresUntaintedInt(t); - // :: error: (argument) + // :: error: [argument] mid.requiresUntaintedInt(t); - // :: error: (argument) + // :: error: [argument] sub.requiresUntaintedInt(t); sup.requiresUntaintedInt(u); mid.requiresUntaintedInt(u); sub.requiresUntaintedInt(u); sup.requiresTaintedIntWithFakeOverride(t); - // :: error: (argument) + // :: error: [argument] mid.requiresTaintedIntWithFakeOverride(t); - // :: error: (argument) + // :: error: [argument] sub.requiresTaintedIntWithFakeOverride(t); sup.requiresTaintedIntWithFakeOverride(u); mid.requiresTaintedIntWithFakeOverride(u); sub.requiresTaintedIntWithFakeOverride(u); - // :: error: (argument) + // :: error: [argument] sup.requiresUntaintedIntWithFakeOverride(t); mid.requiresUntaintedIntWithFakeOverride(t); sub.requiresUntaintedIntWithFakeOverride(t); diff --git a/checker/tests/stubparser-tainting/FakeOverrideReturn.java b/checker/tests/stubparser-tainting/FakeOverrideReturn.java index ca8a261a0470..47211399a12a 100644 --- a/checker/tests/stubparser-tainting/FakeOverrideReturn.java +++ b/checker/tests/stubparser-tainting/FakeOverrideReturn.java @@ -17,11 +17,11 @@ void m(@Tainted int t, @Untainted int u) { tf = sup.returnsTaintedInt(); tf = mid.returnsTaintedInt(); tf = sub.returnsTaintedInt(); - // :: error: (assignment) + // :: error: [assignment] uf = sup.returnsTaintedInt(); - // :: error: (assignment) + // :: error: [assignment] uf = mid.returnsTaintedInt(); - // :: error: (assignment) + // :: error: [assignment] uf = sub.returnsTaintedInt(); tf = sup.returnsUntaintedInt(); @@ -34,7 +34,7 @@ void m(@Tainted int t, @Untainted int u) { tf = sup.returnsTaintedIntWithFakeOverride(); tf = mid.returnsTaintedIntWithFakeOverride(); tf = sub.returnsTaintedIntWithFakeOverride(); - // :: error: (assignment) + // :: error: [assignment] uf = sup.returnsTaintedIntWithFakeOverride(); uf = mid.returnsTaintedIntWithFakeOverride(); uf = sub.returnsTaintedIntWithFakeOverride(); @@ -43,9 +43,9 @@ void m(@Tainted int t, @Untainted int u) { tf = mid.returnsUntaintedIntWithFakeOverride(); tf = sub.returnsUntaintedIntWithFakeOverride(); uf = sup.returnsUntaintedIntWithFakeOverride(); - // :: error: (assignment) + // :: error: [assignment] uf = mid.returnsUntaintedIntWithFakeOverride(); - // :: error: (assignment) + // :: error: [assignment] uf = sub.returnsUntaintedIntWithFakeOverride(); } diff --git a/checker/tests/tainting/Buffer.java b/checker/tests/tainting/Buffer.java index b5b2fd3ad013..429e39796e2a 100644 --- a/checker/tests/tainting/Buffer.java +++ b/checker/tests/tainting/Buffer.java @@ -9,13 +9,13 @@ public class Buffer { final List<@PolyTainted String> list = new ArrayList<>(); @PolyTainted String someString = ""; - // :: error: (invalid.polymorphic.qualifier.use) + // :: error: [invalid.polymorphic.qualifier.use] static @PolyTainted Object staticField; public @PolyTainted Buffer() {} public @Untainted Buffer(@Tainted String s) { - // :: error: (assignment) + // :: error: [assignment] this.someString = s; } @@ -36,9 +36,9 @@ public class Buffer { } public @PolyTainted String unTaintedOnly(@Untainted Buffer this, @PolyTainted String s) { - // :: error: (argument) + // :: error: [argument] list.add(s); - // :: error: (assignment) + // :: error: [assignment] someString = s; return s; } @@ -51,26 +51,26 @@ void passingUses(@Untainted String untainted, @Untainted Buffer buffer) { } void failingUses(@Tainted String tainted, @Untainted Buffer buffer) { - // :: error: (argument) + // :: error: [argument] buffer.list.add(tainted); - // :: error: (assignment) + // :: error: [assignment] buffer.someString = tainted; - // :: error: (argument) + // :: error: [argument] buffer.append(tainted); } void casts(@Untainted Object untainted, @Tainted Object tainted) { @Untainted Buffer b1 = (@Untainted Buffer) untainted; // ok - // :: error: (invariant.cast.unsafe) + // :: error: [invariant.cast.unsafe] @Untainted Buffer b2 = (@Untainted Buffer) tainted; - // :: error: (invariant.cast.unsafe) + // :: error: [invariant.cast.unsafe] @Tainted Buffer b3 = (@Tainted Buffer) untainted; // error - // :: error: (invariant.cast.unsafe) + // :: error: [invariant.cast.unsafe] @Tainted Buffer b4 = (@Tainted Buffer) tainted; // error @Untainted Buffer b5 = (Buffer) untainted; // ok - // :: error: (invariant.cast.unsafe) + // :: error: [invariant.cast.unsafe] @Tainted Buffer b6 = (Buffer) tainted; } diff --git a/checker/tests/tainting/CaptureSubtype2.java b/checker/tests/tainting/CaptureSubtype2.java index 2c24fe8b8681..cce3fa49d8c9 100644 --- a/checker/tests/tainting/CaptureSubtype2.java +++ b/checker/tests/tainting/CaptureSubtype2.java @@ -19,7 +19,7 @@ interface QInterface, V extends MInterface

, P> {} QInterface< ? extends MInterface, ? extends MInterface, DInterface>> r) { - // :: error: (assignment) + // :: error: [assignment] this.r = r; } } diff --git a/checker/tests/tainting/Casts.java b/checker/tests/tainting/Casts.java index 8fd5c998ad09..f9a5e5425a24 100644 --- a/checker/tests/tainting/Casts.java +++ b/checker/tests/tainting/Casts.java @@ -18,22 +18,22 @@ void test( o = (@Tainted Object) untaintedObj; o = (@Tainted Object) untaintedBuf; - // :: error: (invariant.cast.unsafe) + // :: error: [invariant.cast.unsafe] o = (@Tainted Buffer) taintedObj; - // :: error: (invariant.cast.unsafe) + // :: error: [invariant.cast.unsafe] o = (@Tainted Buffer) untaintedBuf; - // :: error: (invariant.cast.unsafe) + // :: error: [invariant.cast.unsafe] o = (@Tainted Buffer) untaintedObj; - // :: warning: (cast.unsafe) + // :: warning: [cast.unsafe] o = (@Untainted Object) taintedObj; - // :: warning: (cast.unsafe) + // :: warning: [cast.unsafe] o = (@Untainted Object) taintedBuf; o = (@Untainted Object) untaintedBuf; - // :: error: (invariant.cast.unsafe) + // :: error: [invariant.cast.unsafe] o = (@Untainted Buffer) taintedObj; - // :: error: (invariant.cast.unsafe) + // :: error: [invariant.cast.unsafe] o = (@Untainted Buffer) taintedBuf; o = (@Untainted Buffer) untaintedObj; } @@ -44,26 +44,26 @@ void test2( @Tainted MyBuffer taintedMyBuf, @Untainted MyBuffer untaintedMyBuff) { @Tainted Object o = (@Tainted Buffer) taintedMyBuf; - // :: error: (invariant.cast.unsafe) + // :: error: [invariant.cast.unsafe] o = (@Tainted Buffer) untaintedBuf; - // :: error: (invariant.cast.unsafe) + // :: error: [invariant.cast.unsafe] o = (@Tainted Buffer) untaintedMyBuff; o = (@Tainted MyBuffer) taintedBuf; - // :: error: (invariant.cast.unsafe) + // :: error: [invariant.cast.unsafe] o = (@Tainted MyBuffer) untaintedBuf; - // :: error: (invariant.cast.unsafe) + // :: error: [invariant.cast.unsafe] o = (@Tainted MyBuffer) untaintedMyBuff; - // :: error: (invariant.cast.unsafe) + // :: error: [invariant.cast.unsafe] o = (@Untainted Buffer) taintedMyBuf; - // :: error: (invariant.cast.unsafe) + // :: error: [invariant.cast.unsafe] o = (@Untainted Buffer) taintedMyBuf; o = (@Untainted Buffer) untaintedMyBuff; - // :: error: (invariant.cast.unsafe) + // :: error: [invariant.cast.unsafe] o = (@Untainted MyBuffer) taintedBuf; - // :: error: (invariant.cast.unsafe) + // :: error: [invariant.cast.unsafe] o = (@Untainted MyBuffer) taintedMyBuf; o = (@Untainted MyBuffer) untaintedMyBuff; } diff --git a/checker/tests/tainting/ClassQPTypeVarTest.java b/checker/tests/tainting/ClassQPTypeVarTest.java index 541f07489a89..30cc0f06e547 100644 --- a/checker/tests/tainting/ClassQPTypeVarTest.java +++ b/checker/tests/tainting/ClassQPTypeVarTest.java @@ -14,9 +14,9 @@ interface Buffer { } void bug(@Untainted Buffer b, @Tainted String s) { - // :: error: (argument) + // :: error: [argument] b.append(s); - // :: error: (type.argument.hasqualparam) + // :: error: [type.argument.hasqualparam] cast(b).append(s); } @@ -30,7 +30,7 @@ void bug(@Untainted Buffer b, @Tainted String s) { } void use(@Untainted Buffer ub, @Tainted Buffer tb) { - // :: error: (type.arguments.not.inferred) + // :: error: [type.arguments.not.inferred] identity(ub); identity(tb); // ok } diff --git a/checker/tests/tainting/ExtendHasQual.java b/checker/tests/tainting/ExtendHasQual.java index f4794cca7d52..03325924fd4e 100644 --- a/checker/tests/tainting/ExtendHasQual.java +++ b/checker/tests/tainting/ExtendHasQual.java @@ -18,7 +18,7 @@ static class MyBuffer1 extends Buffer {} static class MyBuffer2 extends Buffer {} @HasQualifierParameter(Nullable.class) - // :: error: (invalid.qual.param) + // :: error: [invalid.qual.param] static class MyBuffer3 extends Buffer {} @HasQualifierParameter({Tainted.class, Nullable.class}) diff --git a/checker/tests/tainting/ExtendsAndAnnotation.java b/checker/tests/tainting/ExtendsAndAnnotation.java index f49bfe90d100..f5a56f616ac8 100644 --- a/checker/tests/tainting/ExtendsAndAnnotation.java +++ b/checker/tests/tainting/ExtendsAndAnnotation.java @@ -7,13 +7,13 @@ public class ExtendsAndAnnotation extends @Tainted Object { void test(@Untainted ExtendsAndAnnotation c) { - // :: warning: (cast.unsafe.constructor.invocation) + // :: warning: [cast.unsafe.constructor.invocation] Object o = new @Untainted ExtendsAndAnnotation(); o = new @Tainted ExtendsAndAnnotation(); } @HasQualifierParameter(Tainted.class) - // :: error: (invalid.polymorphic.qualifier) - // :: error: (declaration.inconsistent.with.extends.clause) + // :: error: [invalid.polymorphic.qualifier] + // :: error: [declaration.inconsistent.with.extends.clause] static class Banana extends @PolyTainted Object {} } diff --git a/checker/tests/tainting/GenericsEnclosing.java b/checker/tests/tainting/GenericsEnclosing.java index c50b561d5358..ca0aadc59589 100644 --- a/checker/tests/tainting/GenericsEnclosing.java +++ b/checker/tests/tainting/GenericsEnclosing.java @@ -16,10 +16,10 @@ class ExtMyG extends MyG<@Untainted Object> { class EInner1 { class EInner2 { void bar() { - // :: error: (assignment) + // :: error: [assignment] f = 1; m("test"); - // :: error: (argument) + // :: error: [argument] m(1); } } diff --git a/checker/tests/tainting/HasQualParamDefaults.java b/checker/tests/tainting/HasQualParamDefaults.java index ffa82b7da134..ac7470d51a5c 100644 --- a/checker/tests/tainting/HasQualParamDefaults.java +++ b/checker/tests/tainting/HasQualParamDefaults.java @@ -14,7 +14,7 @@ public class Buffer { public Buffer() {} public @Untainted Buffer(@Tainted String s) { - // :: error: (assignment) + // :: error: [assignment] this.someString = s; } @@ -38,9 +38,9 @@ public Buffer append(@PolyTainted String s) { } public @PolyTainted String unTaintedOnly(@Untainted Buffer this, @PolyTainted String s) { - // :: error: (argument) + // :: error: [argument] list.add(s); - // :: error: (assignment) + // :: error: [assignment] someString = s; return s; } @@ -48,14 +48,14 @@ public Buffer append(@PolyTainted String s) { void initializeLocalTainted(@Tainted Buffer b) { Buffer local = b; @Tainted Buffer copy1 = local; - // :: error: (assignment) + // :: error: [assignment] @Untainted Buffer copy2 = local; } void initializeLocalUntainted(@Untainted Buffer b) { Buffer local = b; @Untainted Buffer copy1 = local; - // :: error: (assignment) + // :: error: [assignment] @Tainted Buffer copy2 = local; } @@ -66,7 +66,7 @@ void initializeLocalPolyTainted(@PolyTainted Buffer b) { void noInitializer(@Untainted Buffer b) { Buffer local; - // :: error: (assignment) + // :: error: [assignment] local = b; } } @@ -79,26 +79,26 @@ void passingUses(@Untainted String untainted, @Untainted Buffer buffer) { } void failingUses(@Tainted String tainted, @Untainted Buffer buffer) { - // :: error: (argument) + // :: error: [argument] buffer.list.add(tainted); - // :: error: (assignment) + // :: error: [assignment] buffer.someString = tainted; - // :: error: (argument) + // :: error: [argument] buffer.append(tainted); } void casts(@Untainted Object untainted, @Tainted Object tainted) { @Untainted Buffer b1 = (@Untainted Buffer) untainted; // ok - // :: error: (invariant.cast.unsafe) + // :: error: [invariant.cast.unsafe] @Untainted Buffer b2 = (@Untainted Buffer) tainted; - // :: error: (invariant.cast.unsafe) + // :: error: [invariant.cast.unsafe] @Tainted Buffer b3 = (@Tainted Buffer) untainted; // error - // :: error: (invariant.cast.unsafe) + // :: error: [invariant.cast.unsafe] @Tainted Buffer b4 = (@Tainted Buffer) tainted; // error @Untainted Buffer b5 = (Buffer) untainted; // ok - // :: error: (invariant.cast.unsafe) + // :: error: [invariant.cast.unsafe] @Tainted Buffer b6 = (Buffer) tainted; } @@ -116,14 +116,14 @@ class LocalVars { void initializeLocalTainted(@Tainted Buffer b) { Buffer local = b; @Tainted Buffer copy1 = local; - // :: error: (assignment) + // :: error: [assignment] @Untainted Buffer copy2 = local; } void initializeLocalUntainted(@Untainted Buffer b) { Buffer local = b; @Untainted Buffer copy1 = local; - // :: error: (assignment) + // :: error: [assignment] @Tainted Buffer copy2 = local; } @@ -134,7 +134,7 @@ void initializeLocalPolyTainted(@PolyTainted Buffer b) { void noInitializer(@Untainted Buffer b) { Buffer local; - // :: error: (assignment) + // :: error: [assignment] local = b; } diff --git a/checker/tests/tainting/HasQualifierParameterIsNonTop.java b/checker/tests/tainting/HasQualifierParameterIsNonTop.java index c95da332ecd4..07f9586cd411 100644 --- a/checker/tests/tainting/HasQualifierParameterIsNonTop.java +++ b/checker/tests/tainting/HasQualifierParameterIsNonTop.java @@ -2,7 +2,7 @@ import org.checkerframework.framework.qual.HasQualifierParameter; @HasQualifierParameter(Untainted.class) -// :: error: (invalid.qual.param) +// :: error: [invalid.qual.param] class HasQualifierParameterIsNonTop { @PolyTainted String input; } diff --git a/checker/tests/tainting/InheritQualifierParameter.java b/checker/tests/tainting/InheritQualifierParameter.java index 4f4dbb2572c5..cdf0b1291a25 100644 --- a/checker/tests/tainting/InheritQualifierParameter.java +++ b/checker/tests/tainting/InheritQualifierParameter.java @@ -8,13 +8,13 @@ public class InheritQualifierParameter {} class SubHasQualifierParameter extends InheritQualifierParameter { void test(@Untainted SubHasQualifierParameter arg) { - // :: error: (assignment) + // :: error: [assignment] @Tainted SubHasQualifierParameter local = arg; } } @NoQualifierParameter(Tainted.class) -// :: error: (conflicting.qual.param) +// :: error: [conflicting.qual.param] class SubHasQualifierParameter1 extends InheritQualifierParameter {} @NoQualifierParameter(Tainted.class) @@ -27,5 +27,5 @@ void test(@Untainted SubNoQualifierParameter arg) { } @HasQualifierParameter(Tainted.class) -// :: error: (conflicting.qual.param) +// :: error: [conflicting.qual.param] @Tainted class SubNoQualifierParameter1 extends InheritNoQualifierParameter {} diff --git a/checker/tests/tainting/Issue1111.java b/checker/tests/tainting/Issue1111.java index 7937c049e438..6ddace51af81 100644 --- a/checker/tests/tainting/Issue1111.java +++ b/checker/tests/tainting/Issue1111.java @@ -7,12 +7,12 @@ public class Issue1111 { void foo(Box box, List list) { - // :: error: (type.arguments.not.inferred) + // :: error: [type.arguments.not.inferred] bar(box, list); } void foo2(Box<@Untainted ? super Integer> box, List list) { - // :: error: (type.arguments.not.inferred) + // :: error: [type.arguments.not.inferred] bar(box, list); } diff --git a/checker/tests/tainting/Issue2156.java b/checker/tests/tainting/Issue2156.java index 8e0750884803..13353a687e1a 100644 --- a/checker/tests/tainting/Issue2156.java +++ b/checker/tests/tainting/Issue2156.java @@ -14,7 +14,7 @@ enum SampleEnum { public class Issue2156 { void test() { requireUntainted(SampleEnum.FIRST); - // :: error: (assignment) + // :: error: [assignment] requireUntainted(SampleEnum.SECOND); } diff --git a/checker/tests/tainting/Issue2159.java b/checker/tests/tainting/Issue2159.java index 915d7fe17cfb..aa2a16f7866a 100644 --- a/checker/tests/tainting/Issue2159.java +++ b/checker/tests/tainting/Issue2159.java @@ -8,22 +8,22 @@ public class Issue2159 { static class MyClass extends Issue2159 { MyClass() {} - // :: error: (super.invocation) + // :: error: [super.invocation] @PolyTainted MyClass(@PolyTainted Object x) {} void testPolyTaintedLocal( @PolyTainted Object input, @Untainted Object untainted, @Tainted Object tainted) { - // :: warning: (cast.unsafe) + // :: warning: [cast.unsafe] @PolyTainted Object local = (@PolyTainted MyClass) new MyClass(); - // :: warning: (cast.unsafe.constructor.invocation) + // :: warning: [cast.unsafe.constructor.invocation] @PolyTainted Object local1 = new @PolyTainted MyClass(); - // :: warning: (cast.unsafe.constructor.invocation) + // :: warning: [cast.unsafe.constructor.invocation] @Untainted Object local2 = new @Untainted MyClass(); @PolyTainted Object local3 = new @PolyTainted MyClass(input); - // :: warning: (cast.unsafe.constructor.invocation) + // :: warning: [cast.unsafe.constructor.invocation] @Untainted Object local4 = new @Untainted MyClass(input); - // :: warning: (cast.unsafe.constructor.invocation) + // :: warning: [cast.unsafe.constructor.invocation] @PolyTainted Object local5 = new @PolyTainted MyClass(tainted); @Untainted Object local6 = new @Untainted MyClass(untainted); } diff --git a/checker/tests/tainting/Issue2243.java b/checker/tests/tainting/Issue2243.java index f1de2bd42924..1dc9932c57bc 100644 --- a/checker/tests/tainting/Issue2243.java +++ b/checker/tests/tainting/Issue2243.java @@ -4,10 +4,10 @@ import org.checkerframework.checker.tainting.qual.Tainted; import org.checkerframework.checker.tainting.qual.Untainted; -// :: error: (declaration.inconsistent.with.extends.clause) +// :: error: [declaration.inconsistent.with.extends.clause] public @Tainted class Issue2243 extends Y2243 {} -// :: error: (declaration.inconsistent.with.extends.clause) +// :: error: [declaration.inconsistent.with.extends.clause] class ExtendsSubTypingExplicit2243 extends @Untainted X2243 {} class X2243 {} @@ -17,13 +17,13 @@ class MyClass2243 { } @Untainted class Y2243 extends MyClass2243 { - // :: error: (super.invocation) + // :: error: [super.invocation] @Untainted Y2243() {} } @Untainted interface SuperClass2243 {} -// :: error: (declaration.inconsistent.with.implements.clause) +// :: error: [declaration.inconsistent.with.implements.clause] @Tainted class Z2243 implements SuperClass2243 {} class Issue2243Test { diff --git a/checker/tests/tainting/Issue3033.java b/checker/tests/tainting/Issue3033.java index fe3b4ff78008..553c187fef45 100644 --- a/checker/tests/tainting/Issue3033.java +++ b/checker/tests/tainting/Issue3033.java @@ -5,7 +5,7 @@ public class Issue3033 { void main() { @Tainted String a = getTainted(); - // :: warning: (instanceof.unsafe) + // :: warning: [instanceof.unsafe] if (a instanceof @Untainted String) { // `a` is now refined to @Untainted String isUntainted(a); diff --git a/checker/tests/tainting/Issue3561.java b/checker/tests/tainting/Issue3561.java index 26993dd96d15..e0a43b1910b1 100644 --- a/checker/tests/tainting/Issue3561.java +++ b/checker/tests/tainting/Issue3561.java @@ -9,7 +9,7 @@ void innerMethod(@Untainted Issue3561.@Untainted Inner this) { } void innerMethod2(@Tainted Issue3561.@Untainted Inner this) { - // :: error: (method.invocation) + // :: error: [method.invocation] Issue3561.this.outerMethod(); } } diff --git a/checker/tests/tainting/Issue3776.java b/checker/tests/tainting/Issue3776.java index f63d9c18c1ea..5ff30ae8f1a5 100644 --- a/checker/tests/tainting/Issue3776.java +++ b/checker/tests/tainting/Issue3776.java @@ -22,22 +22,22 @@ void test(Issue3776 outer, @Tainted String tainted) { new MyInnerClass("1") {}; this.new MyInnerClass("2") {}; new MyClass() {}; - // :: error: (argument) + // :: error: [argument] new MyClass(tainted) {}; new MyClass(1, 2, 3) {}; new MyClass(1) {}; new MyInnerClass() {}; - // :: error: (argument) + // :: error: [argument] new MyInnerClass(tainted) {}; new MyInnerClass(1) {}; new MyInnerClass(1, 2, 3) {}; this.new MyInnerClass() {}; - // :: error: (argument) + // :: error: [argument] this.new MyInnerClass(tainted) {}; this.new MyInnerClass(1) {}; this.new MyInnerClass(1, 2, 3) {}; outer.new MyInnerClass() {}; - // :: error: (argument) + // :: error: [argument] outer.new MyInnerClass(tainted) {}; outer.new MyInnerClass(1) {}; outer.new MyInnerClass(1, 2, 3) {}; diff --git a/checker/tests/tainting/Issue4170.java b/checker/tests/tainting/Issue4170.java index 93ad7ece2438..a16a692b5f92 100644 --- a/checker/tests/tainting/Issue4170.java +++ b/checker/tests/tainting/Issue4170.java @@ -31,13 +31,13 @@ public void method3() { public ArrayList<@Tainted String> method5() { var list = new ArrayList<@Untainted String>(); - // :: error: (return) + // :: error: [return] return list; } public ArrayList<@Untainted String> method6() { var list = new ArrayList(); - // :: error: (return) + // :: error: [return] return list; } @@ -51,7 +51,7 @@ public void method8(ArrayList<@Untainted String> data) {} public void method9(List<@Tainted String> taintedlist, List<@Untainted String> untaintedList) { var list1 = taintedlist; List<@Tainted String> l = list1; - // :: error: (assignment) + // :: error: [assignment] list1 = untaintedList; } } diff --git a/checker/tests/tainting/Issue6110.java b/checker/tests/tainting/Issue6110.java index c2dda0fb0613..b52d4ae57a77 100644 --- a/checker/tests/tainting/Issue6110.java +++ b/checker/tests/tainting/Issue6110.java @@ -15,7 +15,7 @@ static void test(Enum<@Untainted TestEnum> o) { o.compareTo(TestEnum.TWO); EnumSet<@Tainted TestEnum> s1 = EnumSet.of(TestEnum.ONE); - // :: error: (type.arguments.not.inferred) + // :: error: [type.arguments.not.inferred] EnumSet<@Untainted TestEnum> s2 = EnumSet.of(TestEnum.ONE); EnumSet<@Untainted TestEnum> s3 = EnumSet.of(TestEnum.TWO); } diff --git a/checker/tests/tainting/LambdaParameterDefaulting.java b/checker/tests/tainting/LambdaParameterDefaulting.java index dd9357899419..66de2dcb0335 100644 --- a/checker/tests/tainting/LambdaParameterDefaulting.java +++ b/checker/tests/tainting/LambdaParameterDefaulting.java @@ -6,26 +6,26 @@ public class LambdaParameterDefaulting { @DefaultQualifier(locations = TypeUseLocation.PARAMETER, value = Untainted.class) void method() { - // :: error: (lambda.param) + // :: error: [lambda.param] Function function = (String s) -> untainted(s); Function<@Untainted String, String> function2 = (String s) -> untainted(s); Function<@Untainted String, @Untainted String> function3 = (String s) -> untainted(s); - // :: error: (argument) + // :: error: [argument] Function function4 = s -> untainted(s); Function<@Untainted String, String> function5 = s -> untainted(s); Function<@Untainted String, @Untainted String> function6 = s -> untainted(s); } void method2() { - // :: error: (argument) + // :: error: [argument] Function function = (String s) -> untainted(s); - // :: error: (argument) + // :: error: [argument] Function<@Untainted String, String> function2 = (String s) -> untainted(s); - // :: error: (argument) + // :: error: [argument] Function<@Untainted String, @Untainted String> function3 = (String s) -> untainted(s); - // :: error: (argument) + // :: error: [argument] Function function4 = s -> untainted(s); Function<@Untainted String, String> function5 = s -> untainted(s); Function<@Untainted String, @Untainted String> function6 = s -> untainted(s); diff --git a/checker/tests/tainting/MemberReferenceInference.java b/checker/tests/tainting/MemberReferenceInference.java index 367826da91d3..fe9472cc96aa 100644 --- a/checker/tests/tainting/MemberReferenceInference.java +++ b/checker/tests/tainting/MemberReferenceInference.java @@ -9,7 +9,7 @@ public class MemberReferenceInference { void clever2( Stream> taintedStream, Stream> untaintedStream) { - // :: error: (type.arguments.not.inferred) + // :: error: [type.arguments.not.inferred] Stream<@Untainted BigDecimal> s = taintedStream.map(Optional::get); Stream<@Untainted BigDecimal> s2 = untaintedStream.map(Optional::get); Stream<@Tainted BigDecimal> s3 = taintedStream.map(Optional::get); @@ -23,7 +23,7 @@ interface MyClass { void method( MyClass clazz, Map, @Untainted String> annotationClassNames) { - // :: error: (type.arguments.not.inferred) + // :: error: [type.arguments.not.inferred] String canonicalName = annotationClassNames.computeIfAbsent(clazz, MyClass::getName); } diff --git a/checker/tests/tainting/NestedAnonymous.java b/checker/tests/tainting/NestedAnonymous.java index a13f00cff687..9edcf1603673 100644 --- a/checker/tests/tainting/NestedAnonymous.java +++ b/checker/tests/tainting/NestedAnonymous.java @@ -5,7 +5,7 @@ class NestedAnonymous { Object o1 = new @Tainted Object() {}; Object o2 = new Outer.@Tainted Inner() {}; - // :: error: (assignment) + // :: error: [assignment] Outer.@Untainted Inner unt = new Outer.@Tainted Inner() {}; static class Outer { diff --git a/checker/tests/tainting/ObjectCreation.java b/checker/tests/tainting/ObjectCreation.java index b335a255434d..8eab7f4ac1d8 100644 --- a/checker/tests/tainting/ObjectCreation.java +++ b/checker/tests/tainting/ObjectCreation.java @@ -36,7 +36,7 @@ static class MyBuffer extends Buffer { } @PolyTainted MyBuffer(Object o) { - // :: error: (super.invocation) + // :: error: [super.invocation] super(""); } diff --git a/checker/tests/tainting/PolyClassDecl.java b/checker/tests/tainting/PolyClassDecl.java index 02ffbdc0d905..53f1350090d1 100644 --- a/checker/tests/tainting/PolyClassDecl.java +++ b/checker/tests/tainting/PolyClassDecl.java @@ -3,30 +3,30 @@ import org.checkerframework.checker.tainting.qual.PolyTainted; public class PolyClassDecl { - // :: error: (invalid.polymorphic.qualifier) + // :: error: [invalid.polymorphic.qualifier] @PolyTainted static class Class1 {} - // :: error: (invalid.polymorphic.qualifier) + // :: error: [invalid.polymorphic.qualifier] static class Class2<@PolyTainted T> {} - // :: error: (invalid.polymorphic.qualifier) + // :: error: [invalid.polymorphic.qualifier] abstract static class Class3> {} - // :: error: (invalid.polymorphic.qualifier) + // :: error: [invalid.polymorphic.qualifier] interface Class4 extends List<@PolyTainted String> {} - // :: error: (invalid.polymorphic.qualifier) - // :: error: (declaration.inconsistent.with.implements.clause) + // :: error: [invalid.polymorphic.qualifier] + // :: error: [declaration.inconsistent.with.implements.clause] interface Class5 extends @PolyTainted List {} - // :: error: (invalid.polymorphic.qualifier) + // :: error: [invalid.polymorphic.qualifier] abstract static class Class6 implements List<@PolyTainted String> {} void method() { ArrayList<@PolyTainted String> s = new ArrayList<@PolyTainted String>() {}; } - // :: error: (invalid.polymorphic.qualifier) + // :: error: [invalid.polymorphic.qualifier] <@PolyTainted T> T identity(T arg) { return arg; } diff --git a/checker/tests/tainting/PolyConstructor.java b/checker/tests/tainting/PolyConstructor.java index ccc4a19d5927..dbfbe8be66f6 100644 --- a/checker/tests/tainting/PolyConstructor.java +++ b/checker/tests/tainting/PolyConstructor.java @@ -15,13 +15,13 @@ static void uses(@Tainted Object tainted, @Untainted Object untainted) { @Tainted PolyConstructor o2 = new @Tainted PolyConstructor(); @PolyTainted PolyConstructor o3 = new @PolyTainted PolyConstructor(); - // :: error: (assignment) + // :: error: [assignment] @Untainted PolyConstructor o4 = new @Tainted PolyConstructor(untainted); @Untainted PolyConstructor o5 = new PolyConstructor(untainted); // This currently isn't supported, but could be in the future. @Untainted PolyConstructor o6 = new PolyConstructor(); - // :: error: (assignment) + // :: error: [assignment] @Tainted PolyConstructor o7 = new PolyConstructor(); } } diff --git a/checker/tests/tainting/PolyVarargs.java b/checker/tests/tainting/PolyVarargs.java index aa62898b58f5..02a80bb17e9d 100644 --- a/checker/tests/tainting/PolyVarargs.java +++ b/checker/tests/tainting/PolyVarargs.java @@ -9,7 +9,7 @@ void testVarargsNoFormals() { } void testVarargsNoFormalsInvalid() { - // :: error: (assignment) + // :: error: [assignment] @Untainted String tainted = varArgsNoFormals(); } @@ -20,20 +20,20 @@ void testVarargsWithFormals() { } void testVarargsWithFormalsInvalid() { - // :: error: (assignment) + // :: error: [assignment] @Untainted String tainted = varArgsWithFormals(1); } void testVarargsWithPolyFormals() { @Tainted String tainted = varArgsWithPolyFormals(1); - // :: warning: (cast.unsafe) + // :: warning: [cast.unsafe] @Untainted int safeInt = (@Untainted int) 1; @Untainted String untainted = varArgsWithPolyFormals(safeInt, "a"); } void testVarargsWithPolyFormalsInvalid() { - // :: error: (assignment) + // :: error: [assignment] @Untainted String tainted = varArgsWithPolyFormals(1); } diff --git a/checker/tests/tainting/Refine.java b/checker/tests/tainting/Refine.java index afc1c499f546..4b5e15f64a74 100644 --- a/checker/tests/tainting/Refine.java +++ b/checker/tests/tainting/Refine.java @@ -5,9 +5,9 @@ @HasQualifierParameter(Tainted.class) public class Refine { void method(@Tainted Refine tainted, @Untainted Refine untainted) { - // :: error: (assignment) + // :: error: [assignment] @Tainted Refine local = untainted; - // :: error: (assignment) + // :: error: [assignment] @Untainted Refine untaintedLocal = local; @Untainted Refine untaintedLocal2 = untaintedLocal; } diff --git a/checker/tests/tainting/SameTypeBounds.java b/checker/tests/tainting/SameTypeBounds.java index d98a1f18e8a7..763cb774e4d6 100644 --- a/checker/tests/tainting/SameTypeBounds.java +++ b/checker/tests/tainting/SameTypeBounds.java @@ -9,23 +9,23 @@ static class MyGen {} void test1(MyGen p) { // The upper and lower bound must have the same annotation because the bounds are collasped // during capture conversion. - // :: error: (super.wildcard) + // :: error: [super.wildcard] MyGen o = p; - // :: error: (assignment) + // :: error: [assignment] p = o; } void test2(MyGen p) { - // :: error: (assignment) + // :: error: [assignment] MyGen<@Untainted ? super @Untainted Object> o = p; - // :: error: (assignment) + // :: error: [assignment] p = o; } void test3(MyGen<@Untainted Object> p) { - // :: error: (assignment) + // :: error: [assignment] MyGen o = p; - // :: error: (assignment) + // :: error: [assignment] p = o; } @@ -35,12 +35,12 @@ static class MySubClass extends MyClass {} class Gen {} - // :: error: (super.wildcard) + // :: error: [super.wildcard] void test3(Gen p, Gen p2) { - // :: error: (super.wildcard) + // :: error: [super.wildcard] Gen o = p; o = p2; - // :: error: (assignment) + // :: error: [assignment] p = p2; } } diff --git a/checker/tests/tainting/SimplePrims.java b/checker/tests/tainting/SimplePrims.java index 4d0e20744f38..e5db1548a18d 100644 --- a/checker/tests/tainting/SimplePrims.java +++ b/checker/tests/tainting/SimplePrims.java @@ -7,13 +7,13 @@ void execute(@Untainted int s) {} void tainted(int s) {} void intLiteral() { - // :: error: (argument) + // :: error: [argument] execute(5); tainted(6); } void intRef(int ref) { - // :: error: (argument) + // :: error: [argument] execute(ref); tainted(ref); } @@ -26,17 +26,17 @@ void untaintedRef(@Untainted int ref) { void concatenation(@Untainted int s1, int s2) { execute(s1 + s1); execute(s1 += s1); - // :: error: (argument) + // :: error: [argument] execute(s1 + 3); - // :: error: (argument) + // :: error: [argument] execute(s1 + s2); - // :: error: (argument) + // :: error: [argument] execute(s2 + s1); - // :: error: (argument) + // :: error: [argument] execute(s2 + 4); - // :: error: (argument) + // :: error: [argument] execute(s2 + s2); tainted(s1 + s1); diff --git a/checker/tests/tainting/SimpleTainting.java b/checker/tests/tainting/SimpleTainting.java index 6fc2794bd88a..0bc2091b073d 100644 --- a/checker/tests/tainting/SimpleTainting.java +++ b/checker/tests/tainting/SimpleTainting.java @@ -12,7 +12,7 @@ void stringLiteral() { } void stringRef(String ref) { - // :: error: (argument) + // :: error: [argument] execute(ref); // error tainted(ref); } @@ -26,14 +26,14 @@ void concatenation(@Untainted String s1, String s2) { execute(s1 + s1); execute(s1 += s1); execute(s1 + "m"); - // :: error: (argument) + // :: error: [argument] execute(s1 + s2); // error - // :: error: (argument) + // :: error: [argument] execute(s2 + s1); // error - // :: error: (argument) + // :: error: [argument] execute(s2 + "m"); // error - // :: error: (argument) + // :: error: [argument] execute(s2 + s2); // error tainted(s1 + s1); diff --git a/checker/tests/tainting/SubClassHasQP.java b/checker/tests/tainting/SubClassHasQP.java index 7726375af047..739af36a6f0f 100644 --- a/checker/tests/tainting/SubClassHasQP.java +++ b/checker/tests/tainting/SubClassHasQP.java @@ -15,7 +15,7 @@ void append2(@PolyTainted Buffer this, @PolyTainted String s) {} @HasQualifierParameter(Tainted.class) static @Untainted class UntaintedBuffer extends @Untainted Buffer { @Override - // :: error: (annotations.on.use) + // :: error: [annotations.on.use] void append(@Tainted UntaintedBuffer this, @Tainted String s) {} @Override @@ -34,10 +34,10 @@ void append2(@Untainted TaintedBuffer this, String s) { } @HasQualifierParameter(Tainted.class) - // :: error: (super.invocation) + // :: error: [super.invocation] static class MyTaintedBuffer extends TaintedBuffer { @Override - // :: error: (override.receiver) + // :: error: [override.receiver] void append(MyTaintedBuffer this, String s) {} // legal override } diff --git a/checker/tests/tainting/SubtypingConstraint.java b/checker/tests/tainting/SubtypingConstraint.java index 2a3eed2cfd0f..4c2cb7c5c44f 100644 --- a/checker/tests/tainting/SubtypingConstraint.java +++ b/checker/tests/tainting/SubtypingConstraint.java @@ -5,7 +5,7 @@ public class SubtypingConstraint { void test() { Object[] o = new Object[0]; - // :: error: (type.arguments.not.inferred) + // :: error: [type.arguments.not.inferred] asList(0, 0, "", Arrays.asList(o)); } diff --git a/checker/tests/tainting/TaintedIntersections.java b/checker/tests/tainting/TaintedIntersections.java index c16b90c49569..27222d7021a9 100644 --- a/checker/tests/tainting/TaintedIntersections.java +++ b/checker/tests/tainting/TaintedIntersections.java @@ -7,11 +7,11 @@ interface MyInterface {} void test1() { // null is @Untainted @Untainted Object o1 = (@Untainted Object & @Untainted MyInterface) null; - // :: warning: (explicit.annotation.ignored) + // :: warning: [explicit.annotation.ignored] @Untainted Object o2 = (@Untainted Object & @Tainted MyInterface) null; - // :: error: (assignment) :: warning: (explicit.annotation.ignored) + // :: error: [assignment] :: warning: [explicit.annotation.ignored] @Untainted Object o3 = (@Tainted Object & @Untainted MyInterface) null; - // :: error: (assignment) + // :: error: [assignment] @Untainted Object o4 = (@Tainted Object & @Tainted MyInterface) null; } @@ -19,31 +19,31 @@ void test2() { // null is @Untainted @Untainted Object o1 = (@Untainted Object & MyInterface) null; @Untainted Object o3 = (Object & @Untainted MyInterface) null; - // :: error: (assignment) + // :: error: [assignment] @Untainted Object o2 = (Object & @Tainted MyInterface) null; - // :: error: (assignment) + // :: error: [assignment] @Untainted Object o4 = (@Tainted Object & MyInterface) null; } void test3(@Tainted MyInterface i) { - // :: warning: (cast.unsafe) + // :: warning: [cast.unsafe] @Untainted Object o1 = (@Untainted Object & @Untainted MyInterface) i; - // :: warning: (explicit.annotation.ignored) :: warning: (cast.unsafe) + // :: warning: [explicit.annotation.ignored] :: warning: [cast.unsafe] @Untainted Object o2 = (@Untainted Object & @Tainted MyInterface) i; - // :: error: (assignment) :: warning: (explicit.annotation.ignored) + // :: error: [assignment] :: warning: [explicit.annotation.ignored] @Untainted Object o3 = (@Tainted Object & @Untainted MyInterface) i; - // :: error: (assignment) + // :: error: [assignment] @Untainted Object o4 = (@Tainted Object & @Tainted MyInterface) i; } void test4(@Tainted MyInterface i) { - // :: warning: (cast.unsafe) + // :: warning: [cast.unsafe] @Untainted Object o1 = (@Untainted Object & MyInterface) i; - // :: warning: (cast.unsafe) + // :: warning: [cast.unsafe] @Untainted Object o3 = (Object & @Untainted MyInterface) i; - // :: error: (assignment) + // :: error: [assignment] @Untainted Object o2 = (Object & @Tainted MyInterface) i; - // :: error: (assignment) + // :: error: [assignment] @Untainted Object o4 = (@Tainted Object & MyInterface) i; } } diff --git a/checker/tests/tainting/TaintingDiamondInference.java b/checker/tests/tainting/TaintingDiamondInference.java index a232435d8d02..527118210a12 100644 --- a/checker/tests/tainting/TaintingDiamondInference.java +++ b/checker/tests/tainting/TaintingDiamondInference.java @@ -9,9 +9,9 @@ public class TaintingDiamondInference { private @Untainted Set<@Untainted String> s; public TaintingDiamondInference() { - // :: warning: (cast.unsafe.constructor.invocation) + // :: warning: [cast.unsafe.constructor.invocation] s = new @Untainted TreeSet<>(); - // :: warning: (cast.unsafe.constructor.invocation) + // :: warning: [cast.unsafe.constructor.invocation] s = new @Untainted TreeSet<@Untainted String>(); } } diff --git a/checker/tests/tainting/TaintingIssue6025.java b/checker/tests/tainting/TaintingIssue6025.java index 3defe0539df8..d9a43fdf83ad 100644 --- a/checker/tests/tainting/TaintingIssue6025.java +++ b/checker/tests/tainting/TaintingIssue6025.java @@ -12,9 +12,9 @@ public interface C, T2 extends A> {} private final B, ? extends A>> two = new B<>(); void f(boolean b) { - // :: error: (assignment) + // :: error: [assignment] B> three1 = one; - // :: error: (assignment) + // :: error: [assignment] B> three = b ? two : one; } } diff --git a/checker/tests/tainting/TaintingIssue6060.java b/checker/tests/tainting/TaintingIssue6060.java index 9c271eb16f38..70921f088bf2 100644 --- a/checker/tests/tainting/TaintingIssue6060.java +++ b/checker/tests/tainting/TaintingIssue6060.java @@ -9,16 +9,16 @@ public interface TaintingIssue6060 extends Iterable<@Untainted R> { } default Spliterator spliterator2() { - // :: error: (return) + // :: error: [return] return Iterable.super.spliterator(); } default Spliterator spliterator3() { - // :: error: (return) + // :: error: [return] return this.spliterator(); } - // :: error: (override.param) + // :: error: [override.param] default void forEach(Consumer action) { Iterable.super.forEach(action); } diff --git a/checker/tests/tainting/TaintingIssue6755.java b/checker/tests/tainting/TaintingIssue6755.java index a7ad3af140ac..c194d65150bf 100644 --- a/checker/tests/tainting/TaintingIssue6755.java +++ b/checker/tests/tainting/TaintingIssue6755.java @@ -31,7 +31,7 @@ static void test(List externals) { var values = Stream.of(1, 2) .map( - // :: error: (argument) + // :: error: [argument] val -> merge(val, testsByValue)); } } diff --git a/checker/tests/tainting/TaintingPolyFields.java b/checker/tests/tainting/TaintingPolyFields.java index e7c69ceef025..59ec0cff5d80 100644 --- a/checker/tests/tainting/TaintingPolyFields.java +++ b/checker/tests/tainting/TaintingPolyFields.java @@ -4,38 +4,38 @@ import org.checkerframework.checker.tainting.qual.Untainted; public class TaintingPolyFields { - // :: error: (invalid.polymorphic.qualifier.use) + // :: error: [invalid.polymorphic.qualifier.use] @PolyTainted Integer x; - // :: error: (invalid.polymorphic.qualifier.use) + // :: error: [invalid.polymorphic.qualifier.use] @PolyTainted List<@PolyTainted String> lst; - // :: error: (invalid.polymorphic.qualifier.use) + // :: error: [invalid.polymorphic.qualifier.use] @PolyTainted String @PolyTainted [] str; - // :: error: (invalid.polymorphic.qualifier.use) + // :: error: [invalid.polymorphic.qualifier.use] List<@PolyTainted String> lst1; - // :: error: (invalid.polymorphic.qualifier.use) + // :: error: [invalid.polymorphic.qualifier.use] @PolyTainted String[] str1; - // :: error: (invalid.polymorphic.qualifier.use) + // :: error: [invalid.polymorphic.qualifier.use] @PolyTainted List lst2; - // :: error: (invalid.polymorphic.qualifier.use) + // :: error: [invalid.polymorphic.qualifier.use] String @PolyTainted [] str2; - // :: error: (invalid.polymorphic.qualifier.use) + // :: error: [invalid.polymorphic.qualifier.use] @PolyTainted int z; // Access of poly fields outside of the declaring class. static void test() { @Tainted TaintingPolyFields obj = new @Tainted TaintingPolyFields(); - // :: error: (assignment) + // :: error: [assignment] @Untainted Integer myX = obj.x; - // :: error: (assignment) + // :: error: [assignment] @Untainted List<@Untainted String> myLst = obj.lst; - // :: error: (assignment) + // :: error: [assignment] @Untainted String @Untainted [] myStr = obj.str; - // :: warning: (cast.unsafe.constructor.invocation) + // :: warning: [cast.unsafe.constructor.invocation] @Untainted TaintingPolyFields obj1 = new @Untainted TaintingPolyFields(); @Untainted Integer myX1 = obj1.x; TaintingPolyFields obj2 = new TaintingPolyFields(); - // :: error: (assignment) + // :: error: [assignment] @Untainted List<@Untainted String> myLst2 = obj2.lst; } diff --git a/checker/tests/tainting/TaintingPrimitiveTarget.java b/checker/tests/tainting/TaintingPrimitiveTarget.java index eef0ccba0628..cbafc63d4e47 100644 --- a/checker/tests/tainting/TaintingPrimitiveTarget.java +++ b/checker/tests/tainting/TaintingPrimitiveTarget.java @@ -5,8 +5,8 @@ public class TaintingPrimitiveTarget { void method(List list) { long l = Collections.min(list); - // :: error: (assignment) - // :: error: (type.arguments.not.inferred) + // :: error: [assignment] + // :: error: [type.arguments.not.inferred] @Untainted long l2 = Collections.min(list); } diff --git a/checker/tests/tainting/TestFieldPolymorphism.java b/checker/tests/tainting/TestFieldPolymorphism.java index 4584ce180472..6be356ddb817 100644 --- a/checker/tests/tainting/TestFieldPolymorphism.java +++ b/checker/tests/tainting/TestFieldPolymorphism.java @@ -24,7 +24,7 @@ void testSetter2(@PolyTainted TestFieldPolymorphism this, @Untainted String s) { } void testSetter3(@PolyTainted TestFieldPolymorphism this, @Tainted String s) { - // :: error: (assignment) + // :: error: [assignment] this.field = s; } @@ -33,7 +33,7 @@ void testSetter3(@PolyTainted TestFieldPolymorphism this, @Tainted String s) { } @Untainted String testGetter2(@PolyTainted TestFieldPolymorphism this) { - // :: error: (return) + // :: error: [return] return this.field; } @@ -43,12 +43,12 @@ void testSetter3(@PolyTainted TestFieldPolymorphism this, @Tainted String s) { static void testInstantiateUntaintedSetter( @Untainted TestFieldPolymorphism c, @Tainted String s) { - // :: error: (assignment) + // :: error: [assignment] c.field = s; } static @Untainted String testInstantiateTaintedGetter(@Tainted TestFieldPolymorphism c) { - // :: error: (return) + // :: error: [return] return c.field; } diff --git a/checker/tests/tainting/TestNoQualifierParameterConflicting.java b/checker/tests/tainting/TestNoQualifierParameterConflicting.java index 0e8b2e41fbb0..c60177769959 100644 --- a/checker/tests/tainting/TestNoQualifierParameterConflicting.java +++ b/checker/tests/tainting/TestNoQualifierParameterConflicting.java @@ -4,13 +4,13 @@ @HasQualifierParameter(Tainted.class) @NoQualifierParameter(Tainted.class) -// :: error: (conflicting.qual.param) +// :: error: [conflicting.qual.param] public class TestNoQualifierParameterConflicting { @HasQualifierParameter(Tainted.class) static class Super {} @NoQualifierParameter(Tainted.class) - // :: error: (conflicting.qual.param) + // :: error: [conflicting.qual.param] static class Sup extends Super {} } diff --git a/checker/tests/tainting/TypeInvalid.java b/checker/tests/tainting/TypeInvalid.java index 9df9301f8606..d8b370cd51a9 100644 --- a/checker/tests/tainting/TypeInvalid.java +++ b/checker/tests/tainting/TypeInvalid.java @@ -9,53 +9,53 @@ import org.checkerframework.checker.tainting.qual.Untainted; abstract class TypeInvalid { - // :: error: (conflicting.annos) + // :: error: [conflicting.annos] static @Untainted @Tainted class Inner {} // Duplication forbidden - // :: error: (conflicting.annos) + // :: error: [conflicting.annos] void bad(@Tainted @Untainted TypeInvalid c) { - // :: error: (conflicting.annos) + // :: error: [conflicting.annos] Object o = new @Tainted @Untainted Object(); - // :: error: (conflicting.annos) + // :: error: [conflicting.annos] o = new @Tainted @Untainted Object(); - // :: error: (conflicting.annos) + // :: error: [conflicting.annos] o = o.equals(new @Tainted @Untainted Object()); - // :: error: (conflicting.annos) + // :: error: [conflicting.annos] o = (Object) new @Tainted @Untainted Object(); - // :: error: (conflicting.annos) + // :: error: [conflicting.annos] o = (@Tainted @Untainted TypeInvalid) o; - // :: error: (conflicting.annos) + // :: error: [conflicting.annos] o = (new @Tainted @Untainted Object()) instanceof Object; - // :: error: (conflicting.annos) - // :: warning: (instanceof.unsafe) + // :: error: [conflicting.annos] + // :: warning: [instanceof.unsafe] o = o instanceof @Tainted @Untainted TypeInvalid; } - // :: error: (conflicting.annos) + // :: error: [conflicting.annos] @Tainted @Untainted Object bar() { return null; } - // :: error: (conflicting.annos) + // :: error: [conflicting.annos] abstract @Tainted @Untainted Object absbar(); void voidmethod() {} TypeInvalid() {} - // :: error: (conflicting.annos) + // :: error: [conflicting.annos] @Tainted @Untainted TypeInvalid(int p) {} - // :: error: (conflicting.annos) + // :: error: [conflicting.annos] void recv(@Tainted @Untainted TypeInvalid this) {} - // :: error: (conflicting.annos) + // :: error: [conflicting.annos] @Tainted @Untainted Object field; // TODO: Note the error marker positions for the errors on fields // and method return types. Maybe these should be improved. - // :: error: (conflicting.annos) + // :: error: [conflicting.annos] void athro() throws @Tainted @Untainted Exception {} } diff --git a/checker/tests/tainting/WildcardArrayBound.java b/checker/tests/tainting/WildcardArrayBound.java index 7be3bb3bd9b8..2a24f60b1dd7 100644 --- a/checker/tests/tainting/WildcardArrayBound.java +++ b/checker/tests/tainting/WildcardArrayBound.java @@ -12,14 +12,14 @@ void use1( Other x, Other<@Tainted MyInterface @Untainted []> y) { Other z = y; - // :: error: (assignment) + // :: error: [assignment] x = y; } void use( Other x, Other<@Tainted MyInterface @Untainted []> y) { - // :: error: (assignment) + // :: error: [assignment] x = y; @Untainted Serializable s = x.getU(); @Untainted MyInterface @Untainted [] sw = x.getU(); diff --git a/checker/tests/tainting/java17/TaintingBindingVariable.java b/checker/tests/tainting/java17/TaintingBindingVariable.java index fef9bde4f202..6afa1b7790a0 100644 --- a/checker/tests/tainting/java17/TaintingBindingVariable.java +++ b/checker/tests/tainting/java17/TaintingBindingVariable.java @@ -13,12 +13,12 @@ void bar(@Untainted Object o) { } void bar2(Object o) { - // :: warning: (instanceof.pattern.unsafe) + // :: warning: [instanceof.pattern.unsafe] if (o instanceof @Untainted String s) { @Untainted String f = s; } if (o instanceof String s) { - // :: error: (assignment) + // :: error: [assignment] @Untainted String f2 = s; } } diff --git a/checker/tests/tainting/withdefault/NoQualifierTest.java b/checker/tests/tainting/withdefault/NoQualifierTest.java index 409daf01a264..2d70098d22ef 100644 --- a/checker/tests/tainting/withdefault/NoQualifierTest.java +++ b/checker/tests/tainting/withdefault/NoQualifierTest.java @@ -6,6 +6,6 @@ @NoQualifierParameter(Tainted.class) public class NoQualifierTest { - // :: error: (invalid.polymorphic.qualifier.use) + // :: error: [invalid.polymorphic.qualifier.use] @PolyTainted int field; } diff --git a/checker/tests/units/Addition.java b/checker/tests/units/Addition.java index c7c524f7b372..aacecba58d49 100644 --- a/checker/tests/units/Addition.java +++ b/checker/tests/units/Addition.java @@ -206,43 +206,43 @@ void bad() { // Dimensions // Acceleration - // :: error: (assignment) + // :: error: [assignment] @Acceleration int sAcceleration = aAcceleration + bMass; // Area - // :: error: (assignment) + // :: error: [assignment] @Luminance int sLuminance = aArea + bArea; // Current - // :: error: (assignment) + // :: error: [assignment] @Current int sCurrent = aMass + bCurrent; // Length - // :: error: (assignment) + // :: error: [assignment] @Length int sLength = aLength + bSubstance; // Luminance - // :: error: (assignment) + // :: error: [assignment] @Temperature int sTemperature = aLuminance + bLuminance; // Mass - // :: error: (assignment) + // :: error: [assignment] @Mass int sMass = aTemperature + bMass; // Substance - // :: error: (assignment) + // :: error: [assignment] @Substance int sSubstance = aSubstance + bCurrent; // Temperature - // :: error: (assignment) + // :: error: [assignment] @Area int sArea = aTemperature + bTemperature; // Time - // :: error: (assignment) + // :: error: [assignment] @Time int sTime = aArea + bTime; // Force - // :: error: (assignment) + // :: error: [assignment] sMass = aForce + bForce; // Units @@ -336,91 +336,91 @@ void bad() { // Units // Amperes - // :: error: (assignment) + // :: error: [assignment] @g int sGram = aAmpere + bAmpere; // Candela - // :: error: (assignment) + // :: error: [assignment] @cd int sCandela = aTemperature + bCandela; // Celsius - // :: error: (assignment) + // :: error: [assignment] @C int sCelsius = aCelsius + bMillimeter; // Gram - // :: error: (assignment) + // :: error: [assignment] @kg int sKilogram = aGram + bGram; // Hour - // :: error: (assignment) + // :: error: [assignment] @h int sHour = aSquareMeter + bHour; // Kelvin - // :: error: (assignment) + // :: error: [assignment] @K int sKelvin = aKelvin + bSecond; // Kilogram - // :: error: (assignment) + // :: error: [assignment] @kmPERh int sKilometerPerHour = aKilogram + bKilogram; // Kilometer - // :: error: (assignment) + // :: error: [assignment] @km int sKilometer = aCandela + bKilometer; // Square kilometer - // :: error: (assignment) + // :: error: [assignment] @km2 int sSquareKilometer = aSquareKilometer + bAmpere; // Kilometer per hour - // :: error: (assignment) + // :: error: [assignment] @mPERs int sMeterPerSecond = aKilometerPerHour + bKilometerPerHour; // Meter - // :: error: (assignment) + // :: error: [assignment] @m int sMeter = aHour + bMeter; // Square meter - // :: error: (assignment) + // :: error: [assignment] @m2 int sSquareMeter = aSquareMeter + bGram; // Meter per second - // :: error: (assignment) + // :: error: [assignment] @mm2 int sSquareMillimeter = aMeterPerSecond + bMeterPerSecond; // Meter per second square - // :: error: (assignment) + // :: error: [assignment] @mPERs2 int sMeterPerSecondSquare = aMeterPerSecondSquare + bMeter; // Minute - // :: error: (assignment) + // :: error: [assignment] @min int sMinute = aMole + bMinute; // Millimeter - // :: error: (assignment) + // :: error: [assignment] @mm int sMillimeter = aMillimeter + bHour; // Square millimeter - // :: error: (assignment) + // :: error: [assignment] @A int sAmpere = aSquareMillimeter + bSquareMillimeter; // Mole - // :: error: (assignment) + // :: error: [assignment] @mol int sMole = aCandela + bMole; // Second - // :: error: (assignment) + // :: error: [assignment] @s int sSecond = aSecond + bSquareKilometer; // Newton - // :: error: (assignment) + // :: error: [assignment] sKilogram = aNewton + bNewton; // Kilonewton - // :: error: (assignment) + // :: error: [assignment] @kN int sKilonewton = aKilonewton + bNewton; // Metric Ton - // :: error: (assignment) + // :: error: [assignment] @N int sNewton = aNewton + bMetricTon; } } diff --git a/checker/tests/units/BasicUnits.java b/checker/tests/units/BasicUnits.java index 54537599a9e9..983cae59d123 100644 --- a/checker/tests/units/BasicUnits.java +++ b/checker/tests/units/BasicUnits.java @@ -21,13 +21,13 @@ public class BasicUnits { void demo() { - // :: error: (assignment) + // :: error: [assignment] @m int merr = 5; @m int m = 5 * UnitsTools.m; @s int s = 9 * UnitsTools.s; - // :: error: (assignment) + // :: error: [assignment] @km int kmerr = 10; @km int km = 10 * UnitsTools.km; @@ -36,57 +36,57 @@ void demo() { @mPERs int good = m / s; - // :: error: (assignment) + // :: error: [assignment] @mPERs int b1 = s / m; - // :: error: (assignment) + // :: error: [assignment] @mPERs int b2 = m * s; @mPERs2 int goodaccel = m / s / s; - // :: error: (assignment) + // :: error: [assignment] @mPERs2 int badaccel1 = s / m / s; - // :: error: (assignment) + // :: error: [assignment] @mPERs2 int badaccel2 = s / s / m; - // :: error: (assignment) + // :: error: [assignment] @mPERs2 int badaccel3 = s * s / m; - // :: error: (assignment) + // :: error: [assignment] @mPERs2 int badaccel4 = m * s * s; @Area int ae = m * m; @m2 int gae = m * m; - // :: error: (assignment) + // :: error: [assignment] @Area int bae = m * m * m; - // :: error: (assignment) + // :: error: [assignment] @km2 int bae1 = m * m; @Volume int vol = m * m * m; @m3 int gvol = m * m * m; - // :: error: (assignment) + // :: error: [assignment] @Volume int bvol = m * m * m * m; - // :: error: (assignment) + // :: error: [assignment] @km3 int bvol1 = m * m * m; @radians double rad = 20.0d * UnitsTools.rad; @degrees double deg = 30.0d * UnitsTools.deg; @degrees double rToD1 = UnitsTools.toDegrees(rad); - // :: error: (argument) + // :: error: [argument] @degrees double rToD2 = UnitsTools.toDegrees(deg); - // :: error: (assignment) + // :: error: [assignment] @radians double rToD3 = UnitsTools.toDegrees(rad); @radians double dToR1 = UnitsTools.toRadians(deg); - // :: error: (argument) + // :: error: [argument] @radians double rToR2 = UnitsTools.toRadians(rad); - // :: error: (assignment) + // :: error: [assignment] @degrees double rToR3 = UnitsTools.toRadians(deg); // speed conversion @@ -96,9 +96,9 @@ void demo() { @kmPERh int kmPhrRes = (int) UnitsTools.fromMeterPerSecondToKiloMeterPerHour(mPs); @mPERs int mPsRes = (int) UnitsTools.fromKiloMeterPerHourToMeterPerSecond(kmPhr); - // :: error: (assignment) + // :: error: [assignment] @mPERs int mPsResBad = (int) UnitsTools.fromMeterPerSecondToKiloMeterPerHour(mPs); - // :: error: (assignment) + // :: error: [assignment] @kmPERh int kmPhrResBad = (int) UnitsTools.fromKiloMeterPerHourToMeterPerSecond(kmPhr); // speeds @@ -107,9 +107,9 @@ void demo() { @kmPERh int speed = kilometers / hours; // Addition/substraction only accepts another @kmPERh value - // :: error: (assignment) + // :: error: [assignment] speed = speed + 5; - // :: error: (compound.assignment) + // :: error: [compound.assignment] speed += 5; speed += speed; @@ -132,18 +132,18 @@ void prefixOutputTest() { @m(Prefix.one) int z = 3 * UnitsTools.m; @km int y2 = 3 * UnitsTools.km; - // :: error: (assignment) + // :: error: [assignment] y2 = z; - // :: error: (assignment) + // :: error: [assignment] y2 = x; - // :: error: (assignment) + // :: error: [assignment] y = z; - // :: error: (assignment) + // :: error: [assignment] y = x; - // :: error: (assignment) + // :: error: [assignment] y2 = x * x; - // :: error: (assignment) + // :: error: [assignment] y2 = z * z; } } diff --git a/checker/tests/units/Division.java b/checker/tests/units/Division.java index 5d87e7b3da0e..599e59921d8b 100644 --- a/checker/tests/units/Division.java +++ b/checker/tests/units/Division.java @@ -24,7 +24,7 @@ void d() { @m int am = 6 * UnitsTools.m, bm = 3 * UnitsTools.m; int x = am / bm; - // :: error: (assignment) + // :: error: [assignment] @m int bad = am / bm; // Division removes the unit. @@ -54,82 +54,82 @@ void d() { // m / s = mPERs @mPERs int velocitym = m / s; - // :: error: (assignment) + // :: error: [assignment] velocitym = m / h; // km / h = kmPERh @kmPERh int velocitykm = km / h; - // :: error: (assignment) + // :: error: [assignment] velocitykm = km / s; // m2 / m = m @m int distancem = m2 / m; - // :: error: (assignment) + // :: error: [assignment] distancem = m2 / km; // km2 / km = km @km int distancekm = km2 / km; - // :: error: (assignment) + // :: error: [assignment] distancekm = km2 / m; // mm2 / mm = mm @mm int distancemm = mm2 / mm; - // :: error: (assignment) + // :: error: [assignment] distancemm = km2 / mm; // m3 / m2 = m distancem = m3 / m2; - // :: error: (assignment) + // :: error: [assignment] distancem = m3 / km2; // km3 / km2 = km distancekm = km3 / km2; - // :: error: (assignment) + // :: error: [assignment] distancekm = km3 / m2; // mm3 / mm2 = mm distancemm = mm3 / mm2; - // :: error: (assignment) + // :: error: [assignment] distancemm = km3 / mm2; // m / mPERs = s @s int times = m / mPERs; - // :: error: (assignment) + // :: error: [assignment] times = km / mPERs; // km / kmPERh = h @h int timeh = km / kmPERh; - // :: error: (assignment) + // :: error: [assignment] timeh = m / kmPERh; // mPERs / s = mPERs2 @mPERs2 int accel1 = mPERs / s; - // :: error: (assignment) + // :: error: [assignment] accel1 = kmPERh / s; // mPERs / mPERs2 = s @s int times2 = mPERs / mPERs2; - // :: error: (assignment) + // :: error: [assignment] times2 = kmPERh / mPERs2; // mPERs2 = N / kg @mPERs2 int accel2 = N / kg; - // :: error: (assignment) + // :: error: [assignment] accel2 = N / km; // mPERs2 = kN / t @mPERs2 int accel3 = kN / t; - // :: error: (assignment) + // :: error: [assignment] accel3 = N / t; // kg = N / mPERs2 @kg int mass = N / mPERs2; - // :: error: (assignment) + // :: error: [assignment] mass = s / mPERs2; // t = kN / mPERs2 @t int mass2 = kN / mPERs2; - // :: error: (assignment) + // :: error: [assignment] mass2 = N / mPERs2; } diff --git a/checker/tests/units/Multiples.java b/checker/tests/units/Multiples.java index 8e3b64b3ee22..a8a8d2849657 100644 --- a/checker/tests/units/Multiples.java +++ b/checker/tests/units/Multiples.java @@ -26,45 +26,45 @@ void m() { // kg @kg int kg = 5 * UnitsTools.kg; @g(Prefix.kilo) int alsokg = kg; - // :: error: (assignment) + // :: error: [assignment] @g(Prefix.giga) int notkg = kg; - // :: error: (assignment) + // :: error: [assignment] kg = notkg; kg = alsokg; // g @g int g = 5 * UnitsTools.g; @g(Prefix.one) int alsog = g; - // :: error: (assignment) + // :: error: [assignment] @g(Prefix.milli) int notg = g; - // :: error: (assignment) + // :: error: [assignment] notg = g; g = alsog; // m @m int m = 5 * UnitsTools.m; @m(Prefix.one) int alsom = m; - // :: error: (assignment) + // :: error: [assignment] @m(Prefix.giga) int notm = m; - // :: error: (assignment) + // :: error: [assignment] m = notm; m = alsom; // km @km int km = 5 * UnitsTools.km; @m(Prefix.kilo) int alsokm = km; - // :: error: (assignment) + // :: error: [assignment] @m(Prefix.giga) int notkm = km; - // :: error: (assignment) + // :: error: [assignment] km = notkm; km = alsokm; // mm @mm int mm = 5 * UnitsTools.mm; @m(Prefix.milli) int alsomm = mm; - // :: error: (assignment) + // :: error: [assignment] @m(Prefix.giga) int notmm = mm; - // :: error: (assignment) + // :: error: [assignment] mm = notmm; mm = alsomm; @@ -72,9 +72,9 @@ void m() { @N int N = 5 * UnitsTools.N; @N(Prefix.one) int alsoN = N; @N(Prefix.giga) - // :: error: (assignment) + // :: error: [assignment] int notN = N; - // :: error: (assignment) + // :: error: [assignment] N = notN; N = alsoN; @@ -82,9 +82,9 @@ void m() { @kN int kN = 5 * UnitsTools.kN; @N(Prefix.kilo) int alsokN = kN; @N(Prefix.giga) - // :: error: (assignment) + // :: error: [assignment] int notkN = kN; - // :: error: (assignment) + // :: error: [assignment] kN = notkN; kN = alsokN; @@ -96,90 +96,90 @@ void m() { // m * m = m2 @m2 int area = m * m; - // :: error: (assignment) + // :: error: [assignment] @km2 int areambad1 = m * m; - // :: error: (assignment) + // :: error: [assignment] @mm2 int areambad2 = m * m; // km * km = km2 @km2 int karea = km * km; - // :: error: (assignment) + // :: error: [assignment] @m2 int areakmbad1 = km * km; - // :: error: (assignment) + // :: error: [assignment] @mm2 int areakmbad2 = km * km; // mm * mm = mm2 @mm2 int marea = mm * mm; - // :: error: (assignment) + // :: error: [assignment] @m2 int areammbad1 = mm * mm; - // :: error: (assignment) + // :: error: [assignment] @km2 int areammbad2 = mm * mm; // m * m2 = m3 @m3 int volume = m * area; - // :: error: (assignment) + // :: error: [assignment] @km3 int volumembad1 = m * area; - // :: error: (assignment) + // :: error: [assignment] @mm3 int volumembad2 = m * area; // km * km2 = km3 @km3 int kvolume = km * karea; - // :: error: (assignment) + // :: error: [assignment] @m3 int volumekmbad1 = km * karea; - // :: error: (assignment) + // :: error: [assignment] @mm3 int volumekmbad2 = km * karea; // mm * mm2 = mm3 @mm3 int mvolume = mm * marea; - // :: error: (assignment) + // :: error: [assignment] @m3 int volumemmbad1 = mm * marea; - // :: error: (assignment) + // :: error: [assignment] @km3 int volumemmbad2 = mm * marea; // m2 * m = m3 volume = area * m; - // :: error: (assignment) + // :: error: [assignment] volumembad1 = area * m; - // :: error: (assignment) + // :: error: [assignment] volumembad2 = area * m; // km2 * km = km3 kvolume = karea * km; - // :: error: (assignment) + // :: error: [assignment] volumekmbad1 = karea * km; - // :: error: (assignment) + // :: error: [assignment] volumekmbad2 = karea * km; // mm2 * mm = mm3 mvolume = marea * mm; - // :: error: (assignment) + // :: error: [assignment] volumemmbad1 = marea * mm; - // :: error: (assignment) + // :: error: [assignment] volumemmbad2 = marea * mm; // s * mPERs = m @mPERs int speedm = 10 * UnitsTools.mPERs; @m int lengthm = s * speedm; lengthm = speedm * s; - // :: error: (assignment) + // :: error: [assignment] @km int lengthmbad1 = s * speedm; - // :: error: (assignment) + // :: error: [assignment] @mm int lengthmbad2 = s * speedm; // s * mPERs2 = mPERs @mPERs2 int accelm = 20 * UnitsTools.mPERs2; @mPERs int speedm2 = s * accelm; speedm2 = accelm * s; - // :: error: (assignment) + // :: error: [assignment] @kmPERh int speedm2bad1 = s * accelm; // h * kmPERh = km @kmPERh int speedkm = 30 * UnitsTools.kmPERh; @km int lengthkm = h * speedkm; lengthkm = speedkm * h; - // :: error: (assignment) + // :: error: [assignment] @m int lengthkmbad1 = h * speedkm; - // :: error: (assignment) + // :: error: [assignment] @mm int lengthkmbad2 = h * speedkm; // kg * mPERs2 = N @@ -199,7 +199,7 @@ void m() { // unit makes sense. // Currently due to left associativity, and the lack of an s2 annotation, this tries to // evaluate (s * s) * mPERs2 which causes the type assignment incompatible error. - // :: error: (assignment) + // :: error: [assignment] @m int distance = s * s * accelm; // if we bracket for order of operations, it works fine distance = s * (s * accelm); diff --git a/checker/tests/units/PolyUnitTest.java b/checker/tests/units/PolyUnitTest.java index b8b42572dabb..952d0d42702f 100644 --- a/checker/tests/units/PolyUnitTest.java +++ b/checker/tests/units/PolyUnitTest.java @@ -16,7 +16,7 @@ void testPolyUnit() { @s int sec1 = 7 * UnitsTools.s; @s int sec2 = triplePolyUnit(sec1); - // :: error: (assignment) + // :: error: [assignment] @s int sec3 = triplePolyUnit(m1); } } diff --git a/checker/tests/units/SubtractionUnits.java b/checker/tests/units/SubtractionUnits.java index e38423240cc6..71626ab7c91e 100644 --- a/checker/tests/units/SubtractionUnits.java +++ b/checker/tests/units/SubtractionUnits.java @@ -211,47 +211,47 @@ void bad() { @Volume int bVolume = 5 * UnitsTools.km3; // Dimensions - // :: error: (assignment) + // :: error: [assignment] @Acceleration int sAcceleration = aAcceleration - bMass; // Area - // :: error: (assignment) + // :: error: [assignment] @Luminance int sLuminance = aArea - bArea; // Current - // :: error: (assignment) + // :: error: [assignment] @Current int sCurrent = aMass - bCurrent; // Length - // :: error: (assignment) + // :: error: [assignment] @Length int sLength = aLength - bSubstance; // Luminance - // :: error: (assignment) + // :: error: [assignment] @Temperature int sTemperature = aLuminance - bLuminance; // Mass - // :: error: (assignment) + // :: error: [assignment] @Mass int sMass = aTemperature - bMass; // Substance - // :: error: (assignment) + // :: error: [assignment] @Substance int sSubstance = aSubstance - bCurrent; // Temperature - // :: error: (assignment) + // :: error: [assignment] @Area int sArea = aTemperature - bTemperature; // Time - // :: error: (assignment) + // :: error: [assignment] @Time int sTime = aArea - bTime; // Volume - // :: error: (assignment) + // :: error: [assignment] @Volume int sVolume = aVolume - bArea; // Force - // :: error: (assignment) + // :: error: [assignment] sMass = aForce - bForce; // Units @@ -357,99 +357,99 @@ void bad() { // Units // Amperes - // :: error: (assignment) + // :: error: [assignment] @g int sGram = aAmpere - bAmpere; // Candela - // :: error: (assignment) + // :: error: [assignment] @cd int sCandela = aTemperature - bCandela; // Celsius - // :: error: (assignment) + // :: error: [assignment] @C int sCelsius = aCelsius - bMillimeter; // Gram - // :: error: (assignment) + // :: error: [assignment] @kg int sKilogram = aGram - bGram; // Hour - // :: error: (assignment) + // :: error: [assignment] @h int sHour = aSquareMeter - bHour; // Kelvin - // :: error: (assignment) + // :: error: [assignment] @K int sKelvin = aKelvin - bSecond; // Kilogram - // :: error: (assignment) + // :: error: [assignment] @kmPERh int sKilometerPerHour = aKilogram - bKilogram; // Kilometer - // :: error: (assignment) + // :: error: [assignment] @km int sKilometer = aCandela - bKilometer; // Square kilometer - // :: error: (assignment) + // :: error: [assignment] @km2 int sSquareKilometer = aSquareKilometer - bAmpere; // Cubic kilometer - // :: error: (assignment) + // :: error: [assignment] @km3 int sCubicKilometer = aCubicKilometer - bAmpere; // Kilometer per hour - // :: error: (assignment) + // :: error: [assignment] @mPERs int sMeterPerSecond = aKilometerPerHour - bKilometerPerHour; // Meter - // :: error: (assignment) + // :: error: [assignment] @m int sMeter = aHour - bMeter; // Square meter - // :: error: (assignment) + // :: error: [assignment] @m2 int sSquareMeter = aSquareMeter - bGram; // Cubic meter - // :: error: (assignment) + // :: error: [assignment] @m3 int sCubicMeter = aCubicMeter - bGram; // Meter per second - // :: error: (assignment) + // :: error: [assignment] @mm2 int sSquareMillimeter = aMeterPerSecond - bMeterPerSecond; // Meter per second square - // :: error: (assignment) + // :: error: [assignment] @mPERs2 int sMeterPerSecondSquare = aMeterPerSecondSquare - bMeter; // Minute - // :: error: (assignment) + // :: error: [assignment] @min int sMinute = aMole - bMinute; // Millimeter - // :: error: (assignment) + // :: error: [assignment] @mm int sMillimeter = aMillimeter - bHour; // Square millimeter - // :: error: (assignment) + // :: error: [assignment] @A int sAmpere = aSquareMillimeter - bSquareMillimeter; // Mole - // :: error: (assignment) + // :: error: [assignment] @mol int sMole = aCandela - bMole; // Second - // :: error: (assignment) + // :: error: [assignment] @s int sSecond = aSecond - bSquareKilometer; // Newton - // :: error: (assignment) + // :: error: [assignment] sKilogram = aNewton - bNewton; // Kilonewton - // :: error: (assignment) + // :: error: [assignment] @kN int sKilonewton = aKilonewton - bNewton; // Metric Ton - // :: error: (assignment) + // :: error: [assignment] @N int sNewton = aNewton - bMetricTon; } } diff --git a/checker/tests/units/UnqualTest.java b/checker/tests/units/UnqualTest.java index e9f3d9b82b49..51460c5fe24a 100644 --- a/checker/tests/units/UnqualTest.java +++ b/checker/tests/units/UnqualTest.java @@ -1,9 +1,9 @@ import org.checkerframework.checker.units.qual.kg; public class UnqualTest { - // :: error: (assignment) + // :: error: [assignment] @kg int kg = 5; int nonkg = kg; - // :: error: (assignment) + // :: error: [assignment] @kg int alsokg = nonkg; } diff --git a/checker/tests/value-index-interaction/MinLenFromPositive.java b/checker/tests/value-index-interaction/MinLenFromPositive.java index 8479b0609de2..943b8f09961a 100644 --- a/checker/tests/value-index-interaction/MinLenFromPositive.java +++ b/checker/tests/value-index-interaction/MinLenFromPositive.java @@ -19,7 +19,7 @@ void testArray(@Positive int @ArrayLen(1) [] x) { void useTestArray(int @ArrayLen(1) [] x, int[] y) { testArray(x); - // :: error: (argument) + // :: error: [argument] testArray(y); } @@ -40,9 +40,9 @@ void foo2(int x) { } @Positive int plus(@Positive int x, @Positive int y) { - // :: error: (assignment) + // :: error: [assignment] @IntRange(from = 0) int z = x + y; - // :: error: (assignment) + // :: error: [assignment] @IntRange(from = 1) int q = x + y; return x + y; diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index d2b1183e10aa..f0c26ac2629c 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -15,6 +15,9 @@ Command-line arguments: New command-line argument `-Aonelinemsg` puts error messages on a single line. This is useful when using a tool that only shows the first line of the error. +The command-line argument `-Anomsgtext` surrounds the error key with brackets +instead of parenthesis. This matches Java error messages. + ### Implementation details In `AnnotatedTypeFactory`, `canonicalAnnotation()` returns a non-null value. diff --git a/docs/developer/release/sanity_checks.py b/docs/developer/release/sanity_checks.py index 9e5a2e25ad7b..8ac06d250fa6 100755 --- a/docs/developer/release/sanity_checks.py +++ b/docs/developer/release/sanity_checks.py @@ -85,8 +85,8 @@ def javac_sanity_check(checker_framework_website: str, release_version: str) -> "Javac sanity check", nullness_output, [ - "NullnessExampleWithWarnings.java:23: error: (assignment)", - "NullnessExampleWithWarnings.java:33: error: (argument)", + "NullnessExampleWithWarnings.java:23: error: [assignment]", + "NullnessExampleWithWarnings.java:33: error: [argument]", ], ) @@ -99,8 +99,8 @@ def javac_sanity_check(checker_framework_website: str, release_version: str) -> "Javac Shorthand Sanity Check", nullness_shorthand_output, [ - "NullnessExampleWithWarnings.java:23: error: (assignment)", - "NullnessExampleWithWarnings.java:33: error: (argument)", + "NullnessExampleWithWarnings.java:23: error: [assignment]", + "NullnessExampleWithWarnings.java:33: error: [argument]", ], ) diff --git a/docs/examples/fenum-extension/FenumDemo.java b/docs/examples/fenum-extension/FenumDemo.java index f8ac4982f0b8..4b2df65bf7d5 100644 --- a/docs/examples/fenum-extension/FenumDemo.java +++ b/docs/examples/fenum-extension/FenumDemo.java @@ -50,18 +50,18 @@ void comparisons() { // ok } - // :: error: (binary) + // :: error: [binary] if (TestStatic.ACONST1 < TestStatic.BCONST2) {} - // :: error: (binary) + // :: error: [binary] if (TestStatic.ACONST1 == TestStatic.BCONST2) {} - // :: error: (binary) + // :: error: [binary] if (TestStatic.ACONST1 >= TestStatic.CCONST2) {} - // :: error: (binary) + // :: error: [binary] if (TestStatic.ACONST1 < 5) {} - // :: error: (binary) + // :: error: [binary] if (TestStatic.BCONST1 > 5) {} - // :: error: (binary) + // :: error: [binary] if (TestStatic.CCONST1 == 5) {} } } diff --git a/docs/examples/subtyping-extension/Demo.java b/docs/examples/subtyping-extension/Demo.java index 35994c9b6404..2c2093191071 100644 --- a/docs/examples/subtyping-extension/Demo.java +++ b/docs/examples/subtyping-extension/Demo.java @@ -9,7 +9,7 @@ abstract class EncryptionDemo { for (int i = 0; i < b.length; b[i++]++) { // side effect is in increment expression of for loop } - // :: warning: (cast.unsafe) + // :: warning: [cast.unsafe] return (@Encrypted String) new String(b); } diff --git a/docs/examples/units-extension/UnitsExtensionDemo.java b/docs/examples/units-extension/UnitsExtensionDemo.java index 79d6a79912fb..148873ff63b6 100644 --- a/docs/examples/units-extension/UnitsExtensionDemo.java +++ b/docs/examples/units-extension/UnitsExtensionDemo.java @@ -10,7 +10,7 @@ public class UnitsExtensionDemo { void bad() { // Error! Unqualified value assigned to a @Hz value. - // :: error: (assignment) + // :: error: [assignment] frq = 5; // suppress all warnings issued by the units checker for the d1 assignment statement @@ -63,7 +63,7 @@ public static void main(String[] args) { @Frequency int okTernaryAssign = seconds > 10 ? hertz : kilohertz; // on the other hand, this statement expects the right-hand side to be a Hz, so it will fail - // :: error: (assignment) + // :: error: [assignment] @Hz int badTernaryAssign = seconds > 10 ? hertz : kilohertz; } } diff --git a/docs/manual/creating-a-checker.tex b/docs/manual/creating-a-checker.tex index 0324099b9a2f..9d4a7444a8b6 100644 --- a/docs/manual/creating-a-checker.tex +++ b/docs/manual/creating-a-checker.tex @@ -286,7 +286,7 @@ void testHierarchy(@UnknownSign int us, @NonNegative int nn) { @UnknownSign int a = us; @UnknownSign int b = nn; - // :: error: (assignment) + // :: error: [assignment] @NonNegative int c = us; // expected error on this line @NonNegative int d = nn; } @@ -2056,7 +2056,7 @@ class MyNullnessTest { void method() { Object nullable = null; - // :: error: (dereference.of.nullable) + // :: error: [dereference.of.nullable] nullable.toString(); } } diff --git a/docs/manual/generics.tex b/docs/manual/generics.tex index 5cca9c484331..cfb48d5946ac 100644 --- a/docs/manual/generics.tex +++ b/docs/manual/generics.tex @@ -936,7 +936,7 @@ \begin{Verbatim} @Untainted Buffer untaintedBuffer = ...; @Tainted String taintedString = ...; -untaintedBuffer.append(taintedString); // error: (argument) +untaintedBuffer.append(taintedString); // error: [argument] \end{Verbatim} The above \ call is illegal because the \<@PolyTainted> is instantiated to \<@Untainted> and the type of the argument is \<@Tainted> which is a supertype of \<@Untainted>. If the type of diff --git a/framework-test/src/main/java/org/checkerframework/framework/test/TestConfiguration.java b/framework-test/src/main/java/org/checkerframework/framework/test/TestConfiguration.java index 7e11c13c3d20..dc3fee7a1c52 100644 --- a/framework-test/src/main/java/org/checkerframework/framework/test/TestConfiguration.java +++ b/framework-test/src/main/java/org/checkerframework/framework/test/TestConfiguration.java @@ -24,7 +24,7 @@ public interface TestConfiguration { * * e.g., * - *
MethodInvocation.java:17: error: (method.invocation)
+ *
MethodInvocation.java:17: error: [method.invocation]
* * If getDiagnosticFiles does NOT return an empty list, then the only diagnostics expected by the * TestExecutor will be the ones found in these files. If it does return an empty list, then the diff --git a/framework-test/src/main/java/org/checkerframework/framework/test/TypecheckResult.java b/framework-test/src/main/java/org/checkerframework/framework/test/TypecheckResult.java index ab9d9274ffd3..aec75670d2c8 100644 --- a/framework-test/src/main/java/org/checkerframework/framework/test/TypecheckResult.java +++ b/framework-test/src/main/java/org/checkerframework/framework/test/TypecheckResult.java @@ -187,10 +187,8 @@ public static TypecheckResult fromCompilationResults( CompilationResult result, Collection expectedDiagnostics) { - // We are passing `true` as the `noMsgText` argument because "-Anomsgtext" - // is always added to the non-JVM options in `TypecheckExecutor.compile`. Set actualDiagnostics = - TestDiagnosticUtils.fromJavaxDiagnosticList(result.getDiagnostics(), true); + TestDiagnosticUtils.fromJavaxDiagnosticList(result.getDiagnostics()); Set unexpectedDiagnostics = new LinkedHashSet<>(actualDiagnostics); unexpectedDiagnostics.removeAll(expectedDiagnostics); diff --git a/framework-test/src/main/java/org/checkerframework/framework/test/diagnostics/TestDiagnostic.java b/framework-test/src/main/java/org/checkerframework/framework/test/diagnostics/TestDiagnostic.java index 146e9b4e83c0..7d186475eae9 100644 --- a/framework-test/src/main/java/org/checkerframework/framework/test/diagnostics/TestDiagnostic.java +++ b/framework-test/src/main/java/org/checkerframework/framework/test/diagnostics/TestDiagnostic.java @@ -130,7 +130,7 @@ public int hashCode() { @Override public String toString() { String loc = filename + ":" + lineNumber + ": "; - String key = "(" + this.key + ")"; + String key = "[" + this.key + "]"; String msg = message == null ? "" : " " + message; if (kind == DiagnosticKind.JSpecify) { return loc + key; diff --git a/framework-test/src/main/java/org/checkerframework/framework/test/diagnostics/TestDiagnosticUtils.java b/framework-test/src/main/java/org/checkerframework/framework/test/diagnostics/TestDiagnosticUtils.java index 8fd0c5718765..ed3d95cfd117 100644 --- a/framework-test/src/main/java/org/checkerframework/framework/test/diagnostics/TestDiagnosticUtils.java +++ b/framework-test/src/main/java/org/checkerframework/framework/test/diagnostics/TestDiagnosticUtils.java @@ -86,15 +86,17 @@ public static TestDiagnostic fromJavaFileComment( /** * Instantiate a diagnostic from output produced by the Java compiler. The resulting diagnostic is - * never fixable and always has parentheses. + * never fixable and always has square brackets. + * + * @param diagnosticString a diagnostic produced by the Java compiler + * @return a TestDiagnostic for the string */ - public static TestDiagnostic fromJavaxToolsDiagnostic( - String diagnosticString, boolean noMsgText) { + public static TestDiagnostic fromJavaxToolsDiagnostic(String diagnosticString) { // It would be nice not to parse this from the diagnostic string. // However, diagnostic.toString() may contain "[unchecked]" even though getMessage() does // not. // Since we want to match the error messages reported by javac exactly, we must parse. - IPair messageAndFilename = messageAndFilename(diagnosticString, noMsgText); + IPair messageAndFilename = messageAndFilename(diagnosticString); String message = messageAndFilename.first; String filename = messageAndFilename.second; return fromPatternMatching( @@ -242,34 +244,31 @@ protected static TestDiagnostic fromPatternMatching( * line of the message, without the leading filename. * * @param original a javax diagnostic - * @param noMsgText true if to do work; if false, this returns a pair of (argument, "") * @return the diagnostic, split into message and filename */ - public static IPair messageAndFilename(String original, boolean noMsgText) { + public static IPair messageAndFilename(String original) { String trimmed = original; String filename = ""; - if (noMsgText) { - if (!retainAllLines(trimmed)) { + if (!retainAllLines(trimmed)) { - // Retain only the first line. - int lineSepPos = trimmed.indexOf(System.lineSeparator()); - if (lineSepPos != -1) { - trimmed = trimmed.substring(0, lineSepPos); - } + // Retain only the first line. + int lineSepPos = trimmed.indexOf(System.lineSeparator()); + if (lineSepPos != -1) { + trimmed = trimmed.substring(0, lineSepPos); + } - int extensionPos = trimmed.indexOf(".java:"); - if (extensionPos != -1) { - int basenameStart = trimmed.lastIndexOf(File.separator, extensionPos); - filename = trimmed.substring(basenameStart + 1, extensionPos + 5).trim(); - trimmed = trimmed.substring(extensionPos + 5).trim(); - } + int extensionPos = trimmed.indexOf(".java:"); + if (extensionPos != -1) { + int basenameStart = trimmed.lastIndexOf(File.separator, extensionPos); + filename = trimmed.substring(basenameStart + 1, extensionPos + 5).trim(); + trimmed = trimmed.substring(extensionPos + 5).trim(); + } - // Retain only the file basename, without directories, when embedded in message. - Matcher m = filenamePattern.matcher(trimmed); - if (m.find()) { - trimmed = - trimmed.substring(0, m.start()) + " " + m.group(1) + ":" + trimmed.substring(m.end()); - } + // Retain only the file basename, without directories, when embedded in message. + Matcher m = filenamePattern.matcher(trimmed); + if (m.find()) { + trimmed = + trimmed.substring(0, m.start()) + " " + m.group(1) + ":" + trimmed.substring(m.end()); } } @@ -426,8 +425,14 @@ public static TestDiagnosticLine fromDiagnosticFileLine(String diagnosticLine) { "", diagnostic.getLineNumber(), diagnosticLine, Arrays.asList(diagnostic)); } + /** + * Convert Java compiler output into a set of {@code TestDiagnostic}s. + * + * @param javaxDiagnostics output of the Java compiler + * @return a set of {@code TestDiagnostic}s + */ public static Set fromJavaxDiagnosticList( - List> javaxDiagnostics, boolean noMsgText) { + List> javaxDiagnostics) { Set diagnostics = new LinkedHashSet<>(javaxDiagnostics.size()); for (Diagnostic diagnostic : javaxDiagnostics) { @@ -443,7 +448,7 @@ public static Set fromJavaxDiagnosticList( continue; } - diagnostics.add(TestDiagnosticUtils.fromJavaxToolsDiagnostic(diagnosticString, noMsgText)); + diagnostics.add(TestDiagnosticUtils.fromJavaxToolsDiagnostic(diagnosticString)); } return diagnostics; diff --git a/framework-test/src/test/java/org/checkerframework/framework/test/test/junit/AlternateTestRootPerDirTest.java b/framework-test/src/test/java/org/checkerframework/framework/test/test/junit/AlternateTestRootPerDirTest.java index 92cefa545899..76c4aa97dc65 100644 --- a/framework-test/src/test/java/org/checkerframework/framework/test/test/junit/AlternateTestRootPerDirTest.java +++ b/framework-test/src/test/java/org/checkerframework/framework/test/test/junit/AlternateTestRootPerDirTest.java @@ -42,11 +42,11 @@ public void checkResult(TypecheckResult typecheckResult) { CoreMatchers.either( CoreMatchers.hasItem( TestDiagnosticUtils.fromJavaFileComment( - "Issue6125A.java", 5, "error: (assignment)"))) + "Issue6125A.java", 5, "error: [assignment]"))) .or( CoreMatchers.hasItem( TestDiagnosticUtils.fromJavaFileComment( - "Issue6125B.java", 5, "error: (assignment)")))); + "Issue6125B.java", 5, "error: [assignment]")))); MatcherAssert.assertThat( "test check result has exactly zero unexpected diagnostics", typecheckResult.getUnexpectedDiagnostics().size(), diff --git a/framework-test/src/test/java/org/checkerframework/framework/test/test/junit/AlternateTestRootPerFileWithDirsTest.java b/framework-test/src/test/java/org/checkerframework/framework/test/test/junit/AlternateTestRootPerFileWithDirsTest.java index 6a2218373d61..aa5b235605c3 100644 --- a/framework-test/src/test/java/org/checkerframework/framework/test/test/junit/AlternateTestRootPerFileWithDirsTest.java +++ b/framework-test/src/test/java/org/checkerframework/framework/test/test/junit/AlternateTestRootPerFileWithDirsTest.java @@ -41,11 +41,11 @@ public void checkResult(TypecheckResult typecheckResult) { CoreMatchers.either( CoreMatchers.hasItem( TestDiagnosticUtils.fromJavaFileComment( - "Issue6125A.java", 5, "error: (assignment)"))) + "Issue6125A.java", 5, "error: [assignment]"))) .or( CoreMatchers.hasItem( TestDiagnosticUtils.fromJavaFileComment( - "Issue6125B.java", 5, "error: (assignment)")))); + "Issue6125B.java", 5, "error: [assignment]")))); MatcherAssert.assertThat( "test check result has exactly zero unexpected diagnostics", typecheckResult.getUnexpectedDiagnostics().size(), diff --git a/framework-test/src/test/java/org/checkerframework/framework/test/test/junit/AlternateTestRootPerFileWithFilesTest.java b/framework-test/src/test/java/org/checkerframework/framework/test/test/junit/AlternateTestRootPerFileWithFilesTest.java index 35bdf9e335e7..e97e81ef97df 100644 --- a/framework-test/src/test/java/org/checkerframework/framework/test/test/junit/AlternateTestRootPerFileWithFilesTest.java +++ b/framework-test/src/test/java/org/checkerframework/framework/test/test/junit/AlternateTestRootPerFileWithFilesTest.java @@ -41,7 +41,7 @@ public void checkResult(TypecheckResult typecheckResult) { "test check result has the expected diagnostic of the test file", typecheckResult.getExpectedDiagnostics(), CoreMatchers.hasItem( - TestDiagnosticUtils.fromJavaFileComment("Issue6125A.java", 5, "error: (assignment)"))); + TestDiagnosticUtils.fromJavaFileComment("Issue6125A.java", 5, "error: [assignment]"))); MatcherAssert.assertThat( "test check result has exactly zero unexpected diagnostics", typecheckResult.getUnexpectedDiagnostics().size(), diff --git a/framework-test/tests-alt/alt-dir-a/Issue6125A.java b/framework-test/tests-alt/alt-dir-a/Issue6125A.java index 176038319996..80aae8e26e71 100644 --- a/framework-test/tests-alt/alt-dir-a/Issue6125A.java +++ b/framework-test/tests-alt/alt-dir-a/Issue6125A.java @@ -1,6 +1,6 @@ import org.checkerframework.common.value.qual.StringVal; public class Issue6125A { - // :: error: (assignment) + // :: error: [assignment] @StringVal("hello") String s = "goodbye"; } diff --git a/framework-test/tests-alt/alt-dir-b/Issue6125B.java b/framework-test/tests-alt/alt-dir-b/Issue6125B.java index 9b6bbbaacc31..0eb23cbb6b50 100644 --- a/framework-test/tests-alt/alt-dir-b/Issue6125B.java +++ b/framework-test/tests-alt/alt-dir-b/Issue6125B.java @@ -1,6 +1,6 @@ import org.checkerframework.common.value.qual.StringVal; public class Issue6125B { - // :: error: (assignment) + // :: error: [assignment] @StringVal("hello") String s = "world"; } diff --git a/framework/src/main/java/org/checkerframework/framework/source/SourceChecker.java b/framework/src/main/java/org/checkerframework/framework/source/SourceChecker.java index 640d1dd28f82..27b335ae65ba 100644 --- a/framework/src/main/java/org/checkerframework/framework/source/SourceChecker.java +++ b/framework/src/main/java/org/checkerframework/framework/source/SourceChecker.java @@ -1449,7 +1449,7 @@ private void report( return; } - String defaultFormat = "(" + messageKey + ")"; + String defaultFormat = "[" + messageKey + "]"; String prefix; String fmtString; if (this.processingEnv.getOptions() != null /*nnbug*/ @@ -1681,7 +1681,7 @@ protected Object processErrorMessageArg(Object arg) { * * @param source the object from which to obtain source position information; may be an Element, a * Tree, or null - * @param defaultFormat the message key, in parentheses + * @param defaultFormat the message key, in square brackets * @param args arguments for interpolation in the string corresponding to the given message key * @return the first part of the message format output by {@code -Adetailedmsgtext} */ diff --git a/framework/tests/accumulation-norr/SimpleFluent.java b/framework/tests/accumulation-norr/SimpleFluent.java index 2f103d6f053f..ad5c43fd3bba 100644 --- a/framework/tests/accumulation-norr/SimpleFluent.java +++ b/framework/tests/accumulation-norr/SimpleFluent.java @@ -29,13 +29,13 @@ SimpleFluent c() { } static void doStuffCorrect(@TestAccumulation({"a", "b"}) SimpleFluent s) { - // :: error: (method.invocation) + // :: error: [method.invocation] s.a().b().build(); } static void doStuffWrong(@TestAccumulation({"a"}) SimpleFluent s) { s.a() - // :: error: (method.invocation) + // :: error: [method.invocation] .build(); } @@ -43,19 +43,19 @@ static void noReturnsReceiverAnno(@TestAccumulation({"a", "b"}) SimpleFluent s) s.a() .b() .c() - // :: error: (method.invocation) + // :: error: [method.invocation] .build(); } static void mixFluentAndNonFluent(SimpleFluent s1) { s1.a().b(); - // :: error: (method.invocation) + // :: error: [method.invocation] s1.build(); } static void mixFluentAndNonFluentWrong(SimpleFluent s) { s.a(); // .b() - // :: error: (method.invocation) + // :: error: [method.invocation] s.build(); } @@ -63,7 +63,7 @@ static void fluentLoop(SimpleFluent t) { SimpleFluent s = t.a(); int i = 10; while (i > 0) { - // :: error: (method.invocation) + // :: error: [method.invocation] s.b().build(); i--; s = new SimpleFluent(); @@ -71,55 +71,55 @@ static void fluentLoop(SimpleFluent t) { } static void m1(SimpleFluent s) { - // :: error: (method.invocation) + // :: error: [method.invocation] s.c().a().b().build(); } static void m2(SimpleFluent s) { s.c().a().b(); - // :: error: (method.invocation) + // :: error: [method.invocation] s.c().build(); } static void m3(SimpleFluent s) { - // :: error: (method.invocation) + // :: error: [method.invocation] s.c().a().b().build(); - // :: error: (method.invocation) + // :: error: [method.invocation] s.c().a().build(); } static void m4(SimpleFluent s) { - // :: error: (method.invocation) + // :: error: [method.invocation] s.c().a().b().build2().build(); } static void m5(SimpleFluent s) { s.a().c(); - // :: error: (method.invocation) + // :: error: [method.invocation] s.b().build(); } static void m6(SimpleFluent s) { - // :: error: (method.invocation) + // :: error: [method.invocation] s.a().c().b().build(); } static void m7(SimpleFluent s) { - // :: error: (method.invocation) + // :: error: [method.invocation] s.a().b().build().c().b().build(); } static void m8(SimpleFluent s) { - // :: error: (method.invocation) + // :: error: [method.invocation] s.a().build().c().a().b().build(); - // :: error: (method.invocation) + // :: error: [method.invocation] s.build(); } static void m9() { - // :: error: (method.invocation) + // :: error: [method.invocation] new SimpleFluent().a().b().build(); - // :: error: (method.invocation) + // :: error: [method.invocation] new SimpleFluent().a().build(); } } diff --git a/framework/tests/accumulation/Not.java b/framework/tests/accumulation/Not.java index dc3b2450a1cd..7849dd27f39c 100644 --- a/framework/tests/accumulation/Not.java +++ b/framework/tests/accumulation/Not.java @@ -27,7 +27,7 @@ void test2(Foo f) { void test3(Foo f) { f.a(); - // :: error: (method.invocation) + // :: error: [method.invocation] f.notA(); f.notB(); } @@ -35,16 +35,16 @@ void test3(Foo f) { void test4(Foo f) { f.b(); f.notA(); - // :: error: (method.invocation) + // :: error: [method.invocation] f.notB(); } void test5(Foo f) { f.a(); f.b(); - // :: error: (method.invocation) + // :: error: [method.invocation] f.notA(); - // :: error: (method.invocation) + // :: error: [method.invocation] f.notB(); } @@ -59,7 +59,7 @@ void test6(Foo f) { } void test7(@TestAccumulation("a") Foo f) { - // :: error: (method.invocation) + // :: error: [method.invocation] f.notA(); } diff --git a/framework/tests/accumulation/Predicates.java b/framework/tests/accumulation/Predicates.java index cb30e7b60e9c..680e15f3d0f2 100644 --- a/framework/tests/accumulation/Predicates.java +++ b/framework/tests/accumulation/Predicates.java @@ -5,7 +5,7 @@ public class Predicates { void testOr1() { MyClass m1 = new MyClass(); - // :: error: (method.invocation) + // :: error: [method.invocation] m1.c(); } @@ -26,7 +26,7 @@ void testOr3() { void testAnd1() { MyClass m1 = new MyClass(); - // :: error: (method.invocation) + // :: error: [method.invocation] m1.d(); } @@ -34,7 +34,7 @@ void testAnd2() { MyClass m1 = new MyClass(); m1.a(); - // :: error: (method.invocation) + // :: error: [method.invocation] m1.d(); } @@ -42,7 +42,7 @@ void testAnd3() { MyClass m1 = new MyClass(); m1.b(); - // :: error: (method.invocation) + // :: error: [method.invocation] m1.d(); } @@ -51,7 +51,7 @@ void testAnd4() { m1.a(); m1.c(); - // :: error: (method.invocation) + // :: error: [method.invocation] m1.d(); } @@ -75,7 +75,7 @@ void testAnd6() { void testAndOr1() { MyClass m1 = new MyClass(); - // :: error: (method.invocation) + // :: error: [method.invocation] m1.e(); } @@ -90,7 +90,7 @@ void testAndOr3() { MyClass m1 = new MyClass(); m1.b(); - // :: error: (method.invocation) + // :: error: [method.invocation] m1.e(); } @@ -115,7 +115,7 @@ void testAndOr5() { void testPrecedence1() { MyClass m1 = new MyClass(); - // :: error: (method.invocation) + // :: error: [method.invocation] m1.f(); } @@ -123,7 +123,7 @@ void testPrecedence2() { MyClass m1 = new MyClass(); m1.a(); - // :: error: (method.invocation) + // :: error: [method.invocation] m1.f(); } @@ -131,7 +131,7 @@ void testPrecedence3() { MyClass m1 = new MyClass(); m1.b(); - // :: error: (method.invocation) + // :: error: [method.invocation] m1.f(); } @@ -201,23 +201,23 @@ void f(@TestAccumulationPredicate("a && b || c") MyClass this) {} static void testAssignability1(@TestAccumulationPredicate("a || b") MyClass cAble) { cAble.c(); - // :: error: (method.invocation) + // :: error: [method.invocation] cAble.d(); - // :: error: (method.invocation) + // :: error: [method.invocation] cAble.e(); - // :: error: (method.invocation) + // :: error: [method.invocation] cAble.f(); } static void testAssignability2(@TestAccumulationPredicate("a && b") MyClass dAble) { // These calls would work if subtyping between predicates was by implication. They issue // errors, because it is not. - // :: error: (method.invocation) + // :: error: [method.invocation] dAble.c(); dAble.d(); - // :: error: (method.invocation) + // :: error: [method.invocation] dAble.e(); - // :: error: (method.invocation) + // :: error: [method.invocation] dAble.f(); } @@ -239,367 +239,367 @@ void testAllAssignability() { cmALocal = cmA; cmALocal = cmpA; - // :: error: (assignment) + // :: error: [assignment] cmALocal = aOrB; cmALocal = aB; // The next line would not fail if predicate subtyping was decided by implication. - // :: error: (assignment) + // :: error: [assignment] cmALocal = aAndB; - // :: error: (assignment) + // :: error: [assignment] cmALocal = bAndCOrA; - // :: error: (assignment) + // :: error: [assignment] cmALocal = bAndCOrAParens; - // :: error: (assignment) + // :: error: [assignment] cmALocal = aAndBOrC; - // :: error: (assignment) + // :: error: [assignment] cmALocal = aAndBOrCParens; - // :: error: (assignment) + // :: error: [assignment] cmALocal = aOrBAndC; // The next line would not fail if predicate subtyping was decided by implication. - // :: error: (assignment) + // :: error: [assignment] cmALocal = bOrCAndA; - // :: error: (assignment) + // :: error: [assignment] cmALocal = bAndC; - // :: error: (assignment) + // :: error: [assignment] cmALocal = bAndCParens; cmpALocal = cmA; cmpALocal = cmpA; - // :: error: (assignment) + // :: error: [assignment] cmpALocal = aOrB; cmpALocal = aB; // The next line would not fail if predicate subtyping was decided by implication. - // :: error: (assignment) + // :: error: [assignment] cmpALocal = aAndB; - // :: error: (assignment) + // :: error: [assignment] cmpALocal = bAndCOrA; - // :: error: (assignment) + // :: error: [assignment] cmpALocal = bAndCOrAParens; - // :: error: (assignment) + // :: error: [assignment] cmpALocal = aAndBOrC; - // :: error: (assignment) + // :: error: [assignment] cmpALocal = aAndBOrCParens; - // :: error: (assignment) + // :: error: [assignment] cmpALocal = aOrBAndC; // The next line would not fail if predicate subtyping was decided by implication. - // :: error: (assignment) + // :: error: [assignment] cmpALocal = bOrCAndA; - // :: error: (assignment) + // :: error: [assignment] cmpALocal = bAndC; - // :: error: (assignment) + // :: error: [assignment] cmpALocal = bAndCParens; aOrBLocal = cmA; // The next line would not fail if predicate subtyping was decided by implication. - // :: error: (assignment) + // :: error: [assignment] aOrBLocal = cmpA; aOrBLocal = aOrB; aOrBLocal = aB; // The next line would not fail if predicate subtyping was decided by implication. - // :: error: (assignment) + // :: error: [assignment] aOrBLocal = aAndB; // The next line would not fail if predicate subtyping was decided by implication. - // :: error: (assignment) + // :: error: [assignment] aOrBLocal = bAndCOrA; // The next line would not fail if predicate subtyping was decided by implication. - // :: error: (assignment) + // :: error: [assignment] aOrBLocal = bAndCOrAParens; - // :: error: (assignment) + // :: error: [assignment] aOrBLocal = aAndBOrC; - // :: error: (assignment) + // :: error: [assignment] aOrBLocal = aAndBOrCParens; // The next line would not fail if predicate subtyping was decided by implication. - // :: error: (assignment) + // :: error: [assignment] aOrBLocal = aOrBAndC; // The next line would not fail if predicate subtyping was decided by implication. - // :: error: (assignment) + // :: error: [assignment] aOrBLocal = bOrCAndA; // The next line would not fail if predicate subtyping was decided by implication. - // :: error: (assignment) + // :: error: [assignment] aOrBLocal = bAndC; // The next line would not fail if predicate subtyping was decided by implication. - // :: error: (assignment) + // :: error: [assignment] aOrBLocal = bAndCParens; - // :: error: (assignment) + // :: error: [assignment] aBLocal = cmA; - // :: error: (assignment) + // :: error: [assignment] aBLocal = cmpA; - // :: error: (assignment) + // :: error: [assignment] aBLocal = aOrB; aBLocal = aB; aBLocal = aAndB; - // :: error: (assignment) + // :: error: [assignment] aBLocal = bAndCOrA; - // :: error: (assignment) + // :: error: [assignment] aBLocal = bAndCOrAParens; - // :: error: (assignment) + // :: error: [assignment] aBLocal = aAndBOrC; - // :: error: (assignment) + // :: error: [assignment] aBLocal = aAndBOrCParens; - // :: error: (assignment) + // :: error: [assignment] aBLocal = aOrBAndC; - // :: error: (assignment) + // :: error: [assignment] aBLocal = bOrCAndA; - // :: error: (assignment) + // :: error: [assignment] aBLocal = bAndC; - // :: error: (assignment) + // :: error: [assignment] aBLocal = bAndCParens; - // :: error: (assignment) + // :: error: [assignment] aAndBLocal = cmA; - // :: error: (assignment) + // :: error: [assignment] aAndBLocal = cmpA; - // :: error: (assignment) + // :: error: [assignment] aAndBLocal = aOrB; aAndBLocal = aB; aAndBLocal = aAndB; - // :: error: (assignment) + // :: error: [assignment] aAndBLocal = bAndCOrA; - // :: error: (assignment) + // :: error: [assignment] aAndBLocal = bAndCOrAParens; - // :: error: (assignment) + // :: error: [assignment] aAndBLocal = aAndBOrC; - // :: error: (assignment) + // :: error: [assignment] aAndBLocal = aAndBOrCParens; - // :: error: (assignment) + // :: error: [assignment] aAndBLocal = aOrBAndC; - // :: error: (assignment) + // :: error: [assignment] aAndBLocal = bOrCAndA; - // :: error: (assignment) + // :: error: [assignment] aAndBLocal = bAndC; - // :: error: (assignment) + // :: error: [assignment] aAndBLocal = bAndCParens; bAndCOrALocal = cmA; // The next line would not fail if predicate subtyping was decided by implication. - // :: error: (assignment) + // :: error: [assignment] bAndCOrALocal = cmpA; - // :: error: (assignment) + // :: error: [assignment] bAndCOrALocal = aOrB; bAndCOrALocal = aB; // The next line would not fail if predicate subtyping was decided by implication. - // :: error: (assignment) + // :: error: [assignment] bAndCOrALocal = aAndB; bAndCOrALocal = bAndCOrA; // The next line would not fail if predicate subtyping was decided by implication. - // :: error: (assignment) + // :: error: [assignment] bAndCOrALocal = bAndCOrAParens; - // :: error: (assignment) + // :: error: [assignment] bAndCOrALocal = aAndBOrC; - // :: error: (assignment) + // :: error: [assignment] bAndCOrALocal = aAndBOrCParens; // The next line would not fail if predicate subtyping was decided by implication. - // :: error: (assignment) + // :: error: [assignment] bAndCOrALocal = aOrBAndC; // The next line would not fail if predicate subtyping was decided by implication. - // :: error: (assignment) + // :: error: [assignment] bAndCOrALocal = bOrCAndA; // The next line would not fail if predicate subtyping was decided by implication. - // :: error: (assignment) + // :: error: [assignment] bAndCOrALocal = bAndC; // The next line would not fail if predicate subtyping was decided by implication. - // :: error: (assignment) + // :: error: [assignment] bAndCOrALocal = bAndCParens; bAndCOrAParensLocal = cmA; // The next line would not fail if predicate subtyping was decided by implication. - // :: error: (assignment) + // :: error: [assignment] bAndCOrAParensLocal = cmpA; - // :: error: (assignment) + // :: error: [assignment] bAndCOrAParensLocal = aOrB; bAndCOrAParensLocal = aB; // The next line would not fail if predicate subtyping was decided by implication. - // :: error: (assignment) + // :: error: [assignment] bAndCOrAParensLocal = aAndB; // The next line would not fail if predicate subtyping was decided by implication. - // :: error: (assignment) + // :: error: [assignment] bAndCOrAParensLocal = bAndCOrA; bAndCOrAParensLocal = bAndCOrAParens; - // :: error: (assignment) + // :: error: [assignment] bAndCOrAParensLocal = aAndBOrC; - // :: error: (assignment) + // :: error: [assignment] bAndCOrAParensLocal = aAndBOrCParens; // The next line would not fail if predicate subtyping was decided by implication. - // :: error: (assignment) + // :: error: [assignment] bAndCOrAParensLocal = aOrBAndC; // The next line would not fail if predicate subtyping was decided by implication. - // :: error: (assignment) + // :: error: [assignment] bAndCOrAParensLocal = bOrCAndA; // The next line would not fail if predicate subtyping was decided by implication. - // :: error: (assignment) + // :: error: [assignment] bAndCOrAParensLocal = bAndC; // The next line would not fail if predicate subtyping was decided by implication. - // :: error: (assignment) + // :: error: [assignment] bAndCOrAParensLocal = bAndCParens; - // :: error: (assignment) + // :: error: [assignment] aAndBOrCLocal = cmA; - // :: error: (assignment) + // :: error: [assignment] aAndBOrCLocal = cmpA; - // :: error: (assignment) + // :: error: [assignment] aAndBOrCLocal = aOrB; aAndBOrCLocal = aB; // The next line would not fail if predicate subtyping was decided by implication. - // :: error: (assignment) + // :: error: [assignment] aAndBOrCLocal = aAndB; - // :: error: (assignment) + // :: error: [assignment] aAndBOrCLocal = bAndCOrA; - // :: error: (assignment) + // :: error: [assignment] aAndBOrCLocal = bAndCOrAParens; aAndBOrCLocal = aAndBOrC; // The next line would not fail if predicate subtyping was decided by implication. - // :: error: (assignment) + // :: error: [assignment] aAndBOrCLocal = aAndBOrCParens; // The next line would not fail if predicate subtyping was decided by implication. - // :: error: (assignment) + // :: error: [assignment] aAndBOrCLocal = aOrBAndC; // The next line would not fail if predicate subtyping was decided by implication. - // :: error: (assignment) + // :: error: [assignment] aAndBOrCLocal = bOrCAndA; // The next line would not fail if predicate subtyping was decided by implication. - // :: error: (assignment) + // :: error: [assignment] aAndBOrCLocal = bAndC; // The next line would not fail if predicate subtyping was decided by implication. - // :: error: (assignment) + // :: error: [assignment] aAndBOrCLocal = bAndCParens; - // :: error: (assignment) + // :: error: [assignment] aAndBOrCParensLocal = cmA; - // :: error: (assignment) + // :: error: [assignment] aAndBOrCParensLocal = cmpA; - // :: error: (assignment) + // :: error: [assignment] aAndBOrCParensLocal = aOrB; aAndBOrCParensLocal = aB; // The next line would not fail if predicate subtyping was decided by implication. - // :: error: (assignment) + // :: error: [assignment] aAndBOrCParensLocal = aAndB; - // :: error: (assignment) + // :: error: [assignment] aAndBOrCParensLocal = bAndCOrA; - // :: error: (assignment) + // :: error: [assignment] aAndBOrCParensLocal = bAndCOrAParens; // The next line would not fail if predicate subtyping was decided by implication. - // :: error: (assignment) + // :: error: [assignment] aAndBOrCParensLocal = aAndBOrC; aAndBOrCParensLocal = aAndBOrCParens; // The next line would not fail if predicate subtyping was decided by implication. - // :: error: (assignment) + // :: error: [assignment] aAndBOrCParensLocal = aOrBAndC; // The next line would not fail if predicate subtyping was decided by implication. - // :: error: (assignment) + // :: error: [assignment] aAndBOrCParensLocal = bOrCAndA; // The next line would not fail if predicate subtyping was decided by implication. - // :: error: (assignment) + // :: error: [assignment] aAndBOrCParensLocal = bAndC; // The next line would not fail if predicate subtyping was decided by implication. - // :: error: (assignment) + // :: error: [assignment] aAndBOrCParensLocal = bAndCParens; - // :: error: (assignment) + // :: error: [assignment] aOrBAndCLocal = cmA; - // :: error: (assignment) + // :: error: [assignment] aOrBAndCLocal = cmpA; - // :: error: (assignment) + // :: error: [assignment] aOrBAndCLocal = aOrB; - // :: error: (assignment) + // :: error: [assignment] aOrBAndCLocal = aB; - // :: error: (assignment) + // :: error: [assignment] aOrBAndCLocal = aAndB; - // :: error: (assignment) + // :: error: [assignment] aOrBAndCLocal = bAndCOrA; - // :: error: (assignment) + // :: error: [assignment] aOrBAndCLocal = bAndCOrAParens; - // :: error: (assignment) + // :: error: [assignment] aOrBAndCLocal = aAndBOrC; - // :: error: (assignment) + // :: error: [assignment] aOrBAndCLocal = aAndBOrCParens; aOrBAndCLocal = aOrBAndC; - // :: error: (assignment) + // :: error: [assignment] aOrBAndCLocal = bOrCAndA; // The next line would not fail if predicate subtyping was decided by implication. - // :: error: (assignment) + // :: error: [assignment] aOrBAndCLocal = bAndC; // The next line would not fail if predicate subtyping was decided by implication. - // :: error: (assignment) + // :: error: [assignment] aOrBAndCLocal = bAndCParens; - // :: error: (assignment) + // :: error: [assignment] bOrCAndALocal = cmA; - // :: error: (assignment) + // :: error: [assignment] bOrCAndALocal = cmpA; - // :: error: (assignment) + // :: error: [assignment] bOrCAndALocal = aOrB; bOrCAndALocal = aB; // The next line would not fail if predicate subtyping was decided by implication. - // :: error: (assignment) + // :: error: [assignment] bOrCAndALocal = aAndB; - // :: error: (assignment) + // :: error: [assignment] bOrCAndALocal = bAndCOrA; - // :: error: (assignment) + // :: error: [assignment] bOrCAndALocal = bAndCOrAParens; - // :: error: (assignment) + // :: error: [assignment] bOrCAndALocal = aAndBOrC; - // :: error: (assignment) + // :: error: [assignment] bOrCAndALocal = aAndBOrCParens; - // :: error: (assignment) + // :: error: [assignment] bOrCAndALocal = aOrBAndC; bOrCAndALocal = bOrCAndA; - // :: error: (assignment) + // :: error: [assignment] bOrCAndALocal = bAndC; - // :: error: (assignment) + // :: error: [assignment] bOrCAndALocal = bAndCParens; - // :: error: (assignment) + // :: error: [assignment] bAndCLocal = cmA; - // :: error: (assignment) + // :: error: [assignment] bAndCLocal = cmpA; - // :: error: (assignment) + // :: error: [assignment] bAndCLocal = aOrB; - // :: error: (assignment) + // :: error: [assignment] bAndCLocal = aB; - // :: error: (assignment) + // :: error: [assignment] bAndCLocal = aAndB; - // :: error: (assignment) + // :: error: [assignment] bAndCLocal = bAndCOrA; - // :: error: (assignment) + // :: error: [assignment] bAndCLocal = bAndCOrAParens; - // :: error: (assignment) + // :: error: [assignment] bAndCLocal = aAndBOrC; - // :: error: (assignment) + // :: error: [assignment] bAndCLocal = aAndBOrCParens; - // :: error: (assignment) + // :: error: [assignment] bAndCLocal = aOrBAndC; - // :: error: (assignment) + // :: error: [assignment] bAndCLocal = bOrCAndA; bAndCLocal = bAndC; // The next line would not fail if predicate subtyping was decided by implication. - // :: error: (assignment) + // :: error: [assignment] bAndCLocal = bAndCParens; - // :: error: (assignment) + // :: error: [assignment] bAndCParensLocal = cmA; - // :: error: (assignment) + // :: error: [assignment] bAndCParensLocal = cmpA; - // :: error: (assignment) + // :: error: [assignment] bAndCParensLocal = aOrB; - // :: error: (assignment) + // :: error: [assignment] bAndCParensLocal = aB; - // :: error: (assignment) + // :: error: [assignment] bAndCParensLocal = aAndB; - // :: error: (assignment) + // :: error: [assignment] bAndCParensLocal = bAndCOrA; - // :: error: (assignment) + // :: error: [assignment] bAndCParensLocal = bAndCOrAParens; - // :: error: (assignment) + // :: error: [assignment] bAndCParensLocal = aAndBOrC; - // :: error: (assignment) + // :: error: [assignment] bAndCParensLocal = aAndBOrCParens; - // :: error: (assignment) + // :: error: [assignment] bAndCParensLocal = aOrBAndC; - // :: error: (assignment) + // :: error: [assignment] bAndCParensLocal = bOrCAndA; // The next line would not fail if predicate subtyping was decided by implication. - // :: error: (assignment) + // :: error: [assignment] bAndCParensLocal = bAndC; bAndCParensLocal = bAndCParens; } diff --git a/framework/tests/accumulation/SimpleFluent.java b/framework/tests/accumulation/SimpleFluent.java index 5ad4e6f4ac2d..5442fd39a3b4 100644 --- a/framework/tests/accumulation/SimpleFluent.java +++ b/framework/tests/accumulation/SimpleFluent.java @@ -32,7 +32,7 @@ static void doStuffCorrect(@TestAccumulation({"a", "b"}) SimpleFluent s) { static void doStuffWrong(@TestAccumulation({"a"}) SimpleFluent s) { s.a() - // :: error: (method.invocation) + // :: error: [method.invocation] .build(); } @@ -40,7 +40,7 @@ static void noReturnsReceiverAnno(@TestAccumulation({"a", "b"}) SimpleFluent s) s.a() .b() .c() - // :: error: (method.invocation) + // :: error: [method.invocation] .build(); } @@ -51,7 +51,7 @@ static void mixFluentAndNonFluent(SimpleFluent s1) { static void mixFluentAndNonFluentWrong(SimpleFluent s) { s.a(); // .b() - // :: error: (method.invocation) + // :: error: [method.invocation] s.build(); } @@ -59,7 +59,7 @@ static void fluentLoop(SimpleFluent t) { SimpleFluent s = t.a(); int i = 10; while (i > 0) { - // :: error: (method.invocation) + // :: error: [method.invocation] s.b().build(); i--; s = new SimpleFluent(); @@ -72,13 +72,13 @@ static void m1(SimpleFluent s) { static void m2(SimpleFluent s) { s.c().a().b(); - // :: error: (method.invocation) + // :: error: [method.invocation] s.c().build(); } static void m3(SimpleFluent s) { s.c().a().b().build(); - // :: error: (method.invocation) + // :: error: [method.invocation] s.c().a().build(); } @@ -92,25 +92,25 @@ static void m5(SimpleFluent s) { } static void m6(SimpleFluent s) { - // :: error: (method.invocation) + // :: error: [method.invocation] s.a().c().b().build(); } static void m7(SimpleFluent s) { - // :: error: (method.invocation) + // :: error: [method.invocation] s.a().b().build().c().b().build(); } static void m8(SimpleFluent s) { - // :: error: (method.invocation) + // :: error: [method.invocation] s.a().build().c().a().b().build(); - // :: error: (method.invocation) + // :: error: [method.invocation] s.build(); } static void m9() { new SimpleFluent().a().b().build(); - // :: error: (method.invocation) + // :: error: [method.invocation] new SimpleFluent().a().build(); } } diff --git a/framework/tests/accumulation/SimpleInference.java b/framework/tests/accumulation/SimpleInference.java index f40a0da513a6..435eb7031a42 100644 --- a/framework/tests/accumulation/SimpleInference.java +++ b/framework/tests/accumulation/SimpleInference.java @@ -24,14 +24,14 @@ static void doStuffCorrect2() { static void doStuffWrong() { SimpleInference s = new SimpleInference(); - // :: error: (method.invocation) + // :: error: [method.invocation] s.build(); } static void doStuffWrong2() { SimpleInference s = new SimpleInference(); s.a(); - // :: error: (method.invocation) + // :: error: [method.invocation] s.doublebuild(); } } diff --git a/framework/tests/accumulation/SimpleInferenceMerge.java b/framework/tests/accumulation/SimpleInferenceMerge.java index c74d42f255f9..29ad83e3f715 100644 --- a/framework/tests/accumulation/SimpleInferenceMerge.java +++ b/framework/tests/accumulation/SimpleInferenceMerge.java @@ -31,7 +31,7 @@ static void doStuffWrongMerge(boolean b) { s.b(); s.c(); } - // :: error: (method.invocation) + // :: error: [method.invocation] s.build(); } } diff --git a/framework/tests/accumulation/SimplePolymorphic.java b/framework/tests/accumulation/SimplePolymorphic.java index 514d1b72a0a9..14881f115335 100644 --- a/framework/tests/accumulation/SimplePolymorphic.java +++ b/framework/tests/accumulation/SimplePolymorphic.java @@ -13,7 +13,7 @@ public class SimplePolymorphic { // Check that polymorphic supertype with accumulator type doesn't cause a crash. void noCrashOnPolySuper(@TestAccumulation("foo") Object obj) { - // :: error: (assignment) + // :: error: [assignment] @PolyTestAccumulation Object obj2 = obj; } } diff --git a/framework/tests/accumulation/Subtyping.java b/framework/tests/accumulation/Subtyping.java index dc1578ace174..53c49c82fdf6 100644 --- a/framework/tests/accumulation/Subtyping.java +++ b/framework/tests/accumulation/Subtyping.java @@ -7,15 +7,15 @@ public class Subtyping { void top(@TestAccumulation() Object o1) { @TestAccumulation() Object o2 = o1; @TestAccumulation("foo") - // :: error: (assignment) + // :: error: [assignment] Object o3 = o1; @TestAccumulation("bar") - // :: error: (assignment) + // :: error: [assignment] Object o4 = o1; @TestAccumulation({"foo", "bar"}) - // :: error: (assignment) + // :: error: [assignment] Object o5 = o1; - // :: error: (assignment) + // :: error: [assignment] @TestAccumulationBottom Object o6 = o1; } @@ -23,25 +23,25 @@ void foo(@TestAccumulation("foo") Object o1) { @TestAccumulation() Object o2 = o1; @TestAccumulation("foo") Object o3 = o1; @TestAccumulation("bar") - // :: error: (assignment) + // :: error: [assignment] Object o4 = o1; @TestAccumulation({"foo", "bar"}) - // :: error: (assignment) + // :: error: [assignment] Object o5 = o1; - // :: error: (assignment) + // :: error: [assignment] @TestAccumulationBottom Object o6 = o1; } void bar(@TestAccumulation("bar") Object o1) { @TestAccumulation() Object o2 = o1; @TestAccumulation("foo") - // :: error: (assignment) + // :: error: [assignment] Object o3 = o1; @TestAccumulation("bar") Object o4 = o1; @TestAccumulation({"foo", "bar"}) - // :: error: (assignment) + // :: error: [assignment] Object o5 = o1; - // :: error: (assignment) + // :: error: [assignment] @TestAccumulationBottom Object o6 = o1; } @@ -50,7 +50,7 @@ void foobar(@TestAccumulation({"foo", "bar"}) Object o1) { @TestAccumulation("foo") Object o3 = o1; @TestAccumulation("bar") Object o4 = o1; @TestAccumulation({"foo", "bar"}) Object o5 = o1; - // :: error: (assignment) + // :: error: [assignment] @TestAccumulationBottom Object o6 = o1; } @@ -59,7 +59,7 @@ void barfoo(@TestAccumulation({"bar", "foo"}) Object o1) { @TestAccumulation("foo") Object o3 = o1; @TestAccumulation("bar") Object o4 = o1; @TestAccumulation({"foo", "bar"}) Object o5 = o1; - // :: error: (assignment) + // :: error: [assignment] @TestAccumulationBottom Object o6 = o1; } diff --git a/framework/tests/accumulation/UnparsablePredicate.java b/framework/tests/accumulation/UnparsablePredicate.java index 4bbe66640cac..625c3c9f4cc1 100644 --- a/framework/tests/accumulation/UnparsablePredicate.java +++ b/framework/tests/accumulation/UnparsablePredicate.java @@ -2,16 +2,16 @@ public class UnparsablePredicate { - // :: error: (predicate) + // :: error: [predicate] void unclosedOpen(@TestAccumulationPredicate("(foo && bar") Object x) {} - // :: error: (predicate) + // :: error: [predicate] void unopenedClose(@TestAccumulationPredicate("foo || bar)") Object x) {} - // :: error: (predicate) + // :: error: [predicate] void badKeywords1(@TestAccumulationPredicate("foo OR bar") Object x) {} - // :: error: (predicate) + // :: error: [predicate] void badKeywords2(@TestAccumulationPredicate("foo AND bar") Object x) {} // These tests check that valid Java identifiers don't cause problems diff --git a/framework/tests/accumulation/Xor.java b/framework/tests/accumulation/Xor.java index 7588829ac6cd..fc4952d26f87 100644 --- a/framework/tests/accumulation/Xor.java +++ b/framework/tests/accumulation/Xor.java @@ -14,13 +14,13 @@ void aXorB(@TestAccumulationPredicate("(a || b) && !(a && b)") Foo this) {} } void test1(Foo f) { - // :: error: (method.invocation) + // :: error: [method.invocation] f.aXorB(); } void test2(Foo f) { f.c(); - // :: error: (method.invocation) + // :: error: [method.invocation] f.aXorB(); } @@ -37,7 +37,7 @@ void test4(Foo f) { void test5(Foo f) { f.a(); f.b(); - // :: error: (method.invocation) + // :: error: [method.invocation] f.aXorB(); } @@ -59,7 +59,7 @@ void test7(@TestAccumulation("a") Foo f) { void test8(Foo f) { callA(f); // THIS IS AN UNAVOIDABLE FALSE POSITIVE - // :: error: (method.invocation) + // :: error: [method.invocation] f.aXorB(); } } diff --git a/framework/tests/aggregate/MultiError.java b/framework/tests/aggregate/MultiError.java index 157330f1a3e4..06483571965d 100644 --- a/framework/tests/aggregate/MultiError.java +++ b/framework/tests/aggregate/MultiError.java @@ -5,16 +5,16 @@ public class MultiError { // Testing that errors from multiple checkers are issued // on the same compilation unit - // :: error: (unique.location.forbidden) + // :: error: [unique.location.forbidden] @Unique String[] array; - // :: error: (assignment) + // :: error: [assignment] @StringVal("hello") String s = "goodbye"; @MethodVal( className = "c", methodName = "m", params = {0, 0}) - // :: error: (invalid.methodval) + // :: error: [invalid.methodval] Object o; } diff --git a/framework/tests/aliasing/AliasingConstructorTest.java b/framework/tests/aliasing/AliasingConstructorTest.java index 28d1d5803245..4429b8b90d44 100644 --- a/framework/tests/aliasing/AliasingConstructorTest.java +++ b/framework/tests/aliasing/AliasingConstructorTest.java @@ -17,7 +17,7 @@ public void annosInAliasingConstructorTest() { new AliasingConstructorTest(o2, 1); AliasingConstructorTest ct = new AliasingConstructorTest(o2, 1); @Unique Object o3 = new Object(); - // ::error: (unique.leaked) + // ::error: [unique.leaked] new AliasingConstructorTest(o3, "someString"); } } diff --git a/framework/tests/aliasing/ArrayInitializerTest.java b/framework/tests/aliasing/ArrayInitializerTest.java index e63fb40ebd0f..2e9af898ab11 100644 --- a/framework/tests/aliasing/ArrayInitializerTest.java +++ b/framework/tests/aliasing/ArrayInitializerTest.java @@ -4,11 +4,11 @@ public class ArrayInitializerTest { void foo() { @Unique Object o = new Object(); - // :: error: (unique.leaked) + // :: error: [unique.leaked] Object[] ar = new Object[] {o}; @Unique Object o2 = new Object(); - // :: error: (unique.leaked) + // :: error: [unique.leaked] Object @Unique [] ar2 = new Object[] {o2}; Object[] arr = new Object[] {new Object()}; diff --git a/framework/tests/aliasing/CatchTest.java b/framework/tests/aliasing/CatchTest.java index a7980ed8771d..72b57f9f9ea1 100644 --- a/framework/tests/aliasing/CatchTest.java +++ b/framework/tests/aliasing/CatchTest.java @@ -5,10 +5,10 @@ public class CatchTest { void foo() { @Unique Exception exVar = new Exception(); try { - // :: error: (unique.leaked) + // :: error: [unique.leaked] throw exVar; - // :: error: (exception.parameter) + // :: error: [exception.parameter] } catch (@Unique Exception e) { // exVar and e points to the same object, therefore catch clauses // are not allowed to have a @Unique parameter. diff --git a/framework/tests/aliasing/ExplicitAnnotationTest.java b/framework/tests/aliasing/ExplicitAnnotationTest.java index b45989654f5f..51062a94d44f 100644 --- a/framework/tests/aliasing/ExplicitAnnotationTest.java +++ b/framework/tests/aliasing/ExplicitAnnotationTest.java @@ -7,9 +7,9 @@ public class ExplicitAnnotationTest { void check(UniqueData p) { // p is @Unique UniqueData Object - // :: error: (unique.leaked) + // :: error: [unique.leaked] UniqueData y = p; // @Unique p is leaked - // :: error: (unique.leaked) + // :: error: [unique.leaked] Object z = p; // @Unique p is leaked } } diff --git a/framework/tests/aliasing/ForbiddenUniqueTest.java b/framework/tests/aliasing/ForbiddenUniqueTest.java index 5248d3cbb545..d1b50c0007b0 100644 --- a/framework/tests/aliasing/ForbiddenUniqueTest.java +++ b/framework/tests/aliasing/ForbiddenUniqueTest.java @@ -3,13 +3,13 @@ public class ForbiddenUniqueTest { - // :: error: (unique.location.forbidden) + // :: error: [unique.location.forbidden] @Unique int field; void notAllowed() { - // :: error: (unique.location.forbidden) + // :: error: [unique.location.forbidden] @Unique Object[] arr; - // :: error: (type.argument) :: error: (unique.location.forbidden) + // :: error: [type.argument] :: error: [unique.location.forbidden] List<@Unique Object> list; } diff --git a/framework/tests/aliasing/ReceiverParameterTest.java b/framework/tests/aliasing/ReceiverParameterTest.java index 428f00e01928..36ac1c88c1e3 100644 --- a/framework/tests/aliasing/ReceiverParameterTest.java +++ b/framework/tests/aliasing/ReceiverParameterTest.java @@ -4,13 +4,13 @@ public class ReceiverParameterTest { public @Unique ReceiverParameterTest() { nonLeaked(); - // :: error: (unique.leaked) + // :: error: [unique.leaked] mayLeak(); } public @Unique ReceiverParameterTest(int i) { leakedToResult(); - // :: error: (unique.leaked) + // :: error: [unique.leaked] ReceiverParameterTest b = leakedToResult(); } @@ -22,9 +22,9 @@ void receiverTest() { rec.leakedToResult(); isUnique(rec); ReceiverParameterTest other = rec.leakedToResult(); - // :: error: (argument) + // :: error: [argument] isUnique(rec); - // :: error: (argument) + // :: error: [argument] isUnique(other); } @@ -35,9 +35,9 @@ void stubFileReceiverTest() { sb.append("something"); isUnique(sb); StringBuffer sb2 = sb.append("something"); - // :: error: (argument) + // :: error: [argument] isUnique(sb); - // :: error: (argument) + // :: error: [argument] isUnique(sb2); } diff --git a/framework/tests/aliasing/SuperTest.java b/framework/tests/aliasing/SuperTest.java index 16086f41b0a0..59e250be714d 100644 --- a/framework/tests/aliasing/SuperTest.java +++ b/framework/tests/aliasing/SuperTest.java @@ -12,7 +12,7 @@ public A() { class B extends A { public @Unique B() { - // :: error: (unique.leaked) + // :: error: [unique.leaked] super(); // "this" is aliased to A.lastA. } diff --git a/framework/tests/aliasing/ThrowTest.java b/framework/tests/aliasing/ThrowTest.java index 8dad69e615f3..d44d1fbfe028 100644 --- a/framework/tests/aliasing/ThrowTest.java +++ b/framework/tests/aliasing/ThrowTest.java @@ -4,7 +4,7 @@ public class ThrowTest { void foo() throws Exception { @Unique Exception e = new Exception(); - // :: error: (unique.leaked) + // :: error: [unique.leaked] throw e; } diff --git a/framework/tests/aliasing/TypeRefinement.java b/framework/tests/aliasing/TypeRefinement.java index 431ba1ad6738..1db8ca057e26 100644 --- a/framework/tests/aliasing/TypeRefinement.java +++ b/framework/tests/aliasing/TypeRefinement.java @@ -29,9 +29,9 @@ void rule1() { String notUnique = unique; // unique loses its refinement. - // :: error: (argument) + // :: error: [argument] isUnique(unique); - // :: error: (argument) + // :: error: [argument] isUnique(notUnique); } @@ -43,7 +43,7 @@ void rule2() { isUnique(unique); leaked(unique); - // :: error: (argument) + // :: error: [argument] isUnique(unique); } @@ -54,7 +54,7 @@ void rule3() { isUnique(unique); String notUnique = leakedToResult(unique); - // :: error: (argument) + // :: error: [argument] isUnique(unique); } diff --git a/framework/tests/aliasing/UniqueAnnoTest.java b/framework/tests/aliasing/UniqueAnnoTest.java index 816ae0ebfa20..5dc8ecc3d51e 100644 --- a/framework/tests/aliasing/UniqueAnnoTest.java +++ b/framework/tests/aliasing/UniqueAnnoTest.java @@ -10,15 +10,15 @@ public class UniqueAnnoTest { public @Unique UniqueAnnoTest(int i) { notLeaked(this); leakedToResult(this); - // :: error: (unique.leaked) + // :: error: [unique.leaked] UniqueAnnoTest b = leakedToResult(this); UniqueAnnoTest other = new UniqueAnnoTest(); - // :: error: (unique.leaked) + // :: error: [unique.leaked] other = this; - // :: error: (unique.leaked) + // :: error: [unique.leaked] leaked(this); - // :: error: (unique.leaked) + // :: error: [unique.leaked] leaked(other); // The receiver parameter is "this", so there is a leak. } diff --git a/framework/tests/aliasing/UniqueConstructorTest.java b/framework/tests/aliasing/UniqueConstructorTest.java index 5cc3a63fe88d..afc9c8e7ba8a 100644 --- a/framework/tests/aliasing/UniqueConstructorTest.java +++ b/framework/tests/aliasing/UniqueConstructorTest.java @@ -15,7 +15,7 @@ class ParentClass extends UniqueConstructorTest { class ChildUniqueClass extends ParentClass { - // ::error: (unique.leaked) + // ::error: [unique.leaked] @Unique ChildUniqueClass() { // Raises unique.leaked error since the parent constructor is not unique } diff --git a/framework/tests/all-systems/GenericsCasts.java b/framework/tests/all-systems/GenericsCasts.java index 4f43b5aeb54d..11f9f43367d4 100644 --- a/framework/tests/all-systems/GenericsCasts.java +++ b/framework/tests/all-systems/GenericsCasts.java @@ -17,7 +17,7 @@ Data forName(String p) { void m() { // Cast from a wildcard to a normal type argument. // Warning only with -AcheckCastElementType. - // TODO:: warning: (cast.unsafe) + // TODO:: warning: [cast.unsafe] // :: warning: [unchecked] unchecked cast Data c = (Data) forName("HaHa!"); } @@ -37,7 +37,7 @@ List poll() { void trouble() { Queue queue = new Queue<>(); // Warning only with -AcheckCastElementType. - // TODO:: warning: (cast.unsafe) + // TODO:: warning: [cast.unsafe] // :: warning: [unchecked] unchecked cast Entry e = (Entry) queue.poll(); } diff --git a/framework/tests/all-systems/java8/memberref/Purity.java b/framework/tests/all-systems/java8/memberref/Purity.java index 751c02ff0f47..091b08487459 100644 --- a/framework/tests/all-systems/java8/memberref/Purity.java +++ b/framework/tests/all-systems/java8/memberref/Purity.java @@ -18,7 +18,7 @@ static String myPureMethod() { void context() { PureFunc f1 = TestPure::myPureMethod; - // :: error: (purity.methodref) + // :: error: [purity.methodref] PureFunc f2 = TestPure::myMethod; } } diff --git a/framework/tests/annotationclassloader/Expected.txt b/framework/tests/annotationclassloader/Expected.txt index 647ee1404832..76dac6a221ce 100644 --- a/framework/tests/annotationclassloader/Expected.txt +++ b/framework/tests/annotationclassloader/Expected.txt @@ -1,4 +1,4 @@ -LoaderTest.java:7: error: (unique.leaked) +LoaderTest.java:7: error: [unique.leaked] Object[] ar = new Object[] {o}; ^ 1 error diff --git a/framework/tests/annotationclassloader/LoaderTest.java b/framework/tests/annotationclassloader/LoaderTest.java index 69e50fdc5855..abd816c2102e 100644 --- a/framework/tests/annotationclassloader/LoaderTest.java +++ b/framework/tests/annotationclassloader/LoaderTest.java @@ -3,7 +3,7 @@ public class LoaderTest { void foo() { @Unique Object o = new Object(); - // :: error: (unique.leaked) + // :: error: [unique.leaked] Object[] ar = new Object[] {o}; } } diff --git a/framework/tests/classval/ClassNameTest.java b/framework/tests/classval/ClassNameTest.java index a43c51f32369..fcb5dc636ec4 100644 --- a/framework/tests/classval/ClassNameTest.java +++ b/framework/tests/classval/ClassNameTest.java @@ -8,15 +8,15 @@ void test() throws Exception { @ClassVal("java.lang.String[][][]") Object o3; @ClassVal("Class$Inner._") Object o8; - // :: error: (illegal.classname) + // :: error: [illegal.classname] @ClassVal("java.lang.String[][]]") Object o4; - // :: error: (illegal.classname) + // :: error: [illegal.classname] @ClassVal("java.lang.String[][][") Object o5; - // :: error: (illegal.classname) + // :: error: [illegal.classname] @ClassVal("java.lang.String[][][]s") Object o6; - // :: error: (illegal.classname) + // :: error: [illegal.classname] @ClassVal("java.lang.String[][][].") Object o7; - // :: error: (illegal.classname) + // :: error: [illegal.classname] @ClassVal("java.lang..String") Object o9; } } diff --git a/framework/tests/classval/ClassValSubtypingTest.java b/framework/tests/classval/ClassValSubtypingTest.java index 47b0bba84c84..587ce1062596 100644 --- a/framework/tests/classval/ClassValSubtypingTest.java +++ b/framework/tests/classval/ClassValSubtypingTest.java @@ -20,25 +20,25 @@ void assignToUnknown() { } void assignUnknown() { - // :: error: (assignment) + // :: error: [assignment] a = unknown; - // :: error: (assignment) + // :: error: [assignment] ab = unknown; - // :: error: (assignment) + // :: error: [assignment] c = unknown; - // :: error: (assignment) + // :: error: [assignment] cd = unknown; } void assignments() { - // :: error: (assignment) + // :: error: [assignment] a = ab; ab = a; - // :: error: (assignment) + // :: error: [assignment] a = c; - // :: error: (assignment) + // :: error: [assignment] ab = c; - // :: error: (assignment) + // :: error: [assignment] ab = cd; } } @@ -62,25 +62,25 @@ void assignToUnknown() { } void assignUnknown() { - // :: error: (assignment) + // :: error: [assignment] a = unknown; - // :: error: (assignment) + // :: error: [assignment] ab = unknown; - // :: error: (assignment) + // :: error: [assignment] c = unknown; - // :: error: (assignment) + // :: error: [assignment] cd = unknown; } void assignments() { - // :: error: (assignment) + // :: error: [assignment] a = ab; ab = a; - // :: error: (assignment) + // :: error: [assignment] a = c; - // :: error: (assignment) + // :: error: [assignment] ab = c; - // :: error: (assignment) + // :: error: [assignment] ab = cd; } } @@ -95,19 +95,19 @@ class ClassValClassBoundSubtypingTest { @ClassBound({"a", "b"}) Object abBound = null; void assignments1() { - // :: error: (assignment) + // :: error: [assignment] a = aBound; - // :: error: (assignment) + // :: error: [assignment] ab = aBound; - // :: error: (assignment) + // :: error: [assignment] a = abBound; - // :: error: (assignment) + // :: error: [assignment] ab = abBound; } void assignments2() { aBound = a; - // :: error: (assignment) + // :: error: [assignment] aBound = ab; abBound = a; diff --git a/framework/tests/classval/GLBTest.java b/framework/tests/classval/GLBTest.java index 8fec88b78e8d..32bda07c2af1 100644 --- a/framework/tests/classval/GLBTest.java +++ b/framework/tests/classval/GLBTest.java @@ -8,11 +8,11 @@ public class GLBTest<@ClassVal({"A", "B"}) T extends Object> { // If that code changes, this code may not test GLB anymore. // This code does not test correctness. Because no expresion is given the GLB as a type, // it is impossible to test GLB for correctness. - // :: error: (type.argument) :: error: (assignment) + // :: error: [type.argument] :: error: [assignment] GLBTest<@ClassVal({"A", "B", "C"}) ?> f1 = new GLBTest<@ClassVal({"A", "E"}) Object>(); - // :: error: (type.argument) :: error: (assignment) + // :: error: [type.argument] :: error: [assignment] GLBTest<@ClassVal({"A", "B", "C"}) ?> f2 = new GLBTest<@ClassBound({"A", "E"}) Object>(); - // :: error: (type.argument) :: error: (assignment) + // :: error: [type.argument] :: error: [assignment] GLBTest<@ClassBound({"A", "B", "C"}) ?> f3 = new GLBTest<@ClassBound({"A", "E"}) Object>(); < diff --git a/framework/tests/compound-checker/MultiError.java b/framework/tests/compound-checker/MultiError.java index d12890ec0f43..39c3712fd77c 100644 --- a/framework/tests/compound-checker/MultiError.java +++ b/framework/tests/compound-checker/MultiError.java @@ -4,9 +4,9 @@ public class MultiError { // Testing that errors from multiple checkers are issued // on the same compilation unit - // :: error: (unique.location.forbidden) + // :: error: [unique.location.forbidden] @Unique String[] array; - // :: error: (assignment) + // :: error: [assignment] @StringVal("hello") String s = "goodbye"; } diff --git a/framework/tests/conservative-defaults/annotatedfor/AnnotatedForTest.java b/framework/tests/conservative-defaults/annotatedfor/AnnotatedForTest.java index f313d5f3ca41..494764743e82 100644 --- a/framework/tests/conservative-defaults/annotatedfor/AnnotatedForTest.java +++ b/framework/tests/conservative-defaults/annotatedfor/AnnotatedForTest.java @@ -45,23 +45,23 @@ void method1() { // When calling annotatedMethod, we expect the usual (non-conservative) defaults, since // @SuperQual is annotated with @DefaultQualifierInHierarchy. @SuperQual Object o1 = annotatedMethod(new Object()); - // :: error: (assignment) + // :: error: [assignment] @SubQual Object o2 = annotatedMethod(new Object()); // When calling unannotatedMethod, we expect the conservative defaults. Object o3 = unannotatedMethod(o2); - // :: error: (argument) + // :: error: [argument] Object o4 = unannotatedMethod(o1); // Testing that @AnnotatedFor({}) behaves the same way as not putting an @AnnotatedFor // annotation. Object o5 = unannotatedMethod(o2); - // :: error: (argument) + // :: error: [argument] Object o6 = unannotatedMethod(o1); // Testing that @AnnotatedFor(a different typesystem) behaves the same way @AnnotatedFor({}) Object o7 = unannotatedMethod(o2); - // :: error: (argument) + // :: error: [argument] Object o8 = unannotatedMethod(o1); } @@ -95,7 +95,7 @@ void method3() { // When calling annotatedMethod, we expect the usual (non-conservative) defaults, since // @SuperQual is annotated with @DefaultQualifierInHierarchy. @SuperQual Object o1 = annotatedMethod(new Object()); - // :: error: (assignment) + // :: error: [assignment] @SubQual Object o2 = annotatedMethod(new Object()); } @@ -130,21 +130,21 @@ Object annotatedForADifferentTypeSystemMethod(Object p) { // Annotated for more than one type system @AnnotatedFor({"nullness", "subtyping"}) void method4() { - // :: error: (assignment) + // :: error: [assignment] @SubQual Object o2 = new @SuperQual Object(); } // Different way of writing the checker name @AnnotatedFor("SubtypingChecker") void method5() { - // :: error: (assignment) + // :: error: [assignment] @SubQual Object o2 = new @SuperQual Object(); } // Different way of writing the checker name @AnnotatedFor("org.checkerframework.common.subtyping.SubtypingChecker") void method6() { - // :: error: (assignment) + // :: error: [assignment] @SubQual Object o2 = new @SuperQual Object(); } @@ -156,12 +156,12 @@ class annotatedClass { // When calling annotatedMethod, we expect the usual (non-conservative) defaults, since // @SuperQual is annotated with @DefaultQualifierInHierarchy. @SuperQual Object o1 = annotatedMethod(new Object()); - // :: error: (assignment) + // :: error: [assignment] @SubQual Object o2 = annotatedMethod(new Object()); // When calling unannotatedMethod, we expect the conservative defaults. Object o3 = unannotatedMethod(o2); - // :: error: (argument) + // :: error: [argument] Object o4 = unannotatedMethod(o1); @SuperQual Object o5; @@ -171,15 +171,15 @@ class annotatedClass { // Test annotated nonstatic initializer block { o5 = annotatedMethod(new Object()); - // :: error: (assignment) + // :: error: [assignment] o6 = annotatedMethod(new Object()); o7 = unannotatedMethod(o6); - // :: error: (argument) + // :: error: [argument] o8 = unannotatedMethod(o5); } void method1() { - // :: error: (assignment) + // :: error: [assignment] @SubQual Object o2 = new @SuperQual Object(); } @@ -198,10 +198,10 @@ static class staticAnnotatedForClass { // Test annotated static initializer block static { so1 = staticAnnotatedMethod(new Object()); - // :: error: (assignment) + // :: error: [assignment] so2 = staticAnnotatedMethod(new Object()); so3 = staticUnannotatedMethod(so2); - // :: error: (argument) + // :: error: [argument] so4 = staticUnannotatedMethod(so1); } } diff --git a/framework/tests/defaulting/lowerbound/LowerBoundDefaulting.java b/framework/tests/defaulting/lowerbound/LowerBoundDefaulting.java index 08cec52b2fdd..59db9284212c 100644 --- a/framework/tests/defaulting/lowerbound/LowerBoundDefaulting.java +++ b/framework/tests/defaulting/lowerbound/LowerBoundDefaulting.java @@ -16,11 +16,11 @@ public void implicitsTypeVar() { // should fail because @LbImplicit is below @LbTop @LbTop MyArrayList<@LbTop ? extends @LbTop String> itLowerBoundIncompatible = - // :: error: (assignment) + // :: error: [assignment] new MyArrayList(); @LbTop MyArrayList<@LbExplicit ? extends @LbTop String> itLowerBoundStillIncompatible = - // :: error: (assignment) + // :: error: [assignment] new MyArrayList(); @LbTop MyArrayList<@LbImplicit ? extends @LbTop String> itLowerBoundCompatible = @@ -30,10 +30,10 @@ public void implicitsTypeVar() { public void implicitsWildcard(MyArrayList myArrayList) { // should fail because @LbImplicit is below @LbTop - // :: error: (assignment) + // :: error: [assignment] @LbTop MyArrayList<@LbTop ? extends @LbTop CharSequence> iwLowerBoundIncompatible = myArrayList; - // :: error: (assignment) + // :: error: [assignment] @LbTop MyArrayList<@LbExplicit ? extends @LbTop CharSequence> iwLowerBoundCompatible = myArrayList; @LbTop MyArrayList<@LbImplicit ? extends @LbTop CharSequence> iwLowerBoundStillCompatible = @@ -43,10 +43,10 @@ public void implicitsWildcard(MyArrayList myArrayList) { public void implicitExtendBoundedWildcard(MyArrayList iebList) { // should fail because @LbImplicit is below @LbTop - // :: error: (assignment) + // :: error: [assignment] @LbTop MyArrayList<@LbTop ? extends @LbTop String> iebLowerBoundIncompatible = iebList; - // :: error: (assignment) + // :: error: [assignment] @LbTop MyArrayList<@LbExplicit ? extends @LbTop String> iebLowerBoundStillIncompatible = iebList; @LbTop MyArrayList<@LbImplicit ? extends @LbTop String> iebLowerBoundCompatible = iebList; @@ -57,7 +57,7 @@ public void implicitExtendBoundedWildcard(MyArrayList iebList) // capture is MyArrayList // The super bound is the LUB of @LbTop and @LbExplicit. public void explicitLowerBoundedWildcard(MyArrayList elbList) { - // :: error: (assignment) + // :: error: [assignment] @LbTop MyArrayList<@LbBottom ? super @LbBottom String> iebLowerBoundIncompatible = elbList; @LbTop MyArrayList<@LbTop ? super @LbExplicit String> iebLowerBoundStillIncompatible = elbList; diff --git a/framework/tests/defaulting/upperbound/UpperBoundDefaulting.java b/framework/tests/defaulting/upperbound/UpperBoundDefaulting.java index b67ff75e00b0..3a5c2ef1faee 100644 --- a/framework/tests/defaulting/upperbound/UpperBoundDefaulting.java +++ b/framework/tests/defaulting/upperbound/UpperBoundDefaulting.java @@ -15,14 +15,14 @@ public class UpperBoundDefaulting { public void explicitUpperBoundTypeVar() { MyArrayList<@UbBottom ? extends @UbBottom Object> eubBottomToBottom = - // :: error: (assignment) + // :: error: [assignment] new MyArrayList(); MyArrayList<@UbBottom ? extends @UbExplicit Object> eubExplicitToBottom = new MyArrayList(); MyArrayList<@UbBottom ? extends @UbImplicit Object> eubImplicitToBottom = - // :: error: (assignment) + // :: error: [assignment] new MyArrayList(); } @@ -33,7 +33,7 @@ public void implicitsWildcard(MyArrayList myArrayList) { @UbTop MyArrayList<@UbBottom ? extends @UbExplicit CharSequence> iwLowerBoundCompatible = myArrayList; @UbTop MyArrayList<@UbBottom ? extends @UbImplicit CharSequence> iwLowerBoundStillCompatible = - // :: error: (assignment) + // :: error: [assignment] myArrayList; } @@ -43,7 +43,7 @@ public void implicitExtendBoundedWildcard(MyArrayList iebList) MyArrayList<@UbBottom ? extends @UbExplicit Object> eubExplicitToBottom = iebList; - // :: error: (assignment) + // :: error: [assignment] MyArrayList<@UbBottom ? extends @UbImplicit Object> eubImplicitToBottom = iebList; } @@ -51,7 +51,7 @@ public void explicitLowerBoundedWildcard(MyArrayList elbList) { @UbTop MyArrayList<@UbTop ? super @UbBottom String> iebLowerBoundIncompatible = elbList; // Upper bound: GLB(@UbExplicit, @UbImplicit), Lower bound: @UbBottom. - // :: error: (assignment) + // :: error: [assignment] @UbTop MyArrayList<@UbImplicit ? super @UbBottom String> iebLowerBoundStillIncompatible = elbList; @UbTop MyArrayList<@UbExplicit ? super @UbBottom String> iebLowerBoundCompatible = elbList; diff --git a/framework/tests/flow/AnnotationAliasing.java b/framework/tests/flow/AnnotationAliasing.java index f75bda997e4b..2740701effc3 100644 --- a/framework/tests/flow/AnnotationAliasing.java +++ b/framework/tests/flow/AnnotationAliasing.java @@ -22,14 +22,14 @@ void nonpure() {} @Pure String t1() { - // :: error: (purity.not.deterministic.not.sideeffectfree.call) + // :: error: [purity.not.deterministic.not.sideeffectfree.call] nonpure(); return ""; } @org.jmlspecs.annotation.Pure String t2() { - // :: error: (purity.not.deterministic.not.sideeffectfree.call) + // :: error: [purity.not.deterministic.not.sideeffectfree.call] nonpure(); return ""; } diff --git a/framework/tests/flow/ArrayFlow.java b/framework/tests/flow/ArrayFlow.java index dfdb5644b858..c103a3db7c6c 100644 --- a/framework/tests/flow/ArrayFlow.java +++ b/framework/tests/flow/ArrayFlow.java @@ -7,7 +7,7 @@ public class ArrayFlow { void t1(@Odd String a1[], String a2[], @Odd String odd) { String l1 = a1[0]; - // :: error: (assignment) + // :: error: [assignment] @Odd String l2 = a2[0]; if (a2[0] == odd) { @@ -18,7 +18,7 @@ void t1(@Odd String a1[], String a2[], @Odd String odd) { a2[i] = odd; @Odd String l4 = a2[i]; i = 2; - // :: error: (assignment) + // :: error: [assignment] @Odd String l5 = a2[i]; } } diff --git a/framework/tests/flow/Basic2.java b/framework/tests/flow/Basic2.java index e819fda005ed..54e49afb2b9b 100644 --- a/framework/tests/flow/Basic2.java +++ b/framework/tests/flow/Basic2.java @@ -8,7 +8,7 @@ public class Basic2 { // basic tests to make sure everything works void t1(@Odd String p1, String p2) { String l1 = p1; - // :: error: (assignment) + // :: error: [assignment] @Odd String l2 = p2; } @@ -18,14 +18,14 @@ void t2(@Odd String p1, String p2, boolean b1) { if (b1) { l1 = p2; } - // :: error: (assignment) + // :: error: [assignment] @Odd String l3 = l1; l1 = p1; while (b1) { l1 = p2; } - // :: error: (assignment) + // :: error: [assignment] @Odd String l4 = l1; } @@ -77,7 +77,7 @@ void t5(@Odd String p1, String p2, boolean b1, C c1, C c2) { c1.f2 = p2; @Odd String l2 = c1.f1; c2.f1 = p2; - // :: error: (assignment) + // :: error: [assignment] @Odd String l3 = c1.f1; } @@ -87,16 +87,16 @@ void t6(@Odd String p1, String p2, boolean b1, C c1, C c2) { c1.c.f1 = p1; @Odd String l2 = c1.c.f1; c1.f1 = p2; - // :: error: (assignment) + // :: error: [assignment] @Odd String l3 = c1.f1; c1.f1 = p1; c1.c.f1 = p1; @Odd String l4 = c1.c.f1; c2.c = c2; - // :: error: (assignment) + // :: error: [assignment] @Odd String l5 = c1.f1; - // :: error: (assignment) + // :: error: [assignment] @Odd String l6 = c1.c.f1; } @@ -105,7 +105,7 @@ void t6b(@Odd String p1, String p2, boolean b1, C c1, C c2) { if (b1) { c1.f1 = p1; } - // :: error: (assignment) + // :: error: [assignment] @Odd String l1 = c1.f1; if (b1) { @@ -127,7 +127,7 @@ int pure() { void t7(@Odd String p1, String p2, boolean b1, C c1, C c2) { c1.f1 = p1; nonpure(); - // :: error: (assignment) + // :: error: [assignment] @Odd String l1 = c1.f1; c1.f1 = p1; @@ -139,7 +139,7 @@ void t7(@Odd String p1, String p2, boolean b1, C c1, C c2) { void t8(@Odd String a1[], String a2[], String p3) { String l1 = a1[0]; - // :: error: (assignment) + // :: error: [assignment] @Odd String l2 = a2[0]; @Odd String l3 = l1; @@ -147,7 +147,7 @@ void t8(@Odd String a1[], String a2[], String p3) { a1[0] = l1; a1[1] = l3; - // :: error: (assignment) + // :: error: [assignment] a1[2] = p3; a2[0] = l1; @@ -166,7 +166,7 @@ public void t10a(T p1, @Odd T p2) { p1 = l1; T l2 = p2; p2 = l2; - // :: error: (assignment) + // :: error: [assignment] @Odd T l3 = p1; @Odd T l4 = p2; } @@ -182,13 +182,13 @@ public void t10a(T p1, @Odd T p2) { // for-each loop void t11(@Odd String p1, String p2, List list, List<@Odd String> oddList) { - // :: error: (enhancedfor) + // :: error: [enhancedfor] for (@Odd String i : list) {} for (@Odd String i : oddList) { @Odd String l1 = i; } for (@Odd String i : oddList) { - // :: error: (assignment) + // :: error: [assignment] i = p2; } for (String i : oddList) { diff --git a/framework/tests/flow/ContractsOverriding.java b/framework/tests/flow/ContractsOverriding.java index 3bea42422d2e..4891525315e4 100644 --- a/framework/tests/flow/ContractsOverriding.java +++ b/framework/tests/flow/ContractsOverriding.java @@ -29,18 +29,18 @@ static class Sub extends Super { @Override @RequiresOdd("f") - // :: error: (contracts.precondition.override) + // :: error: [contracts.precondition.override] void m1() {} @Override @RequiresQualifier(expression = "f", qualifier = Odd.class) - // :: error: (contracts.precondition.override) + // :: error: [contracts.precondition.override] void m2() {} @Override // g is a different field than in the supertype @RequiresOdd("g") - // :: error: (contracts.precondition.override) + // :: error: [contracts.precondition.override] void m3() {} @Override @@ -57,16 +57,16 @@ static class Sub2 extends Super2 { String g; @Override - // :: error: (contracts.postcondition) + // :: error: [contracts.postcondition] void m1() {} @Override - // :: error: (contracts.postcondition) + // :: error: [contracts.postcondition] void m2() {} @Override @EnsuresOdd("g") - // :: error: (contracts.postcondition.override) + // :: error: [contracts.postcondition.override] void m3() { g = odd; } @@ -108,19 +108,19 @@ static class Sub3 extends Super3 { @Override boolean m1() { - // :: error: (contracts.conditional.postcondition) + // :: error: [contracts.conditional.postcondition] return true; } @Override boolean m2() { - // :: error: (contracts.conditional.postcondition) + // :: error: [contracts.conditional.postcondition] return true; } @Override @EnsuresOddIf(expression = "g", result = true) - // :: error: (contracts.conditional.postcondition.true.override) + // :: error: [contracts.conditional.postcondition.true.override] boolean m3() { g = odd; return true; diff --git a/framework/tests/flow/ContractsOverridingSubtyping.java b/framework/tests/flow/ContractsOverridingSubtyping.java index cf29e15c9c1a..ffa79d9b2755 100644 --- a/framework/tests/flow/ContractsOverridingSubtyping.java +++ b/framework/tests/flow/ContractsOverridingSubtyping.java @@ -43,12 +43,12 @@ void requiresOdd() {} @Override @RequiresQualifier(expression = "f", qualifier = Odd.class) - // :: error: (contracts.precondition.override) + // :: error: [contracts.precondition.override] void requiresUnqual() {} @Override @EnsuresQualifier(expression = "f", qualifier = Unqualified.class) - // :: error: (contracts.postcondition.override) + // :: error: [contracts.postcondition.override] void ensuresOdd() { f = g; } @@ -61,7 +61,7 @@ void ensuresUnqual() { @Override @EnsuresQualifierIf(expression = "f", result = true, qualifier = Unqualified.class) - // :: error: (contracts.conditional.postcondition.true.override) + // :: error: [contracts.conditional.postcondition.true.override] boolean ensuresIfOdd() { f = g; return true; diff --git a/framework/tests/flow/CustomContractWithArgs.java b/framework/tests/flow/CustomContractWithArgs.java index c7248410bd54..2fece2bdfc5b 100644 --- a/framework/tests/flow/CustomContractWithArgs.java +++ b/framework/tests/flow/CustomContractWithArgs.java @@ -45,7 +45,7 @@ void ensures() { } @EnsuresValue(value = "o", targetValue = 9) - // :: error: (contracts.postcondition) + // :: error: [contracts.postcondition] void ensuresWrong() { o = o10; } @@ -75,9 +75,9 @@ void use(boolean b) { o10 = o; requires(); } - // :: error: (assignment) + // :: error: [assignment] o10 = o; - // :: error: (contracts.precondition) + // :: error: [contracts.precondition] requires(); } } diff --git a/framework/tests/flow/Equal.java b/framework/tests/flow/Equal.java index 3e1518beacc1..9c1f4fb3103e 100644 --- a/framework/tests/flow/Equal.java +++ b/framework/tests/flow/Equal.java @@ -6,22 +6,22 @@ public class Equal { // annotation inference for equality void t1(@Odd String p1, String p2) { - // :: error: (assignment) + // :: error: [assignment] @Odd String l1 = f1; if (f1 == p1) { @Odd String l2 = f1; } else { - // :: error: (assignment) + // :: error: [assignment] @Odd String l3 = f1; } } // annotation inference for equality void t2(@Odd String p1, String p2) { - // :: error: (assignment) + // :: error: [assignment] @Odd String l1 = f1; if (f1 != p1) { - // :: error: (assignment) + // :: error: [assignment] @Odd String l2 = f1; } else { @Odd String l3 = f1; @@ -29,14 +29,14 @@ void t2(@Odd String p1, String p2) { } void t3(@Odd Long p1) { - // :: error: (assignment) + // :: error: [assignment] @Odd Long l1 = Long.valueOf(2L); if (Long.valueOf(2L) == p1) { // The result of valueOf is not deterministic, so it can't be refined. - // :: error: (assignment) + // :: error: [assignment] @Odd Long l2 = Long.valueOf(2L); } else { - // :: error: (assignment) + // :: error: [assignment] @Odd Long l3 = Long.valueOf(2L); } } diff --git a/framework/tests/flow/FieldShadowing.java b/framework/tests/flow/FieldShadowing.java index bd3962ad4c52..23d7cca02055 100644 --- a/framework/tests/flow/FieldShadowing.java +++ b/framework/tests/flow/FieldShadowing.java @@ -14,7 +14,7 @@ class Sub extends FieldShadowing { @RequiresQualifier(expression = "f", qualifier = Odd.class) int reqSub() { @Odd String l2 = f; - // :: error: (assignment) + // :: error: [assignment] @Odd String l1 = super.f; int i; i = 1; @@ -24,7 +24,7 @@ int reqSub() { @Pure @RequiresQualifier(expression = "super.f", qualifier = Odd.class) int reqSuper() { - // :: error: (assignment) + // :: error: [assignment] @Odd String l2 = f; @Odd String l1 = super.f; return 1; @@ -32,14 +32,14 @@ int reqSuper() { void t1(@Odd String p1) { f = p1; - // :: error: (contracts.precondition) + // :: error: [contracts.precondition] reqSuper(); reqSub(); } void t2(@Odd String p1) { super.f = p1; - // :: error: (contracts.precondition) + // :: error: [contracts.precondition] reqSub(); reqSuper(); } diff --git a/framework/tests/flow/Issue4449.java b/framework/tests/flow/Issue4449.java index 32ad27dfe06d..38c301dd177b 100644 --- a/framework/tests/flow/Issue4449.java +++ b/framework/tests/flow/Issue4449.java @@ -4,27 +4,27 @@ public class Issue4449 { @SideEffectFree public void test1(long[] x) { - // :: error: (purity.not.sideeffectfree.assign.array) + // :: error: [purity.not.sideeffectfree.assign.array] x[0] = 1; long y; - // :: error: (purity.not.sideeffectfree.assign.array) + // :: error: [purity.not.sideeffectfree.assign.array] ++x[0]; - // :: error: (purity.not.sideeffectfree.assign.array) + // :: error: [purity.not.sideeffectfree.assign.array] --x[0]; - // :: error: (purity.not.sideeffectfree.assign.array) + // :: error: [purity.not.sideeffectfree.assign.array] x[0]++; - // :: error: (purity.not.sideeffectfree.assign.array) + // :: error: [purity.not.sideeffectfree.assign.array] x[0]--; - // :: error: (purity.not.sideeffectfree.assign.array) + // :: error: [purity.not.sideeffectfree.assign.array] y = ++x[0]; - // :: error: (purity.not.sideeffectfree.assign.array) + // :: error: [purity.not.sideeffectfree.assign.array] y = --x[0]; - // :: error: (purity.not.sideeffectfree.assign.array) + // :: error: [purity.not.sideeffectfree.assign.array] y = x[0]++; - // :: error: (purity.not.sideeffectfree.assign.array) + // :: error: [purity.not.sideeffectfree.assign.array] y = x[0]--; y = +x[0]; diff --git a/framework/tests/flow/Issue951.java b/framework/tests/flow/Issue951.java index 55d1f4fcfd18..3fda87c30351 100644 --- a/framework/tests/flow/Issue951.java +++ b/framework/tests/flow/Issue951.java @@ -21,14 +21,14 @@ public static int min(int[] a) { @Pure public static int arbitraryExceptionArg1() { - // :: error: (purity.not.deterministic.not.sideeffectfree.call) - // :: error: (purity.not.sideeffectfree.call) + // :: error: [purity.not.deterministic.not.sideeffectfree.call] + // :: error: [purity.not.sideeffectfree.call] throw new MyException("" + arbitraryMethod()); } @Pure public static int arbitraryExceptionArg2() { - // :: error: (purity.not.deterministic.not.sideeffectfree.call) + // :: error: [purity.not.deterministic.not.sideeffectfree.call] throw new MyExceptionSefConstructor("" + arbitraryMethod()); } @@ -36,8 +36,8 @@ public static int arbitraryExceptionArg2() { public static int sefExceptionArg1() { // The method is safe, so this is a false positive warning; // in the future the Purity Checker may not issue this warning. - // :: error: (purity.not.deterministic.call) - // :: error: (purity.not.sideeffectfree.call) + // :: error: [purity.not.deterministic.call] + // :: error: [purity.not.sideeffectfree.call] throw new MyException("" + sefMethod()); } @@ -45,26 +45,26 @@ public static int sefExceptionArg1() { public static int sefExceptionArg2() { // The method is safe, so this is a false positive warning; // in the future the Purity Checker may not issue this warning. - // :: error: (purity.not.deterministic.call) + // :: error: [purity.not.deterministic.call] throw new MyExceptionSefConstructor("" + sefMethod()); } @Pure public static int detExceptionArg1() { - // :: error: (purity.not.sideeffectfree.call) - // :: error: (purity.not.sideeffectfree.call) + // :: error: [purity.not.sideeffectfree.call] + // :: error: [purity.not.sideeffectfree.call] throw new MyException("" + detMethod()); } @Pure public static int detExceptionArg2() { - // :: error: (purity.not.sideeffectfree.call) + // :: error: [purity.not.sideeffectfree.call] throw new MyExceptionSefConstructor("" + detMethod()); } @Pure public static int pureExceptionArg1(int a, int b) { - // :: error: (purity.not.sideeffectfree.call) + // :: error: [purity.not.sideeffectfree.call] throw new MyException("" + min(a, b)); } @@ -80,7 +80,7 @@ int throwNewWithinTry() { for (int j = 0; j < 10; j++) { throw new MyExceptionSefConstructor("foo"); } - // :: error: (purity.not.deterministic.catch) + // :: error: [purity.not.deterministic.catch] } catch (MyExceptionSefConstructor e) { return -1; } diff --git a/framework/tests/flow/MetaPostcondition.java b/framework/tests/flow/MetaPostcondition.java index e7fcb648bb16..ef5ec2a192e8 100644 --- a/framework/tests/flow/MetaPostcondition.java +++ b/framework/tests/flow/MetaPostcondition.java @@ -23,15 +23,15 @@ void oddF1_2(final MetaPostcondition param) { } @EnsuresOdd("f1") - // :: error: (contracts.postcondition) + // :: error: [contracts.postcondition] void oddF1_error() {} @EnsuresOdd("---") - // :: error: (flowexpr.parse.error) + // :: error: [flowexpr.parse.error] void error() {} @EnsuresOdd("#1.#2") - // :: error: (flowexpr.parse.error) + // :: error: [flowexpr.parse.error] void error2(final String p1, final String p2) {} @EnsuresOdd("f1") @@ -43,35 +43,35 @@ void exception() { void param1(final @Odd String f) {} @EnsuresOdd({"#1", "#2"}) - // :: error: (flowexpr.parameter.not.final) + // :: error: [flowexpr.parameter.not.final] void param2(@Odd String f, @Odd String g) { f = g; } @EnsuresOdd("#1") - // :: error: (flowexpr.parse.index.too.big) + // :: error: [flowexpr.parse.index.too.big] void param3() {} // basic postcondition test void t1(@Odd String p1, String p2) { - // :: error: (assignment) + // :: error: [assignment] @Odd String l1 = f1; oddF1(); @Odd String l2 = f1; - // :: error: (flowexpr.parse.error.postcondition) + // :: error: [flowexpr.parse.error.postcondition] error(); } // test parameter syntax void t2(@Odd String p1, String p2) { - // :: error: (flowexpr.parse.index.too.big) + // :: error: [flowexpr.parse.index.too.big] param3(); } // postcondition with more complex expression void tn1(boolean b) { - // :: error: (assignment) + // :: error: [assignment] @Odd String l1 = p.f1; oddF1_1(); @Odd String l2 = p.f1; @@ -80,7 +80,7 @@ void tn1(boolean b) { // postcondition with more complex expression void tn2(boolean b) { MetaPostcondition param = null; - // :: error: (assignment) + // :: error: [assignment] @Odd String l1 = param.f1; oddF1_2(param); @Odd String l2 = param.f1; @@ -88,12 +88,12 @@ void tn2(boolean b) { // basic postcondition test void tnm1(@Odd String p1, @ValueTypeAnno String p2) { - // :: error: (assignment) + // :: error: [assignment] @Odd String l1 = f1; - // :: error: (assignment) + // :: error: [assignment] @ValueTypeAnno String l2 = f2; - // :: error: (flowexpr.parse.error.postcondition) + // :: error: [flowexpr.parse.error.postcondition] error2(p1, p2); } @@ -122,16 +122,16 @@ boolean condOddF1Invalid(boolean b) { f1 = null; return true; } - // :: error: (contracts.conditional.postcondition) + // :: error: [contracts.conditional.postcondition] return false; } @EnsuresOddIf(result = false, expression = "f1") - // :: error: (contracts.conditional.postcondition.returntype) + // :: error: [contracts.conditional.postcondition.returntype] void wrongReturnType() {} @EnsuresOddIf(result = false, expression = "f1") - // :: error: (contracts.conditional.postcondition.returntype) + // :: error: [contracts.conditional.postcondition.returntype] String wrongReturnType2() { f1 = null; return ""; @@ -140,24 +140,24 @@ String wrongReturnType2() { // basic conditional postcondition test void t3(@Odd String p1, String p2) { condOddF1(true); - // :: error: (assignment) + // :: error: [assignment] @Odd String l1 = f1; if (condOddF1(false)) { @Odd String l2 = f1; } - // :: error: (assignment) + // :: error: [assignment] @Odd String l3 = f1; } // basic conditional postcondition test (inverted) void t4(@Odd String p1, String p2) { condOddF1False(true); - // :: error: (assignment) + // :: error: [assignment] @Odd String l1 = f1; if (!condOddF1False(false)) { @Odd String l2 = f1; } - // :: error: (assignment) + // :: error: [assignment] @Odd String l3 = f1; } @@ -165,7 +165,7 @@ void t4(@Odd String p1, String p2) { void t5(boolean b) { condOddF1(true); if (b) { - // :: error: (assignment) + // :: error: [assignment] @Odd String l2 = f1; } } diff --git a/framework/tests/flow/MetaPrecondition.java b/framework/tests/flow/MetaPrecondition.java index 5f0d5dae5bfc..e177ca873ae2 100644 --- a/framework/tests/flow/MetaPrecondition.java +++ b/framework/tests/flow/MetaPrecondition.java @@ -10,7 +10,7 @@ public class MetaPrecondition { @RequiresOdd("f1") void requiresF1() { - // :: error: (assignment) + // :: error: [assignment] @ValueTypeAnno String l1 = f1; @Odd String l2 = f1; } @@ -18,55 +18,55 @@ void requiresF1() { @Pure @RequiresOdd("f1") int requiresF1AndPure() { - // :: error: (assignment) + // :: error: [assignment] @ValueTypeAnno String l1 = f1; @Odd String l2 = f1; return 1; } @RequiresOdd("---") - // :: error: (flowexpr.parse.error) + // :: error: [flowexpr.parse.error] void error() { - // :: error: (assignment) + // :: error: [assignment] @ValueTypeAnno String l1 = f1; - // :: error: (assignment) + // :: error: [assignment] @Odd String l2 = f1; } @RequiresOdd("#1") void requiresParam(String p) { - // :: error: (assignment) + // :: error: [assignment] @ValueTypeAnno String l1 = p; @Odd String l2 = p; } @RequiresOdd({"#1", "#2"}) void requiresParams(String p1, String p2) { - // :: error: (assignment) + // :: error: [assignment] @ValueTypeAnno String l1 = p1; - // :: error: (assignment) + // :: error: [assignment] @ValueTypeAnno String l2 = p2; @Odd String l3 = p1; @Odd String l4 = p2; } @RequiresOdd("#1") - // :: error: (flowexpr.parse.index.too.big) + // :: error: [flowexpr.parse.index.too.big] void param3() {} void t1(@Odd String p1, String p2) { - // :: error: (contracts.precondition) + // :: error: [contracts.precondition] requiresF1(); - // :: error: (contracts.precondition) + // :: error: [contracts.precondition] requiresParam(p2); - // :: error: (contracts.precondition) + // :: error: [contracts.precondition] requiresParams(p1, p2); } void t2(@Odd String p1, String p2) { f1 = p1; requiresF1(); - // :: error: (contracts.precondition) + // :: error: [contracts.precondition] requiresF1(); } @@ -76,7 +76,7 @@ void t3(@Odd String p1, String p2) { requiresF1AndPure(); requiresF1AndPure(); requiresF1(); - // :: error: (contracts.precondition) + // :: error: [contracts.precondition] requiresF1(); } } diff --git a/framework/tests/flow/MethodCallFlowExpr.java b/framework/tests/flow/MethodCallFlowExpr.java index ca25b402a8a8..fafea317bab9 100644 --- a/framework/tests/flow/MethodCallFlowExpr.java +++ b/framework/tests/flow/MethodCallFlowExpr.java @@ -39,97 +39,97 @@ static String p1d(int i) { } @EnsuresQualifier(expression = "p1c(\"abc\")", qualifier = Odd.class) - // :: error: (contracts.postcondition) + // :: error: [contracts.postcondition] void e0() { // don't bother with implementation } @EnsuresQualifier(expression = "p1(1)", qualifier = Odd.class) - // :: error: (contracts.postcondition) + // :: error: [contracts.postcondition] void e1() { // don't bother with implementation } @EnsuresQualifier(expression = "p1(\"abc\")", qualifier = Odd.class) - // :: error: (contracts.postcondition) + // :: error: [contracts.postcondition] void e2() { // don't bother with implementation } @EnsuresQualifier(expression = "p2(\"abc\", 2L, p1(1))", qualifier = Odd.class) - // :: error: (contracts.postcondition) + // :: error: [contracts.postcondition] void e4() { // don't bother with implementation } @EnsuresQualifier(expression = "p1b(2L)", qualifier = Odd.class) - // :: error: (contracts.postcondition) + // :: error: [contracts.postcondition] void e5() { // don't bother with implementation } @EnsuresQualifier(expression = "p1b(null)", qualifier = Odd.class) - // :: error: (contracts.postcondition) + // :: error: [contracts.postcondition] void e6() { // don't bother with implementation } @EnsuresQualifier(expression = "p1d(1)", qualifier = Odd.class) - // :: error: (contracts.postcondition) + // :: error: [contracts.postcondition] void e7a() { // don't bother with implementation } @EnsuresQualifier(expression = "this.p1d(1)", qualifier = Odd.class) - // :: error: (contracts.postcondition) + // :: error: [contracts.postcondition] void e7b() { // don't bother with implementation } @EnsuresQualifier(expression = "MethodCallFlowExpr.p1d(1)", qualifier = Odd.class) - // :: error: (contracts.postcondition) + // :: error: [contracts.postcondition] void e7c() { // don't bother with implementation } void t1() { - // :: error: (assignment) + // :: error: [assignment] @Odd String l1 = p1(1); e1(); - // :: error: (assignment) + // :: error: [assignment] @Odd String l2 = p1(2); @Odd String l3 = p1(1); } void t2() { - // :: error: (assignment) + // :: error: [assignment] @Odd String l1 = p1("abc"); e2(); - // :: error: (assignment) + // :: error: [assignment] @Odd String l2 = p1("def"); - // :: error: (assignment) + // :: error: [assignment] @Odd String l2b = p1(1); @Odd String l3 = p1("abc"); } void t3() { - // :: error: (assignment) + // :: error: [assignment] @Odd String l1 = p2("abc", 2L, p1(1)); e4(); - // :: error: (assignment) + // :: error: [assignment] @Odd String l2 = p2("abc", 2L, p1(2)); - // :: error: (assignment) + // :: error: [assignment] @Odd String l2b = p2("abc", 1L, p1(1)); @Odd String l3 = p2("abc", 2L, p1(1)); } void t4() { - // :: error: (assignment) + // :: error: [assignment] @Odd String l1 = p1b(2L); e5(); - // :: error: (assignment) + // :: error: [assignment] @Odd String l2 = p1b(null); - // :: error: (assignment) + // :: error: [assignment] @Odd String l2b = p1b(1L); // FIXME: the following line shouldn't give an error // (or at least it didn't give an error earlier) @@ -137,10 +137,10 @@ void t4() { } void t5() { - // :: error: (assignment) + // :: error: [assignment] @Odd String l1 = p1b(null); e6(); - // :: error: (assignment) + // :: error: [assignment] @Odd String l2 = p1b(1L); // FIXME: the following line shouldn't give an error // (or at least it didn't give an error earlier) @@ -148,20 +148,20 @@ void t5() { } void t6() { - // :: error: (assignment) + // :: error: [assignment] @Odd String l1 = p1c("abc"); e0(); - // :: error: (assignment) + // :: error: [assignment] @Odd String l2 = p1c("def"); @Odd String l3 = p1c("abc"); } void t7() { - // :: error: (assignment) + // :: error: [assignment] @Odd String l1 = p1d(1); - // :: error: (assignment) + // :: error: [assignment] @Odd String l1b = MethodCallFlowExpr.p1d(1); - // :: error: (assignment) + // :: error: [assignment] @Odd String l1c = this.p1d(1); e7a(); @Odd String l2 = p1d(1); @@ -170,11 +170,11 @@ void t7() { } void t8() { - // :: error: (assignment) + // :: error: [assignment] @Odd String l1 = p1d(1); - // :: error: (assignment) + // :: error: [assignment] @Odd String l1b = MethodCallFlowExpr.p1d(1); - // :: error: (assignment) + // :: error: [assignment] @Odd String l1c = this.p1d(1); e7b(); @Odd String l2 = p1d(1); @@ -183,11 +183,11 @@ void t8() { } void t9() { - // :: error: (assignment) + // :: error: [assignment] @Odd String l1 = p1d(1); - // :: error: (assignment) + // :: error: [assignment] @Odd String l1b = MethodCallFlowExpr.p1d(1); - // :: error: (assignment) + // :: error: [assignment] @Odd String l1c = this.p1d(1); e7c(); @Odd String l2 = p1d(1); diff --git a/framework/tests/flow/Monotonic.java b/framework/tests/flow/Monotonic.java index b01d55b55304..1cea291ad8e6 100644 --- a/framework/tests/flow/Monotonic.java +++ b/framework/tests/flow/Monotonic.java @@ -12,7 +12,7 @@ public class Monotonic { void nonpure() {} void t1(@Odd String p1) { - // :: error: (assignment) + // :: error: [assignment] @Odd String l1 = f2; if (f2 == p1) { @Odd String l2 = f2; @@ -22,14 +22,14 @@ void t1(@Odd String p1) { } void t2(@Odd String p1) { - // :: error: (assignment) + // :: error: [assignment] f2 = f1; - // :: error: (monotonic) + // :: error: [monotonic] f2 = f2b; // assigning @MonotonicOdd to @MonotonicOdd is not allowed } void t3(@Odd String p1) { - // :: error: (assignment) + // :: error: [assignment] @Odd String l1 = f2; f2 = p1; @Odd String l2 = f2; @@ -38,7 +38,7 @@ void t3(@Odd String p1) { } void t4(@Odd String p1) { - // :: error: (assignment) + // :: error: [assignment] @Odd String l1 = f2; f2 = p1; @Odd String l2 = f2; diff --git a/framework/tests/flow/NonMethodCode.java b/framework/tests/flow/NonMethodCode.java index 5f698098c7f8..28310d834192 100644 --- a/framework/tests/flow/NonMethodCode.java +++ b/framework/tests/flow/NonMethodCode.java @@ -19,7 +19,7 @@ public class NonMethodCode { if (g1 == f1) { @Odd String l3 = g1; } - // :: error: (assignment) + // :: error: [assignment] @Odd String l4 = g1; } @@ -30,7 +30,7 @@ public class NonMethodCode { if (sg1 == sf1) { @Odd String l3 = sg1; } - // :: error: (assignment) + // :: error: [assignment] @Odd String l4 = sg1; } } diff --git a/framework/tests/flow/ParamFlowExpr.java b/framework/tests/flow/ParamFlowExpr.java index 8cec0cb46212..79e014f90897 100644 --- a/framework/tests/flow/ParamFlowExpr.java +++ b/framework/tests/flow/ParamFlowExpr.java @@ -10,7 +10,7 @@ void t1(String p1) { } @RequiresQualifier(expression = "#1", qualifier = Odd.class) - // :: error: (flowexpr.parameter.not.final) + // :: error: [flowexpr.parameter.not.final] void t2(String p1) { p1 = ""; } diff --git a/framework/tests/flow/Postcondition.java b/framework/tests/flow/Postcondition.java index 323ce0f67035..527652c3c276 100644 --- a/framework/tests/flow/Postcondition.java +++ b/framework/tests/flow/Postcondition.java @@ -39,15 +39,15 @@ void oddF1_3() { } @EnsuresQualifier(expression = "f1", qualifier = ValueTypeAnno.class) - // :: error: (contracts.postcondition) + // :: error: [contracts.postcondition] void valueF1() {} @EnsuresQualifier(expression = "---", qualifier = ValueTypeAnno.class) - // :: error: (flowexpr.parse.error) + // :: error: [flowexpr.parse.error] void error() {} @EnsuresQualifier(expression = "#1.#2", qualifier = ValueTypeAnno.class) - // :: error: (flowexpr.parse.error) + // :: error: [flowexpr.parse.error] void error2(final String p1, final String p2) {} @EnsuresQualifier(expression = "f1", qualifier = ValueTypeAnno.class) @@ -61,36 +61,36 @@ void param1(final @ValueTypeAnno String f) {} @EnsuresQualifier( expression = {"#1", "#2"}, qualifier = ValueTypeAnno.class) - // :: error: (flowexpr.parameter.not.final) + // :: error: [flowexpr.parameter.not.final] void param2(@ValueTypeAnno String f, @ValueTypeAnno String g) { f = g; } @EnsuresQualifier(expression = "#1", qualifier = ValueTypeAnno.class) - // :: error: (flowexpr.parse.index.too.big) + // :: error: [flowexpr.parse.index.too.big] void param3() {} // basic postcondition test void t1(@Odd String p1, String p2) { valueF1(); - // :: error: (assignment) + // :: error: [assignment] @Odd String l1 = f1; oddF1(); @Odd String l2 = f1; - // :: error: (flowexpr.parse.error.postcondition) + // :: error: [flowexpr.parse.error.postcondition] error(); } // test parameter syntax void t2(@Odd String p1, String p2) { - // :: error: (flowexpr.parse.index.too.big) + // :: error: [flowexpr.parse.index.too.big] param3(); } // postcondition with more complex expression void tn1(boolean b) { - // :: error: (assignment) + // :: error: [assignment] @Odd String l1 = p.f1; oddF1_1(); @Odd String l2 = p.f1; @@ -99,7 +99,7 @@ void tn1(boolean b) { // postcondition with more complex expression void tn2(boolean b) { Postcondition param = null; - // :: error: (assignment) + // :: error: [assignment] @Odd String l1 = param.f1; oddF1_2(param); @Odd String l2 = param.f1; @@ -107,7 +107,7 @@ void tn2(boolean b) { // postcondition with more complex expression void tn3(boolean b) { - // :: error: (assignment) + // :: error: [assignment] @Odd String l1 = p.p1(); oddF1_3(); @Odd String l2 = p.p1(); @@ -150,26 +150,26 @@ void oddValueF1_repeated3(@ValueTypeAnno String p1) { @EnsuresQualifier(expression = "f1", qualifier = Odd.class), @EnsuresQualifier(expression = "f2", qualifier = ValueTypeAnno.class) }) - // :: error: (contracts.postcondition) + // :: error: [contracts.postcondition] void oddValueF1_invalid(@ValueTypeAnno String p1) {} @EnsuresQualifier.List({ @EnsuresQualifier(expression = "---", qualifier = Odd.class), }) - // :: error: (flowexpr.parse.error) + // :: error: [flowexpr.parse.error] void error2() {} // basic postcondition test void tnm1(@Odd String p1, @ValueTypeAnno String p2) { - // :: error: (assignment) + // :: error: [assignment] @Odd String l1 = f1; - // :: error: (assignment) + // :: error: [assignment] @ValueTypeAnno String l2 = f2; oddValueF1(p2); @Odd String l3 = f1; @ValueTypeAnno String l4 = f2; - // :: error: (flowexpr.parse.error.postcondition) + // :: error: [flowexpr.parse.error.postcondition] error2(); } @@ -198,16 +198,16 @@ boolean condOddF1Invalid(boolean b) { f1 = null; return true; } - // :: error: (contracts.conditional.postcondition) + // :: error: [contracts.conditional.postcondition] return false; } @EnsuresQualifierIf(result = false, expression = "f1", qualifier = Odd.class) - // :: error: (contracts.conditional.postcondition.returntype) + // :: error: [contracts.conditional.postcondition.returntype] void wrongReturnType() {} @EnsuresQualifierIf(result = false, expression = "f1", qualifier = Odd.class) - // :: error: (contracts.conditional.postcondition.returntype) + // :: error: [contracts.conditional.postcondition.returntype] String wrongReturnType2() { f1 = null; return ""; @@ -231,24 +231,24 @@ boolean isNotOdd(final String p1) { // basic conditional postcondition test void t3(@Odd String p1, String p2) { condOddF1(true); - // :: error: (assignment) + // :: error: [assignment] @Odd String l1 = f1; if (condOddF1(false)) { @Odd String l2 = f1; } - // :: error: (assignment) + // :: error: [assignment] @Odd String l3 = f1; } // basic conditional postcondition test (inverted) void t4(@Odd String p1, String p2) { condOddF1False(true); - // :: error: (assignment) + // :: error: [assignment] @Odd String l1 = f1; if (!condOddF1False(false)) { @Odd String l2 = f1; } - // :: error: (assignment) + // :: error: [assignment] @Odd String l3 = f1; } @@ -256,7 +256,7 @@ void t4(@Odd String p1, String p2) { void t5(boolean b) { condOddF1(true); if (b) { - // :: error: (assignment) + // :: error: [assignment] @Odd String l2 = f1; } } @@ -281,34 +281,34 @@ boolean condsOddF1(boolean b, @ValueTypeAnno String p1) { }) boolean condsOddF1_invalid(boolean b, @ValueTypeAnno String p1) { if (b) { - // :: error: (contracts.conditional.postcondition) + // :: error: [contracts.conditional.postcondition] return true; } - // :: error: (contracts.conditional.postcondition) + // :: error: [contracts.conditional.postcondition] return false; } @EnsuresQualifierIf.List({ @EnsuresQualifierIf(result = false, expression = "f1", qualifier = Odd.class) }) - // :: error: (contracts.conditional.postcondition.returntype) + // :: error: [contracts.conditional.postcondition.returntype] String wrongReturnType3() { return ""; } void t6(@Odd String p1, @ValueTypeAnno String p2) { condsOddF1(true, p2); - // :: error: (assignment) + // :: error: [assignment] @Odd String l1 = f1; - // :: error: (assignment) + // :: error: [assignment] @ValueTypeAnno String l2 = f1; if (condsOddF1(false, p2)) { @Odd String l3 = f1; - // :: error: (assignment) + // :: error: [assignment] @ValueTypeAnno String l4 = f1; } else { @ValueTypeAnno String l5 = f1; - // :: error: (assignment) + // :: error: [assignment] @Odd String l6 = f1; } } diff --git a/framework/tests/flow/Precondition.java b/framework/tests/flow/Precondition.java index 21fc01ebcd45..d3fc9a5de7cc 100644 --- a/framework/tests/flow/Precondition.java +++ b/framework/tests/flow/Precondition.java @@ -11,7 +11,7 @@ public class Precondition { @RequiresQualifier(expression = "f1", qualifier = Odd.class) void requiresF1() { - // :: error: (assignment) + // :: error: [assignment] @ValueTypeAnno String l1 = f1; @Odd String l2 = f1; } @@ -19,7 +19,7 @@ void requiresF1() { @Pure @RequiresQualifier(expression = "f1", qualifier = Odd.class) int requiresF1AndPure() { - // :: error: (assignment) + // :: error: [assignment] @ValueTypeAnno String l1 = f1; @Odd String l2 = f1; return 1; @@ -27,23 +27,23 @@ int requiresF1AndPure() { @RequiresQualifier(expression = "f1", qualifier = ValueTypeAnno.class) void requiresF1Value() { - // :: error: (assignment) + // :: error: [assignment] @Odd String l1 = f1; @ValueTypeAnno String l2 = f1; } @RequiresQualifier(expression = "---", qualifier = Odd.class) - // :: error: (flowexpr.parse.error) + // :: error: [flowexpr.parse.error] void error() { - // :: error: (assignment) + // :: error: [assignment] @ValueTypeAnno String l1 = f1; - // :: error: (assignment) + // :: error: [assignment] @Odd String l2 = f1; } @RequiresQualifier(expression = "#1", qualifier = Odd.class) void requiresParam(String p) { - // :: error: (assignment) + // :: error: [assignment] @ValueTypeAnno String l1 = p; @Odd String l2 = p; } @@ -52,35 +52,35 @@ void requiresParam(String p) { expression = {"#1", "#2"}, qualifier = Odd.class) void requiresParams(String p1, String p2) { - // :: error: (assignment) + // :: error: [assignment] @ValueTypeAnno String l1 = p1; - // :: error: (assignment) + // :: error: [assignment] @ValueTypeAnno String l2 = p2; @Odd String l3 = p1; @Odd String l4 = p2; } @RequiresQualifier(expression = "#1", qualifier = Odd.class) - // :: error: (flowexpr.parse.index.too.big) + // :: error: [flowexpr.parse.index.too.big] void param3() {} void t1(@Odd String p1, String p2) { - // :: error: (contracts.precondition) + // :: error: [contracts.precondition] requiresF1(); - // :: error: (contracts.precondition) + // :: error: [contracts.precondition] requiresF1Value(); - // :: error: (contracts.precondition) + // :: error: [contracts.precondition] requiresParam(p2); - // :: error: (contracts.precondition) + // :: error: [contracts.precondition] requiresParams(p1, p2); } void t2(@Odd String p1, String p2) { f1 = p1; requiresF1(); - // :: error: (contracts.precondition) + // :: error: [contracts.precondition] requiresF1(); - // :: error: (contracts.precondition) + // :: error: [contracts.precondition] requiresF1Value(); } @@ -90,7 +90,7 @@ void t3(@Odd String p1, String p2) { requiresF1AndPure(); requiresF1AndPure(); requiresF1(); - // :: error: (contracts.precondition) + // :: error: [contracts.precondition] requiresF1(); } @@ -123,9 +123,9 @@ void tt1() { void multi() { @ValueTypeAnno String l1 = f1; @Odd String l2 = f2; - // :: error: (assignment) + // :: error: [assignment] @ValueTypeAnno String l3 = f2; - // :: error: (assignment) + // :: error: [assignment] @Odd String l4 = f1; } @@ -136,27 +136,27 @@ void multi() { void multi_explicit_requiresqualifierlist() { @ValueTypeAnno String l1 = f1; @Odd String l2 = f2; - // :: error: (assignment) + // :: error: [assignment] @ValueTypeAnno String l3 = f2; - // :: error: (assignment) + // :: error: [assignment] @Odd String l4 = f1; } @RequiresQualifier.List({@RequiresQualifier(expression = "---", qualifier = ValueTypeAnno.class)}) - // :: error: (flowexpr.parse.error) + // :: error: [flowexpr.parse.error] void error2() {} void t5(@Odd String p1, String p2, @ValueTypeAnno String p3) { - // :: error: (contracts.precondition) + // :: error: [contracts.precondition] multi(); f1 = p3; - // :: error: (contracts.precondition) + // :: error: [contracts.precondition] multi(); f1 = p3; f2 = p1; multi(); - // :: error: (flowexpr.parse.error) + // :: error: [flowexpr.parse.error] error2(); } } diff --git a/framework/tests/flow/Purity.java b/framework/tests/flow/Purity.java index 731bc8cf6271..174534b6e248 100644 --- a/framework/tests/flow/Purity.java +++ b/framework/tests/flow/Purity.java @@ -16,7 +16,7 @@ private static class NonPureClass {} // class with a pure constructor private static class PureClass { @Pure - // :: warning: (purity.deterministic.constructor) + // :: warning: [purity.deterministic.constructor] public PureClass() {} } @@ -35,14 +35,14 @@ String pure() { } @Pure - // :: warning: (purity.deterministic.void.method) + // :: warning: [purity.deterministic.void.method] void t1() {} @SideEffectFree void t1b() {} @Deterministic - // :: warning: (purity.deterministic.void.method) + // :: warning: [purity.deterministic.void.method] void t1c() {} @Pure @@ -52,11 +52,11 @@ String t2() { @Pure String t3() { - // :: error: (purity.not.deterministic.not.sideeffectfree.call) + // :: error: [purity.not.deterministic.not.sideeffectfree.call] nonpure(); - // :: error: (purity.not.deterministic.call) + // :: error: [purity.not.deterministic.call] t16b(); // Calling a @SideEffectFree method - // :: error: (purity.not.sideeffectfree.call) + // :: error: [purity.not.sideeffectfree.call] t16c(); // Calling a @Deterministic method return ""; } @@ -102,23 +102,23 @@ String t9() { @Pure String t10() { - // :: error: (purity.not.deterministic.not.sideeffectfree.assign.field) + // :: error: [purity.not.deterministic.not.sideeffectfree.assign.field] f1 = ""; - // :: error: (purity.not.deterministic.not.sideeffectfree.assign.field) + // :: error: [purity.not.deterministic.not.sideeffectfree.assign.field] f2 = ""; return ""; } @Pure String t11(Purity l) { - // :: error: (purity.not.deterministic.not.sideeffectfree.assign.array) + // :: error: [purity.not.deterministic.not.sideeffectfree.assign.array] l.a[0] = ""; return ""; } @Pure String t12(String[] s) { - // :: error: (purity.not.deterministic.not.sideeffectfree.assign.array) + // :: error: [purity.not.deterministic.not.sideeffectfree.assign.array] s[0] = ""; return ""; } @@ -168,7 +168,7 @@ String t15() { String t16() { try { int i = 1 / 0; - // :: error: (purity.not.deterministic.catch) + // :: error: [purity.not.deterministic.catch] } catch (Throwable t) { // ... } @@ -189,7 +189,7 @@ String t16b() { String t16c() { try { int i = 1 / 0; - // :: error: (purity.not.deterministic.catch) + // :: error: [purity.not.deterministic.catch] } catch (Throwable t) { // ... } @@ -198,33 +198,33 @@ String t16c() { @Pure String t12() { - // :: error: (purity.not.sideeffectfree.call) - // :: error: (purity.not.deterministic.object.creation) + // :: error: [purity.not.sideeffectfree.call] + // :: error: [purity.not.deterministic.object.creation] NonPureClass p = new NonPureClass(); return ""; } @Deterministic String t17a(Purity l) { - // :: error: (purity.not.deterministic.assign.field) + // :: error: [purity.not.deterministic.assign.field] f1 = ""; - // :: error: (purity.not.deterministic.assign.array) + // :: error: [purity.not.deterministic.assign.array] l.a[0] = ""; - // :: error: (purity.not.deterministic.call) + // :: error: [purity.not.deterministic.call] nonpure(); - // :: error: (purity.not.deterministic.call) + // :: error: [purity.not.deterministic.call] return t16b(); // Calling a @SideEffectFree method } @SideEffectFree String t17b() { - // :: error: (purity.not.sideeffectfree.assign.field) + // :: error: [purity.not.sideeffectfree.assign.field] f1 = ""; - // :: error: (purity.not.sideeffectfree.call) + // :: error: [purity.not.sideeffectfree.call] NonPureClass p = new NonPureClass(); - // :: error: (purity.not.sideeffectfree.call) + // :: error: [purity.not.sideeffectfree.call] nonpure(); - // :: error: (purity.not.sideeffectfree.call) + // :: error: [purity.not.sideeffectfree.call] return t16c(); // Calling a @Deterministic method } diff --git a/framework/tests/flow/StorePure.java b/framework/tests/flow/StorePure.java index d2534590d899..cd1941deda67 100644 --- a/framework/tests/flow/StorePure.java +++ b/framework/tests/flow/StorePure.java @@ -48,10 +48,10 @@ void t1(@Odd String p1, String p2, boolean b1) { @Odd String l1 = pure1(); l0 = "a"; // does not remove information @Odd String l1b = pure1(); - // :: error: (assignment) + // :: error: [assignment] @Odd String l2 = pure1b(); nonpure(); // non-pure method call might change the return value of pure1 - // :: error: (assignment) + // :: error: [assignment] @Odd String l3 = pure1(); } } @@ -69,10 +69,10 @@ void t2(@Odd String p1, String p2, boolean b1) { @Odd String l1 = pure1(); l0 = "a"; // does not remove information @Odd String l1b = pure1(); - // :: error: (assignment) + // :: error: [assignment] @Odd String l2 = pure1b(); f1 = ""; // field update might change the return value of pure1 - // :: error: (assignment) + // :: error: [assignment] @Odd String l3 = pure1(); } } @@ -80,13 +80,13 @@ void t2(@Odd String p1, String p2, boolean b1) { void t3(@Odd String p1, String p2, boolean b1) { String l0 = ""; if (pure2(1) == p1) { - // :: error: (assignment) + // :: error: [assignment] @Odd String l4 = pure2(0); @Odd String l1 = pure2(1); l0 = "a"; // does not remove information @Odd String l1b = pure2(1); nonpure(); // non-pure method call might change the return value of pure2 - // :: error: (assignment) + // :: error: [assignment] @Odd String l3 = pure2(1); } } @@ -94,13 +94,13 @@ void t3(@Odd String p1, String p2, boolean b1) { void t4(@Odd String p1, String p2, boolean b1) { String l0 = ""; if (pure2(1) == p1) { - // :: error: (assignment) + // :: error: [assignment] @Odd String l4 = pure2(0); @Odd String l1 = pure2(1); l0 = "a"; // does not remove information @Odd String l1b = pure2(1); f1 = ""; // field update might change the return value of pure2 - // :: error: (assignment) + // :: error: [assignment] @Odd String l3 = pure2(1); } } @@ -108,13 +108,13 @@ void t4(@Odd String p1, String p2, boolean b1) { void t5(@Odd String p1, String p2, boolean b1) { String l0 = ""; if (pure3(true) == p1) { - // :: error: (assignment) + // :: error: [assignment] @Odd String l4 = pure3(false); @Odd String l1 = pure3(true); l0 = "a"; // does not remove information @Odd String l1b = pure3(true); nonpure(); // non-pure method call might change the return value of pure2 - // :: error: (assignment) + // :: error: [assignment] @Odd String l3 = pure3(true); } } @@ -122,13 +122,13 @@ void t5(@Odd String p1, String p2, boolean b1) { void t6(@Odd String p1, String p2, boolean b1) { String l0 = ""; if (pure3(true) == p1) { - // :: error: (assignment) + // :: error: [assignment] @Odd String l4 = pure3(false); @Odd String l1 = pure3(true); l0 = "a"; // does not remove information @Odd String l1b = pure3(true); f1 = ""; // field update might change the return value of pure2 - // :: error: (assignment) + // :: error: [assignment] @Odd String l3 = pure3(true); } } @@ -137,11 +137,11 @@ void t6(@Odd String p1, String p2, boolean b1) { void t7(@Odd String p1, String p2, boolean b1) { String l0 = ""; if (pure4(l0) == p1) { - // :: error: (assignment) + // :: error: [assignment] @Odd String l4 = pure4("jk"); @Odd String l1 = pure4(l0); l0 = "a"; // remove information (!) - // :: error: (assignment) + // :: error: [assignment] @Odd String l1b = pure4(l0); } } diff --git a/framework/tests/flow/Values.java b/framework/tests/flow/Values.java index f701aac7515c..3dd5ff46cdec 100644 --- a/framework/tests/flow/Values.java +++ b/framework/tests/flow/Values.java @@ -10,23 +10,23 @@ void test() { foo1(o1); foo2(o2); - // :: error: (argument) + // :: error: [argument] foo1(o); - // :: error: (argument) + // :: error: [argument] foo2(o1); - // :: error: (argument) + // :: error: [argument] foo1(o2); - // :: error: (argument) + // :: error: [argument] foo(o2); o1 = o2; foo2(o1); - // :: error: (argument) + // :: error: [argument] foo1(o1); o2 = get1(); foo1(o2); - // :: error: (argument) + // :: error: [argument] foo2(o2); } diff --git a/framework/tests/flow/javaexpression-scope/Class2.java b/framework/tests/flow/javaexpression-scope/Class2.java index c9a88d9269d5..abf9609d410d 100644 --- a/framework/tests/flow/javaexpression-scope/Class2.java +++ b/framework/tests/flow/javaexpression-scope/Class2.java @@ -7,9 +7,9 @@ public class Class2 { @RequiresOdd("Class1.field") - // :: error: (flowexpr.parse.error) + // :: error: [flowexpr.parse.error] public void requiresOddParseError() { - // :: error: (assignment) + // :: error: [assignment] @Odd Object odd = Class1.field; } @@ -19,25 +19,25 @@ public void requiresOdd() { } @EnsuresOdd("Class1.field") - // :: error: (flowexpr.parse.error) + // :: error: [flowexpr.parse.error] public void ensuresOddParseError() { - // :: warning: (cast.unsafe.constructor.invocation) + // :: warning: [cast.unsafe.constructor.invocation] Class1.field = new @Odd Object(); } @EnsuresOdd("pkg1.Class1.field") public void ensuresOdd() { - // :: warning: (cast.unsafe.constructor.invocation) + // :: warning: [cast.unsafe.constructor.invocation] Class1.field = new @Odd Object(); } void illegalUse() { - // :: error: (contracts.precondition) + // :: error: [contracts.precondition] requiresOdd(); } void legalUse() { - // :: warning: (cast.unsafe.constructor.invocation) + // :: warning: [cast.unsafe.constructor.invocation] Class1.field = new @Odd Object(); requiresOdd(); } diff --git a/framework/tests/flow/javaexpression-scope/Issue862.java b/framework/tests/flow/javaexpression-scope/Issue862.java index ee180ecde3f1..c4b98e39b71f 100644 --- a/framework/tests/flow/javaexpression-scope/Issue862.java +++ b/framework/tests/flow/javaexpression-scope/Issue862.java @@ -7,7 +7,7 @@ public class Issue862 { void illegalUse(Class2 class2) { - // :: error: (contracts.precondition) + // :: error: [contracts.precondition] class2.requiresOdd(); } diff --git a/framework/tests/framework/AnnotatedAnnotation.java b/framework/tests/framework/AnnotatedAnnotation.java index d0119c1964c6..fd1d23dcf9ee 100644 --- a/framework/tests/framework/AnnotatedAnnotation.java +++ b/framework/tests/framework/AnnotatedAnnotation.java @@ -30,11 +30,11 @@ class Uses { @OddInt(Const.ok1) Object good1; - // :: error: (annotation) + // :: error: [annotation] @OddInt(4) Object bad1; - // :: error: (annotation) + // :: error: [annotation] @OddInt(Const.notodd) Object bad2; @@ -44,11 +44,11 @@ class Uses { @OddIntArr({Const.ok1, Const.ok2}) Object good3; - // :: error: (annotation) + // :: error: [annotation] @OddIntArr(4) Object bada1; - // :: error: (annotation) + // :: error: [annotation] @OddIntArr({Const.ok1, 4}) Object bada2; @@ -58,11 +58,11 @@ void goodrec1() {} @OddRec({@OddIntArr({Const.ok1, Const.ok2}), @OddIntArr({Const.ok1, Const.ok2})}) void goodrec2() {} - // :: error: (annotation) + // :: error: [annotation] @OddRec(@OddIntArr({Const.ok1, 4})) void badrec1() {} - // :: error: (annotation) + // :: error: [annotation] @OddRec({@OddIntArr({Const.ok1, Const.ok2}), @OddIntArr({3, Const.ok2})}) void badrec2() {} } diff --git a/framework/tests/framework/AnnotatedGenerics.java b/framework/tests/framework/AnnotatedGenerics.java index 3395c7d2b49e..3f3e0b26ecc2 100644 --- a/framework/tests/framework/AnnotatedGenerics.java +++ b/framework/tests/framework/AnnotatedGenerics.java @@ -20,79 +20,79 @@ class Test { // Tests the type of the constructed class is correctly inferred for generics. public void testConstructors() { // Variant without annotated type parameters - // :: warning: (cast.unsafe.constructor.invocation) + // :: warning: [cast.unsafe.constructor.invocation] @Odd MyClass<@Odd String> innerClass1 = new @Odd MyClass<@Odd String>(); - // :: warning: (cast.unsafe.constructor.invocation) + // :: warning: [cast.unsafe.constructor.invocation] @Odd NormalClass<@Odd String> normal1 = new @Odd NormalClass<@Odd String>(); // Should error because the RHS isn't annotated as '@Odd' - // :: error: (assignment) + // :: error: [assignment] @Odd MyClass<@Odd String> innerClass2 = new MyClass<@Odd String>(); - // :: error: (assignment) + // :: error: [assignment] @Odd NormalClass<@Odd String> normal2 = new NormalClass<@Odd String>(); // Variant with annotated type parameters - // :: warning: (cast.unsafe.constructor.invocation) + // :: warning: [cast.unsafe.constructor.invocation] @Odd MyClass innerClass3 = new @Odd MyClass(); - // :: warning: (cast.unsafe.constructor.invocation) + // :: warning: [cast.unsafe.constructor.invocation] @Odd NormalClass normal3 = new @Odd NormalClass(); // Should error because the RHS isn't annotated as '@Odd' - // :: error: (assignment) + // :: error: [assignment] @Odd MyClass innerClass4 = new MyClass(); - // :: error: (assignment) + // :: error: [assignment] @Odd NormalClass normal4 = new NormalClass(); } // Tests the type of the constructed class is correctly inferred when the // diamond operator is used. public void testConstructorsWithTypeParameterInferrence() { - // :: warning: (cast.unsafe.constructor.invocation) + // :: warning: [cast.unsafe.constructor.invocation] @Odd MyClass<@Odd String> innerClass1 = new @Odd MyClass<>(); - // :: warning: (cast.unsafe.constructor.invocation) + // :: warning: [cast.unsafe.constructor.invocation] @Odd NormalClass<@Odd String> normal1 = new @Odd NormalClass<>(); // Should error because the RHS isn't annotated as '@Odd' - // :: error: (assignment) + // :: error: [assignment] @Odd MyClass<@Odd String> innerClass2 = new MyClass<>(); - // :: error: (assignment) + // :: error: [assignment] @Odd NormalClass<@Odd String> normal2 = new NormalClass<>(); - // :: warning: (cast.unsafe.constructor.invocation) + // :: warning: [cast.unsafe.constructor.invocation] @Odd MyClass innerClass3 = new @Odd MyClass<>(); - // :: warning: (cast.unsafe.constructor.invocation) + // :: warning: [cast.unsafe.constructor.invocation] @Odd NormalClass normal3 = new @Odd NormalClass<>(); // Should error because the RHS isn't annotated as '@Odd' - // :: error: (assignment) + // :: error: [assignment] @Odd MyClass innerClass4 = new MyClass<>(); - // :: error: (assignment) + // :: error: [assignment] @Odd NormalClass normal4 = new NormalClass<>(); } // Tests the type of the constructor is appropriately inferred for anonymous classes // N.B. This does not / cannot assert that the RHS is infact a subtype of the LHS. public void testAnonymousConstructors() { - // :: warning: (cast.unsafe.constructor.invocation) + // :: warning: [cast.unsafe.constructor.invocation] @Odd MyClass<@Odd String> innerClass1 = new @Odd MyClass<@Odd String>() {}; - // :: warning: (cast.unsafe.constructor.invocation) + // :: warning: [cast.unsafe.constructor.invocation] @Odd NormalClass<@Odd String> normal1 = new @Odd NormalClass<@Odd String>() {}; // Should error because the RHS isn't annotated as '@Odd' - // :: error: (assignment) + // :: error: [assignment] @Odd MyClass<@Odd String> innerClass2 = new MyClass<@Odd String>() {}; - // :: error: (assignment) + // :: error: [assignment] @Odd NormalClass<@Odd String> normal2 = new NormalClass<@Odd String>() {}; - // :: warning: (cast.unsafe.constructor.invocation) + // :: warning: [cast.unsafe.constructor.invocation] @Odd MyClass innerClass3 = new @Odd MyClass() {}; - // :: warning: (cast.unsafe.constructor.invocation) + // :: warning: [cast.unsafe.constructor.invocation] @Odd NormalClass normal3 = new @Odd NormalClass() {}; // Should error because the RHS isn't annotated as '@Odd' - // :: error: (assignment) + // :: error: [assignment] @Odd MyClass innerClass4 = new MyClass() {}; - // :: error: (assignment) + // :: error: [assignment] @Odd NormalClass normal4 = new NormalClass() {}; } diff --git a/framework/tests/framework/AnonymousClasses.java b/framework/tests/framework/AnonymousClasses.java index 91db208b8ad5..42370114e5fc 100644 --- a/framework/tests/framework/AnonymousClasses.java +++ b/framework/tests/framework/AnonymousClasses.java @@ -8,11 +8,11 @@ void test() { // @Unqualified @Unqualified Object // We should make sure that the qualifier is only present once. - // :: error: (assignment) + // :: error: [assignment] @Odd Object o = this; // error }; - // :: warning: (cast.unsafe.constructor.invocation) + // :: warning: [cast.unsafe.constructor.invocation] new @Odd Object() { @Odd Object o = this; }; diff --git a/framework/tests/framework/ArraySubtyping.java b/framework/tests/framework/ArraySubtyping.java index ce9e9c7d2641..e9f700f6eed0 100644 --- a/framework/tests/framework/ArraySubtyping.java +++ b/framework/tests/framework/ArraySubtyping.java @@ -9,22 +9,22 @@ public class ArraySubtyping { @Odd String[] str2 = new @Odd String[1]; void m() { - // :: error: (assignment) + // :: error: [assignment] obj1 = obj2; - // :: error: (assignment) + // :: error: [assignment] obj2 = obj1; - // :: error: (assignment) + // :: error: [assignment] str1 = str2; - // :: error: (assignment) + // :: error: [assignment] str2 = str1; obj1 = str1; obj2 = str2; - // :: error: (assignment) + // :: error: [assignment] obj1 = str2; - // :: error: (assignment) + // :: error: [assignment] obj2 = str1; } } diff --git a/framework/tests/framework/Arrays.java b/framework/tests/framework/Arrays.java index 8f70b93c640f..ef8a5ba46bfe 100644 --- a/framework/tests/framework/Arrays.java +++ b/framework/tests/framework/Arrays.java @@ -92,13 +92,13 @@ void test2() { void test3() { @Odd Object o1 = new @Odd Object @Odd [] @Odd [] {}; - // :: error: (assignment) + // :: error: [assignment] @Odd Object o2 = new @Odd Object[] @Odd [] {}; // ERROR @Odd Object @Odd [] o3 = (new @Odd Object[] @Odd [] {})[0]; - // :: error: (assignment) + // :: error: [assignment] @Odd Object @Odd [] o4 = (new Object @Odd [][] {})[0]; // ERROR - // :: error: (assignment) + // :: error: [assignment] @Odd Object @Odd [] o5 = (new @Odd Object[][] {})[0]; // ERROR Object @Odd [] o6 = (new Object[] @Odd [] {})[0]; @@ -118,9 +118,9 @@ void testInitializers() { // @Odd String [] ara1 = { null, null }; @Odd String[] ara2 = new @Odd String[] {null, null}; - // // xx:: error: (assignment) + // // xx:: error: [assignment] // @Odd String [] arb1 = { null, "m" }; - // :: error: (array.initializer) + // :: error: [array.initializer] @Odd String[] arb2 = new @Odd String[] {null, "m"}; } } diff --git a/framework/tests/framework/Assignments.java b/framework/tests/framework/Assignments.java index bd55e33d1310..f11652df53af 100644 --- a/framework/tests/framework/Assignments.java +++ b/framework/tests/framework/Assignments.java @@ -13,9 +13,9 @@ public void testAssignment() { } public void testCompound() { - // :: warning: (cast.unsafe) + // :: warning: [cast.unsafe] @Odd String s = (@Odd String) "foo"; - // :: warning: (cast.unsafe) + // :: warning: [cast.unsafe] @Odd String t = (@Odd String) "bar"; s += t; @@ -52,7 +52,7 @@ public void testReturnVoid() { public void testVariable() { @Odd String s = null; - // :: warning: (cast.unsafe) + // :: warning: [cast.unsafe] @Odd String t = (@Odd String) "foo"; @Odd String u = s; String v = s; diff --git a/framework/tests/framework/AssignmentsGeneric.java b/framework/tests/framework/AssignmentsGeneric.java index df4f7b65b22c..e50b0accb43c 100644 --- a/framework/tests/framework/AssignmentsGeneric.java +++ b/framework/tests/framework/AssignmentsGeneric.java @@ -21,7 +21,7 @@ public class AssignmentsGeneric { } public void testAssignment() { - // :: warning: (cast.unsafe) + // :: warning: [cast.unsafe] @Odd String s = (@Odd String) ""; List<@Odd String> lst = new LinkedList<>(); @@ -39,7 +39,7 @@ public void testEnhancedForLoop() { public void testGenericInvocation() { List<@Odd String> lst = new LinkedList<>(); - // :: warning: (cast.unsafe) + // :: warning: [cast.unsafe] @Odd String s = (@Odd String) ""; lst.add(s); } diff --git a/framework/tests/framework/BridgeMethods.java b/framework/tests/framework/BridgeMethods.java index 12a2db847a2f..8a6da3b67ca2 100644 --- a/framework/tests/framework/BridgeMethods.java +++ b/framework/tests/framework/BridgeMethods.java @@ -16,13 +16,13 @@ void use() { C c = new D(); // C<@Odd String>(); // Oddness is OK, will fail with ClassCastException // :: warning: [unchecked] unchecked call to id(T) as a member of the raw type C - // :: warning: (cast.unsafe.constructor.invocation) + // :: warning: [cast.unsafe.constructor.invocation] c.id(new @Odd Object()); // Oddness is wrong! Would also fail with ClassCastException. - // :: error: (argument) + // :: error: [argument] // :: warning: [unchecked] unchecked call to id(T) as a member of the raw type C - // :: warning: (cast.unsafe.constructor.invocation) + // :: warning: [cast.unsafe.constructor.invocation] c.id(new @Even Object()); } } diff --git a/framework/tests/framework/ClassAnnotations.java b/framework/tests/framework/ClassAnnotations.java index abad09012f68..f89998f28798 100644 --- a/framework/tests/framework/ClassAnnotations.java +++ b/framework/tests/framework/ClassAnnotations.java @@ -1,6 +1,6 @@ import org.checkerframework.framework.testchecker.util.*; -// ::warning: (inconsistent.constructor.type) :: error: (super.invocation) +// ::warning: [inconsistent.constructor.type] :: error: [super.invocation] public @Odd class ClassAnnotations { ClassAnnotations c; diff --git a/framework/tests/framework/Constructors.java b/framework/tests/framework/Constructors.java index afafaefd8a1d..6e4ccd683b4f 100644 --- a/framework/tests/framework/Constructors.java +++ b/framework/tests/framework/Constructors.java @@ -5,7 +5,7 @@ public Constructors(Constructors con) {} public void testConstructors() { Constructors c = null; - // :: warning: (cast.unsafe.constructor.invocation) + // :: warning: [cast.unsafe.constructor.invocation] new @Odd Constructors(c); } @@ -15,9 +15,9 @@ public Constructors(@Odd String s, int i) {} public void testStaticAnonymousConstructor() { String notOdd = "m"; - // :: error: (argument) + // :: error: [argument] new Constructors(notOdd, 0); // error - // :: error: (argument) + // :: error: [argument] new Constructors(notOdd, 0) {}; // error } @@ -30,9 +30,9 @@ public MyConstructors(@Odd String s) { public static void testAnonymousConstructor() { Constructors m = new Constructors(null) {}; String notOdd = "m"; - // :: error: (argument) + // :: error: [argument] m.new MyConstructors(notOdd); // error - // :: error: (argument) + // :: error: [argument] m.new MyConstructors(notOdd) {}; // error } diff --git a/framework/tests/framework/DeepOverride.java b/framework/tests/framework/DeepOverride.java index 6efcc3d67ac4..a91dd94bf3c9 100644 --- a/framework/tests/framework/DeepOverride.java +++ b/framework/tests/framework/DeepOverride.java @@ -11,7 +11,7 @@ public static class B extends A {} public static class C extends B { @Override - // :: error: (override.return) + // :: error: [override.return] public String method() { return ""; } diff --git a/framework/tests/framework/DeepOverrideAbstract.java b/framework/tests/framework/DeepOverrideAbstract.java index 0a6b8114dbd8..5751739eee9b 100644 --- a/framework/tests/framework/DeepOverrideAbstract.java +++ b/framework/tests/framework/DeepOverrideAbstract.java @@ -17,7 +17,7 @@ public static class C extends B { return null; } - // :: error: (override.return) + // :: error: [override.return] public String abstractMethod() { return ""; } diff --git a/framework/tests/framework/DeepOverrideBug.java b/framework/tests/framework/DeepOverrideBug.java index ad47c1feaa68..23389696dfff 100644 --- a/framework/tests/framework/DeepOverrideBug.java +++ b/framework/tests/framework/DeepOverrideBug.java @@ -18,12 +18,12 @@ public abstract static class A { public abstract static class B extends A implements I {} public static class C extends B { - // :: error: (override.return) + // :: error: [override.return] public String interfaceMethod() { // should emit error return null; } - // :: error: (override.return) + // :: error: [override.return] public String abstractMethod() { // should emit error return null; } diff --git a/framework/tests/framework/DeepOverrideInterface.java b/framework/tests/framework/DeepOverrideInterface.java index d6d1f092a7d0..e0687b97db83 100644 --- a/framework/tests/framework/DeepOverrideInterface.java +++ b/framework/tests/framework/DeepOverrideInterface.java @@ -13,7 +13,7 @@ public abstract static class A { public abstract static class B extends A implements I {} public static class C extends B { - // :: error: (override.return) + // :: error: [override.return] public String interfaceMethod() { return ""; } diff --git a/framework/tests/framework/ExtendsDefault.java b/framework/tests/framework/ExtendsDefault.java index 34bc29d1e8bc..554632777188 100644 --- a/framework/tests/framework/ExtendsDefault.java +++ b/framework/tests/framework/ExtendsDefault.java @@ -12,7 +12,7 @@ class MyOddDefault {} class MyNonOddDefault {} void testNonOdd() { - // :: error: (type.argument) + // :: error: [type.argument] MyOddDefault s1; MyNonOddDefault s2; } diff --git a/framework/tests/framework/GenericAlias.java b/framework/tests/framework/GenericAlias.java index 3c9538c1a60e..de0b40a6c7c0 100644 --- a/framework/tests/framework/GenericAlias.java +++ b/framework/tests/framework/GenericAlias.java @@ -12,7 +12,7 @@ public static class SuperSetOne extends HashSet<@Odd Map<@Odd List<@Odd String>, public void test() { Set<@Odd Map<@Odd List<@Odd String>, @Odd String>> s = new SuperSetOne(); @Odd Map<@Odd List<@Odd String>, @Odd String> mapA = - // :: warning: (cast.unsafe.constructor.invocation) + // :: warning: [cast.unsafe.constructor.invocation] new @Odd HashMap<@Odd List<@Odd String>, @Odd String>(); s.add(mapA); } diff --git a/framework/tests/framework/GenericAliasInvalid.java b/framework/tests/framework/GenericAliasInvalid.java index 00ebe14f0980..435de839d3f5 100644 --- a/framework/tests/framework/GenericAliasInvalid.java +++ b/framework/tests/framework/GenericAliasInvalid.java @@ -9,7 +9,7 @@ public class GenericAliasInvalid { public static class SuperSetOne extends HashSet<@Odd Map<@Odd List<@Odd String>, @Odd String>> {} public void test() { - // :: error: (assignment) + // :: error: [assignment] Set, @Odd String>> t = new SuperSetOne(); } } diff --git a/framework/tests/framework/GenericAliasInvalidCall.java b/framework/tests/framework/GenericAliasInvalidCall.java index f393a1b2a833..f89f67dd29be 100644 --- a/framework/tests/framework/GenericAliasInvalidCall.java +++ b/framework/tests/framework/GenericAliasInvalidCall.java @@ -12,9 +12,9 @@ public static class SuperSetOne extends HashSet<@Odd Map<@Odd List<@Odd String>, public void test() { Set<@Odd Map<@Odd List<@Odd String>, @Odd String>> s = new SuperSetOne(); @Odd Map, @Odd String> mapA = - // :: warning: (cast.unsafe.constructor.invocation) + // :: warning: [cast.unsafe.constructor.invocation] new @Odd HashMap, @Odd String>(); - // :: error: (argument) + // :: error: [argument] s.add(mapA); } } diff --git a/framework/tests/framework/GenericTest1.java b/framework/tests/framework/GenericTest1.java index 91ac1a53545b..218da735d834 100644 --- a/framework/tests/framework/GenericTest1.java +++ b/framework/tests/framework/GenericTest1.java @@ -12,7 +12,7 @@ public void test(Foo foo) { foo instanceof Bar // TODO flow: support instanceof / cast flow. // Warning only with -AcheckCastElementType. - // TODO:: warning: (cast.unsafe) + // TODO:: warning: [cast.unsafe] ? (Bar) foo : null; } diff --git a/framework/tests/framework/GenericTest4.java b/framework/tests/framework/GenericTest4.java index 09931286879d..bd36d0a9a165 100644 --- a/framework/tests/framework/GenericTest4.java +++ b/framework/tests/framework/GenericTest4.java @@ -49,7 +49,7 @@ void testWow(Map p) { } void testWow2(Map p) { - // :: error: (assignment) :: error: (argument) + // :: error: [assignment] :: error: [argument] p = wow(p); } } diff --git a/framework/tests/framework/GenericTest6.java b/framework/tests/framework/GenericTest6.java index 939778d7e936..1320802022e5 100644 --- a/framework/tests/framework/GenericTest6.java +++ b/framework/tests/framework/GenericTest6.java @@ -22,7 +22,7 @@ void call2(Foo> p) { void test3(Foo>> p) {} void call3(Foo>> p) { - // :: error: (argument) + // :: error: [argument] test3(p); } diff --git a/framework/tests/framework/GenericTest7.java b/framework/tests/framework/GenericTest7.java index 6715eb6633c1..8ee171bb6936 100644 --- a/framework/tests/framework/GenericTest7.java +++ b/framework/tests/framework/GenericTest7.java @@ -17,9 +17,9 @@ public & C> void one(I i) { } public & C> void oneA(I i) { - // :: error: (assignment) + // :: error: [assignment] @Odd B i1 = i; - // :: error: (assignment) + // :: error: [assignment] @Odd C i2 = i; } @@ -34,9 +34,9 @@ public & C> void two(I i) { } public & C> void twoA(I i) { - // :: error: (assignment) + // :: error: [assignment] @Odd B i1 = i; - // :: error: (assignment) + // :: error: [assignment] @Odd C i2 = i; } diff --git a/framework/tests/framework/GenericTest9.java b/framework/tests/framework/GenericTest9.java index 224e08e5ab84..8893da6e6c35 100644 --- a/framework/tests/framework/GenericTest9.java +++ b/framework/tests/framework/GenericTest9.java @@ -12,7 +12,7 @@ class C {} interface MyEntry {} void testclass() { - // :: error: (type.argument) :: error: (type.arguments.not.inferred) + // :: error: [type.argument] :: error: [type.arguments.not.inferred] C<@Odd Object, MyEntry> c1 = new C<>(); C<@Odd Object, @Odd MyEntry> c2 = new C<>(); } @@ -33,9 +33,9 @@ interface Ordering2 { } void test(Ordering2<@Odd MyEntry> ord, MyEntry e, @Odd MyEntry o) { - // :: error: (type.arguments.not.inferred) + // :: error: [type.arguments.not.inferred] MyEntry e1 = ord.sort(e); - // :: error: (type.argument) + // :: error: [type.argument] MyEntry e2 = ord.>sort(e); MyEntry e3 = ord.sort(o); MyEntry e4 = ord.<@Odd MyEntry>sort(o); @@ -48,7 +48,7 @@ interface Ordering3<@Odd T> { void test(Ordering3<@Odd MyEntry> o, @Odd MyEntry e) { MyEntry e1 = o.sort(e); MyEntry e2 = o.<@Odd MyEntry>sort(e); - // :: error: (type.argument) :: error: (argument) + // :: error: [type.argument] :: error: [argument] MyEntry e3 = o.<@Even MyEntry>sort(e); } diff --git a/framework/tests/framework/InnerGenerics.java b/framework/tests/framework/InnerGenerics.java index 5da4141001b1..87066f24e852 100644 --- a/framework/tests/framework/InnerGenerics.java +++ b/framework/tests/framework/InnerGenerics.java @@ -6,16 +6,16 @@ public class InnerGenerics { class ListInner {} void testInner1() { - // :: warning: (cast.unsafe.constructor.invocation) + // :: warning: [cast.unsafe.constructor.invocation] @Odd ListOuter o = new @Odd ListOuter(); - // :: warning: (cast.unsafe.constructor.invocation) + // :: warning: [cast.unsafe.constructor.invocation] @Odd ListInner i = new @Odd ListInner(); } void testInner2() { - // :: error: (assignment) + // :: error: [assignment] @Odd ListOuter o = new ListOuter<>(); - // :: error: (assignment) + // :: error: [assignment] @Odd ListInner i = new ListInner<>(); } @@ -25,9 +25,9 @@ void testInner3() { } void testInner4() { - // :: error: (assignment) + // :: error: [assignment] ListOuter<@Odd String> o = new ListOuter(); - // :: error: (assignment) + // :: error: [assignment] ListInner<@Odd String> i = new ListInner(); } } diff --git a/framework/tests/framework/MethodOverrideBadParam.java b/framework/tests/framework/MethodOverrideBadParam.java index 53fdb0d3b311..a8c1341875c0 100644 --- a/framework/tests/framework/MethodOverrideBadParam.java +++ b/framework/tests/framework/MethodOverrideBadParam.java @@ -5,7 +5,7 @@ public abstract class MethodOverrideBadParam { public abstract void method(String s); public static class SubclassA extends MethodOverrideBadParam { - // :: error: (override.param) + // :: error: [override.param] public void method(@Odd String s) {} } } diff --git a/framework/tests/framework/MethodOverrideBadReceiver.java b/framework/tests/framework/MethodOverrideBadReceiver.java index e77e8ab4d153..d271a6261c7b 100644 --- a/framework/tests/framework/MethodOverrideBadReceiver.java +++ b/framework/tests/framework/MethodOverrideBadReceiver.java @@ -5,7 +5,7 @@ public abstract class MethodOverrideBadReceiver { public abstract String method(); public static class SubclassA extends MethodOverrideBadReceiver { - // :: error: (override.receiver) + // :: error: [override.receiver] public String method(@Odd SubclassA this) { return ""; } diff --git a/framework/tests/framework/MethodOverrideBadReturn.java b/framework/tests/framework/MethodOverrideBadReturn.java index 6c0091583956..142e0462cd43 100644 --- a/framework/tests/framework/MethodOverrideBadReturn.java +++ b/framework/tests/framework/MethodOverrideBadReturn.java @@ -5,7 +5,7 @@ public abstract class MethodOverrideBadReturn { public abstract @Odd String method(); public static class SubclassA extends MethodOverrideBadReturn { - // :: error: (override.return) + // :: error: [override.return] public String method() { return ""; } diff --git a/framework/tests/framework/MethodOverrides.java b/framework/tests/framework/MethodOverrides.java index c29315b40036..2c735beb5e11 100644 --- a/framework/tests/framework/MethodOverrides.java +++ b/framework/tests/framework/MethodOverrides.java @@ -17,13 +17,13 @@ public abstract class MethodOverrides { public static class SubclassA extends MethodOverrides { public @Odd String method() { - // :: error: (assignment) + // :: error: [assignment] @Odd String s = ""; return s; } public @Odd String methodSub() { - // :: error: (assignment) + // :: error: [assignment] @Odd String s = ""; return s; } @@ -53,7 +53,7 @@ static class Y extends X { static class Z extends X { @Override // return type is an incorrect override, as it's a supertype - // :: error: (override.return) + // :: error: [override.return] A[] method(A[] s) { return null; } @@ -61,7 +61,7 @@ A[] method(A[] s) { static class Z2 extends X { @Override - // :: error: (override.return) :: error: (override.param) + // :: error: [override.return] :: error: [override.param] @Odd A[] method(@Odd A[] s) { return null; } @@ -82,7 +82,7 @@ static class ClY extends ClX { static class ClZ extends ClX { @Override - // :: error: (override.return) :: error: (override.param) + // :: error: [override.return] :: error: [override.param] @Odd S[] method(@Odd S[] s) { return null; } diff --git a/framework/tests/framework/Supertypes.java b/framework/tests/framework/Supertypes.java index d1a3c8954091..369b2a85179c 100644 --- a/framework/tests/framework/Supertypes.java +++ b/framework/tests/framework/Supertypes.java @@ -16,10 +16,10 @@ static class B extends ArrayList<@Odd String> implements Inter {} @Odd B b2; void testSelf() { - // :: error: (assignment) + // :: error: [assignment] @Odd A t1 = a1; // should emit error @Odd A t2 = a2; - // :: error: (assignment) + // :: error: [assignment] @Odd B t3 = b1; // should emit error @Odd B t4 = b2; } @@ -27,32 +27,32 @@ void testSelf() { void testList() { List l1 = a1; List l2 = a2; - // :: error: (assignment) + // :: error: [assignment] List l3 = b1; // should emit error - // :: error: (assignment) + // :: error: [assignment] List l4 = b2; // should emit error - // :: error: (assignment) + // :: error: [assignment] List<@Odd String> l5 = a1; // should emit error - // :: error: (assignment) + // :: error: [assignment] List<@Odd String> l6 = a2; // should emit error List<@Odd String> l7 = b1; List<@Odd String> l8 = b2; } void testInter() { - // :: error: (assignment) + // :: error: [assignment] Inter l1 = a1; // should emit error - // :: error: (assignment) + // :: error: [assignment] Inter l2 = a2; // should emit error Inter l3 = b1; Inter l4 = b2; Inter<@Odd String> l5 = a1; Inter<@Odd String> l6 = a2; - // :: error: (assignment) + // :: error: [assignment] Inter<@Odd String> l7 = b1; // should emit error - // :: error: (assignment) + // :: error: [assignment] Inter<@Odd String> l8 = b2; // should emit error } @@ -62,9 +62,9 @@ void testListOp() { String s3 = b1.get(0); String s4 = b2.get(0); - // :: error: (assignment) + // :: error: [assignment] @Odd String s5 = a1.get(0); // should emit error - // :: error: (assignment) + // :: error: [assignment] @Odd String s6 = a2.get(0); // should emit error @Odd String s7 = b1.get(0); @Odd String s8 = b2.get(0); @@ -76,9 +76,9 @@ void ListIterable() { for (String s : b1) {} for (String s : b2) {} - // :: error: (enhancedfor) + // :: error: [enhancedfor] for (@Odd String s : a1) {} - // :: error: (enhancedfor) + // :: error: [enhancedfor] for (@Odd String s : a2) {} for (@Odd String s : b1) {} for (@Odd String s : b2) {} diff --git a/framework/tests/framework/TypeInference.java b/framework/tests/framework/TypeInference.java index c5fe05e8bf5b..3b9c1fea7bdf 100644 --- a/framework/tests/framework/TypeInference.java +++ b/framework/tests/framework/TypeInference.java @@ -8,9 +8,9 @@ public class TypeInference { void test() { Collection<@Odd String> lst1 = Collections.<@Odd String>emptyList(); - // :: error: (assignment) + // :: error: [assignment] Collection<@Odd String> lst2 = Collections.emptyList(); // should emit error - // :: error: (assignment) + // :: error: [assignment] Collection lst3 = Collections.<@Odd String>emptyList(); // should emit error Collection<@Odd String> lst4 = Collections.emptyList(); Map lst5 = Collections.emptyMap(); @@ -26,7 +26,7 @@ static MyMap getMap() { void testSuper() { MyMap<@Odd String> m1 = TypeInference.<@Odd String>getMap(); MyMap<@Odd String> m2 = getMap(); - // :: error: (assignment) + // :: error: [assignment] MyMap m3 = TypeInference.<@Odd String>getMap(); // should emit error MyMap m4 = getMap(); diff --git a/framework/tests/framework/Varargs.java b/framework/tests/framework/Varargs.java index bdd06768a921..c432c4974231 100644 --- a/framework/tests/framework/Varargs.java +++ b/framework/tests/framework/Varargs.java @@ -4,7 +4,7 @@ public class Varargs { public void testVarargsInvocation() { @Odd String s = null; aVarargsMethod(s); - // :: error: (argument) + // :: error: [argument] aVarargsMethod(s, ""); aVarargsMethod(s, s); @@ -12,15 +12,15 @@ public void testVarargsInvocation() { // The assignment context infers @Odd for the component type. With invariant array // subtyping, this will fail, as the main type is a subtype. moreVarargs(new String @Odd [1]); - // :: warning: (cast.unsafe.constructor.invocation) + // :: warning: [cast.unsafe.constructor.invocation] moreVarargs(new @Odd String(), new @Odd String()); - // :: error: (argument) - // :: warning: (cast.unsafe.constructor.invocation) + // :: error: [argument] + // :: warning: [cast.unsafe.constructor.invocation] moreVarargs(new String(), new @Odd String()); moreVarargs( - // :: error: (argument) + // :: error: [argument] new String(), - // :: error: (argument) + // :: error: [argument] new String()); } diff --git a/framework/tests/framework/WildcardSuper.java b/framework/tests/framework/WildcardSuper.java index 87e0155f8606..e6217c2522e3 100644 --- a/framework/tests/framework/WildcardSuper.java +++ b/framework/tests/framework/WildcardSuper.java @@ -3,7 +3,7 @@ public class WildcardSuper { void test(List list) { - // :: error: (assignment) + // :: error: [assignment] @Odd Object odd = list.get(0); } } diff --git a/framework/tests/h1h2checker/AnonymousClasses.java b/framework/tests/h1h2checker/AnonymousClasses.java index b373de987cbc..be024e0bf496 100644 --- a/framework/tests/h1h2checker/AnonymousClasses.java +++ b/framework/tests/h1h2checker/AnonymousClasses.java @@ -4,15 +4,15 @@ public class AnonymousClasses { private <@H1S1 T extends @H1S1 Comparator> void testGenericAnonymous() { - // :: error: (type.argument) :: warning: (cast.unsafe.constructor.invocation) + // :: error: [type.argument] :: warning: [cast.unsafe.constructor.invocation] new @H1S1 Gen() {}; - // :: error: (type.argument) :: warning: (cast.unsafe.constructor.invocation) + // :: error: [type.argument] :: warning: [cast.unsafe.constructor.invocation] new @H1S1 GenInter() {}; } } class Gen<@H1S2 F extends @H1S2 Object> { - // :: error: (super.invocation) :: warning: (inconsistent.constructor.type) + // :: error: [super.invocation] :: warning: [inconsistent.constructor.type] public @H1S2 Gen() {} } diff --git a/framework/tests/h1h2checker/Catch.java b/framework/tests/h1h2checker/Catch.java index 173e1c291c40..467b16f945d7 100644 --- a/framework/tests/h1h2checker/Catch.java +++ b/framework/tests/h1h2checker/Catch.java @@ -28,7 +28,7 @@ void explictlyTopUnionType() throws Throwable { void explictlyNotTopUnionType() throws Throwable { try { throw new Throwable(); - // :: error: (exception.parameter) + // :: error: [exception.parameter] } catch (@H1S1 @H2Top IndexOutOfBoundsException | @H1S1 @H2Top NullPointerException ex) { } @@ -45,7 +45,7 @@ void explictlyTopDeclaredType() throws Throwable { void explictlyNotTopDeclaredType() throws Throwable { try { throw new Throwable(); - // :: error: (exception.parameter) + // :: error: [exception.parameter] } catch (@H1S1 @H2Top RuntimeException ex) { } diff --git a/framework/tests/h1h2checker/CompoundStringAssignment.java b/framework/tests/h1h2checker/CompoundStringAssignment.java index f3091188e38b..704e9a8fb31d 100644 --- a/framework/tests/h1h2checker/CompoundStringAssignment.java +++ b/framework/tests/h1h2checker/CompoundStringAssignment.java @@ -13,7 +13,7 @@ void test1() { // but only if the RHS was a method call. local += getSib1(); - // :: error: (assignment) + // :: error: [assignment] @H1Bot @H2Bot String isBot = local; @H1S1 @H2S1 String isSib1 = local; } @@ -24,9 +24,9 @@ void test2() { String local2 = top; local2 += getSib1(); - // :: error: (assignment) + // :: error: [assignment] @H1Bot @H2Bot String isBot2 = local2; - // :: error: (assignment) + // :: error: [assignment] @H1S1 @H2S1 String isSib12 = local2; } @@ -36,7 +36,7 @@ void test3() { String local3 = null; local3 += sib1; - // :: error: (assignment) + // :: error: [assignment] @H1Bot @H2Bot String isBot3 = local3; @H1S1 @H2S1 String isSib13 = local3; } diff --git a/framework/tests/h1h2checker/Constructors.java b/framework/tests/h1h2checker/Constructors.java index 89a70c2d8551..27cc1fd2b888 100644 --- a/framework/tests/h1h2checker/Constructors.java +++ b/framework/tests/h1h2checker/Constructors.java @@ -1,7 +1,7 @@ import org.checkerframework.framework.testchecker.h1h2checker.quals.*; public class Constructors { - // :: error: (super.invocation) :: warning: (inconsistent.constructor.type) + // :: error: [super.invocation] :: warning: [inconsistent.constructor.type] @H1S2 @H2S2 Constructors() {} void test1() { @@ -13,13 +13,13 @@ void test1() { // from constructor @H1S2 @H2S2 Constructors c3 = new @H1S2 Constructors(); - // :: error: (assignment) + // :: error: [assignment] @H1S2 @H2S1 Constructors e1 = new Constructors(); - // :: error: (assignment) + // :: error: [assignment] @H1S2 @H2S1 Constructors e2 = new @H1S2 Constructors(); } - // :: error: (super.invocation) :: warning: (inconsistent.constructor.type) + // :: error: [super.invocation] :: warning: [inconsistent.constructor.type] @H1S2 @H2Poly Constructors(@H1S1 @H2Poly int i) {} void test2(@H1S1 @H2S2 int p) { @@ -27,15 +27,15 @@ void test2(@H1S1 @H2S2 int p) { @H1S2 @H2S2 Constructors c2 = new @H1S2 @H2S2 Constructors(p); @H1S2 @H2S2 Constructors c3 = new @H1S2 Constructors(p); - // :: error: (assignment) + // :: error: [assignment] @H1S2 @H2S1 Constructors e1 = new Constructors(p); - // :: error: (assignment) + // :: error: [assignment] @H1S2 @H2S1 Constructors e2 = new @H1S2 @H2S2 Constructors(p); - // :: error: (assignment) + // :: error: [assignment] @H1S2 @H2S1 Constructors e3 = new @H1S2 Constructors(p); } - // :: error: (super.invocation) :: warning: (inconsistent.constructor.type) + // :: error: [super.invocation] :: warning: [inconsistent.constructor.type] @H1Poly @H2Poly Constructors(@H1Poly @H2Poly String s) {} void test3(@H1S1 @H2S2 String p) { @@ -43,20 +43,20 @@ void test3(@H1S1 @H2S2 String p) { @H1S1 @H2S2 Constructors c2 = new @H1S1 @H2S2 Constructors(p); @H1S1 @H2S2 Constructors c3 = new @H1S1 Constructors(p); - // :: error: (assignment) + // :: error: [assignment] @H1S2 @H2S1 Constructors e1 = new Constructors(p); - // :: error: (assignment) :: warning: (cast.unsafe.constructor.invocation) + // :: error: [assignment] :: warning: [cast.unsafe.constructor.invocation] @H1S2 @H2S1 Constructors e2 = new @H1S2 @H2S2 Constructors(p); - // :: error: (assignment) :: warning: (cast.unsafe.constructor.invocation) + // :: error: [assignment] :: warning: [cast.unsafe.constructor.invocation] @H1S2 @H2S1 Constructors e3 = new @H1S2 Constructors(p); - // :: warning: (cast.unsafe.constructor.invocation) + // :: warning: [cast.unsafe.constructor.invocation] @H1S2 @H2S2 Constructors e4 = new @H1S2 @H2S2 Constructors(p); - // :: warning: (cast.unsafe.constructor.invocation) + // :: warning: [cast.unsafe.constructor.invocation] @H1S2 @H2S2 Constructors e5 = new @H1S2 Constructors(p); } - // :: error: (super.invocation) :: warning: (inconsistent.constructor.type) + // :: error: [super.invocation] :: warning: [inconsistent.constructor.type] @org.checkerframework.framework.testchecker.util.Encrypted @H1Poly @H2Poly Constructors(@H1Poly @H2Poly String s, int i) {} void test4(@H1S1 @H2S2 String p) { diff --git a/framework/tests/h1h2checker/Defaulting.java b/framework/tests/h1h2checker/Defaulting.java index 1917cb6170dc..60dda75ecef0 100644 --- a/framework/tests/h1h2checker/Defaulting.java +++ b/framework/tests/h1h2checker/Defaulting.java @@ -13,7 +13,7 @@ public class Defaulting { class TestLocal { void m(@H1S1 Object p1, @H1S2 Object p2) { Object l1 = p1; - // :: error: (assignment) + // :: error: [assignment] Object l2 = p2; } } @@ -29,11 +29,11 @@ void m(@H1S1 Object p1, @H1S2 Object p2) { locations = {TypeUseLocation.OTHERWISE}) // Type of x is <@H1S2 X extends @H1S1 Object>, these annotations are siblings // and should not be in the same bound - // :: warning: (inconsistent.constructor.type) :: error: (bound) :: error: (super.invocation) + // :: warning: [inconsistent.constructor.type] :: error: [bound] :: error: [super.invocation] class TestUpperBound { void m(X p) { @H1S1 Object l1 = p; - // :: error: (assignment) + // :: error: [assignment] @H1S2 Object l2 = p; Object l3 = p; } @@ -48,21 +48,21 @@ void m(X p) { @DefaultQualifier( value = H1S2.class, locations = {TypeUseLocation.OTHERWISE}) - // :: warning: (inconsistent.constructor.type) :: error: (super.invocation) + // :: warning: [inconsistent.constructor.type] :: error: [super.invocation] class TestParameter { void m(Object p) { @H1S1 Object l1 = p; - // :: error: (assignment) + // :: error: [assignment] @H1S2 Object l2 = p; Object l3 = p; } void call() { - // :: warning: (cast.unsafe.constructor.invocation) + // :: warning: [cast.unsafe.constructor.invocation] m(new @H1S1 Object()); - // :: error: (argument) :: warning: (cast.unsafe.constructor.invocation) + // :: error: [argument] :: warning: [cast.unsafe.constructor.invocation] m(new @H1S2 Object()); - // :: error: (argument) + // :: error: [argument] m(new Object()); } } @@ -78,20 +78,20 @@ void call() { locations = {TypeUseLocation.OTHERWISE}) class TestConstructorParameter { - // :: warning: (inconsistent.constructor.type) :: error: (super.invocation) + // :: warning: [inconsistent.constructor.type] :: error: [super.invocation] TestConstructorParameter(Object p) { @H1S1 Object l1 = p; - // :: error: (assignment) + // :: error: [assignment] @H1S2 Object l2 = p; Object l3 = p; } void call() { - // :: warning: (cast.unsafe.constructor.invocation) + // :: warning: [cast.unsafe.constructor.invocation] new TestConstructorParameter(new @H1S1 Object()); - // :: error: (argument) :: warning: (cast.unsafe.constructor.invocation) + // :: error: [argument] :: warning: [cast.unsafe.constructor.invocation] new TestConstructorParameter(new @H1S2 Object()); - // :: error: (argument) + // :: error: [argument] new TestConstructorParameter(new Object()); } } @@ -105,27 +105,27 @@ void call() { @DefaultQualifier( value = H1S2.class, locations = {TypeUseLocation.OTHERWISE}) - // :: warning: (inconsistent.constructor.type) :: error: (super.invocation) + // :: warning: [inconsistent.constructor.type] :: error: [super.invocation] class TestReturns { Object res() { - // :: warning: (cast.unsafe.constructor.invocation) + // :: warning: [cast.unsafe.constructor.invocation] return new @H1S1 Object(); } void m() { @H1S1 Object l1 = res(); - // :: error: (assignment) + // :: error: [assignment] @H1S2 Object l2 = res(); Object l3 = res(); } Object res2() { - // :: error: (return) :: warning: (cast.unsafe.constructor.invocation) + // :: error: [return] :: warning: [cast.unsafe.constructor.invocation] return new @H1S2 Object(); } Object res3() { - // :: error: (return) + // :: error: [return] return new Object(); } } @@ -148,16 +148,16 @@ public void m() {} class TestReceiver { void call() { - // :: warning: (cast.unsafe.constructor.invocation) + // :: warning: [cast.unsafe.constructor.invocation] @H1S1 ReceiverDefaulting r2 = new @H1S1 ReceiverDefaulting(); - // :: warning: (cast.unsafe.constructor.invocation) + // :: warning: [cast.unsafe.constructor.invocation] @H1S2 ReceiverDefaulting r3 = new @H1S2 ReceiverDefaulting(); ReceiverDefaulting r = new ReceiverDefaulting(); r2.m(); - // :: error: (method.invocation) + // :: error: [method.invocation] r3.m(); - // :: error: (method.invocation) + // :: error: [method.invocation] r.m(); } } diff --git a/framework/tests/h1h2checker/ForEach.java b/framework/tests/h1h2checker/ForEach.java index b15d0d9568c7..97493567b849 100644 --- a/framework/tests/h1h2checker/ForEach.java +++ b/framework/tests/h1h2checker/ForEach.java @@ -9,14 +9,14 @@ Object arrayAccess1(Object[] constants) { @H1S2 Object arrayAccessBad1(@H1S1 Object[] constants) { Object constant = constants[0]; - // :: error: (return) + // :: error: [return] return constant; } // Return type defaults to H1Top @H2S1 Object arrayAccessBad2(@H1S1 @H2S2 Object[] constants) { Object constant = constants[0]; - // :: error: (return) + // :: error: [return] return constant; } @@ -37,7 +37,7 @@ Object iterateForEach(Object[] constants) { @H2S2 Object iterateForEachBad(@H2S1 Object[] constants) { for (Object constant : constants) { - // :: error: (return) + // :: error: [return] return constant; } return null; @@ -56,14 +56,14 @@ T garrayAccess1(T p) { @H1S2 T garrayAccessBad1(@H1S1 T[] constants) { T constant = constants[0]; - // :: error: (return) + // :: error: [return] return constant; } // Return type defaults to H1Top @H2S1 T garrayAccessBad2(@H1S1 @H2S2 T[] constants) { T constant = constants[0]; - // :: error: (return) + // :: error: [return] return constant; } @@ -84,7 +84,7 @@ T giterateForEach(T[] constants) { @H2S2 T giterateForEachBad(@H2S1 T[] constants) { for (T constant : constants) { - // :: error: (return) + // :: error: [return] return constant; } return null; diff --git a/framework/tests/h1h2checker/Generics.java b/framework/tests/h1h2checker/Generics.java index 59f00591ea2f..8e7995000de5 100644 --- a/framework/tests/h1h2checker/Generics.java +++ b/framework/tests/h1h2checker/Generics.java @@ -6,7 +6,7 @@ class Generics1 { T m(@H1S2 @H2S2 T p) { T l = p; - // :: error: (return) + // :: error: [return] return l; } @@ -19,7 +19,7 @@ class Generics2 { T m(@H1S2 T p) { T l = p; - // :: error: (return) + // :: error: [return] return l; } @@ -33,7 +33,7 @@ class Generics3 { // See comments in BaseTypeVisitor about type variable checks. // The currently desired behavior is that the annotation on the // type variable overrides the bound. - // TODO?:: error: (type.invalid) + // TODO?:: error: [type.invalid] void m(@H1S2 T p) {} } } diff --git a/framework/tests/h1h2checker/GetClassStubTest.java b/framework/tests/h1h2checker/GetClassStubTest.java index 2c0764ea5fc4..c54acfa3bb0a 100644 --- a/framework/tests/h1h2checker/GetClassStubTest.java +++ b/framework/tests/h1h2checker/GetClassStubTest.java @@ -12,10 +12,10 @@ void context() { Class<@H1Bot ? extends @H1S1 Object> succeed1 = i.getClass(); Class<@H1Bot ? extends @H1S1 Integer> succeed2 = i.getClass(); - // :: error: (assignment) + // :: error: [assignment] Class<@H1Bot ? extends @H1Bot Object> fail1 = i.getClass(); - // :: error: (assignment) + // :: error: [assignment] Class<@H1Bot ?> fail2 = i.getClass(); } } diff --git a/framework/tests/h1h2checker/IncompatibleBounds.java b/framework/tests/h1h2checker/IncompatibleBounds.java index a26c7f223a2f..bafe3172e791 100644 --- a/framework/tests/h1h2checker/IncompatibleBounds.java +++ b/framework/tests/h1h2checker/IncompatibleBounds.java @@ -37,26 +37,26 @@ class ValidContext { } // invalid combinations - // :: error: (bound) + // :: error: [bound] class BottomToTop<@H1Top U extends @H1Bot Object> {} - // :: error: (bound) + // :: error: [bound] class H1S1ToTop<@H1Top UU extends @H1S1 Object> {} - // :: error: (bound) + // :: error: [bound] class BottomToH1S1<@H1S1 UUU extends @H1Bot Object> {} - // :: error: (bound) + // :: error: [bound] class H1S2ToH1S1<@H1S1 UUUU extends @H1S2 Object> {} class InvalidContext { - // :: error: (bound) + // :: error: [bound] BottomToTop<@H1Top ? extends @H1Bot Object> bottomToTop; - // :: error: (bound) + // :: error: [bound] H1S1ToTop<@H1Top ? extends @H1S1 Object> h1S1ToTop; - // :: error: (bound) + // :: error: [bound] BottomToH1S1<@H1S1 ? extends @H1Bot Object> bottomToH1S1; - // :: error: (bound) + // :: error: [bound] H1S2ToH1S1<@H1S1 ? extends @H1S2 Object> h1S2ToH1S1; } } diff --git a/framework/tests/h1h2checker/InferTypeArgsPolyChecker.java b/framework/tests/h1h2checker/InferTypeArgsPolyChecker.java index 5d02fd178bb7..bd32f890f385 100644 --- a/framework/tests/h1h2checker/InferTypeArgsPolyChecker.java +++ b/framework/tests/h1h2checker/InferTypeArgsPolyChecker.java @@ -78,15 +78,15 @@ void launder(@NonNull OUTER arg1, @Nullable OUTER arg2) { g.listo = new ArrayList<@NonNull String>(); g.launder("", null); // during this method call null would be added to g.listo */ - // :: error: (type.arguments.not.inferred) + // :: error: [type.arguments.not.inferred] OUTER_SCOPE_TV osNaked2 = methodD(os1, os2, ""); - // :: error: (type.arguments.not.inferred) + // :: error: [type.arguments.not.inferred] OUTER_SCOPE_TV osAnnoed = methodD(os2, os2, ""); - // :: error: (type.arguments.not.inferred) + // :: error: [type.arguments.not.inferred] String str = methodD2(os2, os1, ""); - // :: error: (type.arguments.not.inferred) + // :: error: [type.arguments.not.inferred] OUTER_SCOPE_TV osNaked3 = methodD2(os1, os1, os2); } @@ -112,9 +112,9 @@ void contextF( List l2, List<@H1S1 @H2S2 ? extends @H1Top @H2Top String> l3) { - // :: error: (type.arguments.not.inferred) + // :: error: [type.arguments.not.inferred] List lstr1 = methodF(l1, l2); - // :: error: (type.arguments.not.inferred) + // :: error: [type.arguments.not.inferred] List lstr2 = methodF(l3, l2); } @@ -155,7 +155,7 @@ void contextMN() { void contextOP(@H1S1 @H2S1 String s1, @H1Bot @H2Bot String s2) { // This test is actually here to test that the constraint P :> O is implied on p - // :: error: (assignment) + // :: error: [assignment] @H1Bot @H2Bot String loc = methodOP(s1, s2); } diff --git a/framework/tests/h1h2checker/Inheritance.java b/framework/tests/h1h2checker/Inheritance.java index 066986478f00..86c82d12138e 100644 --- a/framework/tests/h1h2checker/Inheritance.java +++ b/framework/tests/h1h2checker/Inheritance.java @@ -1,18 +1,18 @@ import org.checkerframework.framework.testchecker.h1h2checker.quals.*; -// :: warning: (inconsistent.constructor.type) :: error: (super.invocation) +// :: warning: [inconsistent.constructor.type] :: error: [super.invocation] @H1S1 class Inheritance { void bar1(@H1Bot Inheritance param) {} void bar2(@H1S1 Inheritance param) {} - // :: error: (annotations.on.use) + // :: error: [annotations.on.use] void bar3(@H1Top Inheritance param) {} void foo1(@H1Bot Inheritance[] param) {} void foo2(@H1S1 Inheritance[] param) {} - // :: error: (annotations.on.use) + // :: error: [annotations.on.use] void foo3(@H1Top Inheritance[] param) {} } diff --git a/framework/tests/h1h2checker/Issue2163Final.java b/framework/tests/h1h2checker/Issue2163Final.java index 089fccf6db9d..1a1c175bdcff 100644 --- a/framework/tests/h1h2checker/Issue2163Final.java +++ b/framework/tests/h1h2checker/Issue2163Final.java @@ -10,43 +10,43 @@ } @H1Top class Issue2163FinalAB { - // :: error: (super.invocation) :: warning: (inconsistent.constructor.type) + // :: error: [super.invocation] :: warning: [inconsistent.constructor.type] @H1S1 Issue2163FinalAB() {} } @H1Top class Issue2163FinalAC { - // :: error: (super.invocation) :: warning: (inconsistent.constructor.type) + // :: error: [super.invocation] :: warning: [inconsistent.constructor.type] @H1Bot Issue2163FinalAC() {} } @H1S1 class Issue2163FinalBA { - // :: error: (annotations.on.use) + // :: error: [annotations.on.use] @H1Top Issue2163FinalBA() {} } @H1S1 class Issue2163FinalBB { - // :: error: (super.invocation) :: warning: (inconsistent.constructor.type) + // :: error: [super.invocation] :: warning: [inconsistent.constructor.type] @H1S1 Issue2163FinalBB() {} } @H1S1 class Issue2163FinalBC { - // :: error: (super.invocation) :: warning: (inconsistent.constructor.type) + // :: error: [super.invocation] :: warning: [inconsistent.constructor.type] @H1Bot Issue2163FinalBC() {} } @H1Bot class Issue2163FinalCA { - // :: error: (annotations.on.use) + // :: error: [annotations.on.use] @H1Top Issue2163FinalCA() {} } @H1Bot class Issue2163FinalCB { - // :: error: (annotations.on.use) :: warning: (inconsistent.constructor.type) :: - // error: (super.invocation) + // :: error: [annotations.on.use] :: warning: [inconsistent.constructor.type] :: + // error: [super.invocation] @H1S1 Issue2163FinalCB() {} } @H1Bot class Issue2163FinalCC { - // :: error: (super.invocation) :: warning: (inconsistent.constructor.type) + // :: error: [super.invocation] :: warning: [inconsistent.constructor.type] @H1Bot Issue2163FinalCC() {} } @@ -55,9 +55,9 @@ class Issue2163FinalAAClient { void test() { new @H1Top Issue2163FinalAA(); - // :: warning: (cast.unsafe.constructor.invocation) + // :: warning: [cast.unsafe.constructor.invocation] new @H1S1 Issue2163FinalAA(); - // :: warning: (cast.unsafe.constructor.invocation) + // :: warning: [cast.unsafe.constructor.invocation] new @H1Bot Issue2163FinalAA(); } } diff --git a/framework/tests/h1h2checker/Issue2186.java b/framework/tests/h1h2checker/Issue2186.java index d832ecadbf8d..b253999f7fba 100644 --- a/framework/tests/h1h2checker/Issue2186.java +++ b/framework/tests/h1h2checker/Issue2186.java @@ -7,10 +7,10 @@ @SuppressWarnings("anno.on.irrelevant") @H1S1 class Issue2186 { - // :: error: (super.invocation) :: warning: (inconsistent.constructor.type) + // :: error: [super.invocation] :: warning: [inconsistent.constructor.type] Issue2186() {} - // :: error: (super.invocation) :: warning: (inconsistent.constructor.type) + // :: error: [super.invocation] :: warning: [inconsistent.constructor.type] @H1Bot Issue2186(int x) {} void test() { @@ -20,7 +20,7 @@ void test() { void testDiamond() { @H1Bot ArrayList<@H1Bot String> list = - // :: warning: (cast.unsafe.constructor.invocation) + // :: warning: [cast.unsafe.constructor.invocation] new @H1Bot ArrayList<@H1Bot String>(); } } diff --git a/framework/tests/h1h2checker/Issue2264.java b/framework/tests/h1h2checker/Issue2264.java index 5be0feb64d4c..ad0985a116b2 100644 --- a/framework/tests/h1h2checker/Issue2264.java +++ b/framework/tests/h1h2checker/Issue2264.java @@ -5,15 +5,15 @@ import org.checkerframework.framework.testchecker.h1h2checker.quals.H1Top; public class Issue2264 extends SuperClass { - // :: warning: (inconsistent.constructor.type) + // :: warning: [inconsistent.constructor.type] @H1S1 Issue2264() { - // :: error: (super.invocation) + // :: error: [super.invocation] super(9); } } class ImplicitSuperCall { - // :: error: (super.invocation) :: warning: (inconsistent.constructor.type) + // :: error: [super.invocation] :: warning: [inconsistent.constructor.type] @H1S1 ImplicitSuperCall() {} } @@ -22,6 +22,6 @@ class SuperClass { } @H1S1 class TestClass { - // :: error: (annotations.on.use) + // :: error: [annotations.on.use] @H1Top TestClass() {} } diff --git a/framework/tests/h1h2checker/Issue798.java b/framework/tests/h1h2checker/Issue798.java index 9e834c5e9b4e..f5359778c699 100644 --- a/framework/tests/h1h2checker/Issue798.java +++ b/framework/tests/h1h2checker/Issue798.java @@ -9,12 +9,12 @@ void test1(String format, @H1S1 Object @H1S2 ... args) { } void test2(String format, @H1S1 Object @H1S1 ... args) { - // :: error: (argument) + // :: error: [argument] String.format(format, args); } void test3(String format, @H1S2 Object @H1S2 ... args) { - // :: error: (argument) + // :: error: [argument] String.format(format, args); } } diff --git a/framework/tests/h1h2checker/Issue849.java b/framework/tests/h1h2checker/Issue849.java index 6b2ada320c1a..d4512bb6e1d2 100644 --- a/framework/tests/h1h2checker/Issue849.java +++ b/framework/tests/h1h2checker/Issue849.java @@ -8,7 +8,7 @@ public class Issue849 { class Gen {} void polyAll(Gen> genGenNonNull) { - // :: error: (assignment) + // :: error: [assignment] Gen<@H1Top ? extends @H1Top Gen<@H1Top Object>> a = genGenNonNull; } } diff --git a/framework/tests/h1h2checker/Primitive.java b/framework/tests/h1h2checker/Primitive.java index 5727cd4848b5..2bf1c60bb5e5 100644 --- a/framework/tests/h1h2checker/Primitive.java +++ b/framework/tests/h1h2checker/Primitive.java @@ -13,7 +13,7 @@ void use1(@H1S2 @H2S1 int p) { } void use2(@H1S2 @H2S2 int p) { - // :: error: (assignment) + // :: error: [assignment] @H1S2 @H2S1 int l = m(p); } } diff --git a/framework/tests/h1h2checker/TypeRefinement.java b/framework/tests/h1h2checker/TypeRefinement.java index 0fabe4ffaffb..682e865d37e9 100644 --- a/framework/tests/h1h2checker/TypeRefinement.java +++ b/framework/tests/h1h2checker/TypeRefinement.java @@ -2,9 +2,9 @@ import org.checkerframework.framework.testchecker.h1h2checker.quals.H1Invalid; public class TypeRefinement { - // :: warning: (cast.unsafe.constructor.invocation) + // :: warning: [cast.unsafe.constructor.invocation] @H1Top Object o = new @H1S1 Object(); - // :: error: (h1h2checker.h1invalid.forbidden) :: warning: (cast.unsafe.constructor.invocation) + // :: error: (h1h2checker.h1invalid.forbidden) :: warning: [cast.unsafe.constructor.invocation] @H1Top Object o2 = new @H1Invalid Object(); // :: error: (h1h2checker.h1invalid.forbidden) @H1Top Object o3 = getH1Invalid(); diff --git a/framework/tests/initialized-fields-value/ClassInitializer2a.java b/framework/tests/initialized-fields-value/ClassInitializer2a.java index 33a9da3e041a..59fe169a813b 100644 --- a/framework/tests/initialized-fields-value/ClassInitializer2a.java +++ b/framework/tests/initialized-fields-value/ClassInitializer2a.java @@ -12,6 +12,6 @@ public class ClassInitializer2a { x = 1; } - // :: error: (contracts.postcondition) + // :: error: [contracts.postcondition] ClassInitializer2a() {} } diff --git a/framework/tests/initialized-fields-value/ManualConstructor.java b/framework/tests/initialized-fields-value/ManualConstructor.java index ecc24b8e86d1..4a3b3b381dbe 100644 --- a/framework/tests/initialized-fields-value/ManualConstructor.java +++ b/framework/tests/initialized-fields-value/ManualConstructor.java @@ -8,12 +8,12 @@ public class ManualConstructor { int z; - // :: error: (contracts.postcondition) + // :: error: [contracts.postcondition] ManualConstructor() { x = 1; } - // :: error: (contracts.postcondition) + // :: error: [contracts.postcondition] ManualConstructor(boolean ignore) { x = 1; z = 3; diff --git a/framework/tests/initialized-fields-value/PrimitiveField.java b/framework/tests/initialized-fields-value/PrimitiveField.java index 23ee59538fa5..85efa55ea03b 100644 --- a/framework/tests/initialized-fields-value/PrimitiveField.java +++ b/framework/tests/initialized-fields-value/PrimitiveField.java @@ -28,42 +28,42 @@ public class PrimitiveField { @IntVal(0) long l2; - // :: error: (contracts.postcondition) + // :: error: [contracts.postcondition] static class InitValueNotOk1 { @BoolVal(true) boolean b2; } - // :: error: (contracts.postcondition) + // :: error: [contracts.postcondition] static class InitValueNotOk2 { @IntVal(1) byte by2; } - // :: error: (contracts.postcondition) + // :: error: [contracts.postcondition] static class InitValueNotOk3 { @IntVal(1) char c2; } - // :: error: (contracts.postcondition) + // :: error: [contracts.postcondition] static class InitValueNotOk4 { @IntVal(1) int i2; } - // :: error: (contracts.postcondition) + // :: error: [contracts.postcondition] static class InitValueNotOk5 { @IntVal(1) short s2; } - // :: error: (contracts.postcondition) + // :: error: [contracts.postcondition] static class InitValueNotOk6 { @DoubleVal(1.0) float f2; } - // :: error: (contracts.postcondition) + // :: error: [contracts.postcondition] static class InitValueNotOk7 { @DoubleVal(1.0) double d2; } - // :: error: (contracts.postcondition) + // :: error: [contracts.postcondition] static class InitValueNotOk8 { @IntVal(2) long l2; } diff --git a/framework/tests/initialized-fields/ConstructorPostcondition.java b/framework/tests/initialized-fields/ConstructorPostcondition.java index 15396a814ff5..2de95365cac9 100644 --- a/framework/tests/initialized-fields/ConstructorPostcondition.java +++ b/framework/tests/initialized-fields/ConstructorPostcondition.java @@ -12,7 +12,7 @@ public class ConstructorPostcondition { z = 3; } - // :: error: (contracts.postcondition) + // :: error: [contracts.postcondition] ConstructorPostcondition(int ignore) { x = 1; y = 2; diff --git a/framework/tests/initialized-fields/EnsuresInitializedFieldsTest.java b/framework/tests/initialized-fields/EnsuresInitializedFieldsTest.java index b500dbb955eb..4c215192c244 100644 --- a/framework/tests/initialized-fields/EnsuresInitializedFieldsTest.java +++ b/framework/tests/initialized-fields/EnsuresInitializedFieldsTest.java @@ -17,13 +17,13 @@ public class EnsuresInitializedFieldsTest { @EnsuresInitializedFields( value = "this", fields = {"x", "y"}) - // :: error: (contracts.postcondition) + // :: error: [contracts.postcondition] void setsX() { x = 1; } @EnsuresInitializedFields(fields = {"x", "y"}) - // :: error: (contracts.postcondition) + // :: error: [contracts.postcondition] void setsX2() { x = 1; } @@ -31,7 +31,7 @@ void setsX2() { @EnsuresInitializedFields( value = "#1", fields = {"x", "y"}) - // :: error: (contracts.postcondition) + // :: error: [contracts.postcondition] void setsX(EnsuresInitializedFieldsTest eift) { eift.x = 1; } diff --git a/framework/tests/initialized-fields/SimpleConstructor.java b/framework/tests/initialized-fields/SimpleConstructor.java index 6d509affd859..a540a2ad4b32 100644 --- a/framework/tests/initialized-fields/SimpleConstructor.java +++ b/framework/tests/initialized-fields/SimpleConstructor.java @@ -7,19 +7,19 @@ public class SimpleConstructor { int z; SimpleConstructor() { - // :: error: (assignment) + // :: error: [assignment] @InitializedFields({"x", "y", "z"}) SimpleConstructor sc1 = this; @InitializedFields() SimpleConstructor sc2 = this; x = 1; - // :: error: (assignment) + // :: error: [assignment] @InitializedFields({"x", "y", "z"}) SimpleConstructor sc3 = this; @InitializedFields({"x"}) SimpleConstructor sc4 = this; this.y = 1; - // :: error: (assignment) + // :: error: [assignment] @InitializedFields({"x", "y", "z"}) SimpleConstructor sc5 = this; @InitializedFields({"x", "y"}) SimpleConstructor sc6 = this; @InitializedFields({"y", "x"}) SimpleConstructor sc7 = this; diff --git a/framework/tests/javaexpression/ArrayCreationParsing.java b/framework/tests/javaexpression/ArrayCreationParsing.java index c4bed6c4da25..a2f65ee17e54 100644 --- a/framework/tests/javaexpression/ArrayCreationParsing.java +++ b/framework/tests/javaexpression/ArrayCreationParsing.java @@ -28,7 +28,7 @@ int getI() { void method(@FlowExp("new java.lang.String[2]") Object param) { value3 = param; - // :: error: (assignment) + // :: error: [assignment] value1 = param; } } diff --git a/framework/tests/javaexpression/Canonicalization.java b/framework/tests/javaexpression/Canonicalization.java index 6fc58ddae3c1..41d322c25ab0 100644 --- a/framework/tests/javaexpression/Canonicalization.java +++ b/framework/tests/javaexpression/Canonicalization.java @@ -21,21 +21,21 @@ class Use { @FlowExp("lockExample1.myLock") Object o2 = lockExample1.locked2; @FlowExp("myLock") - // :: error: (assignment) + // :: error: [assignment] Object o3 = lockExample1.locked; @FlowExp("this.myLock") - // :: error: (assignment) + // :: error: [assignment] Object o4 = lockExample1.locked2; @FlowExp("lockExample1.myLock") Object oM1 = lockExample1.getLocked(); @FlowExp("myLock") - // :: error: (assignment) + // :: error: [assignment] Object oM2 = lockExample1.getLocked(); @FlowExp("this.myLock") - // :: error: (assignment) + // :: error: [assignment] Object oM3 = lockExample1.getLocked(); } } diff --git a/framework/tests/javaexpression/ClassLiterals.java b/framework/tests/javaexpression/ClassLiterals.java index 0134c4b07050..30da6a83f612 100644 --- a/framework/tests/javaexpression/ClassLiterals.java +++ b/framework/tests/javaexpression/ClassLiterals.java @@ -14,11 +14,11 @@ void method( @FlowExp("java.lang.String.class") Object p3) { @FlowExp("String.class") Object l1 = p1; @FlowExp("String.class") Object l2 = p2; - // :: error: (assignment) + // :: error: [assignment] @FlowExp("String.class") Object l3 = p3; - // :: error: (assignment) + // :: error: [assignment] @FlowExp("java.lang.String.class") Object l4 = p1; - // :: error: (assignment) + // :: error: [assignment] @FlowExp("java.lang.String.class") Object l5 = p2; @FlowExp("java.lang.String.class") Object l6 = p3; } diff --git a/framework/tests/javaexpression/Constructor.java b/framework/tests/javaexpression/Constructor.java index 7072781e80a2..6ec4859796e9 100644 --- a/framework/tests/javaexpression/Constructor.java +++ b/framework/tests/javaexpression/Constructor.java @@ -17,9 +17,9 @@ static class MyClass2 { void method() { // TODO: This should be an error. MyClass c = new @FlowExp("field") MyClass(); - // :: error: (expression.unparsable) :: error: (constructor.invocation) + // :: error: [expression.unparsable] :: error: [constructor.invocation] MyClass c2 = new @FlowExp("bad") MyClass(); - // :: error: (constructor.invocation) + // :: error: [constructor.invocation] MyClass c3 = new @FlowExp("field2") MyClass(); } } diff --git a/framework/tests/javaexpression/Fields.java b/framework/tests/javaexpression/Fields.java index 6ac621ca8473..c9cd25e0945d 100644 --- a/framework/tests/javaexpression/Fields.java +++ b/framework/tests/javaexpression/Fields.java @@ -8,9 +8,9 @@ static class String { } void method( - // :: error: (expression.unparsable) + // :: error: [expression.unparsable] @FlowExp("java.lang.String.HELLO") Object p1, @FlowExp("Fields.String.HELLO") Object p2) { - // :: error: (assignment) + // :: error: [assignment] @FlowExp("String.HELLO") Object l1 = p1; @FlowExp("String.HELLO") Object l2 = p2; @FlowExp("javaexpression.Fields.String.HELLO") Object l3 = p2; diff --git a/framework/tests/javaexpression/InnerClasses.java b/framework/tests/javaexpression/InnerClasses.java index 40b08a596e57..44db49527067 100644 --- a/framework/tests/javaexpression/InnerClasses.java +++ b/framework/tests/javaexpression/InnerClasses.java @@ -7,7 +7,7 @@ public class InnerClasses { public static String outerStaticField = ""; static class InnerClass { - // :: error: (expression.unparsable) + // :: error: [expression.unparsable] @FlowExp("outerInstanceField") Object o = null; @FlowExp("outerStaticField") Object o2 = null; @@ -27,7 +27,7 @@ static class InnerClass2 { class TestUses { void method(InnerClass innerClass, InnerClass2 innerClass2) { - // :: error: (expression.unparsable) :: error: (assignment) + // :: error: [expression.unparsable] :: error: [assignment] @FlowExp("innerClass.outerInstanceField") Object o = innerClass.o; @FlowExp("InnerClasses.outerStaticField") Object o2 = innerClass.o2; diff --git a/framework/tests/javaexpression/LambdaParameter.java b/framework/tests/javaexpression/LambdaParameter.java index 375bcaaef414..48937cb6b071 100644 --- a/framework/tests/javaexpression/LambdaParameter.java +++ b/framework/tests/javaexpression/LambdaParameter.java @@ -6,19 +6,19 @@ public class LambdaParameter { void method(String methodParam) { Function func1 = ( - // :: error: (lambda.param) + // :: error: [lambda.param] @FlowExp("methodParam") String lambdaParam) -> { return ""; }; Function func2 = ( - // :: error: (lambda.param) :: error: (expression.unparsable) + // :: error: [lambda.param] :: error: [expression.unparsable] @FlowExp("lambdaParam") String lambdaParam) -> { return ""; }; Function func3 = ( - // :: error: (lambda.param) + // :: error: [lambda.param] @FlowExp("#1") String lambdaParam) -> { @FlowExp("lambdaParam") String s = lambdaParam; return ""; @@ -42,7 +42,7 @@ void method3() { String local = ""; Function func1 = ( - // :: error: (lambda.param) + // :: error: [lambda.param] @FlowExp("local") String lambdaParam) -> { return ""; }; diff --git a/framework/tests/javaexpression/SimpleVPA.java b/framework/tests/javaexpression/SimpleVPA.java index d76ca491ead4..d8459fa947b1 100644 --- a/framework/tests/javaexpression/SimpleVPA.java +++ b/framework/tests/javaexpression/SimpleVPA.java @@ -5,7 +5,7 @@ public class SimpleVPA { class MyClass { - // :: error: (expression.unparsable) + // :: error: [expression.unparsable] @FlowExp("this.bad") Object field; } @@ -14,7 +14,7 @@ class Use { MyClass myClass = new MyClass(); @FlowExp("bad") - // :: error: (assignment) + // :: error: [assignment] Object o = myClass.field; } } diff --git a/framework/tests/javaexpression/Standardize.java b/framework/tests/javaexpression/Standardize.java index bd5fcb0facaf..28161e88ad65 100644 --- a/framework/tests/javaexpression/Standardize.java +++ b/framework/tests/javaexpression/Standardize.java @@ -73,7 +73,7 @@ void testCasts() { } void testNewClassTree() { - // :: warning: (cast.unsafe.constructor.invocation) + // :: warning: [cast.unsafe.constructor.invocation] @FlowExp("this.field") Object o = new @FlowExp("field") Object(); } @@ -81,7 +81,7 @@ void list(List<@FlowExp("field") Object> list) { Object field = new Object(); // "field" is local variable, but list.get(1) type is @FlowExp("this.field") @FlowExp("field") - // :: error: (assignment) + // :: error: [assignment] Object o1 = list.get(1); @FlowExp("this.field") Object o2 = list.get(1); } diff --git a/framework/tests/javaexpression/TestParsing.java b/framework/tests/javaexpression/TestParsing.java index 7989f0fee0d7..ae25e3b7abcb 100644 --- a/framework/tests/javaexpression/TestParsing.java +++ b/framework/tests/javaexpression/TestParsing.java @@ -7,6 +7,6 @@ void test(@FlowExp("a.length") Object a, @FlowExp("this.a.length") Object b) {} void test2(@FlowExp("a.clone()") Object a, @FlowExp("this.a.clone()") Object b) {} - // :: error: (expression.unparsable) + // :: error: [expression.unparsable] void test3(@FlowExp("a.leng") Object a) {} } diff --git a/framework/tests/javaexpression/ThisStaticContext.java b/framework/tests/javaexpression/ThisStaticContext.java index 1e8323b13c02..151e65de68ea 100644 --- a/framework/tests/javaexpression/ThisStaticContext.java +++ b/framework/tests/javaexpression/ThisStaticContext.java @@ -6,7 +6,7 @@ public class ThisStaticContext { public Map instanceField; static void staticMethod1( - // :: error: (expression.unparsable) + // :: error: [expression.unparsable] @FlowExp("this.staticField") Object p1, @FlowExp("ThisStaticContext.staticField") Object p2, @FlowExp("staticField") Object p3) { @@ -14,11 +14,11 @@ static void staticMethod1( } static void staticMethod2( - // :: error: (expression.unparsable) + // :: error: [expression.unparsable] @FlowExp("this.instanceField") Object p1, - // :: error: (expression.unparsable) + // :: error: [expression.unparsable] @FlowExp("ThisStaticContext.instanceField") Object p2, - // :: error: (expression.unparsable) + // :: error: [expression.unparsable] @FlowExp("instanceField") Object p3) {} void instanceMethod1( @@ -31,7 +31,7 @@ void instanceMethod1( void instanceMethod2( @FlowExp("this.instanceField") Object p1, - // :: error: (expression.unparsable) + // :: error: [expression.unparsable] @FlowExp("ThisStaticContext.instanceField") Object p2, @FlowExp("instanceField") Object p3) { p1 = p3; diff --git a/framework/tests/javaexpression/ThisSuper.java b/framework/tests/javaexpression/ThisSuper.java index 0bc50a42101c..832d071a0d3e 100644 --- a/framework/tests/javaexpression/ThisSuper.java +++ b/framework/tests/javaexpression/ThisSuper.java @@ -18,9 +18,9 @@ static class SubClass extends SuperClass { void method() { // super.superField : @FlowExp("super.field") // this.subField : @FlowExp("this.field") - // :: error: (assignment) + // :: error: [assignment] this.subField = super.superField; - // :: error: (assignment) + // :: error: [assignment] super.superField = this.subField; @FlowExp("super.field") Object o1 = super.superField; diff --git a/framework/tests/javaexpression/Unparsable.java b/framework/tests/javaexpression/Unparsable.java index cebe151d62a7..2d5f3b33990a 100644 --- a/framework/tests/javaexpression/Unparsable.java +++ b/framework/tests/javaexpression/Unparsable.java @@ -3,13 +3,13 @@ import org.checkerframework.framework.testchecker.javaexpression.qual.FlowExp; public class Unparsable { - // :: error: (expression.unparsable) + // :: error: [expression.unparsable] @FlowExp("lsdjf") Object o3 = null; void method() { - // :: error: (expression.unparsable) + // :: error: [expression.unparsable] @FlowExp("new Object()") Object o1 = null; - // :: error: (expression.unparsable) + // :: error: [expression.unparsable] @FlowExp("int unparseable = 0") Object o2 = null; } } diff --git a/framework/tests/javaexpression/UnsupportJavaCode.java b/framework/tests/javaexpression/UnsupportJavaCode.java index 1fd5d7f54a34..998b6d1b71d3 100644 --- a/framework/tests/javaexpression/UnsupportJavaCode.java +++ b/framework/tests/javaexpression/UnsupportJavaCode.java @@ -6,10 +6,10 @@ public class UnsupportJavaCode { void method() { - // :: error: (expression.unparsable) + // :: error: [expression.unparsable] @FlowExp("new Object()") String s0; - // :: error: (expression.unparsable) + // :: error: [expression.unparsable] @FlowExp("List list;") String s1; } } diff --git a/framework/tests/javaexpression/ViewPointAdaptMethods.java b/framework/tests/javaexpression/ViewPointAdaptMethods.java index a6775c081d17..2e6223964989 100644 --- a/framework/tests/javaexpression/ViewPointAdaptMethods.java +++ b/framework/tests/javaexpression/ViewPointAdaptMethods.java @@ -8,7 +8,7 @@ public class ViewPointAdaptMethods { void method1(Object param1, @FlowExp("#1") Object param2) { @FlowExp("param1") Object local = param2; @FlowExp("this.param1") - // :: error: (assignment) + // :: error: [assignment] Object local2 = param2; @FlowExp("#1") Object local3 = param2; } @@ -17,7 +17,7 @@ void method1(Object param1, @FlowExp("#1") Object param2) { void callMethod1(@FlowExp("this.field") Object param, @FlowExp("#1") Object param2) { method1(field, param); - // :: error: (argument) + // :: error: [argument] method1(field, param2); } @@ -26,12 +26,12 @@ void callMethod1(@FlowExp("this.field") Object param, @FlowExp("#1") Object para return param1; } else if (param1 == param2) { @FlowExp("#2") - // :: error: (assignment) + // :: error: [assignment] Object o = new Object(); return o; } else { @FlowExp("param2") - // :: error: (assignment) + // :: error: [assignment] Object o = new Object(); return o; } diff --git a/framework/tests/javaexpression/ViewpointAdaptation.java b/framework/tests/javaexpression/ViewpointAdaptation.java index 6a7457573adb..9df39bfd1dbf 100644 --- a/framework/tests/javaexpression/ViewpointAdaptation.java +++ b/framework/tests/javaexpression/ViewpointAdaptation.java @@ -23,19 +23,19 @@ class Use { @FlowExp("this.myClass1.field") Object o2 = myClass1.annotatedField2; @FlowExp("field") - // :: error: (assignment) + // :: error: [assignment] Object o3 = myClass1.annotatedField1; @FlowExp("this.field") - // :: error: (assignment) + // :: error: [assignment] Object o4 = myClass1.annotatedField2; @FlowExp("field") - // :: error: (assignment) + // :: error: [assignment] Object oM2 = myClass1.getAnnotatedField1(); @FlowExp("this.field") - // :: error: (assignment) + // :: error: [assignment] Object oM3 = myClass1.getAnnotatedField1(); } } diff --git a/framework/tests/javaexpression/ViewpointAdaptation2.java b/framework/tests/javaexpression/ViewpointAdaptation2.java index 744d7e4e7a63..188e78859627 100644 --- a/framework/tests/javaexpression/ViewpointAdaptation2.java +++ b/framework/tests/javaexpression/ViewpointAdaptation2.java @@ -22,26 +22,26 @@ class Use { @FlowExp("lockExample1.myLock") Object o2 = lockExample1.locked2; @FlowExp("myLock") - // :: error: (assignment) + // :: error: [assignment] Object o3 = lockExample1.locked; @FlowExp("this.myLock") - // :: error: (assignment) + // :: error: [assignment] Object o4 = lockExample1.locked2; @FlowExp("lockExample1.myLock") Object oM1 = lockExample1.getLocked(); @FlowExp("myLock") - // :: error: (assignment) + // :: error: [assignment] Object oM2 = lockExample1.getLocked(); @FlowExp("this.myLock") - // :: error: (assignment) + // :: error: [assignment] Object oM3 = lockExample1.getLocked(); void uses() { lockExample1.locked = o1; - // :: error: (assignment) + // :: error: [assignment] lockExample1.locked = o3; } } diff --git a/framework/tests/lubglb/IntersectionTypes.java b/framework/tests/lubglb/IntersectionTypes.java index d4c3490c25ba..5128bf47d82b 100644 --- a/framework/tests/lubglb/IntersectionTypes.java +++ b/framework/tests/lubglb/IntersectionTypes.java @@ -7,10 +7,10 @@ interface Bar {} class Baz implements Foo, Bar {} public class IntersectionTypes { - // :: warning: (explicit.annotation.ignored) + // :: warning: [explicit.annotation.ignored] void call1(S p) {} - // :: warning: (explicit.annotation.ignored) + // :: warning: [explicit.annotation.ignored] void call2(T p) {} void foo1(@LubglbD Baz baz1) { @@ -25,7 +25,7 @@ void foo2(@LubglbF Baz baz2) { void foo3(@LubglbB Baz baz3) { call1(baz3); - // :: error: (type.arguments.not.inferred) + // :: error: [type.arguments.not.inferred] call2(baz3); } } diff --git a/framework/tests/lubglb/Issue2432Constructor.java b/framework/tests/lubglb/Issue2432Constructor.java index fc13333ba0dc..e69e8a163860 100644 --- a/framework/tests/lubglb/Issue2432Constructor.java +++ b/framework/tests/lubglb/Issue2432Constructor.java @@ -48,13 +48,13 @@ class ReceiverClass { } void invokeConstructors(@LubglbA Object top, @LubglbF Object bottom, @PolyLubglb Object poly) { - // :: error: (assignment) + // :: error: [assignment] @LubglbF Issue2432C bottomOuter = new Issue2432C(top); @LubglbA Issue2432C topOuter = new Issue2432C(top); // lub test @LubglbA Issue2432C bottomOuter2 = new Issue2432C(top, bottom); - // :: error: (assignment) + // :: error: [assignment] @LubglbB Issue2432C bottomOuter3 = new Issue2432C(top, bottom); @LubglbF Issue2432C bottomOuter4 = new Issue2432C(bottom, bottom); @@ -68,12 +68,12 @@ void invokeReceiverConstructors( @LubglbF Object bottom, @LubglbA Object top) { Issue2432C.@LubglbF ReceiverClass ref1 = polyOuter.new ReceiverClass(bottom); - // :: error: (assignment) + // :: error: [assignment] Issue2432C.@LubglbB ReceiverClass ref2 = polyOuter.new ReceiverClass(top); // lub tests Issue2432C.@LubglbA ReceiverClass ref3 = polyOuter.new ReceiverClass(top, bottom); - // :: error: (assignment) + // :: error: [assignment] Issue2432C.@LubglbB ReceiverClass ref4 = polyOuter.new ReceiverClass(top, bottom); Issue2432C.@LubglbF ReceiverClass ref5 = polyOuter.new ReceiverClass(bottom, bottom); @@ -83,12 +83,12 @@ void invokeReceiverConstructors( void invokeTypeVarConstructors( @LubglbA Object top, @LubglbF Object bottom, @PolyLubglb Object poly) { @LubglbF TypeParamClass<@PolyLubglb Object> ref1 = new TypeParamClass<>(bottom, poly); - // :: error: (assignment) + // :: error: [assignment] @LubglbB TypeParamClass<@PolyLubglb Object> ref2 = new TypeParamClass<>(top, poly); // lub tests @LubglbA TypeParamClass<@PolyLubglb Object> ref3 = new TypeParamClass<>(bottom, top, poly); - // :: error: (assignment) + // :: error: [assignment] @LubglbB TypeParamClass<@PolyLubglb Object> ref4 = new TypeParamClass<>(bottom, top, poly); @LubglbF TypeParamClass<@PolyLubglb Object> ref5 = new TypeParamClass<>(bottom, bottom, poly); diff --git a/framework/tests/methodval/MethodNameTest.java b/framework/tests/methodval/MethodNameTest.java index 0c6ae9507d9b..5f467bfb5b03 100644 --- a/framework/tests/methodval/MethodNameTest.java +++ b/framework/tests/methodval/MethodNameTest.java @@ -9,33 +9,33 @@ public class MethodNameTest { @MethodVal(className = "", methodName = "", params = 0) Object o3; - // :: error: (illegal.methodname) + // :: error: [illegal.methodname] @MethodVal(className = "", methodName = "[]MethodName", params = 0) Object o4; - // :: error: (illegal.methodname) + // :: error: [illegal.methodname] @MethodVal(className = "", methodName = "Meht.name", params = 0) Object o5; - // :: error: (illegal.methodname) + // :: error: [illegal.methodname] @MethodVal(className = "", methodName = ".emethos", params = 0) Object o6; @MethodVal( className = "c", methodName = "m", params = {0, 0}) - // :: error: (invalid.methodval) + // :: error: [invalid.methodval] Object o7; @MethodVal( className = "c", methodName = {"m", "m"}, params = {0, 0}) - // :: error: (invalid.methodval) + // :: error: [invalid.methodval] Object o8; @MethodVal( className = "c", methodName = {"m", "m"}, params = {0}) - // :: error: (invalid.methodval) + // :: error: [invalid.methodval] Object o9; } diff --git a/framework/tests/methodval/MethodValInferenceTest.java b/framework/tests/methodval/MethodValInferenceTest.java index 7f12d97fab5a..97c8df387f9d 100644 --- a/framework/tests/methodval/MethodValInferenceTest.java +++ b/framework/tests/methodval/MethodValInferenceTest.java @@ -81,7 +81,7 @@ public void testGetConstructorClassBound() throws Exception { public void testGetConstructorClassBoundFail() throws Exception { @MethodVal(className = "java.lang.Object", methodName = "", params = 0) - // :: error: (assignment) + // :: error: [assignment] Constructor con1 = classBound.getConstructor(new Class[] {}); // Should be @UnknownMethod } diff --git a/framework/tests/methodval/MethodValLUBTest.java b/framework/tests/methodval/MethodValLUBTest.java index 0bd928cc3536..2a516ca9a44f 100644 --- a/framework/tests/methodval/MethodValLUBTest.java +++ b/framework/tests/methodval/MethodValLUBTest.java @@ -20,9 +20,9 @@ void basicLub() { methodName = {"m1", "m2"}, params = {0, 1}) Object lub = unknown; - // :: error: (assignment) + // :: error: [assignment] c1m10 = unknown; - // :: error: (assignment) + // :: error: [assignment] c2m21 = unknown; } @@ -50,9 +50,9 @@ void simalarSigLub() { methodName = {"m1", "m1"}, params = {0, 1}) Object lub = unknown; - // :: error: (assignment) + // :: error: [assignment] c1m10 = unknown; - // :: error: (assignment) + // :: error: [assignment] c1m11 = unknown; } @@ -79,9 +79,9 @@ void setsLub() { methodName = {"method", "method2", "method", "method2"}, params = {0, 1, 0, 1}) Object lub = unknown; - // :: error: (assignment) + // :: error: [assignment] classClass2Method0 = unknown; - // :: error: (assignment) + // :: error: [assignment] class2classMethod0 = unknown; } diff --git a/framework/tests/methodval/MethodValSubtypingTest.java b/framework/tests/methodval/MethodValSubtypingTest.java index 481598031c27..441f0a297e70 100644 --- a/framework/tests/methodval/MethodValSubtypingTest.java +++ b/framework/tests/methodval/MethodValSubtypingTest.java @@ -21,9 +21,9 @@ public class MethodValSubtypingTest { void methodValSubtyping() { classMethod0 = classMethod0Dup; - // :: error: (assignment) + // :: error: [assignment] classMethod0 = classClass2Method0; - // :: error: (assignment) + // :: error: [assignment] classClass2Method0 = class2classMethod0; classClass2Method0 = classMethod0; } @@ -38,7 +38,7 @@ void unknownMethodVal1() { } void unknownMethodVal2() { - // :: error: (assignment) + // :: error: [assignment] class2classMethod0 = unknown; } @@ -62,7 +62,7 @@ void unknownMethodVal2() { void test() { tripleAgain = triple; - // :: error: (assignment) + // :: error: [assignment] one = triple; triple = one; } diff --git a/framework/tests/nontopdefault/NTDTest.java b/framework/tests/nontopdefault/NTDTest.java index 6800d8f77347..4beac29ef801 100644 --- a/framework/tests/nontopdefault/NTDTest.java +++ b/framework/tests/nontopdefault/NTDTest.java @@ -29,9 +29,9 @@ class InnerDefaultReceiver { // takes on the default receiver for inner class constructor methods InnerDefaultReceiver(NTDConstructorReceiverTest NTDConstructorReceiverTest.this) { // The type of NTDConstructorReceiverTest.this should be @NTDTop. - // :: error: (assignment) + // :: error: [assignment] @NTDMiddle NTDConstructorReceiverTest that = NTDConstructorReceiverTest.this; - // :: error: (assignment) + // :: error: [assignment] @NTDMiddle NTDConstructorReceiverTest.@NTDTop InnerDefaultReceiver thatInner = this; } @@ -39,14 +39,14 @@ void method() { // The TypeUseLocation.RECEIVER only applies to the outermost type, so // NTDConstructorReceiverTest.this is given the @NTDMiddle NTDConstructorReceiverTest that = NTDConstructorReceiverTest.this; - // :: error: (assignment) + // :: error: [assignment] @NTDMiddle InnerDefaultReceiver thatInner = this; } void explicit(@NTDTop NTDConstructorReceiverTest.@NTDTop InnerDefaultReceiver this) { - // :: error: (assignment) + // :: error: [assignment] @NTDMiddle NTDConstructorReceiverTest that = NTDConstructorReceiverTest.this; - // :: error: (assignment) + // :: error: [assignment] @NTDMiddle NTDConstructorReceiverTest.@NTDTop InnerDefaultReceiver thatInner = this; } } @@ -54,7 +54,7 @@ void explicit(@NTDTop NTDConstructorReceiverTest.@NTDTop InnerDefaultReceiver th class InnerExplicitReceiver { // explicitly set the receiver to be @NTDTop InnerExplicitReceiver(@NTDTop NTDConstructorReceiverTest NTDConstructorReceiverTest.this) { - // :: error: (assignment) + // :: error: [assignment] @NTDMiddle NTDConstructorReceiverTest that = NTDConstructorReceiverTest.this; } diff --git a/framework/tests/purity-suggestions/PuritySuggestionsClass.java b/framework/tests/purity-suggestions/PuritySuggestionsClass.java index fff0f8b62083..0f9cb11a7f56 100644 --- a/framework/tests/purity-suggestions/PuritySuggestionsClass.java +++ b/framework/tests/purity-suggestions/PuritySuggestionsClass.java @@ -22,7 +22,7 @@ public NonPureClass() { // class with a pure constructor private static class PureClass { - // :: warning: (purity.more.sideeffectfree) + // :: warning: [purity.more.sideeffectfree] public PureClass() {} } @@ -30,13 +30,13 @@ public PureClass() {} private static class PureClass2 { String t; - // :: warning: (purity.more.sideeffectfree) + // :: warning: [purity.more.sideeffectfree] public PureClass2() { t = ""; } } - // :: warning: (purity.more.sideeffectfree) + // :: warning: [purity.more.sideeffectfree] void nonpure() {} @Pure @@ -49,19 +49,19 @@ String t3() { return ""; } - // :: warning: (purity.more.pure) + // :: warning: [purity.more.pure] String t4() { pure(); return ""; } - // :: warning: (purity.more.pure) + // :: warning: [purity.more.pure] int t5() { int i = 1; return i; } - // :: warning: (purity.more.pure) + // :: warning: [purity.more.pure] int t6() { int j = 0; for (int i = 0; i < 10; i++) { @@ -70,7 +70,7 @@ int t6() { return j; } - // :: warning: (purity.more.pure) + // :: warning: [purity.more.pure] String t7() { if (true) { return "a"; @@ -78,12 +78,12 @@ String t7() { return ""; } - // :: warning: (purity.more.pure) + // :: warning: [purity.more.pure] int t8() { return 1 - 2 / 3 * 2 % 2; } - // :: warning: (purity.more.pure) + // :: warning: [purity.more.pure] String t9() { return "b" + "a"; } @@ -109,20 +109,20 @@ String t13() { return ""; } - // :: warning: (purity.more.pure) + // :: warning: [purity.more.pure] String t14() { String i = ""; i = "a"; return i; } - // :: warning: (purity.more.pure) + // :: warning: [purity.more.pure] String t15() { String[] s = new String[1]; return s[0]; } - // :: warning: (purity.more.sideeffectfree) + // :: warning: [purity.more.sideeffectfree] String t16() { try { int i = 1 / 0; @@ -132,7 +132,7 @@ String t16() { return ""; } - // :: warning: (purity.more.sideeffectfree) + // :: warning: [purity.more.sideeffectfree] String t16b() { try { int i = 1 / 0; @@ -142,7 +142,7 @@ String t16b() { return ""; } - // :: warning: (purity.more.sideeffectfree) + // :: warning: [purity.more.sideeffectfree] String t16c() { try { int i = 1 / 0; @@ -152,18 +152,18 @@ String t16c() { return ""; } - // :: warning: (purity.more.pure) + // :: warning: [purity.more.pure] String t17() { return ""; } @Deterministic - // :: warning: (purity.more.sideeffectfree) + // :: warning: [purity.more.sideeffectfree] String t18() { return ""; } - // :: warning: (purity.more.deterministic) + // :: warning: [purity.more.deterministic] String t19() { return t18(); } @@ -175,7 +175,7 @@ String t12() { @SideEffectFree @Deterministic - // :: warning: (purity.effectively.pure) + // :: warning: [purity.effectively.pure] String shouldBeMarkedPure() { return ""; } diff --git a/framework/tests/reflection/AnonymousClassTest.java b/framework/tests/reflection/AnonymousClassTest.java index f2bd60ebb229..570f1ca67461 100644 --- a/framework/tests/reflection/AnonymousClassTest.java +++ b/framework/tests/reflection/AnonymousClassTest.java @@ -30,7 +30,7 @@ public void returnTypePass() { Class c = Class.forName("AnonymousClassTest$1"); Method m = c.getMethod("getSib1", new Class[] {}); // TODO: Can we resolve anonymous classes? - // :: error: (assignment) + // :: error: [assignment] @TestReflectSibling1 Object a = m.invoke(anonymous, (@TestReflectBottom Object[]) null); } catch (Exception ignore) { ignore.printStackTrace(); @@ -45,10 +45,10 @@ public void argumentTypePass() { Class c = Class.forName("AnonymousClassTest$1"); Method m = c.getMethod(str, new Class[] {int.class}); // TODO: Can we resolve anonymous classes? - // :: error: (argument) + // :: error: [argument] m.invoke(anonymous, val1); // TODO: Can we resolve anonymous classes? - // :: error: (argument) + // :: error: [argument] m.invoke(anonymous, val2); } catch (Exception ignore) { ignore.printStackTrace(); @@ -62,9 +62,9 @@ public void argumentTypeFail() { try { Class c = Class.forName("AnonymousClassTest$1"); Method m = c.getMethod(str, new Class[] {int.class}); - // :: error: (argument) + // :: error: [argument] m.invoke(anonymous, val1); - // :: error: (argument) + // :: error: [argument] m.invoke(anonymous, val2); } catch (Exception ignore) { ignore.printStackTrace(); @@ -75,7 +75,7 @@ public void returnTypeFail() { try { Class c = Class.forName("AnonymousClassTest$1"); Method m = c.getMethod("getSib2", new Class[] {}); - // :: error: (assignment) + // :: error: [assignment] @TestReflectSibling1 Object a = m.invoke(anonymous, (@TestReflectBottom Object[]) null); } catch (Exception ignore) { ignore.printStackTrace(); @@ -83,7 +83,7 @@ public void returnTypeFail() { } public @TestReflectBottom MyClass anonymous = - // :: warning: (cast.unsafe.constructor.invocation) + // :: warning: [cast.unsafe.constructor.invocation] new @TestReflectBottom MyClass() { public @TestReflectSibling1 int getSib1() { diff --git a/framework/tests/reflection/MethodTest.java b/framework/tests/reflection/MethodTest.java index 45ec43911537..c87e3ad30330 100644 --- a/framework/tests/reflection/MethodTest.java +++ b/framework/tests/reflection/MethodTest.java @@ -219,7 +219,7 @@ public void testLubReturnFail() { } @TestReflectBottom Object o = - // :: error: (assignment) + // :: error: [assignment] m.invoke(new SuperClass(), new @TestReflectBottom Object @TestReflectBottom [0]); } catch (Exception ignore) { } @@ -233,7 +233,7 @@ public void fail1() { Method m = c.getMethod( "convertTestReflectSibling2ToTestReflectSibling1", new Class[] {Integer.class}); - // :: error: (argument) + // :: error: [argument] Object o = m.invoke(null, sibling1); } catch (Exception ignore) { } @@ -244,7 +244,7 @@ public void fail2(String str) { try { Class c = Class.forName(str); Method m = c.getMethod("getA", new Class[] {Integer.class}); - // :: error: (assignment) + // :: error: [assignment] @TestReflectSibling1 Object o = m.invoke(subClass, (@TestReflectBottom Object[]) null); } catch (Exception ignore) { } @@ -255,7 +255,7 @@ public void fail3() { try { Class c = Class.forName("MethodTest$SuperClass"); Method m = c.getMethod(str, new Class[] {Integer.class}); - // :: error: (argument) + // :: error: [argument] m.invoke(this, sibling1); } catch (Exception ignore) { } @@ -266,7 +266,7 @@ public void fail4() { try { Class c = Class.forName("MethodTest$SubClass"); Method m = c.getMethod(str, new Class[] {Integer.class}); - // :: error: (argument) + // :: error: [argument] m.invoke(this, new Object[] {sibling2}); } catch (Exception ignore) { } @@ -277,7 +277,7 @@ public void fail5() { try { Class c = Class.forName("MethodTest$SubClass"); Method m = c.getMethod(str, new Class[] {Integer.class, Integer.class}); - // :: error: (argument) + // :: error: [argument] m.invoke(this, new Object[] {sibling1, sibling2}); } catch (Exception ignore) { } @@ -291,14 +291,14 @@ public void fail6() { try { Class c = Class.forName("MethodTest$SubClass"); Method m = c.getMethod(str, new Class[] {Integer.class}); - // :: error: (argument) + // :: error: [argument] m.invoke(this, new Object[] {sibling1}); } catch (Exception ignore) { } } public void fail7() { - // :: warning: (cast.unsafe.constructor.invocation) + // :: warning: [cast.unsafe.constructor.invocation] @TestReflectSibling2 MethodTest inst = new @TestReflectSibling2 MethodTest(); try { Class c = MethodTest.class; @@ -315,7 +315,7 @@ public void fail8() { try { Class c = SuperClass.class; Method m = c.getMethod("setC", new Class[] {Integer.class}); - // :: error: (argument) + // :: error: [argument] Object o = m.invoke(new SuperClass(), new Object[] {sibling2}); } catch (Exception ignore) { } @@ -333,7 +333,7 @@ public void bug() { // This error is a bug. // See DefaultReflectionResolver.resolveMethodCall(...) // for details. - // :: error: (argument) + // :: error: [argument] m.invoke(this, args); } catch (Exception ignore) { } @@ -352,7 +352,7 @@ public void bug2() { // This error is a bug. // See DefaultReflectionResolver.resolveMethodCall(...) // for details. - // :: error: (argument) + // :: error: [argument] m.invoke(this, args); } catch (Exception ignore) { } diff --git a/framework/tests/reflection/ReflectionConstructorTest.java b/framework/tests/reflection/ReflectionConstructorTest.java index d53456baa0cf..77ed5be97e16 100644 --- a/framework/tests/reflection/ReflectionConstructorTest.java +++ b/framework/tests/reflection/ReflectionConstructorTest.java @@ -7,12 +7,12 @@ public class ReflectionConstructorTest { @TestReflectSibling1 int sibling1; @TestReflectSibling2 int sibling2; - // :: error: (super.invocation) :: warning: (inconsistent.constructor.type) + // :: error: [super.invocation] :: warning: [inconsistent.constructor.type] public @TestReflectSibling1 ReflectionConstructorTest(@TestReflectSibling1 int a) {} - // :: warning: (inconsistent.constructor.type) + // :: warning: [inconsistent.constructor.type] public @TestReflectSibling2 ReflectionConstructorTest( - // :: error: (super.invocation) + // :: error: [super.invocation] @TestReflectSibling2 int a, @TestReflectSibling2 int b) {} public void pass1() { @@ -40,7 +40,7 @@ public void fail1() { try { Class c = ReflectionConstructorTest.class; Constructor init = c.getConstructor(new Class[] {Integer.class}); - // :: error: (argument) + // :: error: [argument] Object o = init.newInstance(sibling2); } catch (Exception ignore) { } @@ -50,7 +50,7 @@ public void fail2() { try { Class c = ReflectionConstructorTest.class; Constructor init = c.getConstructor(new Class[] {Integer.class}); - // :: error: (argument) :: error: (assignment) + // :: error: [argument] :: error: [assignment] @TestReflectSibling1 Object o = init.newInstance(new Object[] {sibling2}); } catch (Exception ignore) { } @@ -62,7 +62,7 @@ public void fail3() { Constructor init = c.getConstructor(new Class[] {Integer.class, Integer.class}); @TestReflectSibling2 int a = sibling2; @TestReflectSibling1 int b = sibling1; - // :: error: (argument) + // :: error: [argument] @TestReflectSibling2 Object inst = init.newInstance(a, b); } catch (Exception ignore) { } diff --git a/framework/tests/report/Accesses.java b/framework/tests/report/Accesses.java index 11309e8e0efe..12ba9a30ca20 100644 --- a/framework/tests/report/Accesses.java +++ b/framework/tests/report/Accesses.java @@ -12,51 +12,51 @@ Object foo(Object p) { } void implicitRead() { - // :: error: (fieldreadwrite) + // :: error: [fieldreadwrite] Object o = read; // A read counts as access - // :: error: (fieldreadwrite) + // :: error: [fieldreadwrite] read = null; - // :: error: (fieldreadwrite) + // :: error: [fieldreadwrite] read.toString(); } void implicitWrite() { Object o = write; - // :: error: (fieldwrite) + // :: error: [fieldwrite] write = null; write.toString(); } void implicitMethod() { - // :: error: (methodcall) + // :: error: [methodcall] foo(null); - // :: error: (methodcall) + // :: error: [methodcall] equals(foo(null)); } } void accessesRead(Demo d) { - // :: error: (fieldreadwrite) + // :: error: [fieldreadwrite] Object o = d.read; // A read counts as access - // :: error: (fieldreadwrite) + // :: error: [fieldreadwrite] d.read = null; - // :: error: (fieldreadwrite) + // :: error: [fieldreadwrite] d.read.toString(); } void accessesWrite(Demo d) { Object o = d.write; - // :: error: (fieldwrite) + // :: error: [fieldwrite] d.write = null; d.write.toString(); } void accessesMethod(Demo d) { - // :: error: (methodcall) + // :: error: [methodcall] d.foo(null); - // :: error: (methodcall) + // :: error: [methodcall] d.equals(d.foo(null)); } diff --git a/framework/tests/report/CallOverrides.java b/framework/tests/report/CallOverrides.java index ff64f5210d5b..a1736ce9b247 100644 --- a/framework/tests/report/CallOverrides.java +++ b/framework/tests/report/CallOverrides.java @@ -15,12 +15,12 @@ class C extends B {} void test() { C c = new C(); - // :: error: (methodcall) + // :: error: [methodcall] c.m(); B b = c; - // :: error: (methodcall) + // :: error: [methodcall] b.m(); A a = c; diff --git a/framework/tests/report/Creation.java b/framework/tests/report/Creation.java index 5b6f41746adf..bf56407832bb 100644 --- a/framework/tests/report/Creation.java +++ b/framework/tests/report/Creation.java @@ -16,20 +16,20 @@ class TestAll { } void test() { - // :: error: (creation) + // :: error: [creation] new TestAll(); - // :: error: (creation) + // :: error: [creation] new TestAll(4); new TestOne(); - // :: error: (creation) + // :: error: [creation] new TestOne(4); } class TestSub extends TestAll {} void testSub() { - // :: error: (creation) + // :: error: [creation] new TestSub(); } } diff --git a/framework/tests/report/Inherit.java b/framework/tests/report/Inherit.java index 493b79231cc4..4952ca65f148 100644 --- a/framework/tests/report/Inherit.java +++ b/framework/tests/report/Inherit.java @@ -6,9 +6,9 @@ interface A {} class B {} - // :: error: (inherit) + // :: error: [inherit] class C extends B implements A {} - // :: error: (inherit) + // :: error: [inherit] class D extends C {} } diff --git a/framework/tests/report/Interface.java b/framework/tests/report/Interface.java index 1ce0b1e5b1a5..a6f79503bbd5 100644 --- a/framework/tests/report/Interface.java +++ b/framework/tests/report/Interface.java @@ -20,11 +20,11 @@ public void mine() {} interface C extends A {} void foo(A a, B b, C c, Object o) { - // :: error: (methodcall) + // :: error: [methodcall] if (a.equals(o)) {} - // :: error: (methodcall) + // :: error: [methodcall] if (b.equals(o)) {} - // :: error: (methodcall) + // :: error: [methodcall] if (c.equals(o)) {} // Don't report this call. @@ -32,11 +32,11 @@ void foo(A a, B b, C c, Object o) { } void bar(A a, B b, C c, Object o) { - // :: error: (methodcall) + // :: error: [methodcall] a.mine(); - // :: error: (methodcall) + // :: error: [methodcall] b.mine(); - // :: error: (methodcall) + // :: error: [methodcall] c.mine(); } } diff --git a/framework/tests/report/Overrides.java b/framework/tests/report/Overrides.java index 0b9bc870fd78..a95f5db2e156 100644 --- a/framework/tests/report/Overrides.java +++ b/framework/tests/report/Overrides.java @@ -11,7 +11,7 @@ void m() {} } class C extends B { - // :: error: (override) + // :: error: [override] void m() {} } diff --git a/framework/tests/report/Package.java b/framework/tests/report/Package.java index 3fdd14d92e71..6581e2f8eb15 100644 --- a/framework/tests/report/Package.java +++ b/framework/tests/report/Package.java @@ -3,28 +3,28 @@ // File reporttest.astub contains an annotation on // the java.util.regex package. -// :: error: (usage) +// :: error: [usage] public class Package extends PatternSyntaxException { public Package(String desc, String regex, int index) { - // :: error: (usage) + // :: error: [usage] super(desc, regex, index); } @Override @org.checkerframework.dataflow.qual.Pure public String getPattern() { - // :: error: (usage) + // :: error: [usage] return super.getPattern(); } - // :: error: (usage) + // :: error: [usage] void m(Pattern p) { // Access to a constant. - // :: error: (usage) + // :: error: [usage] int i = Pattern.CANON_EQ; // Use of inherited method. - // :: error: (usage) + // :: error: [usage] String msg = getMessage(); // No report for use of overridden method - @@ -34,13 +34,13 @@ void m(Pattern p) { String pat = this.getPattern(); try { - // :: error: (usage) + // :: error: [usage] p.compile("test((("); } catch (Package pe) { // We don't look at supertypes of the types we analyze. // TODO: Should we? System.out.println("OK!"); - // :: error: (usage) + // :: error: [usage] } catch (PatternSyntaxException pse) { // We do get a report for direct uses. System.out.println("Ha!"); diff --git a/framework/tests/report/TestStub.java b/framework/tests/report/TestStub.java index 72493853557f..77ce2f801db4 100644 --- a/framework/tests/report/TestStub.java +++ b/framework/tests/report/TestStub.java @@ -1,7 +1,7 @@ public class TestStub { void demo() { try { - // :: error: (methodcall) + // :: error: [methodcall] Class.forName("Evil"); } catch (Exception e) { } diff --git a/framework/tests/returnsreceiver/GenericReturn.java b/framework/tests/returnsreceiver/GenericReturn.java index df5eb1e39f33..d75b479d142f 100644 --- a/framework/tests/returnsreceiver/GenericReturn.java +++ b/framework/tests/returnsreceiver/GenericReturn.java @@ -11,7 +11,7 @@ abstract static class Builder> { } @This B dontRetThis() { - // :: error: (return) + // :: error: [return] return null; } } @@ -26,7 +26,7 @@ static class Builder1 extends Builder { static class Builder2 extends Builder { @This Builder2 setFoo(String foo) { - // :: error: (return) + // :: error: [return] return null; } } diff --git a/framework/tests/returnsreceiver/MethodRef.java b/framework/tests/returnsreceiver/MethodRef.java index fff972b93723..4b3a05663d63 100644 --- a/framework/tests/returnsreceiver/MethodRef.java +++ b/framework/tests/returnsreceiver/MethodRef.java @@ -10,7 +10,7 @@ interface Setter { @This Object consume(Object p); } - // :: error: (methodref.receiver.bound) + // :: error: [methodref.receiver.bound] Setter co = this::set; void doNothing(@This MethodRef this) {} @@ -21,6 +21,6 @@ interface Fun { // The error here is a false positive, due to // https://github.com/typetools/checker-framework/issues/2931 - // :: error: (methodref.receiver.bound) + // :: error: [methodref.receiver.bound] Fun f = this::doNothing; } diff --git a/framework/tests/returnsreceiver/OverrideTest.java b/framework/tests/returnsreceiver/OverrideTest.java index dff67345aef1..67a65f28fb15 100644 --- a/framework/tests/returnsreceiver/OverrideTest.java +++ b/framework/tests/returnsreceiver/OverrideTest.java @@ -17,7 +17,7 @@ Super retWhatever() { static class Sub extends Super { @Override - // :: error: (override.return) + // :: error: [override.return] Super retThis() { return null; } @@ -25,7 +25,7 @@ Super retThis() { @Override // we do not support this case for now; would need to write explicit @This on receiver in // superclass - // :: error: (override.receiver) + // :: error: [override.receiver] @This Super retWhatever() { return this; } diff --git a/framework/tests/returnsreceiver/SimpleTest.java b/framework/tests/returnsreceiver/SimpleTest.java index 7a6fa945cc9c..fc93fb26f7fb 100644 --- a/framework/tests/returnsreceiver/SimpleTest.java +++ b/framework/tests/returnsreceiver/SimpleTest.java @@ -4,7 +4,7 @@ public class SimpleTest { @This SimpleTest retNull() { - // :: error: (return) + // :: error: [return] return null; } @@ -14,7 +14,7 @@ public class SimpleTest { @This SimpleTest retThisWrapper(@UnknownThis SimpleTest other, boolean flag) { if (flag) { - // :: error: (return) + // :: error: [return] return other.retThis(); } else { return this.retThis(); @@ -28,29 +28,29 @@ public class SimpleTest { @This SimpleTest retNewLocal() { SimpleTest x = new SimpleTest(); - // :: error: (return) + // :: error: [return] return x; } - // :: error: (this.location) + // :: error: [this.location] @This SimpleTest thisOnParam(@This SimpleTest x) { return x; } void thisOnLocal() { - // :: error: (this.location) - // :: error: (assignment) + // :: error: [this.location] + // :: error: [assignment] @This SimpleTest x = new SimpleTest(); - // :: error: (this.location) - // :: error: (type.argument) + // :: error: [this.location] + // :: error: [type.argument] java.util.List<@This String> l = null; } // can write @This on receiver void thisOnReceiver(@This SimpleTest this) {} - // :: error: (this.location) :: error: (invalid.polymorphic.qualifier.use) + // :: error: [this.location] :: error: [invalid.polymorphic.qualifier.use] @This Object f; interface I { @@ -60,9 +60,9 @@ interface I { SimpleTest.@This I setBar(); } - // :: error: (this.location) + // :: error: [this.location] static @This Object thisOnStatic() { - // :: error: (return) + // :: error: [return] return new Object(); } } diff --git a/framework/tests/returnsreceiver/SubtypingTest.java b/framework/tests/returnsreceiver/SubtypingTest.java index 27d5761913e0..2d664cf3f158 100644 --- a/framework/tests/returnsreceiver/SubtypingTest.java +++ b/framework/tests/returnsreceiver/SubtypingTest.java @@ -5,7 +5,7 @@ public class SubtypingTest { void allSubtypingRelationships(@UnknownThis int x, @BottomThis int y) { @UnknownThis int a = x; @UnknownThis int b = y; - // :: error: (assignment) + // :: error: [assignment] @BottomThis int c = x; // expected error on this line @BottomThis int d = y; } diff --git a/framework/tests/stringpatterns/stringpatterns-full/StringPatternsUsage.java b/framework/tests/stringpatterns/stringpatterns-full/StringPatternsUsage.java index 9a9a6cf8b2b9..576d7c1c267b 100644 --- a/framework/tests/stringpatterns/stringpatterns-full/StringPatternsUsage.java +++ b/framework/tests/stringpatterns/stringpatterns-full/StringPatternsUsage.java @@ -25,63 +25,63 @@ void m() { String e = ""; requiresA(a); - // :: error: (argument) + // :: error: [argument] requiresB(a); - // :: error: (argument) + // :: error: [argument] requiresC(a); requiresAB(a); - // :: error: (argument) + // :: error: [argument] requiresBC(a); requiresAC(a); requiresAny(a); - // :: error: (argument) + // :: error: [argument] requiresA(b); requiresB(b); - // :: error: (argument) + // :: error: [argument] requiresC(b); requiresAB(b); requiresBC(b); - // :: error: (argument) + // :: error: [argument] requiresAC(b); requiresAny(b); - // :: error: (argument) + // :: error: [argument] requiresA(c); - // :: error: (argument) + // :: error: [argument] requiresB(c); requiresC(c); - // :: error: (argument) + // :: error: [argument] requiresAB(c); requiresBC(c); requiresAC(c); requiresAny(c); - // :: error: (argument) + // :: error: [argument] requiresA(d); - // :: error: (argument) + // :: error: [argument] requiresB(d); - // :: error: (argument) + // :: error: [argument] requiresC(d); - // :: error: (argument) + // :: error: [argument] requiresAB(d); - // :: error: (argument) + // :: error: [argument] requiresBC(d); - // :: error: (argument) + // :: error: [argument] requiresAC(d); requiresAny(d); - // :: error: (argument) + // :: error: [argument] requiresA(e); - // :: error: (argument) + // :: error: [argument] requiresB(e); - // :: error: (argument) + // :: error: [argument] requiresC(e); - // :: error: (argument) + // :: error: [argument] requiresAB(e); - // :: error: (argument) + // :: error: [argument] requiresBC(e); - // :: error: (argument) + // :: error: [argument] requiresAC(e); requiresAny(e); } diff --git a/framework/tests/subtyping/InvariantArrays.java b/framework/tests/subtyping/InvariantArrays.java index f9a9d67964e5..6e77390b9896 100644 --- a/framework/tests/subtyping/InvariantArrays.java +++ b/framework/tests/subtyping/InvariantArrays.java @@ -10,13 +10,13 @@ public class InvariantArrays { @Encrypted String[] esa; void tests() { - // TODOINVARR:: error: (assignment) + // TODOINVARR:: error: [assignment] oa = eoa; // This error only occurs with the Encrypted type system; // other type systems don't suffer an error here. - // :: error: (assignment) + // :: error: [assignment] eoa = oa; - // TODOINVARR:: error: (assignment) + // TODOINVARR:: error: [assignment] oa = esa; // OK oa = sa; @@ -41,13 +41,13 @@ void genericTests() { leoa = llera; eloa = ellera; - // TODOINVARR:: error: (assignment) + // TODOINVARR:: error: [assignment] loa = eloa; - // TODOINVARR:: error: (assignment) + // TODOINVARR:: error: [assignment] loa = ellra; - // :: error: (assignment) + // :: error: [assignment] eleoa = eloa; - // TODOINVARR:: error: (assignment) + // TODOINVARR:: error: [assignment] leoa = eleoa; } } diff --git a/framework/tests/subtyping/Poly.java b/framework/tests/subtyping/Poly.java index 525927f69ba0..4e14ea313f57 100644 --- a/framework/tests/subtyping/Poly.java +++ b/framework/tests/subtyping/Poly.java @@ -11,15 +11,15 @@ void test() { String t = "foo"; @Encrypted String x1 = id(s); // valid - // :: error: (assignment) + // :: error: [assignment] @Encrypted String x2 = id(t); // error String x3 = id(s); // valid String x4 = id(t); // valid @Encrypted String y01 = combine(s, s); // valid - // :: error: (assignment) + // :: error: [assignment] @Encrypted String y02 = combine(s, t); // error - // :: error: (assignment) + // :: error: [assignment] @Encrypted String y03 = combine(t, t); // error String y11 = combine(s, s); // valid @@ -32,7 +32,7 @@ void test() { } @PolyEncrypted String combine(@PolyEncrypted String s, @PolyEncrypted String t) { - // :: error: (argument) + // :: error: [argument] sendOverNet(s); // error return s; } @@ -62,11 +62,11 @@ void test2() { } void test3() { - // :: error: (assignment) + // :: error: [assignment] @Encrypted String s = substitute(new HashMap()); @Encrypted String t = substitute(new HashMap()); - // :: error: (assignment) + // :: error: [assignment] @Encrypted String q = substituteSuper(new HashMap()); @Encrypted String r = substituteSuper(new HashMap()); } @@ -76,7 +76,7 @@ void test3() { if (s == null) { return encrypt(null); // valid } else { - // :: error: (return) + // :: error: [return] return "m"; // invalid } } diff --git a/framework/tests/subtyping/Simple.java b/framework/tests/subtyping/Simple.java index 47480a4c3dcc..398659bbeee5 100644 --- a/framework/tests/subtyping/Simple.java +++ b/framework/tests/subtyping/Simple.java @@ -7,7 +7,7 @@ abstract class BasicFunctionality { @Encrypted String encrypt(String s) { byte[] b = s.getBytes(); for (int i = 0; i < b.length; b[i++]++) {} - // :: warning: (cast.unsafe) + // :: warning: [cast.unsafe] return (@Encrypted String) new String(b); } diff --git a/framework/tests/subtyping/ThisType.java b/framework/tests/subtyping/ThisType.java index 4904394791f7..51ed2e37510d 100644 --- a/framework/tests/subtyping/ThisType.java +++ b/framework/tests/subtyping/ThisType.java @@ -10,7 +10,7 @@ void t1(@Encrypted ThisType this) { void t2(ThisType this) { ThisType l1 = this; - // :: error: (assignment) + // :: error: [assignment] @Encrypted ThisType l2 = this; } } diff --git a/framework/tests/subtyping/ThrowCatch.java b/framework/tests/subtyping/ThrowCatch.java index 71a0402b5255..64cab5eada15 100644 --- a/framework/tests/subtyping/ThrowCatch.java +++ b/framework/tests/subtyping/ThrowCatch.java @@ -24,7 +24,7 @@ void catches() { try { throwsNoncritical(); - // :: error: (type.incompatible) + // :: error: [type.incompatible] } catch (@Critical Exception e) { } diff --git a/framework/tests/typedecldefault/BoundsAndDefaults.java b/framework/tests/typedecldefault/BoundsAndDefaults.java index 43336537f1b6..57d75a3eabaf 100644 --- a/framework/tests/typedecldefault/BoundsAndDefaults.java +++ b/framework/tests/typedecldefault/BoundsAndDefaults.java @@ -8,11 +8,11 @@ public class BoundsAndDefaults { @TypeDeclDefaultBottom MiddleClass method(@TypeDeclDefaultMiddle MiddleClass middle, MiddleClass noAnno) { noAnno = middle; - // :: error: (return) + // :: error: [return] return noAnno; } - // :: error: (annotations.on.use) + // :: error: [annotations.on.use] void tops(@TypeDeclDefaultTop MiddleClass invalid) { @TypeDeclDefaultTop MiddleClass local = null; } @@ -23,7 +23,7 @@ void tops(@TypeDeclDefaultTop MiddleClass invalid) { } @TypeDeclDefaultBottom MiddleBoundClass method(@TypeDeclDefaultMiddle MiddleBoundClass middle, MiddleBoundClass noAnno) { - // :: error: (assignment) + // :: error: [assignment] noAnno = middle; return noAnno; } diff --git a/framework/tests/value-ignore-range-overflow/RefinementEq.java b/framework/tests/value-ignore-range-overflow/RefinementEq.java index d318a799b6eb..7fd67b603211 100644 --- a/framework/tests/value-ignore-range-overflow/RefinementEq.java +++ b/framework/tests/value-ignore-range-overflow/RefinementEq.java @@ -7,21 +7,21 @@ void test_equal(int a, int j, int s) { if (-1 == a) { @IntRange(from = -1) int b = a; } else { - // :: error: (assignment) + // :: error: [assignment] @IntRange(from = -1) int c = a; } if (0 == j) { @IntRange(from = 0) int k = j; } else { - // :: error: (assignment) + // :: error: [assignment] @IntRange(from = 0) int l = j; } if (1 == s) { @IntRange(from = 1) int t = s; } else { - // :: error: (assignment) + // :: error: [assignment] @IntRange(from = 1) int u = s; } } diff --git a/framework/tests/value-ignore-range-overflow/RefinementGT.java b/framework/tests/value-ignore-range-overflow/RefinementGT.java index 7b76f526cb7d..34cb5c7944aa 100644 --- a/framework/tests/value-ignore-range-overflow/RefinementGT.java +++ b/framework/tests/value-ignore-range-overflow/RefinementGT.java @@ -4,16 +4,16 @@ public class RefinementGT { void test_forward(int a, int j, int s) { /** forwards greater than */ - // :: error: (assignment) + // :: error: [assignment] @IntRange(from = 0) int aa = a; if (a > -1) { /** a is NN now */ @IntRange(from = 0) int b = a; @IntRange(from = -1) int b1 = a; - // :: error: (assignment) + // :: error: [assignment] @IntRange(from = 1) int b2 = a; } else { - // :: error: (assignment) + // :: error: [assignment] @IntRange(from = 0) int c = a; } @@ -21,42 +21,42 @@ void test_forward(int a, int j, int s) { /** j is POS now */ @IntRange(from = 1) int k = j; } else { - // :: error: (assignment) + // :: error: [assignment] @IntRange(from = 1) int l = j; } if (s > 1) { @IntRange(from = 1) int t = s; } else { - // :: error: (assignment) + // :: error: [assignment] @IntRange(from = 1) int u = s; } } void test_backwards(int a, int j, int s) { /** backwards greater than */ - // :: error: (assignment) + // :: error: [assignment] @IntRange(from = 0) int aa = a; if (-1 > a) { - // :: error: (assignment) + // :: error: [assignment] @IntRange(from = -1) int b = a; } else { @IntRange(from = -1) int c = a; - // :: error: (assignment) + // :: error: [assignment] @IntRange(from = 0) int c1 = a; - // :: error: (assignment) + // :: error: [assignment] @IntRange(from = 1) int c2 = a; } if (0 > j) { - // :: error: (assignment) + // :: error: [assignment] @IntRange(from = 0) int k = j; } else { @IntRange(from = 0) int l = j; } if (1 > s) { - // :: error: (assignment) + // :: error: [assignment] @IntRange(from = 1) int t = s; } else { @IntRange(from = 1) int u = s; diff --git a/framework/tests/value-ignore-range-overflow/RefinementGTE.java b/framework/tests/value-ignore-range-overflow/RefinementGTE.java index 792a6ab198b3..c074cfb4b978 100644 --- a/framework/tests/value-ignore-range-overflow/RefinementGTE.java +++ b/framework/tests/value-ignore-range-overflow/RefinementGTE.java @@ -4,39 +4,39 @@ public class RefinementGTE { void test_forward(int a, int j, int s) { /** forwards greater than or equals */ - // :: error: (assignment) + // :: error: [assignment] @IntRange(from = -1) int aa = a; if (a >= -1) { @IntRange(from = -1) int b = a; } else { - // :: error: (assignment) + // :: error: [assignment] @IntRange(from = -1) int c = a; } if (j >= 0) { @IntRange(from = 0) int k = j; - // :: error: (assignment) + // :: error: [assignment] @IntRange(from = 1) int k1 = j; @IntRange(from = -1) int k2 = j; } else { - // :: error: (assignment) + // :: error: [assignment] @IntRange(from = 0) int l = j; } } void test_backwards(int a, int j, int s) { /** backwards greater than or equal */ - // :: error: (assignment) + // :: error: [assignment] @IntRange(from = 0) int aa = a; if (-1 >= a) { - // :: error: (assignment) + // :: error: [assignment] @IntRange(from = 0) int b = a; } else { @IntRange(from = 0) int c = a; } if (0 >= j) { - // :: error: (assignment) + // :: error: [assignment] @IntRange(from = 1) int k = j; } else { @IntRange(from = 1) int l = j; @@ -45,7 +45,7 @@ void test_backwards(int a, int j, int s) { } if (1 >= s) { - // :: error: (assignment) + // :: error: [assignment] @IntRange(from = 1) int t = s; } else { @IntRange(from = 1) int u = s; diff --git a/framework/tests/value-ignore-range-overflow/RefinementLT.java b/framework/tests/value-ignore-range-overflow/RefinementLT.java index ef3f95ec0aec..a65f9b05ab14 100644 --- a/framework/tests/value-ignore-range-overflow/RefinementLT.java +++ b/framework/tests/value-ignore-range-overflow/RefinementLT.java @@ -4,56 +4,56 @@ public class RefinementLT { void test_backwards(int a, int j, int s) { /** backwards less than */ - // :: error: (assignment) + // :: error: [assignment] @IntRange(from = 0) int aa = a; if (-1 < a) { @IntRange(from = 0) int b = a; @IntRange(from = -1) int b1 = a; - // :: error: (assignment) + // :: error: [assignment] @IntRange(from = 1) int b2 = a; } else { - // :: error: (assignment) + // :: error: [assignment] @IntRange(from = 0) int c = a; } if (0 < j) { @IntRange(from = 1) int k = j; } else { - // :: error: (assignment) + // :: error: [assignment] @IntRange(from = 1) int l = j; } if (1 < s) { @IntRange(from = 1) int t = s; } else { - // :: error: (assignment) + // :: error: [assignment] @IntRange(from = 1) int u = s; } } void test_forwards(int a, int j, int s) { /** forwards less than */ - // :: error: (assignment) + // :: error: [assignment] @IntRange(from = 0) int aa = a; if (a < -1) { - // :: error: (assignment) + // :: error: [assignment] @IntRange(from = -1) int b = a; } else { @IntRange(from = -1) int c = a; } if (j < 0) { - // :: error: (assignment) + // :: error: [assignment] @IntRange(from = 0) int k = j; } else { @IntRange(from = 0) int l = j; @IntRange(from = -1) int l1 = j; - // :: error: (assignment) + // :: error: [assignment] @IntRange(from = 1) int l2 = j; } if (s < 1) { - // :: error: (assignment) + // :: error: [assignment] @IntRange(from = 1) int t = s; } else { @IntRange(from = 1) int u = s; diff --git a/framework/tests/value-ignore-range-overflow/RefinementLTE.java b/framework/tests/value-ignore-range-overflow/RefinementLTE.java index e04ac935e04e..6f83b5ab403b 100644 --- a/framework/tests/value-ignore-range-overflow/RefinementLTE.java +++ b/framework/tests/value-ignore-range-overflow/RefinementLTE.java @@ -4,57 +4,57 @@ public class RefinementLTE { void test_backwards(int a, int j, int s) { /** backwards less than or equals */ - // :: error: (assignment) + // :: error: [assignment] @IntRange(from = -1) int aa = a; if (-1 <= a) { @IntRange(from = -1) int b = a; } else { - // :: error: (assignment) + // :: error: [assignment] @IntRange(from = -1) int c = a; } if (0 <= j) { @IntRange(from = 0) int k = j; @IntRange(from = -1) int k1 = j; - // :: error: (assignment) + // :: error: [assignment] @IntRange(from = 1) int k2 = j; } else { - // :: error: (assignment) + // :: error: [assignment] @IntRange(from = 0) int l = j; } if (1 <= s) { @IntRange(from = 1) int t = s; } else { - // :: error: (assignment) + // :: error: [assignment] @IntRange(from = 1) int u = s; } } void test_forwards(int a, int j, int s) { /** forwards less than or equal */ - // :: error: (assignment) + // :: error: [assignment] @IntRange(from = 0) int aa = a; if (a <= -1) { - // :: error: (assignment) + // :: error: [assignment] @IntRange(from = -1) int b0 = a; - // :: error: (assignment) + // :: error: [assignment] @IntRange(from = 0) int b = a; - // :: error: (assignment) + // :: error: [assignment] @IntRange(from = 1) int b2 = a; } else { @IntRange(from = 0) int c = a; } if (j <= 0) { - // :: error: (assignment) + // :: error: [assignment] @IntRange(from = 1) int k = j; } else { @IntRange(from = 1) int l = j; } if (s <= 1) { - // :: error: (assignment) + // :: error: [assignment] @IntRange(from = 1) int t = s; } else { @IntRange(from = 1) int u = s; diff --git a/framework/tests/value-ignore-range-overflow/RefinementNEq.java b/framework/tests/value-ignore-range-overflow/RefinementNEq.java index 5f5db69ed6b0..bbd1ba6136f9 100644 --- a/framework/tests/value-ignore-range-overflow/RefinementNEq.java +++ b/framework/tests/value-ignore-range-overflow/RefinementNEq.java @@ -4,24 +4,24 @@ public class RefinementNEq { void test_not_equal(int a, int j, int s) { - // :: error: (assignment) + // :: error: [assignment] @IntRange(from = 0) int aa = a; if (-1 != a) { - // :: error: (assignment) + // :: error: [assignment] @IntRange(from = -1) int b = a; } else { @IntRange(from = -1) int c = a; } if (0 != j) { - // :: error: (assignment) + // :: error: [assignment] @IntRange(from = 0) int k = j; } else { @IntRange(from = 0) int l = j; } if (1 != s) { - // :: error: (assignment) + // :: error: [assignment] @IntRange(from = 1) int t = s; } else { @IntRange(from = 1) int u = s; diff --git a/framework/tests/value-ignore-range-overflow/TransferAdd.java b/framework/tests/value-ignore-range-overflow/TransferAdd.java index 85b331fc80b1..0641ac053e0c 100644 --- a/framework/tests/value-ignore-range-overflow/TransferAdd.java +++ b/framework/tests/value-ignore-range-overflow/TransferAdd.java @@ -16,7 +16,7 @@ void test() { @IntRange(from = -1) int d = a + 0; @IntRange(from = -1) int e = 0 + a; - // :: error: (assignment) + // :: error: [assignment] @IntRange(from = 1) int f = a + 1; @IntRange(from = 0) int g = b + 0; @@ -29,19 +29,19 @@ void test() { // adding values @IntRange(from = 1) int k = i + j; - // :: error: (assignment) + // :: error: [assignment] @IntRange(from = 1) int l = b + c; - // :: error: (assignment) + // :: error: [assignment] @IntRange(from = 1) int m = d + c; - // :: error: (assignment) + // :: error: [assignment] @IntRange(from = 1) int n = d + e; @IntRange(from = 1) int o = h + g; - // :: error: (assignment) + // :: error: [assignment] @IntRange(from = 1) int p = h + d; @IntRange(from = 0) int q = b + c; - // :: error: (assignment) + // :: error: [assignment] @IntRange(from = 0) int r = q + d; @IntRange(from = 0) int s = k + d; @@ -49,7 +49,7 @@ void test() { // increments - // :: error: (assignment) + // :: error: [assignment] @IntRange(from = 1) int u = b++; @IntRange(from = 1) int u1 = b; @@ -64,19 +64,19 @@ void test() { @IntRange(from = 0) int w1 = n1p1; - // :: error: (assignment) + // :: error: [assignment] @IntRange(from = 1) int w2 = n1p1; - // :: error: (assignment) + // :: error: [assignment] @IntRange(from = 1) int w3 = n1p1++; - // :: error: (assignment) + // :: error: [assignment] @IntRange(from = 0) int x = n1p2++; @IntRange(from = 0) int x1 = n1p2; - // :: error: (assignment) + // :: error: [assignment] @IntRange(from = 1) int y = ++d; - // :: error: (assignment) + // :: error: [assignment] @IntRange(from = 1) int z = e++; } } diff --git a/framework/tests/value-ignore-range-overflow/TransferDivide.java b/framework/tests/value-ignore-range-overflow/TransferDivide.java index 5c70e4245572..49a5998a1460 100644 --- a/framework/tests/value-ignore-range-overflow/TransferDivide.java +++ b/framework/tests/value-ignore-range-overflow/TransferDivide.java @@ -24,28 +24,28 @@ void test() { /** pos / pos -> nn */ @IntRange(from = 0) int l = d / c; @IntRange(from = 0) int m = c / d; - // :: error: (assignment) + // :: error: [assignment] @IntRange(from = 1) int n = c / d; /** nn / pos -> nn */ @IntRange(from = 0) int o = b / c; - // :: error: (assignment) + // :: error: [assignment] @IntRange(from = 1) int p = b / d; /** pos / nn -> nn */ @IntRange(from = 0) int q = d / l; - // :: error: (assignment) + // :: error: [assignment] @IntRange(from = 1) int r = c / l; /** nn / nn -> nn */ @IntRange(from = 0) int s = b / q; - // :: error: (assignment) + // :: error: [assignment] @IntRange(from = 1) int t = b / q; /** n1p / pos -> n1p */ @IntRange(from = -1) int u = a / d; @IntRange(from = -1) int v = a / c; - // :: error: (assignment) + // :: error: [assignment] @IntRange(from = 0) int w = a / c; /** n1p / nn -> n1p */ diff --git a/framework/tests/value-ignore-range-overflow/TransferSub.java b/framework/tests/value-ignore-range-overflow/TransferSub.java index a00637bb59f5..2697aeeeb73d 100644 --- a/framework/tests/value-ignore-range-overflow/TransferSub.java +++ b/framework/tests/value-ignore-range-overflow/TransferSub.java @@ -7,30 +7,30 @@ void test() { int a = 1; @IntRange(from = 0) int b = a - 1; - // :: error: (assignment) + // :: error: [assignment] @IntRange(from = 1) int c = a - 1; @IntRange(from = -1) int d = a - 2; - // :: error: (assignment) + // :: error: [assignment] @IntRange(from = 0) int e = a - 2; @IntRange(from = -1) int f = b - 1; - // :: error: (assignment) + // :: error: [assignment] @IntRange(from = 0) int g = b - 1; - // :: error: (assignment) + // :: error: [assignment] @IntRange(from = -1) int h = f - 1; @IntRange(from = -1) int i = f - 0; @IntRange(from = 0) int j = b - 0; @IntRange(from = 1) int k = a - 0; - // :: error: (assignment) + // :: error: [assignment] @IntRange(from = 1) int l = j - 0; - // :: error: (assignment) + // :: error: [assignment] @IntRange(from = 0) int m = i - 0; - // :: error: (assignment) + // :: error: [assignment] @IntRange(from = 1) int n = a - k; // this would be an error if the values of b and j (both zero) weren't known at compile time @IntRange(from = 0) int o = b - j; @@ -40,29 +40,29 @@ void test() { // decrements - // :: error: (unary.decrement) - // :: error: (assignment) + // :: error: [unary.decrement] + // :: error: [assignment] @IntRange(from = 1) int q = --k; // k = 0 - // :: error: (unary.decrement) + // :: error: [unary.decrement] @IntRange(from = 0) int r = k--; // after this k = -1 int k1 = 0; @IntRange(from = 0) int s = k1--; - // :: error: (assignment) + // :: error: [assignment] @IntRange(from = 0) int s1 = k1; k1 = 1; @IntRange(from = 0) int t = --k1; k1 = 1; - // :: error: (assignment) + // :: error: [assignment] @IntRange(from = 1) int t1 = --k1; int u1 = -1; @IntRange(from = -1) int x = u1--; - // :: error: (assignment) + // :: error: [assignment] @IntRange(from = -1) int x1 = u1; } } diff --git a/framework/tests/value-ignore-range-overflow/TransferTimes.java b/framework/tests/value-ignore-range-overflow/TransferTimes.java index e2121b207fd6..cf691747e565 100644 --- a/framework/tests/value-ignore-range-overflow/TransferTimes.java +++ b/framework/tests/value-ignore-range-overflow/TransferTimes.java @@ -7,14 +7,14 @@ void test() { @IntRange(from = 1) int b = a * 1; @IntRange(from = 1) int c = 1 * a; @IntRange(from = 0) int d = 0 * a; - // :: error: (assignment) + // :: error: [assignment] @IntRange(from = 0) int e = -1 * a; int g = -1; @IntRange(from = 0) int h = g * 0; - // :: error: (assignment) + // :: error: [assignment] @IntRange(from = 1) int i = g * 0; - // :: error: (assignment) + // :: error: [assignment] @IntRange(from = 1) int j = g * a; int k = 0; diff --git a/framework/tests/value-non-null-strings-concatenation/Binaries.java b/framework/tests/value-non-null-strings-concatenation/Binaries.java index d2a124072e5e..4bf1134a89c3 100644 --- a/framework/tests/value-non-null-strings-concatenation/Binaries.java +++ b/framework/tests/value-non-null-strings-concatenation/Binaries.java @@ -51,7 +51,7 @@ public void testIntRange( /* IntRange * UnknownVal */ @IntRange(from = 0) - // :: error: (assignment) + // :: error: [assignment] int d = range1 + top; } @@ -179,7 +179,7 @@ public void and() { if (flag) { a = false; } - // :: error: (assignment) + // :: error: [assignment] @BoolVal({true}) boolean b = a & true; int c = 4; @@ -203,7 +203,7 @@ public void or() { a = false; } // TODO: we could detect this case - // :: error: (assignment) + // :: error: [assignment] @BoolVal({true}) boolean b = a | true; int c = 4; @@ -225,7 +225,7 @@ public void xor() { if (true) { a = false; } - // :: error: (assignment) + // :: error: [assignment] @BoolVal({true}) boolean b = a ^ true; int c = 4; @@ -262,7 +262,7 @@ public void conditionals() { Character bang = '!'; // Reference equalitiy is used - // :: error: (assignment) + // :: error: [assignment] @BoolVal(false) boolean i = (BANG == bang); } @@ -319,7 +319,7 @@ public void chains() { public void compareWithNull() { String s = "1"; // TODO - // :: error: (assignment) + // :: error: [assignment] @BoolVal(true) boolean b = (s != null); } @@ -365,14 +365,14 @@ public void conditionalComparisions() { boolean unknown = flag ? true : false; @BoolVal(true) boolean a9 = true || unknown; @BoolVal(true) boolean a11 = unknown || true; - // :: error: (assignment) + // :: error: [assignment] @BoolVal(false) boolean a12 = unknown || false; - // :: error: (assignment) + // :: error: [assignment] @BoolVal(true) boolean a13 = false || unknown; - // :: error: (assignment) + // :: error: [assignment] @BoolVal(true) boolean a14 = true && unknown; - // :: error: (assignment) + // :: error: [assignment] @BoolVal(true) boolean a15 = unknown && true; @BoolVal(false) boolean a16 = unknown && false; @BoolVal(false) boolean a17 = false && unknown; diff --git a/framework/tests/value-non-null-strings-concatenation/CompoundAssignment.java b/framework/tests/value-non-null-strings-concatenation/CompoundAssignment.java index 367ef16b1bae..92a89639a691 100644 --- a/framework/tests/value-non-null-strings-concatenation/CompoundAssignment.java +++ b/framework/tests/value-non-null-strings-concatenation/CompoundAssignment.java @@ -11,43 +11,43 @@ public class CompoundAssignment { public void refinements() { field = "hello"; - // :: error: (compound.assignment) + // :: error: [compound.assignment] field += method(); - // :: error: (assignment) - // :: error: (compound.assignment) + // :: error: [assignment] + // :: error: [compound.assignment] @StringVal("hellohellohello") String test = field += method(); } @StringVal("hello") String method() { - // :: error: (assignment) + // :: error: [assignment] field = "goodbye"; return "hello"; } void value() { @StringVal("hello") String s = "hello"; - // :: error: (compound.assignment) + // :: error: [compound.assignment] s += "hello"; @IntVal(1) int i = 1; - // :: error: (compound.assignment) + // :: error: [compound.assignment] i += 1; @IntVal(2) int j = 2; - // :: error: (compound.assignment) + // :: error: [compound.assignment] j += 2; - // :: error: (assignment) + // :: error: [assignment] @IntVal(4) int four = j; } void value2() { @StringVal("hello") String s = "hello"; - // :: error: (assignment) + // :: error: [assignment] s = s + "hello"; @IntVal(1) int i = 1; - // :: error: (assignment) + // :: error: [assignment] i = i + 1; } diff --git a/framework/tests/value/Alias.java b/framework/tests/value/Alias.java index 16c7ce21ac7f..98c0e4d07de4 100644 --- a/framework/tests/value/Alias.java +++ b/framework/tests/value/Alias.java @@ -2,9 +2,9 @@ public class Alias { public void androidIntRange() { - // :: error: (assignment) + // :: error: [assignment] @IntRange(from = 0, to = 10) int j = 13; - // :: error: (assignment) + // :: error: [assignment] @IntRange(from = 0) int k = -1; } } diff --git a/framework/tests/value/AnnotationUse.java b/framework/tests/value/AnnotationUse.java index a243a5af2d3e..4d84e22cb17b 100644 --- a/framework/tests/value/AnnotationUse.java +++ b/framework/tests/value/AnnotationUse.java @@ -1,10 +1,10 @@ import org.checkerframework.common.value.qual.IntRange; public class AnnotationUse { - // :: error: (annotation.intrange.on.noninteger) + // :: error: [annotation.intrange.on.noninteger] @IntRange(to = 0) String s1; - // :: error: (annotation.intrange.on.noninteger) + // :: error: [annotation.intrange.on.noninteger] @IntRange(from = 0) String s2; // Allowed on j.l.Object, because of possible boxing diff --git a/framework/tests/value/ArrayInit.java b/framework/tests/value/ArrayInit.java index ed68c3541cf9..000603779f30 100644 --- a/framework/tests/value/ArrayInit.java +++ b/framework/tests/value/ArrayInit.java @@ -52,7 +52,7 @@ public void rangeInit( @IntRange(from = 1, to = 20) int longLength, @BottomVal int bottom) { int @ArrayLen({1, 2}) [] a = new int[shortLength]; - // :: error: (assignment) + // :: error: [assignment] int @ArrayLen({1, 2}) [] b = new int[longLength]; int @ArrayLenRange(from = 1, to = 20) [] d = new int[longLength]; int @ArrayLen({0}) [] c = new int[bottom]; @@ -103,20 +103,20 @@ public void nullableArrays() { public void subtyping1(int @ArrayLen({1, 5}) [] a) { int @ArrayLenRange(from = 1, to = 5) [] b = a; - // :: error: (assignment) + // :: error: [assignment] int @ArrayLenRange(from = 2, to = 5) [] c = a; } public void subtyping2(int @ArrayLenRange(from = 1, to = 5) [] a) { int @ArrayLen({1, 2, 3, 4, 5}) [] b = a; - // :: error: (assignment) + // :: error: [assignment] int @ArrayLen({1, 5}) [] c = a; } public void subtyping3(int @ArrayLenRange(from = 1, to = 17) [] a) { - // :: error: (assignment) + // :: error: [assignment] int @ArrayLenRange(from = 1, to = 12) [] b = a; - // :: error: (assignment) + // :: error: [assignment] int @ArrayLenRange(from = 5, to = 18) [] c = a; int @ArrayLenRange(from = 0, to = 20) [] d = a; } @@ -168,19 +168,19 @@ public void refine(int[] q) { } // The argument is an arraylen with too many values. - // :: warning: (too.many.values.given) + // :: warning: [too.many.values.given] public void coerce(int @ArrayLen({1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 36}) [] a) { int @ArrayLenRange(from = 1, to = 36) [] b = a; if (a.length < 15) { - // :: error: (assignment) + // :: error: [assignment] int @ArrayLen({1, 2, 3, 4, 5, 6, 7, 8, 9, 10}) [] c = a; } } public void warnings() { - // :: warning: (negative.arraylen) + // :: warning: [negative.arraylen] int @ArrayLenRange(from = -1, to = 5) [] a; - // :: error: (from.greater.than.to) + // :: error: [from.greater.than.to] int @ArrayLenRange(from = 10, to = 3) [] b; } } diff --git a/framework/tests/value/ArrayIntro.java b/framework/tests/value/ArrayIntro.java index a243bebef620..bdb61efe660a 100644 --- a/framework/tests/value/ArrayIntro.java +++ b/framework/tests/value/ArrayIntro.java @@ -8,11 +8,11 @@ void test() { a -= 2; int @MinLen(12) [] arr1 = new int[a]; int @MinLen(3) [] arr2 = {1, 2, 3}; - // :: error: (assignment) + // :: error: [assignment] int @MinLen(4) [] arr3 = {4, 5, 6}; - // :: error: (assignment) + // :: error: [assignment] int @MinLen(7) [] arr4 = new int[4]; - // :: error: (assignment) + // :: error: [assignment] int @MinLen(16) [] arr5 = new int[a]; } } diff --git a/framework/tests/value/Basics.java b/framework/tests/value/Basics.java index 1ac47741113f..20c37c206612 100644 --- a/framework/tests/value/Basics.java +++ b/framework/tests/value/Basics.java @@ -11,7 +11,7 @@ public void boolTest() { } @BoolVal({true, false}) boolean b = a; - // :: error: (assignment) + // :: error: [assignment] @BoolVal({false}) boolean c = a; } @@ -22,7 +22,7 @@ public void CharacterTest() { } @IntVal({'a', 'b'}) Character b = a; - // :: error: (assignment) + // :: error: [assignment] @IntVal({'a'}) Character c = a; } @@ -33,7 +33,7 @@ public void charTest() { } @IntVal({'a', 'b'}) char b = a; - // :: error: (assignment) + // :: error: [assignment] @IntVal({'a'}) char c = a; } @@ -44,7 +44,7 @@ public void DoubleTest() { } @DoubleVal({0, 2}) Double b = a; - // :: error: (assignment) + // :: error: [assignment] @DoubleVal({0}) Double c = a; } @@ -55,7 +55,7 @@ public void doubleTest() { } @DoubleVal({0, 2}) double b = a; - // :: error: (assignment) + // :: error: [assignment] @DoubleVal({0}) double c = a; } @@ -66,7 +66,7 @@ public void FloatTest() { } @DoubleVal({0, 2}) Float b = a; - // :: error: (assignment) + // :: error: [assignment] @DoubleVal({0}) Float c = a; } @@ -77,7 +77,7 @@ public void floatTest() { } @DoubleVal({0, 2}) float b = a; - // :: error: (assignment) + // :: error: [assignment] @DoubleVal({'a'}) float c = a; } @@ -90,7 +90,7 @@ public void IntegerTest( if (true) { a = 2; } - // :: error: (assignment) + // :: error: [assignment] @IntVal({0}) Integer test1 = a; @IntVal({0, 2}) Integer test2 = a; @@ -101,7 +101,7 @@ public void IntegerTest( a = y; } @IntRange(from = 15, to = 30) - // :: error: (assignment) + // :: error: [assignment] Integer test4 = a; @IntRange(from = 3, to = 30) Integer test5 = a; @@ -118,7 +118,7 @@ public void IntegerTest( a = y; } @IntRange(from = 1, to = 30) - // :: error: (assignment) + // :: error: [assignment] Integer test8 = a; @IntRange(from = 0, to = 30) Integer test9 = a; } @@ -131,7 +131,7 @@ public void intTest(@IntRange(from = 3, to = 4) int x, @IntRange(from = 20, to = if (true) { a = 2; } - // :: error: (assignment) + // :: error: [assignment] @IntVal({0}) int test1 = a; @IntVal({0, 2}) int test2 = a; @@ -142,7 +142,7 @@ public void intTest(@IntRange(from = 3, to = 4) int x, @IntRange(from = 20, to = a = y; } @IntRange(from = 15, to = 30) - // :: error: (assignment) + // :: error: [assignment] int test4 = a; @IntRange(from = 3, to = 30) int test5 = a; @@ -159,7 +159,7 @@ public void intTest(@IntRange(from = 3, to = 4) int x, @IntRange(from = 20, to = a = y; } @IntRange(from = 1, to = 30) - // :: error: (assignment) + // :: error: [assignment] int test8 = a; @IntRange(from = 0, to = 30) int test9 = a; } @@ -178,19 +178,19 @@ public void IntDoubleTest( if (true) { a = dv1; } - // :: error: (assignment) + // :: error: [assignment] @DoubleVal({4.0, 5.0}) double test1 = a; @DoubleVal({0.0, 1.0, 2.0, 3.0, 4.0, 5.0}) double test2 = a; /* IntRange + DoubleVal */ a = ir; - // :: error: (assignment) + // :: error: [assignment] @DoubleVal({2.0}) double test3 = a; @DoubleVal({2.0, 3.0}) double test4 = a; if (true) { a = dv1; } - // :: error: (assignment) + // :: error: [assignment] test1 = a; test2 = a; @@ -199,7 +199,7 @@ public void IntDoubleTest( if (true) { a = dv1; } - // :: error: (assignment) + // :: error: [assignment] @DoubleVal({4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0}) double test5 = a; @UnknownVal double test6 = a; } @@ -211,7 +211,7 @@ public void stringTest() { } @StringVal({"test1", "test2"}) String b = a; - // :: error: (assignment) + // :: error: [assignment] @StringVal({"test1"}) String c = a; } @@ -222,21 +222,21 @@ public void stringCastTest() { } void tooManyValuesInt() { - // :: warning: (too.many.values.given.int) + // :: warning: [too.many.values.given.int] @IntVal({1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 100}) int a = 20; // This should succeed if a is treated as @IntRange(from=1, to=100) - // :: warning: (too.many.values.given.int) + // :: warning: [too.many.values.given.int] @IntVal({1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12}) - // :: error: (assignment) + // :: error: [assignment] int b = 20; // d is @IntRange(from=1, to=12) @UnknownVal int c = a; // This should always succeed } void fromGreaterThanTo() { - // :: error: (from.greater.than.to) + // :: error: [from.greater.than.to] @IntRange(from = 2, to = 0) - // :: error: (assignment) + // :: error: [assignment] int a = 1; // a should be @BottomVal @IntRange(from = 1) int b = 2; @@ -247,7 +247,7 @@ void fromGreaterThanTo() { } void tooManyValuesDouble() { - // :: warning: (too.many.values.given) + // :: warning: [too.many.values.given] @DoubleVal({1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0}) double a = 8.0; @UnknownVal double b = a; // This should always succeed @@ -256,29 +256,29 @@ void tooManyValuesDouble() { a = c; // This should succeed if a is treated as @UnknownVal - // :: warning: (too.many.values.given) + // :: warning: [too.many.values.given] @DoubleVal({1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0}) double d = 8.0; d = 2.0 * d; // This should succeed since d is @UnknownVal } void tooManyValuesString() { - // :: warning: (too.many.values.given) + // :: warning: [too.many.values.given] @StringVal({"a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l"}) String a = "h"; @UnknownVal String b = a; // This should always succeed @UnknownVal String c = ""; - // :: error: (assignment) + // :: error: [assignment] a = c; // This should not succeed if a is treated as @ArrayLen(1) @ArrayLen(1) String al = a; // a is @ArrayLen(1) - // :: warning: (too.many.values.given) + // :: warning: [too.many.values.given] @StringVal({"a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l"}) String d = "h"; - // :: error: (assignment) + // :: error: [assignment] d = "b" + d; // This should not succeed since d is @ArrayLen(1) @ArrayLen(1) String dl = d; // d is @ArrayLen(1) diff --git a/framework/tests/value/Binaries.java b/framework/tests/value/Binaries.java index 760dbe649b43..dc17a0ccb313 100644 --- a/framework/tests/value/Binaries.java +++ b/framework/tests/value/Binaries.java @@ -51,7 +51,7 @@ public void testIntRange( /* IntRange * UnknownVal */ @IntRange(from = 0) - // :: error: (assignment) + // :: error: [assignment] int d = range1 + top; } @@ -179,7 +179,7 @@ public void and() { if (flag) { a = false; } - // :: error: (assignment) + // :: error: [assignment] @BoolVal({true}) boolean b = a & true; int c = 4; @@ -203,7 +203,7 @@ public void or() { a = false; } // TODO: we could detect this case - // :: error: (assignment) + // :: error: [assignment] @BoolVal({true}) boolean b = a | true; int c = 4; @@ -225,7 +225,7 @@ public void xor() { if (true) { a = false; } - // :: error: (assignment) + // :: error: [assignment] @BoolVal({true}) boolean b = a ^ true; int c = 4; @@ -262,7 +262,7 @@ public void conditionals() { Character bang = '!'; // Reference equalitiy is used - // :: error: (assignment) + // :: error: [assignment] @BoolVal(false) boolean i = (BANG == bang); } @@ -319,7 +319,7 @@ public void chains() { public void compareWithNull() { String s = "1"; // TODO - // :: error: (assignment) + // :: error: [assignment] @BoolVal(true) boolean b = (s != null); } @@ -365,14 +365,14 @@ public void conditionalComparisions() { boolean unknown = flag ? true : false; @BoolVal(true) boolean a9 = true || unknown; @BoolVal(true) boolean a11 = unknown || true; - // :: error: (assignment) + // :: error: [assignment] @BoolVal(false) boolean a12 = unknown || false; - // :: error: (assignment) + // :: error: [assignment] @BoolVal(true) boolean a13 = false || unknown; - // :: error: (assignment) + // :: error: [assignment] @BoolVal(true) boolean a14 = true && unknown; - // :: error: (assignment) + // :: error: [assignment] @BoolVal(true) boolean a15 = unknown && true; @BoolVal(false) boolean a16 = unknown && false; @BoolVal(false) boolean a17 = false && unknown; diff --git a/framework/tests/value/Casts.java b/framework/tests/value/Casts.java index 1bfe48e2a8db..0d3dfb42c842 100644 --- a/framework/tests/value/Casts.java +++ b/framework/tests/value/Casts.java @@ -74,9 +74,9 @@ public void intCastTest1(@IntVal({0, 1}) int input) { @IntVal({0, 1}) int c = (int) input; @IntVal({0, 1}) int ac = (@IntVal({0, 1}) int) input; @IntVal({0, 1, 2}) int sc = (@IntVal({0, 1, 2}) int) input; - // :: warning: (cast.unsafe) + // :: warning: [cast.unsafe] @IntVal({1}) int uc = (@IntVal({1}) int) input; - // :: warning: (cast.unsafe) + // :: warning: [cast.unsafe] @IntVal({2}) int bc = (@IntVal({2}) int) input; } @@ -84,9 +84,9 @@ public void intCastTest2(@IntVal({2, 0}) int input) { @IntVal({0, 2}) int c = (int) input; @IntVal({0, 2}) int ac = (@IntVal({0, 2}) int) input; @IntVal({0, 1, 2}) int sc = (@IntVal({0, 1, 2}) int) input; - // :: warning: (cast.unsafe) + // :: warning: [cast.unsafe] @IntVal({1}) int uc = (@IntVal({1}) int) input; - // :: warning: (cast.unsafe) + // :: warning: [cast.unsafe] @IntVal({2}) int bc = (@IntVal({2}) int) input; } } diff --git a/framework/tests/value/CastsFloatDouble.java b/framework/tests/value/CastsFloatDouble.java index cfacae73e89a..e156f5f29d83 100644 --- a/framework/tests/value/CastsFloatDouble.java +++ b/framework/tests/value/CastsFloatDouble.java @@ -18,7 +18,7 @@ void floatToFloatSuperset(@DoubleVal({1.0}) float f) { } void floatToFloatSubset(@DoubleVal({1.0, 2.0, 3.0}) float f) { - // :: error: (assignment) + // :: error: [assignment] @DoubleVal({1.0}) float f2 = (float) f; } @@ -32,7 +32,7 @@ void floatToFloatUnannotated1(@DoubleVal({1.0}) float f1) { } void floatToFloatUnannotated2(float f1) { - // :: error: (assignment) + // :: error: [assignment] @DoubleVal({1.0}) float f2 = f1; } @@ -48,7 +48,7 @@ void doubleToFloatSuperset(@DoubleVal({1.0}) double d) { } void doubleToFloatSubset(@DoubleVal({1.0, 2.0}) double d) { - // :: error: (assignment) + // :: error: [assignment] @DoubleVal({1.0}) float f = (float) d; } @@ -80,7 +80,7 @@ void floatToDoubleSuperset(@DoubleVal({1.0}) float f) { } void floatToDoubleSubset(@DoubleVal({1.0, 2.0, 3.0}) float f) { - // :: error: (assignment) + // :: error: [assignment] @DoubleVal({1.0}) double d = (double) f; } @@ -96,7 +96,7 @@ void doubleToDoubleSuperset(@DoubleVal({1.0}) double d1) { } void doubleToDoubleSubset(@DoubleVal({1.0, 2.0, 3.0}) double d1) { - // :: error: (assignment) + // :: error: [assignment] @DoubleVal({1.0}) double d = (double) d1; } diff --git a/framework/tests/value/ClassNotFound.java b/framework/tests/value/ClassNotFound.java index 86c3d827806b..8ebb04048905 100644 --- a/framework/tests/value/ClassNotFound.java +++ b/framework/tests/value/ClassNotFound.java @@ -11,7 +11,7 @@ public static int foo(int a) { public void bar() { int a = 0; - // :: warning: (class.find.failed) + // :: warning: [class.find.failed] foo(a); } } diff --git a/framework/tests/value/CompoundAssignment.java b/framework/tests/value/CompoundAssignment.java index a7305c7c9763..e82e4faa2fba 100644 --- a/framework/tests/value/CompoundAssignment.java +++ b/framework/tests/value/CompoundAssignment.java @@ -12,43 +12,43 @@ public class CompoundAssignment { public void refinements() { field = "hello"; - // :: error: (compound.assignment) + // :: error: [compound.assignment] field += method(); - // :: error: (assignment) - // :: error: (compound.assignment) + // :: error: [assignment] + // :: error: [compound.assignment] @StringVal("hellohellohello") String test = field += method(); } @StringVal("hello") String method() { - // :: error: (assignment) + // :: error: [assignment] field = "goodbye"; return "hello"; } void value() { @StringVal("hello") String s = "hello"; - // :: error: (compound.assignment) + // :: error: [compound.assignment] s += "hello"; @IntVal(1) int i = 1; - // :: error: (compound.assignment) + // :: error: [compound.assignment] i += 1; @IntVal(2) int j = 2; - // :: error: (compound.assignment) + // :: error: [compound.assignment] j += 2; - // :: error: (assignment) + // :: error: [assignment] @IntVal(4) int four = j; } void value2() { @StringVal("hello") String s = "hello"; - // :: error: (assignment) + // :: error: [assignment] s = s + "hello"; @IntVal(1) int i = 1; - // :: error: (assignment) + // :: error: [assignment] i = i + 1; } @@ -58,7 +58,7 @@ void afield() { if (afield == 5) { afield += 5; } - // :: error: (compound.assignment) + // :: error: [compound.assignment] afield += 2; } @@ -66,7 +66,7 @@ void aparam(@IntRange(from = 5, to = 10) int aparam) { if (aparam == 5) { aparam += 5; } - // :: error: (compound.assignment) + // :: error: [compound.assignment] aparam += 2; } @@ -81,7 +81,7 @@ void alocal() { if (alocal == 5) { alocal += 5; } - // :: error: (compound.assignment) + // :: error: [compound.assignment] alocal += 2; } @@ -95,7 +95,7 @@ void noErrorCompoundAssignments() { void errorCompundAssignments() { @StringVal("hello") String s = "hello"; - // :: error: (compound.assignment) + // :: error: [compound.assignment] s += ""; } } diff --git a/framework/tests/value/DivideByZero.java b/framework/tests/value/DivideByZero.java index 02c7b0b9c2cf..adfefacf7b3b 100644 --- a/framework/tests/value/DivideByZero.java +++ b/framework/tests/value/DivideByZero.java @@ -11,13 +11,13 @@ void divideNoException(@DoubleVal(1.0) float f, @DoubleVal(1.0) double d, @IntVa @DoubleVal(Double.POSITIVE_INFINITY) double c = i / 0.0; @DoubleVal(Float.POSITIVE_INFINITY) float e = i / 0.0f; - // :: error: (assignment) + // :: error: [assignment] @BottomVal float a2 = f / 0; - // :: error: (assignment) + // :: error: [assignment] @BottomVal double b2 = d / 0L; - // :: error: (assignment) + // :: error: [assignment] @BottomVal double c2 = i / 0.0; - // :: error: (assignment) + // :: error: [assignment] @BottomVal float e2 = i / 0.0f; } @@ -27,13 +27,13 @@ void remainderNoException(@DoubleVal(1.0) float f, @DoubleVal(1.0) double d, @In @DoubleVal(Double.NaN) double c = i % 0.0; @DoubleVal(Float.NaN) float e = i % 0.0f; - // :: error: (assignment) + // :: error: [assignment] @BottomVal float a2 = f % 0; - // :: error: (assignment) + // :: error: [assignment] @BottomVal double b2 = d % 0l; - // :: error: (assignment) + // :: error: [assignment] @BottomVal double c2 = i % 0.0; - // :: error: (assignment) + // :: error: [assignment] @BottomVal float e2 = i % 0.0f; } diff --git a/framework/tests/value/EmptyAnnotationArgument.java b/framework/tests/value/EmptyAnnotationArgument.java index 4cc53bc49a6b..fb6ed482dc22 100644 --- a/framework/tests/value/EmptyAnnotationArgument.java +++ b/framework/tests/value/EmptyAnnotationArgument.java @@ -6,18 +6,18 @@ public class EmptyAnnotationArgument { - // :: warning: (no.values.given) + // :: warning: [no.values.given] void mArray(int @ArrayLen({}) [] a) {} - // :: warning: (no.values.given) + // :: warning: [no.values.given] void mBool(@BoolVal({}) boolean arg) {} - // :: warning: (no.values.given) + // :: warning: [no.values.given] void mDouble(@DoubleVal({}) double arg) {} - // :: warning: (no.values.given) + // :: warning: [no.values.given] void mInt(@IntVal({}) int arg) {} - // :: warning: (no.values.given) + // :: warning: [no.values.given] void mString(@StringVal({}) String arg) {} } diff --git a/framework/tests/value/EnumConstants.java b/framework/tests/value/EnumConstants.java index be73053f88f2..a675a706dc97 100644 --- a/framework/tests/value/EnumConstants.java +++ b/framework/tests/value/EnumConstants.java @@ -19,16 +19,16 @@ enum MyEnum { static void subtyping1(@EnumVal("VALUE") MyEnum value) { @EnumVal("VALUE") MyEnum value2 = value; - // :: error: (assignment) + // :: error: [assignment] @EnumVal("OTHER_VALUE") MyEnum value3 = value; @UnknownVal MyEnum value4 = value; @EnumVal({"VALUE", "OTHER_VALUE"}) MyEnum value5 = value; } static void subtyping2(@EnumVal({"VALUE", "OTHER_VALUE"}) MyEnum value) { - // :: error: (assignment) + // :: error: [assignment] @EnumVal("VALUE") MyEnum value2 = value; - // :: error: (assignment) + // :: error: [assignment] @EnumVal("OTHER_VALUE") MyEnum value3 = value; @UnknownVal MyEnum value4 = value; @EnumVal({"VALUE", "OTHER_VALUE"}) MyEnum value5 = value; @@ -38,7 +38,7 @@ static void subtyping2(@EnumVal({"VALUE", "OTHER_VALUE"}) MyEnum value) { static void enumConstants() { @EnumVal("VALUE") MyEnum v1 = MyEnum.VALUE; @EnumVal({"VALUE", "OTHER_VALUE"}) MyEnum v2 = MyEnum.VALUE; - // :: error: (assignment) + // :: error: [assignment] @EnumVal("OTHER_VALUE") MyEnum v3 = MyEnum.VALUE; } @@ -50,9 +50,9 @@ static void enumToString() { // These are just paranoia based on the implementation strategy for enum constant defaulting. static void nonConstantEnum(MyEnum m) { - // :: error: (assignment) + // :: error: [assignment] @EnumVal("m") MyEnum m2 = m; - // :: error: (assignment) + // :: error: [assignment] @EnumVal("m3") MyEnum m3 = m; } @@ -61,7 +61,7 @@ static void enums(@EnumVal("VALUE") MyEnum... enums) {} static void testEnums() { enums(); enums(MyEnum.VALUE); - // :: error: (argument) + // :: error: [argument] enums(MyEnum.OTHER_VALUE); } diff --git a/framework/tests/value/EnumValue.java b/framework/tests/value/EnumValue.java index 1c6b72de82df..ad25434c0f1e 100644 --- a/framework/tests/value/EnumValue.java +++ b/framework/tests/value/EnumValue.java @@ -26,13 +26,13 @@ void simpleTest() { Color @ArrayLen(3) [] myColors = Color.values(); Fruit @ArrayLen(3) [] myFruitBasket = Fruit.values(); - // :: error: (assignment) + // :: error: [assignment] Direction @ArrayLen(7) [] badCompass = Direction.values(); - // :: error: (assignment) + // :: error: [assignment] Color @ArrayLen(4) [] badColors = Color.values(); - // :: error: (assignment) + // :: error: [assignment] Fruit @ArrayLen(2) [] badFruit = Fruit.values(); } @@ -63,9 +63,9 @@ public AdvDirection getOpposite() { void advTest() { AdvDirection @ArrayLen(4) [] myCompass = AdvDirection.values(); - // :: error: (assignment) + // :: error: [assignment] AdvDirection @ArrayLen(3) [] badCompass = AdvDirection.values(); - // :: error: (assignment) + // :: error: [assignment] AdvDirection @ArrayLen(5) [] badCompass2 = AdvDirection.values(); } } diff --git a/framework/tests/value/ExceptionTest.java b/framework/tests/value/ExceptionTest.java index 6771207a6c21..d32fda2d601b 100644 --- a/framework/tests/value/ExceptionTest.java +++ b/framework/tests/value/ExceptionTest.java @@ -5,7 +5,7 @@ public class ExceptionTest { public void foo() { int indexTooBig = 5; String s = "hello"; - // :: warning: (method.evaluation.exception) + // :: warning: [method.evaluation.exception] char c = s.charAt(indexTooBig); } } diff --git a/framework/tests/value/Fields.java b/framework/tests/value/Fields.java index aeb8f6ee2420..a20516b9ca61 100644 --- a/framework/tests/value/Fields.java +++ b/framework/tests/value/Fields.java @@ -8,13 +8,13 @@ public class Fields { public void innerClassFields() { @IntVal({9}) int x = java.util.zip.Deflater.BEST_COMPRESSION; @IntVal({4}) int a = BorderUIResource.TitledBorderUIResource.ABOVE_BOTTOM; - // :: error: (assignment) + // :: error: [assignment] @IntVal({0}) int b = BorderUIResource.TitledBorderUIResource.ABOVE_BOTTOM; } public void inClassFields() { @IntVal({1}) int a = field; - // :: error: (assignment) + // :: error: [assignment] @IntVal({0}) int b = field; } @@ -23,26 +23,26 @@ public void otherClassFields() { @IntVal({16}) byte y = Character.FORMAT; @BoolVal({false}) boolean a = Boolean.FALSE; - // :: error: (assignment) + // :: error: [assignment] a = Boolean.TRUE; @IntVal({4}) int b = java.util.Calendar.MAY; - // :: error: (assignment) + // :: error: [assignment] b = java.util.Calendar.APRIL; @IntVal({9}) int c = java.util.zip.Deflater.BEST_COMPRESSION; - // :: error: (assignment) + // :: error: [assignment] c = java.util.zip.Deflater.BEST_SPEED; @IntVal({1024}) int d = java.awt.GridBagConstraints.ABOVE_BASELINE; - // :: error: (assignment) + // :: error: [assignment] d = java.awt.GridBagConstraints.LAST_LINE_END; } void innerFieldTest() { @StringVal("section_number") String a = InnerStaticClass.INNER_STATIC_FIELD; - // :: error: (assignment) + // :: error: [assignment] @StringVal("") String b = InnerStaticClass.INNER_STATIC_FIELD; } diff --git a/framework/tests/value/GTETransferBug.java b/framework/tests/value/GTETransferBug.java index fb4e9420f157..ef7d6d54c08e 100644 --- a/framework/tests/value/GTETransferBug.java +++ b/framework/tests/value/GTETransferBug.java @@ -3,7 +3,7 @@ public class GTETransferBug { void gte_bad_check(int[] a) { if (a.length >= 1) { - // :: error: (assignment) + // :: error: [assignment] int @ArrayLenRange(from = 2) [] b = a; int @ArrayLenRange(from = 1) [] c = a; diff --git a/framework/tests/value/Issue1214.java b/framework/tests/value/Issue1214.java index c1fd86fc0a9f..11096f849ad4 100644 --- a/framework/tests/value/Issue1214.java +++ b/framework/tests/value/Issue1214.java @@ -26,11 +26,11 @@ static void arrayAccess(String[] array) { n = 3; } @IntVal({0, 1, 2}) int ok = n; - // :: error: (assignment) + // :: error: [assignment] @IntVal({0, 1}) int ng1 = n; - // :: error: (assignment) + // :: error: [assignment] @IntVal({0, 2}) int ng2 = n; - // :: error: (assignment) + // :: error: [assignment] @IntVal(0) int ng3 = n; } @@ -46,7 +46,7 @@ static void forArray(String[] array) { n = 3; } @IntVal({0, 1}) int ok = n; - // :: error: (assignment) + // :: error: [assignment] @IntVal(0) int ng = n; } @@ -60,11 +60,11 @@ static void forIterable(Iterable itr) { n = 2; } @IntVal({0, 1, 2}) int ok = n; - // :: error: (assignment) + // :: error: [assignment] @IntVal({0, 1}) int ng1 = n; - // :: error: (assignment) + // :: error: [assignment] @IntVal({0, 2}) int ng2 = n; - // :: error: (assignment) + // :: error: [assignment] @IntVal(0) int ng3 = n; } } diff --git a/framework/tests/value/Issue1218.java b/framework/tests/value/Issue1218.java index 989677b78526..5f01d6ff2666 100644 --- a/framework/tests/value/Issue1218.java +++ b/framework/tests/value/Issue1218.java @@ -41,9 +41,9 @@ final > void enums(E @MinLen(2) ... enums) {} final void anys(T @MinLen(3) ... anys) {} void testMethodCall() { - // :: error: (varargs) + // :: error: [varargs] strs(); - // :: error: (varargs) + // :: error: [varargs] strs(""); strs("", ""); // type of arg should be @UnknownVal String @BottomVal [] @@ -53,16 +53,16 @@ void testMethodCall() { String[] args1 = {""}; String[] args2 = {"", ""}; - // :: error: (argument) + // :: error: [argument] strs(args0); - // :: error: (argument) + // :: error: [argument] strs(args1); strs(args2); ints(1, 2); - // :: error: (argument) + // :: error: [argument] ints(0, 0, 0); - // :: error: (varargs) + // :: error: [varargs] ints(3); // type of arg should be @IntVal(1) int @BottomVal [] ints((@IntVal(1) int[]) null); @@ -72,9 +72,9 @@ void testMethodCall() { // works if the type is a specific enum; see the test file Enums.java for an example. @SuppressWarnings("type.argument") void testMethodCallTypeInferred() { - // :: error: (varargs) + // :: error: [varargs] enums(); - // :: error: (varargs) + // :: error: [varargs] enums(MyEnum.A); enums(MyEnum.A, MyEnum.B); enums(MyEnum.A, MyEnum.B, MyEnum.C); @@ -83,20 +83,20 @@ void testMethodCallTypeInferred() { & Serializable> void testMethodCallTypeInferredIntersection() { T t = null; - // :: error: (varargs) + // :: error: [varargs] anys(1, 1.0); - // :: error: (varargs) + // :: error: [varargs] anys(1, ""); anys(1, 1.0, ""); - // :: error: (varargs) + // :: error: [varargs] anys(1, t); anys(1, t, ""); } void testConstructorCall() { - // :: error: (varargs) + // :: error: [varargs] new ForString(); - // :: error: (varargs) + // :: error: [varargs] new ForString(""); new ForString("", ""); // type of arg should be @UnknownVal String @BottomVal [] @@ -106,23 +106,23 @@ void testConstructorCall() { String[] args1 = {""}; String[] args2 = {"", ""}; - // :: error: (argument) + // :: error: [argument] new ForString(args0); - // :: error: (argument) + // :: error: [argument] new ForString(args1); new ForString(args2); new ForInt(1, 2); - // :: error: (argument) + // :: error: [argument] new ForInt(0, 0, 0); - // :: error: (varargs) + // :: error: [varargs] new ForInt(3); // type of arg should be @IntVal(1) int @BottomVal [] ints((@IntVal(1) int[]) null); } void testConstructorCallTypeInferred() { - // :: error: (varargs) + // :: error: [varargs] new ForEnum<>(MyEnum.A); new ForEnum<>(MyEnum.A, MyEnum.B); new ForEnum<>(MyEnum.A, MyEnum.B, MyEnum.C); @@ -132,12 +132,12 @@ void testConstructorCallTypeInferred() { & Serializable> void testConstructorCallTypeInferredIntersection() { T t = null; - // :: error: (varargs) + // :: error: [varargs] new ForAny<>(1, 1.0); - // :: error: (varargs) + // :: error: [varargs] new ForAny<>(1, ""); new ForAny<>(1, 1.0, ""); - // :: error: (varargs) + // :: error: [varargs] new ForAny<>(1, t); new ForAny<>(1, t, ""); } diff --git a/framework/tests/value/Issue867.java b/framework/tests/value/Issue867.java index d9885915b95b..ba4a92657135 100644 --- a/framework/tests/value/Issue867.java +++ b/framework/tests/value/Issue867.java @@ -8,13 +8,13 @@ void test1() { @IntVal({0, 1}) int x1 = 0; @IntVal(0) int zero = x1++; @IntVal(1) int one = x1; - // :: error: (unary.increment) + // :: error: [unary.increment] x1++; x1 = 1; one = x1--; zero = x1; - // :: error: (unary.decrement) + // :: error: [unary.decrement] x1--; } @@ -22,13 +22,13 @@ void test2() { @IntVal({0, 1, 2}) int x2 = 0; @IntVal(1) int one = x2++ + x2++; @IntVal(2) int two = x2; - // :: error: (unary.increment) + // :: error: [unary.increment] x2++; x2 = 2; @IntVal(3) int three = x2-- + x2--; @IntVal(0) int zero = x2; - // :: error: (unary.decrement) + // :: error: [unary.decrement] x2--; } @@ -36,29 +36,29 @@ void test3() { @IntVal({0, 1, 2}) int x3 = 0; @IntVal(2) int two = x3++ + ++x3; two = x3; - // :: error: (unary.increment) + // :: error: [unary.increment] x3++; x3 = 2; two = x3-- + --x3; @IntVal(0) int zero = x3; - // :: error: (unary.decrement) + // :: error: [unary.decrement] x3--; } void test4() { @IntVal({0, 1}) int x4 = 0; m0(x4++); - // :: error: (argument) + // :: error: [argument] m0(x4); - // :: error: (unary.increment) + // :: error: [unary.increment] m1(x4++); x4 = 1; m1(x4--); - // :: error: (argument) + // :: error: [argument] m1(x4); - // :: error: (unary.decrement) + // :: error: [unary.decrement] m0(x4--); } diff --git a/framework/tests/value/Loop.java b/framework/tests/value/Loop.java index 007b93422717..247ebf6a97df 100644 --- a/framework/tests/value/Loop.java +++ b/framework/tests/value/Loop.java @@ -10,9 +10,9 @@ void test1(final double @ArrayLen(20) [] f2) { for (int g = 0; g < f2.length; g++) { x = g; } - // :: error: (assignment) + // :: error: [assignment] double @BottomVal [] test = f2; - // :: error: (assignment) + // :: error: [assignment] @BottomVal int q = f2.length; } @@ -21,7 +21,7 @@ void test2(final @IntVal(20) int param) { for (int g = 0; g < param; g++) { x = g; } - // :: error: (assignment) + // :: error: [assignment] @BottomVal int q = param; } diff --git a/framework/tests/value/Methods.java b/framework/tests/value/Methods.java index aad1ba04fdeb..67a0ff5ada5b 100644 --- a/framework/tests/value/Methods.java +++ b/framework/tests/value/Methods.java @@ -17,7 +17,7 @@ public static void Length() { } @IntVal({'e', 'l', 'o', 'r'}) char g = e.charAt(f); - // :: error: (assignment) + // :: error: [assignment] @IntVal({'l'}) char h = e.charAt(i); @IntVal({'l'}) char j = e.charAt(k); @@ -40,7 +40,7 @@ public static void Byte() { public static void Character() { @IntVal({'c'}) char a = Character.toLowerCase('C'); - // :: error: (assignment) + // :: error: [assignment] @BoolVal({false}) boolean b = Character.isWhitespace('\t'); } @@ -78,7 +78,7 @@ public static void Short() { public static void String() { @StringVal({"herro"}) String a = "hello".replace('l', 'r'); - // :: error: (assignment) + // :: error: [assignment] @StringVal({"hello"}) String b = "hello".replace('l', 'r'); } } diff --git a/framework/tests/value/MinLenEqTransfer.java b/framework/tests/value/MinLenEqTransfer.java index e86b0589fdba..1ffaa8b52e58 100644 --- a/framework/tests/value/MinLenEqTransfer.java +++ b/framework/tests/value/MinLenEqTransfer.java @@ -12,7 +12,7 @@ void eq_check(int[] a) { void eq_bad_check(int[] a) { if (1 == a.length) { - // :: error: (assignment) + // :: error: [assignment] int @MinLen(2) [] b = a; } } @@ -23,7 +23,7 @@ void eq_bad_check(int[] a) { return a; } else if (a.length == 0 || a.length == 1) { int x = a.length; - // :: error: (return) + // :: error: [return] return a; } return new int[] {1, 2}; diff --git a/framework/tests/value/MinLenFieldInvar.java b/framework/tests/value/MinLenFieldInvar.java index 66e8420ed983..ba52074b154d 100644 --- a/framework/tests/value/MinLenFieldInvar.java +++ b/framework/tests/value/MinLenFieldInvar.java @@ -10,7 +10,7 @@ public Super(int @MinLen(2) [] minlen2) { } } - // :: error: (field.invariant.not.subtype) + // :: error: [field.invariant.not.subtype] @MinLenFieldInvariant(field = "minlen2", minLen = 1) class InvalidSub extends Super { public InvalidSub() { @@ -28,7 +28,7 @@ public ValidSub(int[] validSubField) { } } - // :: error: (field.invariant.not.found.superclass) + // :: error: [field.invariant.not.found.superclass] @MinLenFieldInvariant(field = "validSubField", minLen = 3) class InvalidSubSub1 extends ValidSub { public InvalidSubSub1() { @@ -36,7 +36,7 @@ public InvalidSubSub1() { } } - // :: error: (field.invariant.not.subtype.superclass) + // :: error: [field.invariant.not.subtype.superclass] @MinLenFieldInvariant(field = "minlen2", minLen = 3) class InvalidSubSub2 extends ValidSub { public InvalidSubSub2() { diff --git a/framework/tests/value/MinLenGTETransfer.java b/framework/tests/value/MinLenGTETransfer.java index 61fe182dd78a..f257344aa7bd 100644 --- a/framework/tests/value/MinLenGTETransfer.java +++ b/framework/tests/value/MinLenGTETransfer.java @@ -9,7 +9,7 @@ void gte_check(int[] a) { void gte_bad_check(int[] a) { if (a.length >= 1) { - // :: error: (assignment) + // :: error: [assignment] int @MinLen(2) [] b = a; } } diff --git a/framework/tests/value/MinLenGTTransfer.java b/framework/tests/value/MinLenGTTransfer.java index 5fcd74a846cd..84eff27c84bd 100644 --- a/framework/tests/value/MinLenGTTransfer.java +++ b/framework/tests/value/MinLenGTTransfer.java @@ -9,7 +9,7 @@ void gt_check(int[] a) { void gt_bad_check(int[] a) { if (a.length > 0) { - // :: error: (assignment) + // :: error: [assignment] int @MinLen(2) [] b = a; } } diff --git a/framework/tests/value/MinLenLTETransfer.java b/framework/tests/value/MinLenLTETransfer.java index 1e3f1da8a3ca..8c6fbee2cb06 100644 --- a/framework/tests/value/MinLenLTETransfer.java +++ b/framework/tests/value/MinLenLTETransfer.java @@ -9,7 +9,7 @@ void lte_check(int[] a) { void lte_bad_check(int[] a) { if (1 <= a.length) { - // :: error: (assignment) + // :: error: [assignment] int @MinLen(2) [] b = a; } } diff --git a/framework/tests/value/MinLenLTTransfer.java b/framework/tests/value/MinLenLTTransfer.java index 8841e2d2f220..7ade990f5df2 100644 --- a/framework/tests/value/MinLenLTTransfer.java +++ b/framework/tests/value/MinLenLTTransfer.java @@ -9,7 +9,7 @@ void lt_check(int[] a) { void lt_bad_check(int[] a) { if (0 < a.length) { - // :: error: (assignment) + // :: error: [assignment] int @MinLen(2) [] b = a; } } diff --git a/framework/tests/value/MinLenLUB.java b/framework/tests/value/MinLenLUB.java index 1a5fa082b25a..4b1d5aa5bb49 100644 --- a/framework/tests/value/MinLenLUB.java +++ b/framework/tests/value/MinLenLUB.java @@ -9,10 +9,10 @@ public static void MinLen(int @MinLen(10) [] arg, int @MinLen(4) [] arg2) { } else { arr = arg2; } - // :: error: (assignment) + // :: error: [assignment] int @MinLen(10) [] res = arr; int @MinLen(4) [] res2 = arr; - // :: error: (assignment) + // :: error: [assignment] int @BottomVal [] res3 = arr; } @@ -23,10 +23,10 @@ public static void Bottom(int @BottomVal [] arg, int @MinLen(4) [] arg2) { } else { arr = arg2; } - // :: error: (assignment) + // :: error: [assignment] int @MinLen(10) [] res = arr; int @MinLen(4) [] res2 = arr; - // :: error: (assignment) + // :: error: [assignment] int @BottomVal [] res3 = arr; } diff --git a/framework/tests/value/MinLenNEqTransfer.java b/framework/tests/value/MinLenNEqTransfer.java index ccbe8ca64891..7eeda4bacd1a 100644 --- a/framework/tests/value/MinLenNEqTransfer.java +++ b/framework/tests/value/MinLenNEqTransfer.java @@ -13,7 +13,7 @@ void neq_bad_check(int[] a) { if (1 != a.length) { int x = 1; // do nothing. } else { - // :: error: (assignment) + // :: error: [assignment] int @MinLen(2) [] b = a; } } diff --git a/framework/tests/value/MinLenVarargs.java b/framework/tests/value/MinLenVarargs.java index 636edc58ea9e..1cd575fac40c 100644 --- a/framework/tests/value/MinLenVarargs.java +++ b/framework/tests/value/MinLenVarargs.java @@ -8,13 +8,13 @@ static void check(String @MinLen(3) ... var) { } public static void main(String[] args) { - // :: error: (argument) + // :: error: [argument] check(new String[] {"goodbye"}); - // :: error: (argument) + // :: error: [argument] check("goodbye"); - // :: error: (argument) + // :: error: [argument] check(); - // :: error: (argument) + // :: error: [argument] check("hello", "goodbye"); } } diff --git a/framework/tests/value/MyTree.java b/framework/tests/value/MyTree.java index 78e42231bc7c..afdb65362981 100644 --- a/framework/tests/value/MyTree.java +++ b/framework/tests/value/MyTree.java @@ -20,23 +20,23 @@ void uses() { newTree("hello").put("bye"); MyTree<@UnknownVal String> myTree1 = newTree("hello").put("bye"); - // :: error: (assignment) + // :: error: [assignment] MyTree<@StringVal("hello") String> myTree1b = newTree("hello").put("bye"); // Note: This is a false positive: the type of newTree("hello").put("hello") should be // inferred as MyTree<@StringVal("hello") String> and the assignment should therefore pass. - // :: error: (assignment) + // :: error: [assignment] MyTree<@StringVal("hello") String> myTree2 = newTree("hello").put("hello"); MyTree<@StringVal("hello") String> myTree2b = MyTree.<@StringVal("hello") String>newTree("hello").put("hello"); - // :: error: (assignment) + // :: error: [assignment] MyTree<@StringVal("error") String> myTree2c = newTree("hello").put("hello"); MyTree<@UnknownVal String> myTree3 = newTree("hello"); myTree3.put("bye"); MyTree<@StringVal("hello") String> myTree4 = newTree("hello"); - // :: error: (argument) + // :: error: [argument] myTree4.put("bye"); } } diff --git a/framework/tests/value/NegativeArrayLen.java b/framework/tests/value/NegativeArrayLen.java index 3994776f5394..d6211f8f6f36 100644 --- a/framework/tests/value/NegativeArrayLen.java +++ b/framework/tests/value/NegativeArrayLen.java @@ -5,14 +5,14 @@ public class NegativeArrayLen { void test1() { int @BottomVal [] a = new int[-1]; int @BottomVal [] b = new int[Integer.MAX_VALUE + 1]; - // :: warning: (negative.arraylen) + // :: warning: [negative.arraylen] int @ArrayLen(-1) [] c = new int[-1]; } void test2( - // :: warning: (negative.arraylen) + // :: warning: [negative.arraylen] int @ArrayLen(Integer.MIN_VALUE) [] a, - // :: warning: (negative.arraylen) + // :: warning: [negative.arraylen] int @ArrayLen({-1, 2, 0}) [] b) { int @BottomVal [] y = a; int @BottomVal [] x = b; diff --git a/framework/tests/value/Overflows.java b/framework/tests/value/Overflows.java index e8d148f69fbb..6a10ca169b97 100644 --- a/framework/tests/value/Overflows.java +++ b/framework/tests/value/Overflows.java @@ -5,20 +5,20 @@ public class Overflows { static void bytes() { byte max = Byte.MAX_VALUE; @IntVal(-128) byte maxPlus1 = (byte) (max + 1); - // :: error: (assignment) + // :: error: [assignment] @IntVal(-128) short maxPlus1Short = (short) (max + 1); } static void chars() { char max = Character.MAX_VALUE; - // :: warning: (cast.unsafe) + // :: warning: [cast.unsafe] @IntVal(0) char maxPlus1 = (char) (max + 1); } static void shorts() { short max = Short.MAX_VALUE; @IntVal(-32768) short maxPlus1 = (short) (max + 1); - // :: error: (assignment) + // :: error: [assignment] @IntVal(-32768) int maxPlus1Int = (int) (max + 1); } diff --git a/framework/tests/value/Polymorphic.java b/framework/tests/value/Polymorphic.java index bd4ad78cbfc9..fcc928d90355 100644 --- a/framework/tests/value/Polymorphic.java +++ b/framework/tests/value/Polymorphic.java @@ -14,19 +14,19 @@ public class Polymorphic { void minlen_id(int @MinLen(5) [] a) { int @MinLen(5) [] b = identity_array(a); - // :: error: (assignment) + // :: error: [assignment] int @MinLen(6) [] c = identity_array(b); } void use(int @ArrayLenRange(from = 5, to = 25) [] a) { int @ArrayLenRange(from = 5, to = 25) [] b = identity_array(a); - // :: error: (assignment) + // :: error: [assignment] int @ArrayLenRange(from = 1, to = 13) [] c = identity_array(a); } void use2(@IntRange(from = 5, to = 25) int a) { @IntRange(from = 5, to = 25) int b = identity_int(a); - // :: error: (assignment) + // :: error: [assignment] @IntVal(3) int x = identity_int(a); } } diff --git a/framework/tests/value/Polymorphic2.java b/framework/tests/value/Polymorphic2.java index e5aacfd3fbdf..d156bab3ea7f 100644 --- a/framework/tests/value/Polymorphic2.java +++ b/framework/tests/value/Polymorphic2.java @@ -13,23 +13,23 @@ public class Polymorphic2 { void testMinLen(int @MinLen(2) [] a, int @MinLen(5) [] b) { int @MinLen(2) [] z = mergeValue(a, b); - // :: error: (assignment) + // :: error: [assignment] int @MinLen(5) [] zz = mergeValue(a, b); } void testArrayLen(int @ArrayLen(2) [] a, int @ArrayLen(5) [] b) { - // :: error: (assignment) + // :: error: [assignment] int @ArrayLen(2) [] z = mergeValue(a, b); - // :: error: (assignment) + // :: error: [assignment] int @ArrayLen(5) [] zz = mergeValue(a, b); int @ArrayLen({2, 5}) [] zzz = mergeValue(a, b); } void testIntVal(@IntVal(2) int a, @IntVal(5) int b) { - // :: error: (assignment) + // :: error: [assignment] @IntVal(2) int z = mergeValue(a, b); - // :: error: (assignment) + // :: error: [assignment] @IntVal(5) int zz = mergeValue(a, b); @IntVal({2, 5}) int zzz = mergeValue(a, b); diff --git a/framework/tests/value/Refinement.java b/framework/tests/value/Refinement.java index 6a7d170a96cd..3811d4e54f0e 100644 --- a/framework/tests/value/Refinement.java +++ b/framework/tests/value/Refinement.java @@ -6,12 +6,12 @@ void eq_test(@IntVal({1, 2}) int x, @IntVal({1, 5, 6}) int w) { if (x == 1) { @IntVal({1}) int y = x; - // :: error: (assignment) + // :: error: [assignment] @IntVal({2}) int z = x; } else { @IntVal({2}) int y = x; - // :: error: (assignment) + // :: error: [assignment] @IntVal({1}) int z = x; } @@ -22,9 +22,9 @@ void eq_test(@IntVal({1, 2}) int x, @IntVal({1, 5, 6}) int w) { // These two assignments are illegal because one of x or w could be 1, // while the other is not. So no refinement can be applied. - // :: error: (assignment) + // :: error: [assignment] @IntVal({2}) int y = x; - // :: error: (assignment) + // :: error: [assignment] @IntVal({5, 6}) int z = w; } } @@ -33,22 +33,22 @@ void lt_test(@IntVal({1, 2}) int x, @IntVal({1, 5, 6}) int w) { if (x < 2) { @IntVal({1}) int y = x; - // :: error: (assignment) + // :: error: [assignment] @IntVal({2}) int z = x; } else { @IntVal({2}) int y = x; - // :: error: (assignment) + // :: error: [assignment] @IntVal({1}) int z = x; } if (x < w) { - // :: error: (assignment) + // :: error: [assignment] @IntVal({1}) int y = x; @IntVal({5, 6}) int z = w; } else { - // :: error: (assignment) + // :: error: [assignment] @IntVal({2}) int y = x; @IntVal({1}) int z = w; } @@ -58,19 +58,19 @@ void lte_test(@IntVal({1, 2}) int x, @IntVal({1, 5, 6}) int w) { if (x <= 1) { @IntVal({1}) int y = x; - // :: error: (assignment) + // :: error: [assignment] @IntVal({2}) int z = x; } else { @IntVal({2}) int y = x; - // :: error: (assignment) + // :: error: [assignment] @IntVal({1}) int z = x; } if (x <= w) { - // :: error: (assignment) + // :: error: [assignment] @IntVal({1}) int y = x; - // :: error: (assignment) + // :: error: [assignment] @IntVal({5, 6}) int z = w; } else { @IntVal({2}) int y = x; @@ -82,12 +82,12 @@ void neq_test(@IntVal({1, 2}) int x, @IntVal({1, 5, 6}) int w) { if (x != 1) { @IntVal({2}) int y = x; - // :: error: (assignment) + // :: error: [assignment] @IntVal({1}) int z = x; } else { @IntVal({1}) int y = x; - // :: error: (assignment) + // :: error: [assignment] @IntVal({2}) int z = x; } @@ -95,9 +95,9 @@ void neq_test(@IntVal({1, 2}) int x, @IntVal({1, 5, 6}) int w) { // These two assignments are illegal because one of x or w could be 1, // while the other is not. So no refinement can be applied. - // :: error: (assignment) + // :: error: [assignment] @IntVal({2}) int y = x; - // :: error: (assignment) + // :: error: [assignment] @IntVal({5, 6}) int z = w; } else { @IntVal({1}) int y = x; @@ -109,21 +109,21 @@ void gte_test(@IntVal({1, 2}) int x, @IntVal({1, 5, 6}) int w) { if (x >= 2) { @IntVal({2}) int y = x; - // :: error: (assignment) + // :: error: [assignment] @IntVal({1}) int z = x; } else { @IntVal({1}) int y = x; - // :: error: (assignment) + // :: error: [assignment] @IntVal({2}) int z = x; } if (x >= w) { - // :: error: (assignment) + // :: error: [assignment] @IntVal({2}) int y = x; @IntVal({1}) int z = w; } else { - // :: error: (assignment) + // :: error: [assignment] @IntVal({1}) int y = x; @IntVal({5, 6}) int z = w; @@ -134,12 +134,12 @@ void gt_test(@IntVal({1, 2}) int x, @IntVal({1, 5, 6}) int w) { if (x > 1) { @IntVal({2}) int y = x; - // :: error: (assignment) + // :: error: [assignment] @IntVal({1}) int z = x; } else { @IntVal({1}) int y = x; - // :: error: (assignment) + // :: error: [assignment] @IntVal({2}) int z = x; } @@ -147,9 +147,9 @@ void gt_test(@IntVal({1, 2}) int x, @IntVal({1, 5, 6}) int w) { @IntVal({2}) int y = x; @IntVal({1}) int z = w; } else { - // :: error: (assignment) + // :: error: [assignment] @IntVal({1}) int y = x; - // :: error: (assignment) + // :: error: [assignment] @IntVal({5, 6}) int z = w; } } @@ -166,10 +166,10 @@ void test_intrange_eq(@IntRange(from = 3, to = 10) int x, @IntRange(from = 1, to @IntRange(from = 3, to = 5) int b = y; } else { @IntRange(from = 6, to = 10) - // :: error: (assignment) + // :: error: [assignment] int a = x; @IntRange(from = 1, to = 2) - // :: error: (assignment) + // :: error: [assignment] int b = y; } } @@ -202,10 +202,10 @@ void test_intrange_eq3(@IntRange(from = 0, to = 10) int x, @IntVal(0) int y) { void test_intrange_neq(@IntRange(from = 3, to = 10) int x, @IntRange(from = 1, to = 5) int y) { if (x != y) { @IntRange(from = 6, to = 10) - // :: error: (assignment) + // :: error: [assignment] int a = x; @IntRange(from = 1, to = 2) - // :: error: (assignment) + // :: error: [assignment] int b = y; } else { @IntRange(from = 3, to = 5) int a = x; @@ -239,10 +239,10 @@ void test_intrange_gt2(@IntRange(from = 5, to = 10) int x, @IntRange(from = 2, t @IntRange(from = 2, to = 7) int b = y; @IntRange(from = 5, to = 7) - // :: error: (assignment) + // :: error: [assignment] int c = x; @IntRange(from = 5, to = 7) - // :: error: (assignment) + // :: error: [assignment] int d = y; } else { @IntRange(from = 5, to = 7) int a = x; diff --git a/framework/tests/value/Refinement2.java b/framework/tests/value/Refinement2.java index 9c09a98e017e..4644a6913d84 100644 --- a/framework/tests/value/Refinement2.java +++ b/framework/tests/value/Refinement2.java @@ -4,7 +4,7 @@ public class Refinement2 { void eq_test(int x, @IntVal({1, 5, 6}) int w) { if (x == 1) { - // :: error: (assignment) + // :: error: [assignment] @BottomVal int q = x; } else if (x == 2) { @@ -13,7 +13,7 @@ void eq_test(int x, @IntVal({1, 5, 6}) int w) { } if (x != 1) { - // :: error: (assignment) + // :: error: [assignment] @IntVal({1}) int y = x; @IntVal({2}) int z = x; } @@ -22,12 +22,12 @@ void eq_test(int x, @IntVal({1, 5, 6}) int w) { @IntVal({1}) int y = x; - // :: error: (assignment) + // :: error: [assignment] @IntVal({2}) int z = x; } else { @IntVal({2}) int y = x; - // :: error: (assignment) + // :: error: [assignment] @IntVal({1}) int z = x; } @@ -38,9 +38,9 @@ void eq_test(int x, @IntVal({1, 5, 6}) int w) { // These two assignments are illegal because one of x or w could be 1, // while the other is not. So no refinement can be applied. - // :: error: (assignment) + // :: error: [assignment] @IntVal({2}) int y = x; - // :: error: (assignment) + // :: error: [assignment] @IntVal({5, 6}) int z = w; } } @@ -48,7 +48,7 @@ void eq_test(int x, @IntVal({1, 5, 6}) int w) { void testDeadCode(int x) { if (x == 4 || x == 5) { @IntVal({4, 5}) int a = x; - // :: error: (assignment) + // :: error: [assignment] @BottomVal int a2 = x; } if (x == 4 && x == 5) { @@ -85,7 +85,7 @@ void moreTests(@IntVal({1, 2, 3}) Integer x, Integer y) { @BottomVal int z2 = y; } else { // y should be @UnknownVal here. - // :: error: (assignment) + // :: error: [assignment] @IntVal({1, 2, 3}) int z = y; } } diff --git a/framework/tests/value/RegexMatching.java b/framework/tests/value/RegexMatching.java index 5e06227c32b3..92143a27608b 100644 --- a/framework/tests/value/RegexMatching.java +++ b/framework/tests/value/RegexMatching.java @@ -6,40 +6,40 @@ public class RegexMatching { void stringConstants() { @MatchesRegex("a*") String a = "a"; @MatchesRegex("a*") String blank = ""; - // :: error: (assignment) + // :: error: [assignment] @MatchesRegex("a*") String b = "b"; // NOTE: these tests show that there are implicit anchors in the regular expressions // used by @MatchesRegex. - // :: error: (assignment) + // :: error: [assignment] @MatchesRegex("a*") String ab = "ab"; - // :: error: (assignment) + // :: error: [assignment] @MatchesRegex("a*") String baa = "baa"; @MatchesRegex("a") String a1 = "a"; - // :: error: (assignment) + // :: error: [assignment] @MatchesRegex("a") String blank1 = ""; - // :: error: (assignment) + // :: error: [assignment] @MatchesRegex("a") String b1 = "b"; @MatchesRegex("\\s") String space = " "; @MatchesRegex("\\s+") String severalSpaces = " "; - // :: error: (assignment) + // :: error: [assignment] @MatchesRegex("\\s") String b2 = "b"; @MatchesRegex("[^abc]") String d = "d"; @MatchesRegex("[^abc]") String d1 = String.valueOf(new char[] {'d'}); - // :: error: (assignment) + // :: error: [assignment] @MatchesRegex("[^abc]") String c = "c"; } void severalString(@StringVal({"a", "aa"}) String aaa, @StringVal({"aa", "b"}) String aab) { @MatchesRegex("a*") String a = aaa; - // :: error: (assignment) + // :: error: [assignment] @MatchesRegex("a*") String a1 = aab; @MatchesRegex("a+") String a2 = aaa; - // :: error: (assignment) + // :: error: [assignment] @MatchesRegex("a+") String a3 = aab; } @@ -47,34 +47,34 @@ void multipleRegexes(@StringVal({"a", "aa"}) String aaa, @StringVal({"aa", "b"}) @MatchesRegex({"a*", "b*"}) String a = aaa; @MatchesRegex({"a*", "b*"}) String a1 = aab; - // :: error: (assignment) + // :: error: [assignment] @MatchesRegex({"aa", "b*"}) String a2 = aaa; @MatchesRegex({"aa", "b*"}) String a3 = aab; } void regexSubtypingConstant(@MatchesRegex({"a", "b"}) String ab) { - // :: error: (assignment) + // :: error: [assignment] @MatchesRegex("a") String a = ab; @MatchesRegex({"a", "b"}) String ab1 = ab; @MatchesRegex({"a", "b", "c"}) String abc = ab; - // :: error: (assignment) + // :: error: [assignment] @StringVal("a") String a1 = ab; - // :: error: (assignment) + // :: error: [assignment] @StringVal({"a", "b"}) String ab2 = ab; - // :: error: (assignment) + // :: error: [assignment] @StringVal({"a", "b", "c"}) String abc1 = ab; } void regexSubtyping2(@MatchesRegex({"a*", "b*"}) String ab) { - // :: error: (assignment) + // :: error: [assignment] @MatchesRegex("a*") String a = ab; @MatchesRegex({"a*", "b*"}) String ab1 = ab; @MatchesRegex({"a*", "b*", "c*"}) String abc = ab; - // :: error: (assignment) + // :: error: [assignment] @StringVal("a*") String a1 = ab; - // :: error: (assignment) + // :: error: [assignment] @StringVal({"a*", "b*"}) String ab2 = ab; - // :: error: (assignment) + // :: error: [assignment] @StringVal({"a*", "b*", "c*"}) String abc1 = ab; } @@ -87,9 +87,9 @@ void lubRegexes( s = bstar; } @MatchesRegex({"a*", "b*"}) String s1 = s; - // :: error: (assignment) + // :: error: [assignment] @MatchesRegex({"a*"}) String s2 = s; - // :: error: (assignment) + // :: error: [assignment] @MatchesRegex({"b*"}) String s3 = s; } @@ -105,18 +105,18 @@ void lubRegexWithStringVal( // yields an error: // @MatchesRegex({"a*", "b"}) String s0 = s; @MatchesRegex({"a*", "\\Qb\\E"}) String s1 = s; - // :: error: (assignment) + // :: error: [assignment] @MatchesRegex({"a*"}) String s2 = s; - // :: error: (assignment) + // :: error: [assignment] @StringVal({"b"}) String s3 = s; - // :: error: (assignment) + // :: error: [assignment] @MatchesRegex("b") String s4 = s; - // :: error: (assignment) + // :: error: [assignment] @MatchesRegex("^b$") String s5 = s; } void stringToRegex1(@StringVal({"(a)"}) String a) { - // :: error: (assignment) + // :: error: [assignment] @MatchesRegex("(a)") String a2 = a; } @@ -130,7 +130,7 @@ void stringToRegex3(@StringVal({"a"}) String a) { void regexToString(@MatchesRegex("^a$") String a) { // TODO: This is a false positive. In the future, eliminate it. - // :: error: (assignment) + // :: error: [assignment] @StringVal({"a"}) String a2 = a; } } diff --git a/framework/tests/value/RegexNonMatching.java b/framework/tests/value/RegexNonMatching.java index 582fbd6812c9..2c4e40bef44b 100644 --- a/framework/tests/value/RegexNonMatching.java +++ b/framework/tests/value/RegexNonMatching.java @@ -5,9 +5,9 @@ public class RegexNonMatching { void stringConstants() { - // :: error: (assignment) + // :: error: [assignment] @DoesNotMatchRegex("a*") String aStar = "a"; - // :: error: (assignment) + // :: error: [assignment] aStar = ""; aStar = "b"; @DoesNotMatchRegex({"a+"}) String aPlus = "b"; @@ -15,77 +15,77 @@ void stringConstants() { aStar = "ab"; aStar = "baa"; - // :: error: (assignment) + // :: error: [assignment] @DoesNotMatchRegex("a") String a1 = "a"; @DoesNotMatchRegex("a") String blank1 = ""; @DoesNotMatchRegex("a") String b1 = "b"; - // :: error: (assignment) + // :: error: [assignment] @DoesNotMatchRegex("\\s") String space = " "; - // :: error: (assignment) + // :: error: [assignment] @DoesNotMatchRegex("\\s+") String severalSpaces = " "; // TODO: this should work @DoesNotMatchRegex("\\s") String b2 = "b"; - // :: error: (assignment) + // :: error: [assignment] @DoesNotMatchRegex("[^abc]") String d = "d"; - // :: error: (assignment) + // :: error: [assignment] @DoesNotMatchRegex("[^abc]") String d1 = String.valueOf(new char[] {'d'}); // TODO: this should work, shouldn't it? @DoesNotMatchRegex("[^abc]") String c = "c"; } void severalString(@StringVal({"a", "aa"}) String aaa, @StringVal({"aa", "b"}) String aab) { - // :: error: (assignment) + // :: error: [assignment] @DoesNotMatchRegex("a*") String a = aaa; - // :: error: (assignment) + // :: error: [assignment] @DoesNotMatchRegex("a*") String a1 = aab; - // :: error: (assignment) + // :: error: [assignment] @DoesNotMatchRegex("a+") String a2 = aaa; - // :: error: (assignment) + // :: error: [assignment] @DoesNotMatchRegex("a+") String a3 = aab; } void multipleRegexes(@StringVal({"a", "aa"}) String aaa, @StringVal({"aa", "b"}) String aab) { - // :: error: (assignment) + // :: error: [assignment] @DoesNotMatchRegex({"a*", "b*"}) String a = aaa; - // :: error: (assignment) + // :: error: [assignment] @DoesNotMatchRegex({"a*", "b*"}) String a1 = aab; - // :: error: (assignment) + // :: error: [assignment] @DoesNotMatchRegex({"aa", "b*"}) String a2 = aaa; - // :: error: (assignment) + // :: error: [assignment] @DoesNotMatchRegex({"aa", "b*"}) String a3 = aab; } void regexSubtypingConstant(@DoesNotMatchRegex({"a", "b"}) String ab) { @DoesNotMatchRegex("a") String a = ab; - // :: error: (assignment) + // :: error: [assignment] @DoesNotMatchRegex("c") String c = ab; @DoesNotMatchRegex({"a", "b"}) String ab1 = ab; - // :: error: (assignment) + // :: error: [assignment] @DoesNotMatchRegex({"a", "b", "c"}) String abc = ab; - // :: error: (assignment) + // :: error: [assignment] @StringVal("a") String a1 = ab; - // :: error: (assignment) + // :: error: [assignment] @StringVal({"a", "b"}) String ab2 = ab; - // :: error: (assignment) + // :: error: [assignment] @StringVal({"a", "b", "c"}) String abc1 = ab; } void regexSubtyping2(@DoesNotMatchRegex({"a*", "b*"}) String ab) { @DoesNotMatchRegex("a*") String a = ab; @DoesNotMatchRegex({"a*", "b*"}) String ab1 = ab; - // :: error: (assignment) + // :: error: [assignment] @DoesNotMatchRegex({"a*", "b*", "c*"}) String abc = ab; - // :: error: (assignment) + // :: error: [assignment] @StringVal("a*") String a1 = ab; - // :: error: (assignment) + // :: error: [assignment] @StringVal({"a*", "b*"}) String ab2 = ab; - // :: error: (assignment) + // :: error: [assignment] @StringVal({"a*", "b*", "c*"}) String abc1 = ab; - // :: error: (assignment) + // :: error: [assignment] @StringVal({"c*"}) String c = ab; } @@ -97,16 +97,16 @@ void lubRegexes( } else { s = bstar; } - // :: error: (assignment) + // :: error: [assignment] @DoesNotMatchRegex({"a*", "b*"}) String s1 = s; - // :: error: (assignment) + // :: error: [assignment] @DoesNotMatchRegex({"a*"}) String s2 = s; - // :: error: (assignment) + // :: error: [assignment] @DoesNotMatchRegex({"b*"}) String s3 = s; s3 = s1; - // :: error: (assignment) + // :: error: [assignment] @DoesNotMatchRegex({}) String s4 = s; - // :: error: (assignment) + // :: error: [assignment] @DoesNotMatchRegex({".*"}) String s5 = s; @UnknownVal() String s6 = s; } @@ -132,103 +132,103 @@ void lubRegexWithStringVal( @DoesNotMatchRegex({"a", "b", "c"}) String dnmABC; dnmNone = dnmsNone; - // :: error: (assignment) + // :: error: [assignment] dnmA = dnmsNone; - // :: error: (assignment) + // :: error: [assignment] dnmB = dnmsNone; - // :: error: (assignment) + // :: error: [assignment] dnmC = dnmsNone; - // :: error: (assignment) + // :: error: [assignment] dnmAB = dnmsNone; - // :: error: (assignment) + // :: error: [assignment] dnmAC = dnmsNone; - // :: error: (assignment) + // :: error: [assignment] dnmBC = dnmsNone; - // :: error: (assignment) + // :: error: [assignment] dnmABC = dnmsNone; dnmNone = dnmsA; dnmA = dnmsA; - // :: error: (assignment) + // :: error: [assignment] dnmB = dnmsA; - // :: error: (assignment) + // :: error: [assignment] dnmC = dnmsA; - // :: error: (assignment) + // :: error: [assignment] dnmAB = dnmsA; - // :: error: (assignment) + // :: error: [assignment] dnmAC = dnmsA; - // :: error: (assignment) + // :: error: [assignment] dnmBC = dnmsA; - // :: error: (assignment) + // :: error: [assignment] dnmABC = dnmsA; dnmNone = dnmsB; - // :: error: (assignment) + // :: error: [assignment] dnmA = dnmsB; dnmB = dnmsB; - // :: error: (assignment) + // :: error: [assignment] dnmC = dnmsB; - // :: error: (assignment) + // :: error: [assignment] dnmAB = dnmsB; - // :: error: (assignment) + // :: error: [assignment] dnmAC = dnmsB; - // :: error: (assignment) + // :: error: [assignment] dnmBC = dnmsB; - // :: error: (assignment) + // :: error: [assignment] dnmABC = dnmsB; dnmNone = dnmsC; - // :: error: (assignment) + // :: error: [assignment] dnmA = dnmsC; - // :: error: (assignment) + // :: error: [assignment] dnmB = dnmsC; dnmC = dnmsC; - // :: error: (assignment) + // :: error: [assignment] dnmAB = dnmsC; - // :: error: (assignment) + // :: error: [assignment] dnmAC = dnmsC; - // :: error: (assignment) + // :: error: [assignment] dnmBC = dnmsC; - // :: error: (assignment) + // :: error: [assignment] dnmABC = dnmsC; dnmNone = dnmsAC; dnmA = dnmsAC; - // :: error: (assignment) + // :: error: [assignment] dnmB = dnmsAC; dnmC = dnmsAC; - // :: error: (assignment) + // :: error: [assignment] dnmAB = dnmsAC; dnmAC = dnmsAC; - // :: error: (assignment) + // :: error: [assignment] dnmBC = dnmsAC; - // :: error: (assignment) + // :: error: [assignment] dnmABC = dnmsAC; dnmNone = dnmsAB; dnmA = dnmsAB; dnmB = dnmsAB; - // :: error: (assignment) + // :: error: [assignment] dnmC = dnmsAB; dnmAB = dnmsAB; - // :: error: (assignment) + // :: error: [assignment] dnmAC = dnmsAB; - // :: error: (assignment) + // :: error: [assignment] dnmBC = dnmsAB; - // :: error: (assignment) + // :: error: [assignment] dnmABC = dnmsAB; dnmNone = dnmsBC; - // :: error: (assignment) + // :: error: [assignment] dnmA = dnmsBC; dnmB = dnmsBC; dnmC = dnmsBC; - // :: error: (assignment) + // :: error: [assignment] dnmAB = dnmsBC; - // :: error: (assignment) + // :: error: [assignment] dnmAC = dnmsBC; dnmBC = dnmsBC; - // :: error: (assignment) + // :: error: [assignment] dnmABC = dnmsBC; dnmNone = dnmsABC; @@ -243,7 +243,7 @@ void lubRegexWithStringVal( void stringToRegex1(@StringVal({"(a)"}) String a) { @DoesNotMatchRegex("(a)") String a2 = a; - // :: error: (assignment) + // :: error: [assignment] @DoesNotMatchRegex("\\(a\\)") String a3 = a; } } diff --git a/framework/tests/value/RegexPatternSyntaxException.java b/framework/tests/value/RegexPatternSyntaxException.java index 9f279ae07456..4d76bbd26663 100644 --- a/framework/tests/value/RegexPatternSyntaxException.java +++ b/framework/tests/value/RegexPatternSyntaxException.java @@ -3,9 +3,9 @@ import org.checkerframework.common.value.qual.*; public class RegexPatternSyntaxException { - // :: warning: (invalid.matches.regex) + // :: warning: [invalid.matches.regex] void stringConstants1(@MatchesRegex("(a*") String a) {} - // :: warning: (invalid.doesnotmatch.regex) + // :: warning: [invalid.doesnotmatch.regex] void stringConstants2(@DoesNotMatchRegex("(a*") String a) {} } diff --git a/framework/tests/value/RepeatMinLenIfWithError.java b/framework/tests/value/RepeatMinLenIfWithError.java index 0efa56ea97ad..cb26e3d59cdc 100644 --- a/framework/tests/value/RepeatMinLenIfWithError.java +++ b/framework/tests/value/RepeatMinLenIfWithError.java @@ -40,7 +40,7 @@ public boolean withcondpostconditionsfunc1() { a = "checker"; c = "framework"; b = "hello"; // condition not satisfied here - // :: error: (contracts.conditional.postcondition) + // :: error: [contracts.conditional.postcondition] return true; } @@ -53,7 +53,7 @@ public boolean withcondpostconditionfunc1() { a = "checker"; c = "framework"; b = "hello"; // condition not satisfied here - // :: error: (contracts.conditional.postcondition) + // :: error: [contracts.conditional.postcondition] return true; } } diff --git a/framework/tests/value/Repo.java b/framework/tests/value/Repo.java index bf7e490d6090..6086593dda23 100644 --- a/framework/tests/value/Repo.java +++ b/framework/tests/value/Repo.java @@ -7,7 +7,7 @@ public class Repo { void testLoop() { for (int i = 0; i < 20; i++) { - // :: error: (assignment) + // :: error: [assignment] @IntVal(0) int x = i; int j = flag ? i : 3; } diff --git a/framework/tests/value/StartsEndsWith.java b/framework/tests/value/StartsEndsWith.java index 045abf4fbb1a..78ced2c10245 100644 --- a/framework/tests/value/StartsEndsWith.java +++ b/framework/tests/value/StartsEndsWith.java @@ -9,10 +9,10 @@ public class StartsEndsWith { void refineStartsWith(String str) { if (str.startsWith("prefix")) { @MinLen(6) String s6 = str; - // :: error: (assignment) + // :: error: [assignment] @MinLen(7) String s7 = str; } else { - // :: error: (assignment) + // :: error: [assignment] @MinLen(6) String s6 = str; } } @@ -20,10 +20,10 @@ void refineStartsWith(String str) { void refineEndsWith(String str) { if (str.endsWith("suffix")) { @MinLen(6) String s6 = str; - // :: error: (assignment) + // :: error: [assignment] @MinLen(7) String s7 = str; } else { - // :: error: (assignment) + // :: error: [assignment] @MinLen(6) String s6 = str; } } @@ -31,7 +31,7 @@ void refineEndsWith(String str) { void refineStartsEndsWith(String str) { if (str.startsWith("longprefix") && str.endsWith("prefix")) { @MinLen(10) String s10 = str; - // :: error: (assignment) + // :: error: [assignment] @MinLen(11) String s11 = str; } } @@ -39,7 +39,7 @@ void refineStartsEndsWith(String str) { void refineStartsArrayLen(String str, @ArrayLen(10) String prefix) { if (str.startsWith(prefix)) { @MinLen(10) String sg10 = str; - // :: error: (assignment) + // :: error: [assignment] @ArrayLen(10) String s10 = str; } } diff --git a/framework/tests/value/StaticallyExecutableWarnings.java b/framework/tests/value/StaticallyExecutableWarnings.java index cdf662be4ac4..af7fe372fadc 100644 --- a/framework/tests/value/StaticallyExecutableWarnings.java +++ b/framework/tests/value/StaticallyExecutableWarnings.java @@ -4,7 +4,7 @@ public class StaticallyExecutableWarnings { @StaticallyExecutable - // :: warning: (statically.executable.not.pure) + // :: warning: [statically.executable.not.pure] static int addNotPure(int a, int b) { return a + b; } @@ -17,28 +17,28 @@ static int add(Integer a, Integer b) { @StaticallyExecutable @Pure - // :: error: (statically.executable.nonconstant.parameter.type) + // :: error: [statically.executable.nonconstant.parameter.type] int receiverCannotBeConstant(int a, int b) { return a + b; } @StaticallyExecutable @Pure - // :: error: (statically.executable.nonconstant.parameter.type) + // :: error: [statically.executable.nonconstant.parameter.type] int explicitReceiverCannotBeConstant(StaticallyExecutableWarnings this, int a, int b) { return a + b; } @StaticallyExecutable @Pure - // :: error: (statically.executable.nonconstant.return.type) + // :: error: [statically.executable.nonconstant.return.type] static StaticallyExecutableWarnings returnTypeCannotBeConstant(int a, int b) { return new StaticallyExecutableWarnings(); } @StaticallyExecutable @Pure - // :: error: (statically.executable.nonconstant.parameter.type) + // :: error: [statically.executable.nonconstant.parameter.type] static int parameterCannotBeConstant(int a, int b, Object o) { return a + b; } diff --git a/framework/tests/value/StringConcats.java b/framework/tests/value/StringConcats.java index b922ae440582..c97b60a9ef15 100644 --- a/framework/tests/value/StringConcats.java +++ b/framework/tests/value/StringConcats.java @@ -8,7 +8,7 @@ void stringConcat() { @StringVal("true") String bool = "" + true; @StringVal("null") String nullV = "" + null; - // :: error: (assignment) + // :: error: [assignment] @BottomVal String bottom = "" + null; @StringVal("1") String intL = "" + 1; @StringVal("$") String charL = "" + '$'; @@ -34,7 +34,7 @@ void compoundStringAssignement() { s += 0b11010; // TODO: this should pass // compound assignments have not been implemented. - // :: error: (assignment) + // :: error: [assignment] @StringVal("helloa11.01.020truenull2626") String all = s; } diff --git a/framework/tests/value/StringLen.java b/framework/tests/value/StringLen.java index 1e473624d910..b410c4fa0d44 100644 --- a/framework/tests/value/StringLen.java +++ b/framework/tests/value/StringLen.java @@ -22,9 +22,9 @@ void stringValArrayLen( @ArrayLenRange(from = 5, to = 5) String rng5 = constant; @ArrayLenRange(from = 1, to = 12) String rng1_12 = values; - // :: error: (assignment) + // :: error: [assignment] @ArrayLen(4) String len4 = constant; - // :: error: (assignment) + // :: error: [assignment] @ArrayLenRange(from = 1, to = 11) String rng1_10 = values; } @@ -53,9 +53,9 @@ void arrayLenStringVal( @StringVal("") String emptyLen = len0; @StringVal("") String emptyRng = rng0; - // :: error: (assignment) + // :: error: [assignment] @StringVal("") String emptyError = nonEmpty; - // :: error: (assignment) + // :: error: [assignment] @StringVal("a") String nonEmptyError = nonEmpty; } @@ -69,7 +69,7 @@ void stringValLength( @IntVal(5) int len5 = constant.length(); @IntVal({1, 12}) int len1_12 = values.length(); - // :: error: (assignment) + // :: error: [assignment] @IntVal({1, 11}) int len1_11 = values.length(); } @@ -83,7 +83,7 @@ void arrayLenLength( @IntVal(5) int len5 = constant.length(); @IntVal({1, 12}) int len1_12 = values.length(); - // :: error: (assignment) + // :: error: [assignment] @IntVal({1, 11}) int len1_11 = values.length(); } @@ -97,7 +97,7 @@ void arrayLenRangeLength( @IntRange(from = 5, to = 5) int len5 = constant.length(); @IntRange(from = 1, to = 12) int len1_12 = values.length(); - // :: error: (assignment) + // :: error: [assignment] @IntRange(from = 1, to = 11) int len1_11 = values.length(); } diff --git a/framework/tests/value/StringValNull.java b/framework/tests/value/StringValNull.java index fdf0b4535e28..c81810879a32 100644 --- a/framework/tests/value/StringValNull.java +++ b/framework/tests/value/StringValNull.java @@ -27,7 +27,7 @@ public static void main(String[] args) { } static @StringVal("arg=itsValue") String toString1(@Nullable @StringVal("itsValue") String arg) { - // :: error: (return) + // :: error: [return] return "arg=" + arg; } @@ -41,7 +41,7 @@ public static void main(String[] args) { } */ static @StringVal("arg=22") String toString4(@Nullable @IntVal(22) Integer arg) { - // :: error: (return) + // :: error: [return] return "arg=" + arg; } @@ -58,9 +58,9 @@ public static void main(String[] args) { @StringVal("hello") String s2 = null; void method2(StringValNull obj) { - // :: error: (assignment) + // :: error: [assignment] @StringVal("hello") String l1 = "" + obj.s; - // :: error: (assignment) + // :: error: [assignment] @StringVal("hello") String l2 = "" + obj.s2; } } diff --git a/framework/tests/value/StringValNullConcatLength.java b/framework/tests/value/StringValNullConcatLength.java index 8c6aad992844..ed67007a9278 100644 --- a/framework/tests/value/StringValNullConcatLength.java +++ b/framework/tests/value/StringValNullConcatLength.java @@ -22,6 +22,6 @@ public class StringValNullConcatLength { @ArrayLenRange(from = 2, to = 8) String string10 = string1 + string5; // Omitting that string2 can be null - // :: error: (assignment) + // :: error: [assignment] @ArrayLen({3, 4}) String string9 = string2 + string4; } diff --git a/framework/tests/value/Switch.java b/framework/tests/value/Switch.java index e5e0f74fe112..e2ed1405d6ab 100644 --- a/framework/tests/value/Switch.java +++ b/framework/tests/value/Switch.java @@ -13,7 +13,7 @@ void test1(@IntVal({1, 2, 3, 4, 5}) int x) { break; case 2: @IntVal({2}) int w = x; - // :: error: (assignment) + // :: error: [assignment] @IntVal({1}) int z = x; break; default: @@ -31,15 +31,15 @@ void test2(@IntVal({1, 2, 3, 4, 5}) int x) { case 2: case 3: @IntVal({1, 2, 3}) int w = x; - // :: error: (assignment) + // :: error: [assignment] @IntVal({2, 3}) int z = x; - // :: error: (assignment) + // :: error: [assignment] @IntVal({3}) int z1 = x; break; default: @IntVal({4, 5}) int q = x; - // :: error: (assignment) + // :: error: [assignment] @IntVal(5) int q2 = x; break; } @@ -54,16 +54,16 @@ void test3(@IntVal({1, 2, 3, 4, 5}) int x) { case 2: case 3: @IntVal({1, 2, 3}) int w = x; - // :: error: (assignment) + // :: error: [assignment] @IntVal({2, 3}) int z = x; - // :: error: (assignment) + // :: error: [assignment] @IntVal({3}) int z1 = x; break; case 4: default: @IntVal({4, 5}) int q = x; - // :: error: (assignment) + // :: error: [assignment] @IntVal(5) int q2 = x; break; } @@ -83,7 +83,7 @@ void test4(int x) { return; } @IntVal({1, 2, 3}) int y = x; - // :: error: (assignment) + // :: error: [assignment] @IntVal(4) int y2 = x; } @@ -92,16 +92,16 @@ void test5(@IntVal({0, 1, 2, 3, 4}) int x) { switch (y = y + 1) { case 1: @IntVal({1}) int a = y; - // :: error: (assignment) + // :: error: [assignment] @IntVal({2}) int b = y; case 2: case 3: @IntVal({1, 2, 3}) int c = y; break; default: - // :: error: (assignment) + // :: error: [assignment] @IntVal({4}) int d = y; - // :: error: (assignment) + // :: error: [assignment] @IntVal({5}) int e = y; @IntVal({4, 5}) int f = y; break; diff --git a/framework/tests/value/TypeCast.java b/framework/tests/value/TypeCast.java index e6ca7b9f328e..0d7fbf6781bb 100644 --- a/framework/tests/value/TypeCast.java +++ b/framework/tests/value/TypeCast.java @@ -13,17 +13,17 @@ public void charIntDoubleTest() { @IntVal({'b'}) char h = (char) a; h = (char) b; - // :: warning: (cast.unsafe) + // :: warning: [cast.unsafe] h = (char) c; - // :: warning: (cast.unsafe) + // :: warning: [cast.unsafe] h = (char) d; h = (char) f; h = (char) g; @IntVal({98}) int i = (int) b; - // :: warning: (cast.unsafe) + // :: warning: [cast.unsafe] i = (int) c; - // :: warning: (cast.unsafe) + // :: warning: [cast.unsafe] i = (int) d; i = (int) e; i = (int) f; @@ -45,12 +45,12 @@ void otherCast() { void rangeCast(@IntRange(from = 127, to = 128) int a, @IntRange(from = 128, to = 129) int b) { @IntRange(from = 0, to = 128) - // :: error: (assignment) :: warning: (cast.unsafe) + // :: error: [assignment] :: warning: [cast.unsafe] byte c = (byte) a; // (byte) a is @IntRange(from = -128, to = 127) because of casting @IntRange(from = -128, to = -127) - // :: warning: (cast.unsafe) + // :: warning: [cast.unsafe] byte d = (byte) b; } } diff --git a/framework/tests/value/UncheckedMinLen.java b/framework/tests/value/UncheckedMinLen.java index db5fea2e3da1..ffe891bef802 100644 --- a/framework/tests/value/UncheckedMinLen.java +++ b/framework/tests/value/UncheckedMinLen.java @@ -5,13 +5,13 @@ public class UncheckedMinLen { void addToUnboundedIntRange(@IntRange(from = 0) int l, Object v) { - // :: error: (assignment) + // :: error: [assignment] Object @MinLen(100) [] o = new Object[l + 1]; o[99] = v; } void addToBoundedIntRangeOK(@IntRange(from = 0, to = 1) int l, Object v) { - // :: error: (assignment) + // :: error: [assignment] Object @MinLen(100) [] o = new Object[l + 1]; o[99] = v; } diff --git a/framework/tests/value/Underflows.java b/framework/tests/value/Underflows.java index c3a46370b899..4584d161bfcb 100644 --- a/framework/tests/value/Underflows.java +++ b/framework/tests/value/Underflows.java @@ -4,20 +4,20 @@ public class Underflows { static void bytes() { byte min = Byte.MIN_VALUE; @IntVal(127) byte maxPlus1 = (byte) (min - 1); - // :: error: (assignment) + // :: error: [assignment] @IntVal(127) short maxPlus1Short = (short) (min - 1); } static void chars() { char min = Character.MIN_VALUE; - // :: warning: (cast.unsafe) + // :: warning: [cast.unsafe] @IntVal(65535) char maxPlus1 = (char) (min - 1); } static void shorts() { short min = Short.MIN_VALUE; @IntVal(32767) short maxPlus1 = (short) (min - 1); - // :: error: (assignment) + // :: error: [assignment] @IntVal(32767) int maxPlus1Int = (int) (min - 1); } diff --git a/framework/tests/value/ValueCast.java b/framework/tests/value/ValueCast.java index 3ada76f5182c..33449f4d08bc 100644 --- a/framework/tests/value/ValueCast.java +++ b/framework/tests/value/ValueCast.java @@ -5,55 +5,55 @@ public class ValueCast { void testShort_plus(@IntRange(from = 0) short x) { @IntRange(from = 1, to = Short.MAX_VALUE + 1) int y = x + 1; - // :: error: (assignment) + // :: error: [assignment] @IntRange(from = 1, to = Short.MAX_VALUE - 1) int z = x; } void testIntFrom(@IntRange(from = 0) int x) { @IntRange(from = 0, to = Integer.MAX_VALUE) long y = x; - // :: error: (assignment) + // :: error: [assignment] @IntRange(from = 0, to = Integer.MAX_VALUE - 1) int z = x; } void testShortFrom(@IntRange(from = 0) short x) { @IntRange(from = 0, to = Short.MAX_VALUE) int y = x; - // :: error: (assignment) + // :: error: [assignment] @IntRange(from = 0, to = Short.MAX_VALUE - 1) int z = x; } void testCharFrom(@IntRange(from = 0) char x) { @IntRange(from = 0, to = Character.MAX_VALUE) int y = x; - // :: error: (assignment) + // :: error: [assignment] @IntRange(from = 0, to = Character.MAX_VALUE - 1) int z = x; } void testByteFrom(@IntRange(from = 0) byte x) { @IntRange(from = 0, to = Byte.MAX_VALUE) int y = x; - // :: error: (assignment) + // :: error: [assignment] @IntRange(from = 0, to = Byte.MAX_VALUE - 1) int z = x; } void testIntTo(@IntRange(to = 0) int x) { @IntRange(to = 0, from = Integer.MIN_VALUE) long y = x; - // :: error: (assignment) + // :: error: [assignment] @IntRange(to = 0, from = Integer.MIN_VALUE + 1) int z = x; } void testShortTo(@IntRange(to = 0) short x) { @IntRange(to = 0, from = Short.MIN_VALUE) int y = x; - // :: error: (assignment) + // :: error: [assignment] @IntRange(to = 0, from = Short.MIN_VALUE + 1) int z = x; } void testCharTo(@IntRange(to = 1) char x) { @IntRange(to = 1, from = Character.MIN_VALUE) int y = x; - // :: error: (assignment) + // :: error: [assignment] @IntRange(to = 1, from = Character.MIN_VALUE + 1) int z = x; } void testByteTo(@IntRange(to = 0) byte x) { @IntRange(to = 0, from = Byte.MIN_VALUE) int y = x; - // :: error: (assignment) + // :: error: [assignment] @IntRange(to = 0, from = Byte.MIN_VALUE + 1) int z = x; } } diff --git a/framework/tests/value/ValueWrapperCast.java b/framework/tests/value/ValueWrapperCast.java index 10778647cc5f..4ba069877510 100644 --- a/framework/tests/value/ValueWrapperCast.java +++ b/framework/tests/value/ValueWrapperCast.java @@ -5,55 +5,55 @@ public class ValueWrapperCast { void testShort_plus(@IntRange(from = 0) Short x) { @IntRange(from = 1, to = Short.MAX_VALUE + 1) int y = x + 1; - // :: error: (assignment) + // :: error: [assignment] @IntRange(from = 1, to = Short.MAX_VALUE - 1) int z = x; } void testIntFrom(@IntRange(from = 0) Integer x) { @IntRange(from = 0, to = Integer.MAX_VALUE) long y = x; - // :: error: (assignment) + // :: error: [assignment] @IntRange(from = 0, to = Integer.MAX_VALUE - 1) int z = x; } void testShortFrom(@IntRange(from = 0) Short x) { @IntRange(from = 0, to = Short.MAX_VALUE) int y = x; - // :: error: (assignment) + // :: error: [assignment] @IntRange(from = 0, to = Short.MAX_VALUE - 1) int z = x; } void testCharFrom(@IntRange(from = 0) Character x) { @IntRange(from = 0, to = Character.MAX_VALUE) int y = x; - // :: error: (assignment) + // :: error: [assignment] @IntRange(from = 0, to = Character.MAX_VALUE - 1) int z = x; } void testByteFrom(@IntRange(from = 0) Byte x) { @IntRange(from = 0, to = Byte.MAX_VALUE) int y = x; - // :: error: (assignment) + // :: error: [assignment] @IntRange(from = 0, to = Byte.MAX_VALUE - 1) int z = x; } void testIntTo(@IntRange(to = 0) Integer x) { @IntRange(to = 0, from = Integer.MIN_VALUE) long y = x; - // :: error: (assignment) + // :: error: [assignment] @IntRange(to = 0, from = Integer.MIN_VALUE + 1) int z = x; } void testShortTo(@IntRange(to = 0) Short x) { @IntRange(to = 0, from = Short.MIN_VALUE) int y = x; - // :: error: (assignment) + // :: error: [assignment] @IntRange(to = 0, from = Short.MIN_VALUE + 1) int z = x; } void testCharTo(@IntRange(to = 1) Character x) { @IntRange(to = 1, from = Character.MIN_VALUE) int y = x; - // :: error: (assignment) + // :: error: [assignment] @IntRange(to = 1, from = Character.MIN_VALUE + 1) int z = x; } void testByteTo(@IntRange(to = 0) Byte x) { @IntRange(to = 0, from = Byte.MIN_VALUE) int y = x; - // :: error: (assignment) + // :: error: [assignment] @IntRange(to = 0, from = Byte.MIN_VALUE + 1) int z = x; } } diff --git a/framework/tests/value/java17/MultiCaseConst.java b/framework/tests/value/java17/MultiCaseConst.java index 0362299984a3..74c09b874b9f 100644 --- a/framework/tests/value/java17/MultiCaseConst.java +++ b/framework/tests/value/java17/MultiCaseConst.java @@ -6,11 +6,11 @@ public class MultiCaseConst { void method(int selector) { switch (selector) { case 1, 2, 3: - // :: error: (assignment) + // :: error: [assignment] @IntVal(0) int o = selector; @IntVal({1, 2, 3}) int tmp = selector; case 4, 5: - // :: error: (assignment) + // :: error: [assignment] @IntVal({4, 5}) int tmp2 = selector; @IntVal({1, 2, 3, 4, 5}) int tmp3 = selector; } @@ -19,7 +19,7 @@ void method(int selector) { void method2(int selector) { switch (selector) { case 1: - // :: error: (assignment) + // :: error: [assignment] @IntVal(0) int o = selector; @IntVal({1, 2, 3}) int tmp = selector; break; @@ -32,7 +32,7 @@ void method2(int selector) { void method3(int selector) { switch (selector) { case 1 -> { - // :: error: (assignment) + // :: error: [assignment] @IntVal(0) int o = selector; @IntVal({1, 2, 3}) int tmp = selector; } diff --git a/framework/tests/value/java17/SwitchExpressionTyping.java b/framework/tests/value/java17/SwitchExpressionTyping.java index 94860ed42643..2656d9ec41ae 100644 --- a/framework/tests/value/java17/SwitchExpressionTyping.java +++ b/framework/tests/value/java17/SwitchExpressionTyping.java @@ -35,7 +35,7 @@ void method1(String s) { }; @IntVal(1) int o2 = - // :: error: (assignment) + // :: error: [assignment] switch (s) { case "Hello?" -> 1; case "Hello" -> 1; diff --git a/framework/tests/value/java17/ValueSwitchExprNeedsDataflow.java b/framework/tests/value/java17/ValueSwitchExprNeedsDataflow.java index 3b2ab677dd0f..da5ecb287c47 100644 --- a/framework/tests/value/java17/ValueSwitchExprNeedsDataflow.java +++ b/framework/tests/value/java17/ValueSwitchExprNeedsDataflow.java @@ -28,7 +28,7 @@ void method(int selector) { void method1(int selector) { @IntVal(3) int value1 = - // :: error: (assignment) + // :: error: [assignment] switch (selector) { case 1: yield 1 + 2; @@ -37,7 +37,7 @@ void method1(int selector) { }; @IntVal(3) int value2 = - // :: error: (assignment) + // :: error: [assignment] switch (selector) { case 1 -> 1 + 2; default -> 1 + 1; diff --git a/framework/tests/value/java17/ValueSwitchStatementRules.java b/framework/tests/value/java17/ValueSwitchStatementRules.java index cf78c973e00c..b9250e882ae8 100644 --- a/framework/tests/value/java17/ValueSwitchStatementRules.java +++ b/framework/tests/value/java17/ValueSwitchStatementRules.java @@ -11,7 +11,7 @@ void method(int selector) { field = 42; @IntVal(42) int copyField = field; case 2: - // :: error: (assignment) + // :: error: [assignment] @IntVal(300) int copyField2 = field; } diff --git a/framework/tests/value/loops/WidenedUpperBound.java b/framework/tests/value/loops/WidenedUpperBound.java index 6c18daf5c3b4..1e2c4fa03681 100644 --- a/framework/tests/value/loops/WidenedUpperBound.java +++ b/framework/tests/value/loops/WidenedUpperBound.java @@ -14,7 +14,7 @@ void increment() { for (forIndex = 0; forIndex < 4323; forIndex++) { @IntRange(from = 0, to = 4322) int x = forIndex; } - // // ::error: (assignment) + // // ::error: [assignment] @IntRange(from = 0, to = 4322) int x = forIndex; @IntRange(from = 4323) int y = forIndex; @@ -23,7 +23,7 @@ void increment() { @IntRange(from = 0, to = 1233) int z = whileIndex; whileIndex++; } - // // ::error: (assignment) + // // ::error: [assignment] @IntRange(from = 0, to = 1233) int a = whileIndex; @IntRange(from = 1234) int b = whileIndex; @@ -32,7 +32,7 @@ void increment() { @IntRange(from = 0, to = 2344) int c = doWhileIndex; doWhileIndex++; } while (doWhileIndex < 2345); - // // ::error: (assignment) + // // ::error: [assignment] @IntRange(from = 0, to = 2344) int d = doWhileIndex; @IntRange(from = 2345) int e = doWhileIndex; } @@ -42,7 +42,7 @@ void decrement() { for (forIndex = 4323; forIndex > 0; forIndex--) { @IntRange(from = 1, to = 4323) int x = forIndex; } - // // ::error: (assignment) + // // ::error: [assignment] @IntRange(from = 1, to = 4323) int x = forIndex; @IntRange(to = 0) int y = forIndex; @@ -51,7 +51,7 @@ void decrement() { @IntRange(from = 1, to = 1234) int z = whileIndex; whileIndex--; } - // // ::error: (assignment) + // // ::error: [assignment] @IntRange(from = 1, to = 1234) int a = whileIndex; @IntRange(to = 0) int b = whileIndex; @@ -60,7 +60,7 @@ void decrement() { @IntRange(from = 1, to = 2344) int c = doWhileIndex; doWhileIndex--; } while (doWhileIndex > 0); - // // ::error: (assignment) + // // ::error: [assignment] @IntRange(from = 1, to = 2344) int d = doWhileIndex; @IntRange(to = 0) int e = doWhileIndex; } diff --git a/framework/tests/variablenamedefault/TestVariableNameDefault.java b/framework/tests/variablenamedefault/TestVariableNameDefault.java index 634d388d8f4c..820741839c6c 100644 --- a/framework/tests/variablenamedefault/TestVariableNameDefault.java +++ b/framework/tests/variablenamedefault/TestVariableNameDefault.java @@ -40,51 +40,51 @@ void testFields() { @VariableNameDefaultMiddle int m; - // :: error: (assignment) + // :: error: [assignment] m = top; m = middle; m = middlevar; m = mymiddle; - // :: error: (assignment) + // :: error: [assignment] m = notmiddle; - // :: error: (assignment) + // :: error: [assignment] m = notmiddlevar; m = namedbottombutnot; m = bottom; m = bottomvar; m = mybottom; - // :: error: (assignment) + // :: error: [assignment] m = notbottom; - // :: error: (assignment) + // :: error: [assignment] m = notbottomvar; m = namedmiddlebutnot; @VariableNameDefaultBottom int b; - // :: error: (assignment) + // :: error: [assignment] b = top; - // :: error: (assignment) + // :: error: [assignment] b = middle; - // :: error: (assignment) + // :: error: [assignment] b = middlevar; - // :: error: (assignment) + // :: error: [assignment] b = mymiddle; - // :: error: (assignment) + // :: error: [assignment] b = notmiddle; - // :: error: (assignment) + // :: error: [assignment] b = notmiddlevar; - // :: error: (assignment) + // :: error: [assignment] b = namedbottombutnot; b = bottom; b = bottomvar; b = mybottom; - // :: error: (assignment) + // :: error: [assignment] b = notbottom; - // :: error: (assignment) + // :: error: [assignment] b = notbottomvar; b = namedmiddlebutnot; } @@ -101,30 +101,30 @@ void testFormals(int middle, int notmiddle, int bottom, int notbottom) { @VariableNameDefaultMiddle int m; m = middle; - // :: error: (assignment) + // :: error: [assignment] m = notmiddle; m = bottom; - // :: error: (assignment) + // :: error: [assignment] m = notbottom; @VariableNameDefaultBottom int b; - // :: error: (assignment) + // :: error: [assignment] b = middle; - // :: error: (assignment) + // :: error: [assignment] b = notmiddle; b = bottom; - // :: error: (assignment) + // :: error: [assignment] b = notbottom; } int middlemethod() { - // :: error: (return) + // :: error: [return] return 0; } int mymiddlemethod() { - // :: error: (return) + // :: error: [return] return 0; } @@ -137,12 +137,12 @@ int mynotmiddlemethod() { } int bottommethod() { - // :: error: (return) + // :: error: [return] return 0; } int mybottommethod() { - // :: error: (return) + // :: error: [return] return 0; } @@ -172,34 +172,34 @@ void testMethods() { m = middlemethod(); m = mymiddlemethod(); - // :: error: (assignment) + // :: error: [assignment] m = notmiddlemethod(); - // :: error: (assignment) + // :: error: [assignment] m = mynotmiddlemethod(); m = bottommethod(); m = mybottommethod(); - // :: error: (assignment) + // :: error: [assignment] m = notbottommethod(); - // :: error: (assignment) + // :: error: [assignment] m = mynotbottommethod(); @VariableNameDefaultBottom int b; - // :: error: (assignment) + // :: error: [assignment] b = middlemethod(); - // :: error: (assignment) + // :: error: [assignment] b = mymiddlemethod(); - // :: error: (assignment) + // :: error: [assignment] b = notmiddlemethod(); - // :: error: (assignment) + // :: error: [assignment] b = mynotmiddlemethod(); b = bottommethod(); b = mybottommethod(); - // :: error: (assignment) + // :: error: [assignment] b = notbottommethod(); - // :: error: (assignment) + // :: error: [assignment] b = mynotbottommethod(); } }