diff --git a/compiler/testData/cli/jvm/compatqual/A.java b/compiler/testData/cli/jvm/compatqual/B.java similarity index 85% rename from compiler/testData/cli/jvm/compatqual/A.java rename to compiler/testData/cli/jvm/compatqual/B.java index b0bc053d23f..232a2eb4311 100644 --- a/compiler/testData/cli/jvm/compatqual/A.java +++ b/compiler/testData/cli/jvm/compatqual/B.java @@ -1,3 +1,3 @@ -public class A { +public class B { public void foo(@org.checkerframework.checker.nullness.compatqual.NonNullDecl String x) {} } diff --git a/compiler/testData/cli/jvm/compatqualDefault.out b/compiler/testData/cli/jvm/compatqualDefault.out index f3ff8034e89..48dec5699f9 100644 --- a/compiler/testData/cli/jvm/compatqualDefault.out +++ b/compiler/testData/cli/jvm/compatqualDefault.out @@ -1,4 +1,4 @@ compiler/testData/cli/jvm/compatqualUsage.kt:2:11: error: null can not be a value of a non-null type String - a.foo(null) + b.foo(null) ^ COMPILATION_ERROR diff --git a/compiler/testData/cli/jvm/compatqualEnable.out b/compiler/testData/cli/jvm/compatqualEnable.out index f3ff8034e89..48dec5699f9 100644 --- a/compiler/testData/cli/jvm/compatqualEnable.out +++ b/compiler/testData/cli/jvm/compatqualEnable.out @@ -1,4 +1,4 @@ compiler/testData/cli/jvm/compatqualUsage.kt:2:11: error: null can not be a value of a non-null type String - a.foo(null) + b.foo(null) ^ COMPILATION_ERROR diff --git a/compiler/testData/cli/jvm/compatqualUsage.kt b/compiler/testData/cli/jvm/compatqualUsage.kt index bb806147851..8502baa8ccf 100644 --- a/compiler/testData/cli/jvm/compatqualUsage.kt +++ b/compiler/testData/cli/jvm/compatqualUsage.kt @@ -1,3 +1,3 @@ -fun bar(a: A) { - a.foo(null) +fun bar(b: B) { + b.foo(null) } diff --git a/compiler/testData/cli/jvm/nullabilityAnnotations.args b/compiler/testData/cli/jvm/nullabilityAnnotations.args new file mode 100644 index 00000000000..0dd32abb34e --- /dev/null +++ b/compiler/testData/cli/jvm/nullabilityAnnotations.args @@ -0,0 +1,8 @@ +-Xnullability-annotations=@org.jspecify.nullness\:strict +-Xnullability-annotations=@org.checkerframework.checker.nullness.compatqual\:warn +$TESTDATA_DIR$/severalAnnotations.kt +$TESTDATA_DIR$/jspecify +$TESTDATA_DIR$/compatqual +$FOREIGN_ANNOTATIONS_DIR$ +-d +$TEMP_DIR$ diff --git a/compiler/testData/cli/jvm/nullabilityAnnotations.out b/compiler/testData/cli/jvm/nullabilityAnnotations.out new file mode 100644 index 00000000000..9c4f1d64e19 --- /dev/null +++ b/compiler/testData/cli/jvm/nullabilityAnnotations.out @@ -0,0 +1,4 @@ +compiler/testData/cli/jvm/severalAnnotations.kt:2:11: error: null can not be a value of a non-null type String + a.foo(null) + ^ +COMPILATION_ERROR diff --git a/compiler/testData/cli/jvm/severalAnnotations.kt b/compiler/testData/cli/jvm/severalAnnotations.kt new file mode 100644 index 00000000000..0d15b5015fb --- /dev/null +++ b/compiler/testData/cli/jvm/severalAnnotations.kt @@ -0,0 +1,5 @@ +fun bar(a: A, b: B) { + a.foo(null) + a.bar().hashCode() + b.foo(null) +} diff --git a/compiler/tests-gen/org/jetbrains/kotlin/cli/CliTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/cli/CliTestGenerated.java index 7bda4f3f4a8..a131e170b5c 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/cli/CliTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/cli/CliTestGenerated.java @@ -706,6 +706,11 @@ public class CliTestGenerated extends AbstractCliTest { runTest("compiler/testData/cli/jvm/nonexistingArgfile.args"); } + @TestMetadata("nullabilityAnnotations.args") + public void testNullabilityAnnotations() throws Exception { + runTest("compiler/testData/cli/jvm/nullabilityAnnotations.args"); + } + @TestMetadata("pluginSimple.args") public void testPluginSimple() throws Exception { runTest("compiler/testData/cli/jvm/pluginSimple.args");