Basic Java nullability warnings implemented
#KT-6723 In Progress
This commit is contained in:
@@ -1,29 +1,29 @@
|
||||
import java.sql.DriverManager
|
||||
|
||||
fun getConnection(url: String?) {
|
||||
DriverManager.getConnection(url)
|
||||
DriverManager.getConnection(<!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>url<!>)
|
||||
DriverManager.getConnection(url!!) : java.sql.Connection
|
||||
}
|
||||
|
||||
fun getConnection(url: String?, props: java.util.Properties?) {
|
||||
DriverManager.getConnection(url, props)
|
||||
DriverManager.getConnection(<!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>url<!>, props)
|
||||
DriverManager.getConnection(url!!, props) : java.sql.Connection
|
||||
}
|
||||
|
||||
fun getConnection(url: String?, user: String?, password: String?) {
|
||||
DriverManager.getConnection(url, user!!, password!!)
|
||||
DriverManager.getConnection(<!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>url<!>, user!!, password!!)
|
||||
DriverManager.getConnection(url!!, user, password<!UNNECESSARY_NOT_NULL_ASSERTION!>!!<!>)
|
||||
DriverManager.getConnection(url<!UNNECESSARY_NOT_NULL_ASSERTION!>!!<!>, user<!UNNECESSARY_NOT_NULL_ASSERTION!>!!<!>, password)
|
||||
DriverManager.getConnection(url<!UNNECESSARY_NOT_NULL_ASSERTION!>!!<!>, user<!UNNECESSARY_NOT_NULL_ASSERTION!>!!<!>, password<!UNNECESSARY_NOT_NULL_ASSERTION!>!!<!>) : java.sql.Connection
|
||||
}
|
||||
|
||||
fun getDriver(url: String?) {
|
||||
DriverManager.getDriver(url)
|
||||
DriverManager.getDriver(<!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>url<!>)
|
||||
DriverManager.getDriver(url!!) : java.sql.Driver
|
||||
}
|
||||
|
||||
fun registerDriver(driver: java.sql.Driver?) {
|
||||
DriverManager.registerDriver(driver)
|
||||
DriverManager.registerDriver(<!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>driver<!>)
|
||||
DriverManager.registerDriver(driver!!)
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
fun executeQuery(statement: java.sql.Statement, cmd: String?) {
|
||||
statement.executeQuery(cmd)
|
||||
statement.executeQuery(<!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>cmd<!>)
|
||||
statement.executeQuery(cmd!!) : java.sql.ResultSet
|
||||
}
|
||||
|
||||
@@ -8,6 +8,6 @@ fun executeQuery(statement: java.sql.PreparedStatement) {
|
||||
}
|
||||
|
||||
fun executeUpdate(statement: java.sql.Statement, cmd: String?) {
|
||||
statement.executeUpdate(cmd)
|
||||
statement.executeUpdate(<!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>cmd<!>)
|
||||
statement.executeUpdate(cmd!!)
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
// FILE: p/J.java
|
||||
package p;
|
||||
|
||||
import org.jetbrains.annotations.*;
|
||||
|
||||
public class J {
|
||||
@NotNull
|
||||
public static Integer staticNN;
|
||||
@Nullable
|
||||
public static Integer staticN;
|
||||
public static Integer staticJ;
|
||||
}
|
||||
|
||||
// FILE: k.kt
|
||||
|
||||
import p.*
|
||||
|
||||
fun test() {
|
||||
// @NotNull platform type
|
||||
var platformNN = J.staticNN
|
||||
// @Nullable platform type
|
||||
var platformN = J.staticN
|
||||
// platform type with no annotation
|
||||
var platformJ = J.staticJ
|
||||
|
||||
+platformNN
|
||||
+platformN
|
||||
+platformJ
|
||||
|
||||
++platformNN
|
||||
++platformN
|
||||
++platformJ
|
||||
|
||||
platformNN++
|
||||
platformN++
|
||||
platformJ++
|
||||
|
||||
1 + platformNN
|
||||
1 + <!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>platformN<!>
|
||||
1 + platformJ
|
||||
|
||||
platformNN + 1
|
||||
platformN + 1
|
||||
platformJ + 1
|
||||
|
||||
1 plus platformNN
|
||||
1 plus <!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>platformN<!>
|
||||
1 plus platformJ
|
||||
|
||||
platformNN plus 1
|
||||
platformN plus 1
|
||||
platformJ plus 1
|
||||
|
||||
platformNN += 1
|
||||
platformN += 1
|
||||
platformJ += 1
|
||||
}
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
package
|
||||
|
||||
internal fun test(): kotlin.Unit
|
||||
@@ -0,0 +1,34 @@
|
||||
// FILE: p/J.java
|
||||
package p;
|
||||
|
||||
import org.jetbrains.annotations.*;
|
||||
|
||||
public class J {
|
||||
@NotNull
|
||||
public static Integer[] staticNN;
|
||||
@Nullable
|
||||
public static Integer[] staticN;
|
||||
public static Integer[] staticJ;
|
||||
}
|
||||
|
||||
// FILE: k.kt
|
||||
|
||||
import p.*
|
||||
|
||||
fun test() {
|
||||
// @NotNull platform type
|
||||
val platformNN = J.staticNN
|
||||
// @Nullable platform type
|
||||
val platformN = J.staticN
|
||||
// platform type with no annotation
|
||||
val platformJ = J.staticJ
|
||||
|
||||
platformNN[0]
|
||||
platformN[0]
|
||||
platformJ[0]
|
||||
|
||||
platformNN[0] = 1
|
||||
platformN[0] = 1
|
||||
platformJ[0] = 1
|
||||
}
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
package
|
||||
|
||||
internal fun test(): kotlin.Unit
|
||||
@@ -0,0 +1,29 @@
|
||||
// FILE: p/J.java
|
||||
package p;
|
||||
|
||||
import org.jetbrains.annotations.*;
|
||||
|
||||
public class J {
|
||||
@NotNull
|
||||
public static J staticNN;
|
||||
@Nullable
|
||||
public static J staticN;
|
||||
public static J staticJ;
|
||||
}
|
||||
|
||||
// FILE: k.kt
|
||||
|
||||
import p.*
|
||||
|
||||
var v: J = J()
|
||||
var n: J? = J()
|
||||
|
||||
fun test() {
|
||||
v = J.staticNN
|
||||
v = <!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>J.staticN<!>
|
||||
v = J.staticJ
|
||||
|
||||
n = J.staticNN
|
||||
n = J.staticN
|
||||
n = J.staticJ
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
package
|
||||
|
||||
internal var n: p.J?
|
||||
internal var v: p.J
|
||||
internal fun test(): kotlin.Unit
|
||||
@@ -0,0 +1,50 @@
|
||||
// !DIAGNOSTICS: -UNUSED_EXPRESSION
|
||||
// FILE: p/J.java
|
||||
package p;
|
||||
|
||||
import org.jetbrains.annotations.*;
|
||||
|
||||
public class J {
|
||||
@NotNull
|
||||
public static Boolean staticNN;
|
||||
@Nullable
|
||||
public static Boolean staticN;
|
||||
public static Boolean staticJ;
|
||||
}
|
||||
|
||||
// FILE: k.kt
|
||||
|
||||
import p.*
|
||||
|
||||
fun test() {
|
||||
// @NotNull platform type
|
||||
val platformNN = J.staticNN
|
||||
// @Nullable platform type
|
||||
val platformN = J.staticN
|
||||
// platform type with no annotation
|
||||
val platformJ = J.staticJ
|
||||
|
||||
if (platformNN) {}
|
||||
if (<!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>platformN<!>) {}
|
||||
if (platformJ) {}
|
||||
|
||||
while (platformNN) {}
|
||||
while (<!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>platformN<!>) {}
|
||||
while (platformJ) {}
|
||||
|
||||
do {} while (platformNN)
|
||||
do {} while (<!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>platformN<!>)
|
||||
do {} while (platformJ)
|
||||
|
||||
platformNN && false
|
||||
<!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>platformN<!> && false
|
||||
platformJ && false
|
||||
|
||||
platformNN || false
|
||||
<!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>platformN<!> || false
|
||||
platformJ || false
|
||||
|
||||
!platformNN
|
||||
!<!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>platformN<!>
|
||||
!platformJ
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
package
|
||||
|
||||
internal fun test(): kotlin.Unit
|
||||
@@ -0,0 +1,34 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
// FILE: p/J.java
|
||||
package p;
|
||||
|
||||
import org.jetbrains.annotations.*;
|
||||
|
||||
public class J {
|
||||
@NotNull
|
||||
public static J staticNN;
|
||||
@Nullable
|
||||
public static J staticN;
|
||||
}
|
||||
|
||||
// FILE: k.kt
|
||||
|
||||
import p.*
|
||||
|
||||
fun test() {
|
||||
val n = J.staticN
|
||||
foo(<!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>n<!>)
|
||||
J.staticNN = <!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>n<!>
|
||||
if (n != null) {
|
||||
foo(n)
|
||||
J.staticNN = n
|
||||
}
|
||||
|
||||
val x: J? = null
|
||||
J.staticNN = <!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>x<!>
|
||||
if (x != null) {
|
||||
J.staticNN = x
|
||||
}
|
||||
}
|
||||
|
||||
fun foo(j: J) {}
|
||||
@@ -0,0 +1,4 @@
|
||||
package
|
||||
|
||||
internal fun foo(/*0*/ j: p.J): kotlin.Unit
|
||||
internal fun test(): kotlin.Unit
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
// FILE: p/J.java
|
||||
package p;
|
||||
|
||||
import org.jetbrains.annotations.*;
|
||||
|
||||
public class J {
|
||||
@NotNull
|
||||
public static J staticNN;
|
||||
@Nullable
|
||||
public static J staticN;
|
||||
public static J staticJ;
|
||||
}
|
||||
|
||||
// FILE: k.kt
|
||||
|
||||
import p.*
|
||||
|
||||
fun test() {
|
||||
// @NotNull platform type
|
||||
val platformNN = J.staticNN
|
||||
// @Nullable platform type
|
||||
val platformN = J.staticN
|
||||
// platform type with no annotation
|
||||
val platformJ = J.staticJ
|
||||
|
||||
fun foo(p: J = platformNN, p1: J = <!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>platformN<!>, p2: J = platformJ) {}
|
||||
|
||||
fun foo1(p: J? = platformNN, p1: J? = platformN, p2: J? = platformJ) {}
|
||||
}
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
package
|
||||
|
||||
internal fun test(): kotlin.Unit
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
// FILE: p/J.java
|
||||
package p;
|
||||
|
||||
import org.jetbrains.annotations.*;
|
||||
|
||||
public class J {
|
||||
|
||||
public interface DP {
|
||||
String get(Object a, Object b);
|
||||
String set(Object a, Object b, Object c);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static DP staticNN;
|
||||
@Nullable
|
||||
public static DP staticN;
|
||||
public static DP staticJ;
|
||||
}
|
||||
|
||||
// FILE: k.kt
|
||||
|
||||
import p.*
|
||||
|
||||
var A by J.staticNN
|
||||
var B by J.staticN
|
||||
var C by J.staticJ
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
package
|
||||
|
||||
internal var A: kotlin.String!
|
||||
internal var B: kotlin.String!
|
||||
internal var C: kotlin.String!
|
||||
@@ -0,0 +1,21 @@
|
||||
// FILE: p/J.java
|
||||
package p;
|
||||
|
||||
import org.jetbrains.annotations.*;
|
||||
import java.util.*;
|
||||
|
||||
public class J {
|
||||
@NotNull
|
||||
public static List<String> staticNN;
|
||||
@Nullable
|
||||
public static List<String> staticN;
|
||||
public static List<String> staticJ;
|
||||
}
|
||||
|
||||
// FILE: k.kt
|
||||
|
||||
import p.*
|
||||
|
||||
class A : List<String> by J.staticNN
|
||||
class B : List<String> by <!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>J.staticN<!>
|
||||
class C : List<String> by J.staticJ
|
||||
@@ -0,0 +1,55 @@
|
||||
package
|
||||
|
||||
internal final class A : kotlin.List<kotlin.String> {
|
||||
public constructor A()
|
||||
public open override /*1*/ /*delegation*/ fun contains(/*0*/ o: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*delegation*/ fun containsAll(/*0*/ c: kotlin.Collection<kotlin.Any?>): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*delegation*/ fun get(/*0*/ index: kotlin.Int): kotlin.String
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*delegation*/ fun indexOf(/*0*/ o: kotlin.Any?): kotlin.Int
|
||||
public open override /*1*/ /*delegation*/ fun isEmpty(): kotlin.Boolean
|
||||
public open override /*1*/ /*delegation*/ fun iterator(): kotlin.Iterator<kotlin.String>
|
||||
public open override /*1*/ /*delegation*/ fun lastIndexOf(/*0*/ o: kotlin.Any?): kotlin.Int
|
||||
public open override /*1*/ /*delegation*/ fun listIterator(): kotlin.ListIterator<kotlin.String>
|
||||
public open override /*1*/ /*delegation*/ fun listIterator(/*0*/ index: kotlin.Int): kotlin.ListIterator<kotlin.String>
|
||||
public open override /*1*/ /*delegation*/ fun size(): kotlin.Int
|
||||
public open override /*1*/ /*delegation*/ fun subList(/*0*/ fromIndex: kotlin.Int, /*1*/ toIndex: kotlin.Int): kotlin.List<kotlin.String>
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
internal final class B : kotlin.List<kotlin.String> {
|
||||
public constructor B()
|
||||
public open override /*1*/ /*delegation*/ fun contains(/*0*/ o: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*delegation*/ fun containsAll(/*0*/ c: kotlin.Collection<kotlin.Any?>): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*delegation*/ fun get(/*0*/ index: kotlin.Int): kotlin.String
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*delegation*/ fun indexOf(/*0*/ o: kotlin.Any?): kotlin.Int
|
||||
public open override /*1*/ /*delegation*/ fun isEmpty(): kotlin.Boolean
|
||||
public open override /*1*/ /*delegation*/ fun iterator(): kotlin.Iterator<kotlin.String>
|
||||
public open override /*1*/ /*delegation*/ fun lastIndexOf(/*0*/ o: kotlin.Any?): kotlin.Int
|
||||
public open override /*1*/ /*delegation*/ fun listIterator(): kotlin.ListIterator<kotlin.String>
|
||||
public open override /*1*/ /*delegation*/ fun listIterator(/*0*/ index: kotlin.Int): kotlin.ListIterator<kotlin.String>
|
||||
public open override /*1*/ /*delegation*/ fun size(): kotlin.Int
|
||||
public open override /*1*/ /*delegation*/ fun subList(/*0*/ fromIndex: kotlin.Int, /*1*/ toIndex: kotlin.Int): kotlin.List<kotlin.String>
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
internal final class C : kotlin.List<kotlin.String> {
|
||||
public constructor C()
|
||||
public open override /*1*/ /*delegation*/ fun contains(/*0*/ o: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*delegation*/ fun containsAll(/*0*/ c: kotlin.Collection<kotlin.Any?>): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*delegation*/ fun get(/*0*/ index: kotlin.Int): kotlin.String
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*delegation*/ fun indexOf(/*0*/ o: kotlin.Any?): kotlin.Int
|
||||
public open override /*1*/ /*delegation*/ fun isEmpty(): kotlin.Boolean
|
||||
public open override /*1*/ /*delegation*/ fun iterator(): kotlin.Iterator<kotlin.String>
|
||||
public open override /*1*/ /*delegation*/ fun lastIndexOf(/*0*/ o: kotlin.Any?): kotlin.Int
|
||||
public open override /*1*/ /*delegation*/ fun listIterator(): kotlin.ListIterator<kotlin.String>
|
||||
public open override /*1*/ /*delegation*/ fun listIterator(/*0*/ index: kotlin.Int): kotlin.ListIterator<kotlin.String>
|
||||
public open override /*1*/ /*delegation*/ fun size(): kotlin.Int
|
||||
public open override /*1*/ /*delegation*/ fun subList(/*0*/ fromIndex: kotlin.Int, /*1*/ toIndex: kotlin.Int): kotlin.List<kotlin.String>
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
// FILE: p/J.java
|
||||
package p;
|
||||
|
||||
import org.jetbrains.annotations.*;
|
||||
|
||||
public class J {
|
||||
@NotNull
|
||||
public static J staticNN;
|
||||
@Nullable
|
||||
public static J staticN;
|
||||
public static J staticJ;
|
||||
}
|
||||
|
||||
// FILE: k.kt
|
||||
|
||||
import p.*
|
||||
|
||||
fun test() {
|
||||
// @NotNull platform type
|
||||
val platformNN = J.staticNN
|
||||
// @Nullable platform type
|
||||
val platformN = J.staticN
|
||||
// platform type with no annotation
|
||||
val platformJ = J.staticJ
|
||||
|
||||
platformNN.foo()
|
||||
platformN.foo()
|
||||
platformJ.foo()
|
||||
|
||||
platformNN.bar()
|
||||
platformN.bar()
|
||||
platformJ.bar()
|
||||
}
|
||||
|
||||
fun J.foo() {}
|
||||
fun J?.bar() {}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
package
|
||||
|
||||
internal fun test(): kotlin.Unit
|
||||
internal fun p.J?.bar(): kotlin.Unit
|
||||
internal fun p.J.foo(): kotlin.Unit
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
// FILE: p/J.java
|
||||
package p;
|
||||
|
||||
import org.jetbrains.annotations.*;
|
||||
|
||||
public class J {
|
||||
@NotNull
|
||||
public static J staticNN;
|
||||
@Nullable
|
||||
public static J staticN;
|
||||
public static J staticJ;
|
||||
|
||||
public void foo() {}
|
||||
}
|
||||
|
||||
// FILE: k.kt
|
||||
|
||||
import p.*
|
||||
|
||||
fun test() {
|
||||
// @NotNull platform type
|
||||
val platformNN = J.staticNN
|
||||
// @Nullable platform type
|
||||
val platformN = J.staticN
|
||||
// platform type with no annotation
|
||||
val platformJ = J.staticJ
|
||||
|
||||
platformNN.foo()
|
||||
platformN.foo()
|
||||
platformJ.foo()
|
||||
}
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
package
|
||||
|
||||
internal fun test(): kotlin.Unit
|
||||
@@ -0,0 +1,33 @@
|
||||
// FILE: p/J.java
|
||||
package p;
|
||||
|
||||
import org.jetbrains.annotations.*;
|
||||
|
||||
public class J {
|
||||
@NotNull
|
||||
public static J staticNN;
|
||||
@Nullable
|
||||
public static J staticN;
|
||||
public static J staticJ;
|
||||
}
|
||||
|
||||
// FILE: k.kt
|
||||
|
||||
import p.*
|
||||
|
||||
fun test() {
|
||||
// @NotNull platform type
|
||||
val platformNN = J.staticNN
|
||||
// @Nullable platform type
|
||||
val platformN = J.staticN
|
||||
// platform type with no annotation
|
||||
val platformJ = J.staticJ
|
||||
|
||||
platformNN : J
|
||||
<!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>platformN<!> : J
|
||||
platformJ : J
|
||||
|
||||
platformNN : J?
|
||||
platformN : J?
|
||||
platformJ : J?
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
package
|
||||
|
||||
internal fun test(): kotlin.Unit
|
||||
@@ -0,0 +1,31 @@
|
||||
// FILE: p/J.java
|
||||
package p;
|
||||
|
||||
import org.jetbrains.annotations.*;
|
||||
import java.util.*;
|
||||
|
||||
public class J {
|
||||
@NotNull
|
||||
public static List<String> staticNN;
|
||||
@Nullable
|
||||
public static List<String> staticN;
|
||||
public static List<String> staticJ;
|
||||
}
|
||||
|
||||
// FILE: k.kt
|
||||
|
||||
import p.*
|
||||
|
||||
fun test() {
|
||||
// @NotNull platform type
|
||||
val platformNN = J.staticNN
|
||||
// @Nullable platform type
|
||||
val platformN = J.staticN
|
||||
// platform type with no annotation
|
||||
val platformJ = J.staticJ
|
||||
|
||||
for (x in platformNN) {}
|
||||
for (x in platformN) {}
|
||||
for (x in platformJ) {}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
package
|
||||
|
||||
internal fun test(): kotlin.Unit
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
// FILE: p/J.java
|
||||
package p;
|
||||
|
||||
import org.jetbrains.annotations.*;
|
||||
|
||||
public class J {
|
||||
@NotNull
|
||||
public static J staticNN;
|
||||
@Nullable
|
||||
public static J staticN;
|
||||
public static J staticJ;
|
||||
}
|
||||
|
||||
// FILE: k.kt
|
||||
|
||||
import p.*
|
||||
|
||||
fun test() {
|
||||
foo(J.staticNN)
|
||||
foo(<!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>J.staticN<!>)
|
||||
foo(J.staticJ)
|
||||
|
||||
bar(J.staticNN)
|
||||
bar(J.staticN)
|
||||
bar(J.staticJ)
|
||||
}
|
||||
|
||||
fun foo(j: J) {}
|
||||
fun bar(j: J?) {}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
package
|
||||
|
||||
internal fun bar(/*0*/ j: p.J?): kotlin.Unit
|
||||
internal fun foo(/*0*/ j: p.J): kotlin.Unit
|
||||
internal fun test(): kotlin.Unit
|
||||
@@ -0,0 +1,27 @@
|
||||
// FILE: p/J.java
|
||||
package p;
|
||||
|
||||
import org.jetbrains.annotations.*;
|
||||
|
||||
public class J {
|
||||
public interface Invoke {
|
||||
void invoke();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static Invoke staticNN;
|
||||
@Nullable
|
||||
public static Invoke staticN;
|
||||
public static Invoke staticJ;
|
||||
}
|
||||
|
||||
// FILE: k.kt
|
||||
|
||||
import p.*
|
||||
|
||||
fun test() {
|
||||
J.staticNN()
|
||||
J.staticN()
|
||||
J.staticJ()
|
||||
}
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
package
|
||||
|
||||
internal fun test(): kotlin.Unit
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
// !DIAGNOSTICS: -UNUSED_VARIABLE
|
||||
// FILE: p/J.java
|
||||
package p;
|
||||
|
||||
import org.jetbrains.annotations.*;
|
||||
|
||||
public class J {
|
||||
public interface Multi {
|
||||
String component1();
|
||||
String component2();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static Multi staticNN;
|
||||
@Nullable
|
||||
public static Multi staticN;
|
||||
public static Multi staticJ;
|
||||
}
|
||||
|
||||
// FILE: k.kt
|
||||
|
||||
import p.*
|
||||
|
||||
fun test() {
|
||||
// @NotNull platform type
|
||||
val platformNN = J.staticNN
|
||||
// @Nullable platform type
|
||||
val platformN = J.staticN
|
||||
// platform type with no annotation
|
||||
val platformJ = J.staticJ
|
||||
|
||||
val (a1, b1) = platformNN
|
||||
val (a2, b2) = platformN
|
||||
val (a3, b3) = platformJ
|
||||
}
|
||||
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
package
|
||||
|
||||
internal fun test(): kotlin.Unit
|
||||
@@ -0,0 +1,92 @@
|
||||
// FILE: p/J.java
|
||||
package p;
|
||||
|
||||
import org.jetbrains.annotations.*;
|
||||
|
||||
public class J {
|
||||
@NotNull
|
||||
public static J staticNN;
|
||||
@Nullable
|
||||
public static J staticN;
|
||||
public static J staticJ;
|
||||
|
||||
public static void staticSet(@NotNull J nn, @Nullable J n, J j) {}
|
||||
|
||||
public J(@NotNull J nn, @Nullable J n, J j) {}
|
||||
public J() {}
|
||||
|
||||
@NotNull
|
||||
public J nn;
|
||||
@Nullable
|
||||
public J n;
|
||||
public J j;
|
||||
|
||||
public void set(@NotNull J nn, @Nullable J n, J j) {}
|
||||
}
|
||||
|
||||
// FILE: k.kt
|
||||
|
||||
import p.*
|
||||
|
||||
fun test(n: J?, nn: J) {
|
||||
// @NotNull platform type
|
||||
val platformNN = J.staticNN
|
||||
// @Nullable platform type
|
||||
val platformN = J.staticN
|
||||
// platform type with no annotation
|
||||
val platformJ = J.staticJ
|
||||
|
||||
J.staticNN = <!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>n<!>
|
||||
J.staticNN = <!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>platformN<!>
|
||||
J.staticNN = nn
|
||||
J.staticNN = platformNN
|
||||
J.staticNN = platformJ
|
||||
|
||||
J.staticN = n
|
||||
J.staticN = platformN
|
||||
J.staticN = nn
|
||||
J.staticN = platformNN
|
||||
J.staticN = platformJ
|
||||
|
||||
J.staticJ = n
|
||||
J.staticJ = platformN
|
||||
J.staticJ = nn
|
||||
J.staticJ = platformNN
|
||||
J.staticJ = platformJ
|
||||
|
||||
J.staticSet(nn, nn, nn)
|
||||
J.staticSet(platformNN, platformNN, platformNN)
|
||||
J.staticSet(<!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>n<!>, n, n)
|
||||
J.staticSet(<!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>platformN<!>, platformN, platformN)
|
||||
J.staticSet(platformJ, platformJ, platformJ)
|
||||
|
||||
J().nn = <!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>n<!>
|
||||
J().nn = <!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>platformN<!>
|
||||
J().nn = nn
|
||||
J().nn = platformNN
|
||||
J().nn = platformJ
|
||||
|
||||
J().n = n
|
||||
J().n = platformN
|
||||
J().n = nn
|
||||
J().n = platformNN
|
||||
J().n = platformJ
|
||||
|
||||
J().j = n
|
||||
J().j = platformN
|
||||
J().j = nn
|
||||
J().j = platformNN
|
||||
J().j = platformJ
|
||||
|
||||
J().set(nn, nn, nn)
|
||||
J().set(platformNN, platformNN, platformNN)
|
||||
J().set(<!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>n<!>, n, n)
|
||||
J().set(<!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>platformN<!>, platformN, platformN)
|
||||
J().set(platformJ, platformJ, platformJ)
|
||||
|
||||
J(nn, nn, nn)
|
||||
J(platformNN, platformNN, platformNN)
|
||||
J(<!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>n<!>, n, n)
|
||||
J(<!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>platformN<!>, platformN, platformN)
|
||||
J(platformJ, platformJ, platformJ)
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
package
|
||||
|
||||
internal fun test(/*0*/ n: p.J?, /*1*/ nn: p.J): kotlin.Unit
|
||||
@@ -0,0 +1,28 @@
|
||||
// FILE: p/J.java
|
||||
package p;
|
||||
|
||||
import org.jetbrains.annotations.*;
|
||||
|
||||
public class J {
|
||||
@NotNull
|
||||
public static Exception staticNN;
|
||||
@Nullable
|
||||
public static Exception staticN;
|
||||
public static Exception staticJ;
|
||||
}
|
||||
|
||||
// FILE: k.kt
|
||||
|
||||
import p.*
|
||||
|
||||
fun test() {
|
||||
throw J.staticNN
|
||||
}
|
||||
|
||||
fun test1() {
|
||||
throw <!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>J.staticN<!>
|
||||
}
|
||||
|
||||
fun test2() {
|
||||
throw J.staticJ
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
package
|
||||
|
||||
internal fun test(): kotlin.Unit
|
||||
internal fun test1(): kotlin.Unit
|
||||
internal fun test2(): kotlin.Unit
|
||||
Reference in New Issue
Block a user