Add -Xsupport-compatqual-checker-framework-annotations flag

It's implemented through Jsr305State while it's not related
to jsr-305 becasue currently it's the most convenient way
to introduce the flag.

Probably, it's worth renaming Jsr305State to something more abstract
like NullabilityAnnotationsConfiguration

 #KT-21982 Fixed
This commit is contained in:
Denis Zharkov
2018-01-10 17:02:46 +03:00
parent 40706de3db
commit 3cfe43f83a
19 changed files with 132 additions and 21 deletions
+3
View File
@@ -0,0 +1,3 @@
public class A {
public void foo(@org.checkerframework.checker.nullness.compatqual.NonNullDecl String x) {}
}
+5
View File
@@ -0,0 +1,5 @@
$TESTDATA_DIR$/compatqualUsage.kt
$TESTDATA_DIR$/compatqual
$FOREIGN_ANNOTATIONS_DIR$
-d
$TEMP_DIR$
+4
View File
@@ -0,0 +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)
^
COMPILATION_ERROR
+6
View File
@@ -0,0 +1,6 @@
-Xsupport-compatqual-checker-framework-annotations=disable
$TESTDATA_DIR$/compatqualUsage.kt
$TESTDATA_DIR$/compatqual
$FOREIGN_ANNOTATIONS_DIR$
-d
$TEMP_DIR$
+1
View File
@@ -0,0 +1 @@
OK
+6
View File
@@ -0,0 +1,6 @@
-Xsupport-compatqual-checker-framework-annotations=enable
$TESTDATA_DIR$/compatqualUsage.kt
$TESTDATA_DIR$/compatqual
$FOREIGN_ANNOTATIONS_DIR$
-d
$TEMP_DIR$
+4
View File
@@ -0,0 +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)
^
COMPILATION_ERROR
+3
View File
@@ -0,0 +1,3 @@
fun bar(a: A) {
a.foo(null)
}
+6
View File
@@ -0,0 +1,6 @@
-Xsupport-compatqual-checker-framework-annotations=true
$TESTDATA_DIR$/compatqualUsage.kt
$TESTDATA_DIR$/compatqual
$FOREIGN_ANNOTATIONS_DIR$
-d
$TEMP_DIR$
+2
View File
@@ -0,0 +1,2 @@
error: unrecognized -Xsupport-compatqual-checker-framework-annotations option: true. Possible values are 'enable'/'disable'
COMPILATION_ERROR
+5
View File
@@ -35,6 +35,11 @@ where advanced options include:
-Xskip-runtime-version-check Allow Kotlin runtime libraries of incompatible versions in the classpath
-Xstrict-java-nullability-assertions
Generate nullability assertions for non-null Java expressions
-Xsupport-compatqual-checker-framework-annotations=enable|disable
Specify behavior for Checker Framework compatqual annotations (NullableDecl/NonNullDecl).
Default value is 'enable'
-Xuse-javac Use javac for Java source and class files analysis
-Xuse-old-class-files-reading Use old class files reading implementation (may slow down the build and should be used in case of problems with the new implementation)
-Xallow-kotlin-package Allow compiling code in package 'kotlin' and allow not requiring kotlin.stdlib in module-info