Introduce a compiler X flag to enable enhancing not null annotated type parameter's types to definitely not null types

This commit is contained in:
Victor Petukhov
2021-10-19 13:11:52 +03:00
parent abe607f4ea
commit 012f1f6013
8 changed files with 36 additions and 0 deletions
+2
View File
@@ -27,6 +27,8 @@ where advanced options include:
-Xemit-jvm-type-annotations Emit JVM type annotations in bytecode
-Xjvm-enable-preview Allow using features from Java language that are in preview phase.
Works as `--enable-preview` in Java. All class files are marked as preview-generated thus it won't be possible to use them in release environment
-Xenhance-type-parameter-types-to-def-not-null
Enhance not null annotated type parameter's types to definitely not null types (@NotNull T => T & Any)
-Xfriend-paths=<path> Paths to output directories for friend modules (whose internals should be visible)
-Xmultifile-parts-inherit Compile multifile classes as a hierarchy of parts and facade
-Xmodule-path=<path> Paths where to find Java 9+ modules
+6
View File
@@ -0,0 +1,6 @@
-Xenhance-type-parameter-types-to-def-not-null
$TESTDATA_DIR$/kt49209.kt
$TESTDATA_DIR$/kt49209
$FOREIGN_JAVA8_ANNOTATIONS_DIR$
-d
$TEMP_DIR$
+2
View File
@@ -0,0 +1,2 @@
fun usingMethod(java : Java<String?>) : String = java.getFoo()
fun usingProperty(java : Java<String?>) : String = java.foo
+1
View File
@@ -0,0 +1 @@
OK
+6
View File
@@ -0,0 +1,6 @@
import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable;
public interface Java<T extends @Nullable Object> {
@NonNull T getFoo();
}