Support type enhancement on freshly supported module level annotations
^KT-45189 Fixed
This commit is contained in:
Vendored
-18
@@ -1,18 +0,0 @@
|
||||
// FILE: module-info.java
|
||||
// INCLUDE_JAVA_AS_BINARY
|
||||
import org.jspecify.nullness.NullMarked;
|
||||
|
||||
@NullMarked
|
||||
module sandbox {
|
||||
requires java9_annotations;
|
||||
}
|
||||
|
||||
// FILE: Test.java
|
||||
public class Test {
|
||||
void foo(Integer x) {}
|
||||
}
|
||||
|
||||
// FILE: main.kt
|
||||
fun main(x: Test) {
|
||||
x.foo(1)
|
||||
}
|
||||
Vendored
-11
@@ -1,11 +0,0 @@
|
||||
package
|
||||
|
||||
public fun main(/*0*/ x: Test): kotlin.Unit
|
||||
|
||||
public open class Test {
|
||||
public constructor Test()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public/*package*/ open fun foo(/*0*/ x: kotlin.Int!): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
// ALLOW_KOTLIN_PACKAGE
|
||||
// JSPECIFY_STATE: strict
|
||||
|
||||
// FILE: sandbox/module-info.java
|
||||
import org.jspecify.nullness.NullMarked;
|
||||
|
||||
@NullMarked
|
||||
module sandbox {
|
||||
requires java9_annotations;
|
||||
exports test;
|
||||
}
|
||||
|
||||
// FILE: sandbox/test/Test.java
|
||||
package test;
|
||||
|
||||
public class Test {
|
||||
public void foo(Integer x) {}
|
||||
}
|
||||
|
||||
// FILE: main.kt
|
||||
import test.Test
|
||||
|
||||
fun main(x: Test) {
|
||||
x.foo(<!NULL_FOR_NONNULL_TYPE!>null<!>)
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
package
|
||||
|
||||
public fun main(/*0*/ x: test.Test): kotlin.Unit
|
||||
|
||||
package test {
|
||||
|
||||
public open class Test {
|
||||
public constructor Test()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open fun foo(/*0*/ x: kotlin.Int): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
}
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
// ALLOW_KOTLIN_PACKAGE
|
||||
// JSPECIFY_STATE: strict
|
||||
|
||||
// FILE: sandbox/test/module-info.java
|
||||
import org.jspecify.nullness.NullMarked;
|
||||
|
||||
@NullMarked
|
||||
module sandbox {
|
||||
requires java9_annotations;
|
||||
exports test;
|
||||
}
|
||||
|
||||
// FILE: sandbox/test/Test.java
|
||||
package test;
|
||||
|
||||
import org.jspecify.nullness.NullMarked;
|
||||
|
||||
@NullMarked
|
||||
public class Test {
|
||||
public void foo(Integer x) {}
|
||||
}
|
||||
|
||||
// FILE: main.kt
|
||||
import test.Test
|
||||
|
||||
fun main(x: Test) {
|
||||
x.foo(<!NULL_FOR_NONNULL_TYPE!>null<!>)
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
package
|
||||
|
||||
public fun main(/*0*/ x: test.Test): kotlin.Unit
|
||||
|
||||
package test {
|
||||
|
||||
@org.jspecify.nullness.NullMarked public open class Test {
|
||||
public constructor Test()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open fun foo(/*0*/ x: kotlin.Int): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
}
|
||||
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
// ALLOW_KOTLIN_PACKAGE
|
||||
// JSPECIFY_STATE: strict
|
||||
|
||||
// FILE: sandbox/module-info.java
|
||||
import org.jspecify.nullness.NullMarked;
|
||||
|
||||
@NullMarked
|
||||
module sandbox {
|
||||
requires java9_annotations;
|
||||
exports test;
|
||||
}
|
||||
|
||||
// FILE: sandbox/test/package-info.java
|
||||
@NullMarked
|
||||
package test;
|
||||
|
||||
import org.jspecify.nullness.NullMarked;
|
||||
|
||||
// FILE: sandbox/test/Test.java
|
||||
package test;
|
||||
|
||||
public class Test {
|
||||
public void foo(Integer x) {}
|
||||
}
|
||||
|
||||
// FILE: main.kt
|
||||
import test.Test
|
||||
|
||||
fun main(x: Test) {
|
||||
x.foo(<!NULL_FOR_NONNULL_TYPE!>null<!>)
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
package
|
||||
|
||||
public fun main(/*0*/ x: test.Test): kotlin.Unit
|
||||
|
||||
package test {
|
||||
|
||||
public open class Test {
|
||||
public constructor Test()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open fun foo(/*0*/ x: kotlin.Int): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
}
|
||||
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
// ALLOW_KOTLIN_PACKAGE
|
||||
// JSPECIFY_STATE: strict
|
||||
|
||||
// MODULE: module1
|
||||
// FILE: module1/module-info.java
|
||||
import org.jspecify.nullness.NullMarked;
|
||||
|
||||
@NullMarked
|
||||
module module1 {
|
||||
requires java9_annotations;
|
||||
}
|
||||
|
||||
// MODULE: module2(module1)
|
||||
// FILE: module2/module-info.java
|
||||
module module2 {
|
||||
requires module1;
|
||||
exports test2;
|
||||
}
|
||||
|
||||
// FILE: module2/test2/Test.java
|
||||
package test2;
|
||||
|
||||
public class Test {
|
||||
public void foo(Integer x) {}
|
||||
}
|
||||
|
||||
// FILE: main.kt
|
||||
fun main(y: test2.Test) {
|
||||
y.foo(null)
|
||||
}
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
// -- Module: <module1> --
|
||||
package
|
||||
|
||||
|
||||
// -- Module: <module2> --
|
||||
package
|
||||
|
||||
public fun main(/*0*/ y: test2.Test): kotlin.Unit
|
||||
|
||||
package test2 {
|
||||
|
||||
public open class Test {
|
||||
public constructor Test()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open fun foo(/*0*/ x: kotlin.Int!): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
}
|
||||
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
// ALLOW_KOTLIN_PACKAGE
|
||||
// JSPECIFY_STATE: strict
|
||||
|
||||
// MODULE: module1
|
||||
// FILE: module1/module-info.java
|
||||
module module1 {
|
||||
}
|
||||
|
||||
// MODULE: module2(module1)
|
||||
// FILE: module2/module-info.java
|
||||
import org.jspecify.nullness.NullMarked;
|
||||
|
||||
@NullMarked
|
||||
module module2 {
|
||||
requires java9_annotations;
|
||||
requires module1;
|
||||
exports test2;
|
||||
}
|
||||
|
||||
// FILE: module2/test2/Test.java
|
||||
package test2;
|
||||
|
||||
public class Test {
|
||||
public void foo(Integer x) {}
|
||||
}
|
||||
|
||||
// FILE: main.kt
|
||||
fun main(y: test2.Test) {
|
||||
y.foo(<!NULL_FOR_NONNULL_TYPE!>null<!>)
|
||||
}
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
// -- Module: <module1> --
|
||||
package
|
||||
|
||||
|
||||
// -- Module: <module2> --
|
||||
package
|
||||
|
||||
public fun main(/*0*/ y: test2.Test): kotlin.Unit
|
||||
|
||||
package test2 {
|
||||
|
||||
public open class Test {
|
||||
public constructor Test()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open fun foo(/*0*/ x: kotlin.Int): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
}
|
||||
|
||||
+44
@@ -0,0 +1,44 @@
|
||||
// ALLOW_KOTLIN_PACKAGE
|
||||
// JSPECIFY_STATE: strict
|
||||
|
||||
// MODULE: sandbox
|
||||
// FILE: sandbox/module-info.java
|
||||
import org.jspecify.nullness.NullMarked;
|
||||
|
||||
@NullMarked
|
||||
module sandbox {
|
||||
requires java9_annotations;
|
||||
exports test;
|
||||
}
|
||||
|
||||
// FILE: sandbox/test/package-info.java
|
||||
package test;
|
||||
|
||||
// FILE: sandbox/test/Foo.java
|
||||
package test;
|
||||
|
||||
class Foo {}
|
||||
|
||||
// MODULE: sandbox2
|
||||
// FILE: sandbox2/module-info.java
|
||||
module sandbox2 {
|
||||
requires java9_annotations;
|
||||
exports test;
|
||||
}
|
||||
|
||||
// FILE: sandbox2/test/package-info.java
|
||||
package test;
|
||||
|
||||
// FILE: sandbox2/test/Test.java
|
||||
package test;
|
||||
|
||||
public class Test {
|
||||
public void foo(Integer x) {}
|
||||
}
|
||||
|
||||
// FILE: main.kt
|
||||
import test.Test
|
||||
|
||||
fun main(x: Test) {
|
||||
x.foo(null)
|
||||
}
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
// -- Module: <sandbox> --
|
||||
package
|
||||
|
||||
package test {
|
||||
|
||||
public/*package*/ open class Foo {
|
||||
public/*package*/ constructor Foo()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
}
|
||||
|
||||
// -- Module: <sandbox2> --
|
||||
package
|
||||
|
||||
public fun main(/*0*/ x: test.Test): kotlin.Unit
|
||||
|
||||
package test {
|
||||
|
||||
public open class Test {
|
||||
public constructor Test()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open fun foo(/*0*/ x: kotlin.Int!): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
}
|
||||
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
// ALLOW_KOTLIN_PACKAGE
|
||||
// JSPECIFY_STATE: strict
|
||||
|
||||
// FILE: my.sand.box/module-info.java
|
||||
import org.jspecify.nullness.NullMarked;
|
||||
|
||||
@NullMarked
|
||||
open module my.sand.box {
|
||||
requires java9_annotations;
|
||||
exports my.test;
|
||||
}
|
||||
|
||||
// FILE: my.sand.box/my/test/Test.java
|
||||
package my.test;
|
||||
|
||||
public class Test {
|
||||
public void foo(Integer x) {}
|
||||
}
|
||||
|
||||
// FILE: main.kt
|
||||
import my.test.Test
|
||||
|
||||
fun main(x: Test) {
|
||||
x.foo(<!NULL_FOR_NONNULL_TYPE!>null<!>)
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
package
|
||||
|
||||
public fun main(/*0*/ x: my.test.Test): kotlin.Unit
|
||||
|
||||
package my {
|
||||
|
||||
package my.test {
|
||||
|
||||
public open class Test {
|
||||
public constructor Test()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open fun foo(/*0*/ x: kotlin.Int): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+45
@@ -0,0 +1,45 @@
|
||||
// ALLOW_KOTLIN_PACKAGE
|
||||
// JSPECIFY_STATE: strict
|
||||
|
||||
// MODULE: module1
|
||||
// FILE: module1/module-info.java
|
||||
import org.jspecify.nullness.NullMarked;
|
||||
|
||||
@NullMarked
|
||||
module module1 {
|
||||
requires java9_annotations;
|
||||
exports test1;
|
||||
}
|
||||
|
||||
// FILE: module1/test1/Test1.java
|
||||
package test1;
|
||||
|
||||
public class Test1 {
|
||||
public void foo(Integer x) {}
|
||||
}
|
||||
|
||||
// MODULE: module2(module1)
|
||||
// FILE: module2/module-info.java
|
||||
module module2 {
|
||||
requires module1;
|
||||
exports test2;
|
||||
}
|
||||
|
||||
// FILE: module2/test2/Test2.java
|
||||
package test2;
|
||||
|
||||
import test1.Test1;
|
||||
|
||||
public class Test2 extends Test1 {
|
||||
public void foo2(Integer x) {}
|
||||
}
|
||||
|
||||
// FILE: main.kt
|
||||
import test1.Test1
|
||||
import test2.Test2
|
||||
|
||||
fun main(x: Test1, y: Test2) {
|
||||
x.foo(<!NULL_FOR_NONNULL_TYPE!>null<!>)
|
||||
y.foo(<!NULL_FOR_NONNULL_TYPE!>null<!>)
|
||||
y.foo2(null)
|
||||
}
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
// -- Module: <module1> --
|
||||
package
|
||||
|
||||
package test1 {
|
||||
|
||||
public open class Test1 {
|
||||
public constructor Test1()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open fun foo(/*0*/ x: kotlin.Int): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
}
|
||||
|
||||
// -- Module: <module2> --
|
||||
package
|
||||
|
||||
public fun main(/*0*/ x: test1.Test1, /*1*/ y: test2.Test2): kotlin.Unit
|
||||
|
||||
package test2 {
|
||||
|
||||
public open class Test2 : test1.Test1 {
|
||||
public constructor Test2()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun foo(/*0*/ p0: kotlin.Int): kotlin.Unit
|
||||
public open fun foo2(/*0*/ x: kotlin.Int!): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
}
|
||||
|
||||
+43
@@ -0,0 +1,43 @@
|
||||
// ALLOW_KOTLIN_PACKAGE
|
||||
// JSPECIFY_STATE: strict
|
||||
|
||||
// FILE: sandbox/module-info.java
|
||||
import org.jspecify.nullness.NullMarked;
|
||||
|
||||
@NullMarked
|
||||
module sandbox {
|
||||
requires java9_annotations;
|
||||
exports test;
|
||||
}
|
||||
|
||||
// FILE: sandbox/test/Test.java
|
||||
package test;
|
||||
|
||||
public class Test {
|
||||
public static class Test2 {
|
||||
public Integer foo(Integer x) { return 1; }
|
||||
public static class Test4 {
|
||||
public Integer foo(Integer x) { return 1; }
|
||||
}
|
||||
public class Test5 {
|
||||
public Integer foo(Integer x) { return 1; }
|
||||
}
|
||||
}
|
||||
public class Test3 {
|
||||
public Integer foo(Integer x) { return 1; }
|
||||
public class Test5 {
|
||||
public Integer foo(Integer x) { return 1; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// FILE: main.kt
|
||||
import test.Test
|
||||
|
||||
fun main(x: Test) {
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int")!>x.Test3().foo(<!NULL_FOR_NONNULL_TYPE!>null<!>)<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int")!>x.Test3().Test5().foo(<!NULL_FOR_NONNULL_TYPE!>null<!>)<!>
|
||||
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int")!>Test.Test2().foo(<!NULL_FOR_NONNULL_TYPE!>null<!>)<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int")!>Test.Test2().Test5().foo(<!NULL_FOR_NONNULL_TYPE!>null<!>)<!>
|
||||
}
|
||||
+54
@@ -0,0 +1,54 @@
|
||||
package
|
||||
|
||||
public fun main(/*0*/ x: test.Test): kotlin.Unit
|
||||
|
||||
package test {
|
||||
|
||||
public open class Test {
|
||||
public constructor Test()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
|
||||
public open class Test2 {
|
||||
public constructor Test2()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open fun foo(/*0*/ x: kotlin.Int): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
|
||||
public open class Test4 {
|
||||
public constructor Test4()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open fun foo(/*0*/ x: kotlin.Int): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public open inner class Test5 {
|
||||
public constructor Test5()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open fun foo(/*0*/ x: kotlin.Int): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
}
|
||||
|
||||
public open inner class Test3 {
|
||||
public constructor Test3()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open fun foo(/*0*/ x: kotlin.Int): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
|
||||
public open inner class Test5 {
|
||||
public constructor Test5()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open fun foo(/*0*/ x: kotlin.Int): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
// ALLOW_KOTLIN_PACKAGE
|
||||
// JSPECIFY_STATE: strict
|
||||
|
||||
// FILE: sandbox/test/module-info.java
|
||||
import org.jspecify.nullness.NullMarked;
|
||||
|
||||
@NullMarked
|
||||
module sandbox {
|
||||
requires java9_annotations;
|
||||
exports test;
|
||||
}
|
||||
|
||||
// FILE: sandbox/test/Test.java
|
||||
package test;
|
||||
|
||||
import org.jspecify.nullness.Nullable;
|
||||
|
||||
public class Test {
|
||||
public void foo(@Nullable Integer x) {}
|
||||
}
|
||||
|
||||
// FILE: main.kt
|
||||
import test.Test
|
||||
|
||||
fun main(x: Test) {
|
||||
x.foo(null)
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
package
|
||||
|
||||
public fun main(/*0*/ x: test.Test): kotlin.Unit
|
||||
|
||||
package test {
|
||||
|
||||
public open class Test {
|
||||
public constructor Test()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open fun foo(/*0*/ @org.jspecify.nullness.Nullable x: @org.jspecify.nullness.Nullable kotlin.Int?): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
}
|
||||
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
// ALLOW_KOTLIN_PACKAGE
|
||||
// JSPECIFY_STATE: strict
|
||||
|
||||
// MODULE: module1
|
||||
// FILE: module1/module-info.java
|
||||
import org.jspecify.nullness.NullMarked;
|
||||
|
||||
@NullMarked
|
||||
module module1 {
|
||||
requires java9_annotations;
|
||||
exports test1;
|
||||
}
|
||||
|
||||
// FILE: module1/test1/Test.java
|
||||
package test1;
|
||||
|
||||
public class Test {
|
||||
public void foo(Integer x) {}
|
||||
}
|
||||
|
||||
// MODULE: module2(module1)
|
||||
// FILE: module2/module-info.java
|
||||
module module2 {
|
||||
requires module1;
|
||||
exports test2;
|
||||
}
|
||||
|
||||
// FILE: module2/test2/Test.java
|
||||
package test2;
|
||||
|
||||
public class Test {
|
||||
public void foo(Integer x) {}
|
||||
}
|
||||
|
||||
// FILE: main.kt
|
||||
fun main(x: test1.Test, y: test2.Test) {
|
||||
x.foo(<!NULL_FOR_NONNULL_TYPE!>null<!>)
|
||||
y.foo(null)
|
||||
}
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
// -- Module: <module1> --
|
||||
package
|
||||
|
||||
package test1 {
|
||||
|
||||
public open class Test {
|
||||
public constructor Test()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open fun foo(/*0*/ x: kotlin.Int): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
}
|
||||
|
||||
// -- Module: <module2> --
|
||||
package
|
||||
|
||||
public fun main(/*0*/ x: test1.Test, /*1*/ y: test2.Test): kotlin.Unit
|
||||
|
||||
package test2 {
|
||||
|
||||
public open class Test {
|
||||
public constructor Test()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open fun foo(/*0*/ x: kotlin.Int!): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
}
|
||||
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
// ALLOW_KOTLIN_PACKAGE
|
||||
|
||||
// FILE: sandbox/module-info.java
|
||||
import org.jspecify.nullness.NullMarked;
|
||||
|
||||
@NullMarked
|
||||
module sandbox {
|
||||
requires java9_annotations;
|
||||
exports test;
|
||||
}
|
||||
|
||||
// FILE: sandbox/test/Test.java
|
||||
package test;
|
||||
|
||||
public class Test {
|
||||
public void foo(Integer x) {}
|
||||
}
|
||||
|
||||
// FILE: main.kt
|
||||
import test.Test
|
||||
|
||||
fun main(x: Test) {
|
||||
x.foo(<!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>null<!>)
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
package
|
||||
|
||||
public fun main(/*0*/ x: test.Test): kotlin.Unit
|
||||
|
||||
package test {
|
||||
|
||||
public open class Test {
|
||||
public constructor Test()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open fun foo(/*0*/ x: kotlin.Int!): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
}
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
// ALLOW_KOTLIN_PACKAGE
|
||||
|
||||
// FILE: sandbox/test/module-info.java
|
||||
import org.jspecify.nullness.NullMarked;
|
||||
|
||||
@NullMarked
|
||||
module sandbox {
|
||||
requires java9_annotations;
|
||||
exports test;
|
||||
}
|
||||
|
||||
// FILE: sandbox/test/Test.java
|
||||
package test;
|
||||
|
||||
import org.jspecify.nullness.NullMarked;
|
||||
|
||||
@NullMarked
|
||||
public class Test {
|
||||
public void foo(Integer x) {}
|
||||
}
|
||||
|
||||
// FILE: main.kt
|
||||
import test.Test
|
||||
|
||||
fun main(x: Test) {
|
||||
x.foo(<!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>null<!>)
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
package
|
||||
|
||||
public fun main(/*0*/ x: test.Test): kotlin.Unit
|
||||
|
||||
package test {
|
||||
|
||||
@org.jspecify.nullness.NullMarked public open class Test {
|
||||
public constructor Test()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open fun foo(/*0*/ x: kotlin.Int!): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
}
|
||||
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
// ALLOW_KOTLIN_PACKAGE
|
||||
|
||||
// FILE: sandbox/module-info.java
|
||||
import org.jspecify.nullness.NullMarked;
|
||||
|
||||
@NullMarked
|
||||
module sandbox {
|
||||
requires java9_annotations;
|
||||
exports test;
|
||||
}
|
||||
|
||||
// FILE: sandbox/test/package-info.java
|
||||
@NullMarked
|
||||
package test;
|
||||
|
||||
import org.jspecify.nullness.NullMarked;
|
||||
|
||||
// FILE: sandbox/test/Test.java
|
||||
package test;
|
||||
|
||||
public class Test {
|
||||
public void foo(Integer x) {}
|
||||
}
|
||||
|
||||
// FILE: main.kt
|
||||
import test.Test
|
||||
|
||||
fun main(x: Test) {
|
||||
x.foo(<!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>null<!>)
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
package
|
||||
|
||||
public fun main(/*0*/ x: test.Test): kotlin.Unit
|
||||
|
||||
package test {
|
||||
|
||||
public open class Test {
|
||||
public constructor Test()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open fun foo(/*0*/ x: kotlin.Int!): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
}
|
||||
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
// ALLOW_KOTLIN_PACKAGE
|
||||
|
||||
// MODULE: module1
|
||||
// FILE: module1/module-info.java
|
||||
import org.jspecify.nullness.NullMarked;
|
||||
|
||||
@NullMarked
|
||||
module module1 {
|
||||
requires java9_annotations;
|
||||
}
|
||||
|
||||
// MODULE: module2(module1)
|
||||
// FILE: module2/module-info.java
|
||||
module module2 {
|
||||
requires module1;
|
||||
exports test2;
|
||||
}
|
||||
|
||||
// FILE: module2/test2/Test.java
|
||||
package test2;
|
||||
|
||||
public class Test {
|
||||
public void foo(Integer x) {}
|
||||
}
|
||||
|
||||
// FILE: main.kt
|
||||
fun main(y: test2.Test) {
|
||||
y.foo(null)
|
||||
}
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
// -- Module: <module1> --
|
||||
package
|
||||
|
||||
|
||||
// -- Module: <module2> --
|
||||
package
|
||||
|
||||
public fun main(/*0*/ y: test2.Test): kotlin.Unit
|
||||
|
||||
package test2 {
|
||||
|
||||
public open class Test {
|
||||
public constructor Test()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open fun foo(/*0*/ x: kotlin.Int!): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
}
|
||||
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
// ALLOW_KOTLIN_PACKAGE
|
||||
|
||||
// MODULE: module1
|
||||
// FILE: module1/module-info.java
|
||||
module module1 {
|
||||
}
|
||||
|
||||
// MODULE: module2(module1)
|
||||
// FILE: module2/module-info.java
|
||||
import org.jspecify.nullness.NullMarked;
|
||||
|
||||
@NullMarked
|
||||
module module2 {
|
||||
requires java9_annotations;
|
||||
requires module1;
|
||||
exports test2;
|
||||
}
|
||||
|
||||
// FILE: module2/test2/Test.java
|
||||
package test2;
|
||||
|
||||
public class Test {
|
||||
public void foo(Integer x) {}
|
||||
}
|
||||
|
||||
// FILE: main.kt
|
||||
fun main(y: test2.Test) {
|
||||
y.foo(<!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>null<!>)
|
||||
}
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
// -- Module: <module1> --
|
||||
package
|
||||
|
||||
|
||||
// -- Module: <module2> --
|
||||
package
|
||||
|
||||
public fun main(/*0*/ y: test2.Test): kotlin.Unit
|
||||
|
||||
package test2 {
|
||||
|
||||
public open class Test {
|
||||
public constructor Test()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open fun foo(/*0*/ x: kotlin.Int!): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
}
|
||||
|
||||
+43
@@ -0,0 +1,43 @@
|
||||
// ALLOW_KOTLIN_PACKAGE
|
||||
|
||||
// MODULE: sandbox
|
||||
// FILE: sandbox/module-info.java
|
||||
import org.jspecify.nullness.NullMarked;
|
||||
|
||||
@NullMarked
|
||||
module sandbox {
|
||||
requires java9_annotations;
|
||||
exports test;
|
||||
}
|
||||
|
||||
// FILE: sandbox/test/package-info.java
|
||||
package test;
|
||||
|
||||
// FILE: sandbox/test/Foo.java
|
||||
package test;
|
||||
|
||||
class Foo {}
|
||||
|
||||
// MODULE: sandbox2
|
||||
// FILE: sandbox2/module-info.java
|
||||
module sandbox2 {
|
||||
requires java9_annotations;
|
||||
exports test;
|
||||
}
|
||||
|
||||
// FILE: sandbox2/test/package-info.java
|
||||
package test;
|
||||
|
||||
// FILE: sandbox2/test/Test.java
|
||||
package test;
|
||||
|
||||
public class Test {
|
||||
public void foo(Integer x) {}
|
||||
}
|
||||
|
||||
// FILE: main.kt
|
||||
import test.Test
|
||||
|
||||
fun main(x: Test) {
|
||||
x.foo(null)
|
||||
}
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
// -- Module: <sandbox> --
|
||||
package
|
||||
|
||||
package test {
|
||||
|
||||
public/*package*/ open class Foo {
|
||||
public/*package*/ constructor Foo()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
}
|
||||
|
||||
// -- Module: <sandbox2> --
|
||||
package
|
||||
|
||||
public fun main(/*0*/ x: test.Test): kotlin.Unit
|
||||
|
||||
package test {
|
||||
|
||||
public open class Test {
|
||||
public constructor Test()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open fun foo(/*0*/ x: kotlin.Int!): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
}
|
||||
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
// ALLOW_KOTLIN_PACKAGE
|
||||
|
||||
// FILE: my.sand.box/module-info.java
|
||||
import org.jspecify.nullness.NullMarked;
|
||||
|
||||
@NullMarked
|
||||
open module my.sand.box {
|
||||
requires java9_annotations;
|
||||
exports my.test;
|
||||
}
|
||||
|
||||
// FILE: my.sand.box/my/test/Test.java
|
||||
package my.test;
|
||||
|
||||
public class Test {
|
||||
public void foo(Integer x) {}
|
||||
}
|
||||
|
||||
// FILE: main.kt
|
||||
import my.test.Test
|
||||
|
||||
fun main(x: Test) {
|
||||
x.foo(<!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>null<!>)
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
package
|
||||
|
||||
public fun main(/*0*/ x: my.test.Test): kotlin.Unit
|
||||
|
||||
package my {
|
||||
|
||||
package my.test {
|
||||
|
||||
public open class Test {
|
||||
public constructor Test()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open fun foo(/*0*/ x: kotlin.Int!): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+44
@@ -0,0 +1,44 @@
|
||||
// ALLOW_KOTLIN_PACKAGE
|
||||
|
||||
// MODULE: module1
|
||||
// FILE: module1/module-info.java
|
||||
import org.jspecify.nullness.NullMarked;
|
||||
|
||||
@NullMarked
|
||||
module module1 {
|
||||
requires java9_annotations;
|
||||
exports test1;
|
||||
}
|
||||
|
||||
// FILE: module1/test1/Test1.java
|
||||
package test1;
|
||||
|
||||
public class Test1 {
|
||||
public void foo(Integer x) {}
|
||||
}
|
||||
|
||||
// MODULE: module2(module1)
|
||||
// FILE: module2/module-info.java
|
||||
module module2 {
|
||||
requires module1;
|
||||
exports test2;
|
||||
}
|
||||
|
||||
// FILE: module2/test2/Test2.java
|
||||
package test2;
|
||||
|
||||
import test1.Test1;
|
||||
|
||||
public class Test2 extends Test1 {
|
||||
public void foo2(Integer x) {}
|
||||
}
|
||||
|
||||
// FILE: main.kt
|
||||
import test1.Test1
|
||||
import test2.Test2
|
||||
|
||||
fun main(x: Test1, y: Test2) {
|
||||
x.foo(<!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>null<!>)
|
||||
y.foo(<!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>null<!>)
|
||||
y.foo2(null)
|
||||
}
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
// -- Module: <module1> --
|
||||
package
|
||||
|
||||
package test1 {
|
||||
|
||||
public open class Test1 {
|
||||
public constructor Test1()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open fun foo(/*0*/ x: kotlin.Int!): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
}
|
||||
|
||||
// -- Module: <module2> --
|
||||
package
|
||||
|
||||
public fun main(/*0*/ x: test1.Test1, /*1*/ y: test2.Test2): kotlin.Unit
|
||||
|
||||
package test2 {
|
||||
|
||||
public open class Test2 : test1.Test1 {
|
||||
public constructor Test2()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun foo(/*0*/ p0: kotlin.Int!): kotlin.Unit
|
||||
public open fun foo2(/*0*/ x: kotlin.Int!): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
}
|
||||
|
||||
+42
@@ -0,0 +1,42 @@
|
||||
// ALLOW_KOTLIN_PACKAGE
|
||||
|
||||
// FILE: sandbox/module-info.java
|
||||
import org.jspecify.nullness.NullMarked;
|
||||
|
||||
@NullMarked
|
||||
module sandbox {
|
||||
requires java9_annotations;
|
||||
exports test;
|
||||
}
|
||||
|
||||
// FILE: sandbox/test/Test.java
|
||||
package test;
|
||||
|
||||
public class Test {
|
||||
public static class Test2 {
|
||||
public Integer foo(Integer x) { return 1; }
|
||||
public static class Test4 {
|
||||
public Integer foo(Integer x) { return 1; }
|
||||
}
|
||||
public class Test5 {
|
||||
public Integer foo(Integer x) { return 1; }
|
||||
}
|
||||
}
|
||||
public class Test3 {
|
||||
public Integer foo(Integer x) { return 1; }
|
||||
public class Test5 {
|
||||
public Integer foo(Integer x) { return 1; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// FILE: main.kt
|
||||
import test.Test
|
||||
|
||||
fun main(x: Test) {
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("(kotlin.Int..kotlin.Int?)")!>x.Test3().foo(<!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>null<!>)<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("(kotlin.Int..kotlin.Int?)")!>x.Test3().Test5().foo(<!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>null<!>)<!>
|
||||
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("(kotlin.Int..kotlin.Int?)")!>Test.Test2().foo(<!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>null<!>)<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("(kotlin.Int..kotlin.Int?)")!>Test.Test2().Test5().foo(<!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>null<!>)<!>
|
||||
}
|
||||
+54
@@ -0,0 +1,54 @@
|
||||
package
|
||||
|
||||
public fun main(/*0*/ x: test.Test): kotlin.Unit
|
||||
|
||||
package test {
|
||||
|
||||
public open class Test {
|
||||
public constructor Test()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
|
||||
public open class Test2 {
|
||||
public constructor Test2()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open fun foo(/*0*/ x: kotlin.Int!): kotlin.Int!
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
|
||||
public open class Test4 {
|
||||
public constructor Test4()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open fun foo(/*0*/ x: kotlin.Int!): kotlin.Int!
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public open inner class Test5 {
|
||||
public constructor Test5()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open fun foo(/*0*/ x: kotlin.Int!): kotlin.Int!
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
}
|
||||
|
||||
public open inner class Test3 {
|
||||
public constructor Test3()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open fun foo(/*0*/ x: kotlin.Int!): kotlin.Int!
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
|
||||
public open inner class Test5 {
|
||||
public constructor Test5()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open fun foo(/*0*/ x: kotlin.Int!): kotlin.Int!
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
// ALLOW_KOTLIN_PACKAGE
|
||||
|
||||
// FILE: sandbox/test/module-info.java
|
||||
import org.jspecify.nullness.NullMarked;
|
||||
|
||||
@NullMarked
|
||||
module sandbox {
|
||||
requires java9_annotations;
|
||||
exports test;
|
||||
}
|
||||
|
||||
// FILE: sandbox/test/Test.java
|
||||
package test;
|
||||
|
||||
import org.jspecify.nullness.Nullable;
|
||||
|
||||
public class Test {
|
||||
public void foo(@Nullable Integer x) {}
|
||||
}
|
||||
|
||||
// FILE: main.kt
|
||||
import test.Test
|
||||
|
||||
fun main(x: Test) {
|
||||
x.foo(null)
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
package
|
||||
|
||||
public fun main(/*0*/ x: test.Test): kotlin.Unit
|
||||
|
||||
package test {
|
||||
|
||||
public open class Test {
|
||||
public constructor Test()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open fun foo(/*0*/ @org.jspecify.nullness.Nullable x: @org.jspecify.nullness.Nullable kotlin.Int!): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
}
|
||||
|
||||
+38
@@ -0,0 +1,38 @@
|
||||
// ALLOW_KOTLIN_PACKAGE
|
||||
|
||||
// MODULE: module1
|
||||
// FILE: module1/module-info.java
|
||||
import org.jspecify.nullness.NullMarked;
|
||||
|
||||
@NullMarked
|
||||
module module1 {
|
||||
requires java9_annotations;
|
||||
exports test1;
|
||||
}
|
||||
|
||||
// FILE: module1/test1/Test.java
|
||||
package test1;
|
||||
|
||||
public class Test {
|
||||
public void foo(Integer x) {}
|
||||
}
|
||||
|
||||
// MODULE: module2(module1)
|
||||
// FILE: module2/module-info.java
|
||||
module module2 {
|
||||
requires module1;
|
||||
exports test2;
|
||||
}
|
||||
|
||||
// FILE: module2/test2/Test.java
|
||||
package test2;
|
||||
|
||||
public class Test {
|
||||
public void foo(Integer x) {}
|
||||
}
|
||||
|
||||
// FILE: main.kt
|
||||
fun main(x: test1.Test, y: test2.Test) {
|
||||
x.foo(<!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>null<!>)
|
||||
y.foo(null)
|
||||
}
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
// -- Module: <module1> --
|
||||
package
|
||||
|
||||
package test1 {
|
||||
|
||||
public open class Test {
|
||||
public constructor Test()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open fun foo(/*0*/ x: kotlin.Int!): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
}
|
||||
|
||||
// -- Module: <module2> --
|
||||
package
|
||||
|
||||
public fun main(/*0*/ x: test1.Test, /*1*/ y: test2.Test): kotlin.Unit
|
||||
|
||||
package test2 {
|
||||
|
||||
public open class Test {
|
||||
public constructor Test()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open fun foo(/*0*/ x: kotlin.Int!): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
-19
@@ -1,19 +0,0 @@
|
||||
// ALLOW_KOTLIN_PACKAGE
|
||||
|
||||
// FILE: module-info.java
|
||||
import org.jspecify.nullness.NullMarked;
|
||||
|
||||
@NullMarked
|
||||
module sandbox {
|
||||
requires java9_annotations;
|
||||
}
|
||||
|
||||
// FILE: Test.java
|
||||
public class Test {
|
||||
void foo(Integer x) {}
|
||||
}
|
||||
|
||||
// FILE: main.kt
|
||||
fun main(x: Test) {
|
||||
x.foo(1)
|
||||
}
|
||||
Vendored
-11
@@ -1,11 +0,0 @@
|
||||
package
|
||||
|
||||
public fun main(/*0*/ x: Test): kotlin.Unit
|
||||
|
||||
public open class Test {
|
||||
public constructor Test()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public/*package*/ open fun foo(/*0*/ x: kotlin.Int!): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
+169
-9
@@ -1070,16 +1070,176 @@ public class ForeignAnnotationsCompiledJavaTestGenerated extends AbstractForeign
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests"), Pattern.compile("^(.+)\\.kt$"), null, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("binaryModuleInfoAnnotation.kt")
|
||||
public void testBinaryModuleInfoAnnotation() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/binaryModuleInfoAnnotation.kt");
|
||||
}
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class Jspecify {
|
||||
@Test
|
||||
public void testAllFilesPresentInJspecify() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify"), Pattern.compile("^(.+)\\.kt$"), null, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("sourceModuleInfoAnnotation.kt")
|
||||
public void testSourceModuleInfoAnnotation() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/sourceModuleInfoAnnotation.kt");
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class ModuleAnnotations {
|
||||
@Test
|
||||
public void testAllFilesPresentInModuleAnnotations() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations"), Pattern.compile("^(.+)\\.kt$"), null, true);
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/strict")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class Strict {
|
||||
@Test
|
||||
public void testAllFilesPresentInStrict() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/strict"), Pattern.compile("^(.+)\\.kt$"), null, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("basic.kt")
|
||||
public void testBasic() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/strict/basic.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("composeWithClassDefaultAnnotation.kt")
|
||||
public void testComposeWithClassDefaultAnnotation() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/strict/composeWithClassDefaultAnnotation.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("composeWithPackageDefaultAnnotation.kt")
|
||||
public void testComposeWithPackageDefaultAnnotation() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/strict/composeWithPackageDefaultAnnotation.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("dependentModulesNoNullMarked.kt")
|
||||
public void testDependentModulesNoNullMarked() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/strict/dependentModulesNoNullMarked.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("dependentModulesNullMarked.kt")
|
||||
public void testDependentModulesNullMarked() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/strict/dependentModulesNullMarked.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("dontPropagateModuleAnnotationToAnotherModuleWithSamePackage.kt")
|
||||
public void testDontPropagateModuleAnnotationToAnotherModuleWithSamePackage() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/strict/dontPropagateModuleAnnotationToAnotherModuleWithSamePackage.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("dotNamedModule.kt")
|
||||
public void testDotNamedModule() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/strict/dotNamedModule.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("inheritanceAcrossModules.kt")
|
||||
public void testInheritanceAcrossModules() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/strict/inheritanceAcrossModules.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("nestedClasses.kt")
|
||||
public void testNestedClasses() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/strict/nestedClasses.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("overrideAtDeclarationLevel.kt")
|
||||
public void testOverrideAtDeclarationLevel() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/strict/overrideAtDeclarationLevel.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("severalModulesDifferentPackages.kt")
|
||||
public void testSeveralModulesDifferentPackages() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/strict/severalModulesDifferentPackages.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/warn")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class Warn {
|
||||
@Test
|
||||
public void testAllFilesPresentInWarn() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/warn"), Pattern.compile("^(.+)\\.kt$"), null, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("basic.kt")
|
||||
public void testBasic() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/warn/basic.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("composeWithClassDefaultAnnotation.kt")
|
||||
public void testComposeWithClassDefaultAnnotation() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/warn/composeWithClassDefaultAnnotation.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("composeWithPackageDefaultAnnotation.kt")
|
||||
public void testComposeWithPackageDefaultAnnotation() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/warn/composeWithPackageDefaultAnnotation.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("dependentModulesNoNullMarked.kt")
|
||||
public void testDependentModulesNoNullMarked() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/warn/dependentModulesNoNullMarked.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("dependentModulesNullMarked.kt")
|
||||
public void testDependentModulesNullMarked() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/warn/dependentModulesNullMarked.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("dontPropagateModuleAnnotationToAnotherModuleWithSamePackage.kt")
|
||||
public void testDontPropagateModuleAnnotationToAnotherModuleWithSamePackage() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/warn/dontPropagateModuleAnnotationToAnotherModuleWithSamePackage.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("dotNamedModule.kt")
|
||||
public void testDotNamedModule() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/warn/dotNamedModule.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("inheritanceAcrossModules.kt")
|
||||
public void testInheritanceAcrossModules() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/warn/inheritanceAcrossModules.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("nestedClasses.kt")
|
||||
public void testNestedClasses() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/warn/nestedClasses.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("overrideAtDeclarationLevel.kt")
|
||||
public void testOverrideAtDeclarationLevel() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/warn/overrideAtDeclarationLevel.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("severalModulesDifferentPackages.kt")
|
||||
public void testSeveralModulesDifferentPackages() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/warn/severalModulesDifferentPackages.kt");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+169
-9
@@ -1070,16 +1070,176 @@ public class ForeignAnnotationsCompiledJavaWithPsiClassReadingTestGenerated exte
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests"), Pattern.compile("^(.+)\\.kt$"), null, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("binaryModuleInfoAnnotation.kt")
|
||||
public void testBinaryModuleInfoAnnotation() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/binaryModuleInfoAnnotation.kt");
|
||||
}
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class Jspecify {
|
||||
@Test
|
||||
public void testAllFilesPresentInJspecify() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify"), Pattern.compile("^(.+)\\.kt$"), null, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("sourceModuleInfoAnnotation.kt")
|
||||
public void testSourceModuleInfoAnnotation() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/sourceModuleInfoAnnotation.kt");
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class ModuleAnnotations {
|
||||
@Test
|
||||
public void testAllFilesPresentInModuleAnnotations() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations"), Pattern.compile("^(.+)\\.kt$"), null, true);
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/strict")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class Strict {
|
||||
@Test
|
||||
public void testAllFilesPresentInStrict() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/strict"), Pattern.compile("^(.+)\\.kt$"), null, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("basic.kt")
|
||||
public void testBasic() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/strict/basic.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("composeWithClassDefaultAnnotation.kt")
|
||||
public void testComposeWithClassDefaultAnnotation() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/strict/composeWithClassDefaultAnnotation.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("composeWithPackageDefaultAnnotation.kt")
|
||||
public void testComposeWithPackageDefaultAnnotation() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/strict/composeWithPackageDefaultAnnotation.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("dependentModulesNoNullMarked.kt")
|
||||
public void testDependentModulesNoNullMarked() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/strict/dependentModulesNoNullMarked.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("dependentModulesNullMarked.kt")
|
||||
public void testDependentModulesNullMarked() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/strict/dependentModulesNullMarked.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("dontPropagateModuleAnnotationToAnotherModuleWithSamePackage.kt")
|
||||
public void testDontPropagateModuleAnnotationToAnotherModuleWithSamePackage() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/strict/dontPropagateModuleAnnotationToAnotherModuleWithSamePackage.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("dotNamedModule.kt")
|
||||
public void testDotNamedModule() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/strict/dotNamedModule.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("inheritanceAcrossModules.kt")
|
||||
public void testInheritanceAcrossModules() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/strict/inheritanceAcrossModules.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("nestedClasses.kt")
|
||||
public void testNestedClasses() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/strict/nestedClasses.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("overrideAtDeclarationLevel.kt")
|
||||
public void testOverrideAtDeclarationLevel() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/strict/overrideAtDeclarationLevel.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("severalModulesDifferentPackages.kt")
|
||||
public void testSeveralModulesDifferentPackages() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/strict/severalModulesDifferentPackages.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/warn")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class Warn {
|
||||
@Test
|
||||
public void testAllFilesPresentInWarn() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/warn"), Pattern.compile("^(.+)\\.kt$"), null, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("basic.kt")
|
||||
public void testBasic() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/warn/basic.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("composeWithClassDefaultAnnotation.kt")
|
||||
public void testComposeWithClassDefaultAnnotation() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/warn/composeWithClassDefaultAnnotation.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("composeWithPackageDefaultAnnotation.kt")
|
||||
public void testComposeWithPackageDefaultAnnotation() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/warn/composeWithPackageDefaultAnnotation.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("dependentModulesNoNullMarked.kt")
|
||||
public void testDependentModulesNoNullMarked() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/warn/dependentModulesNoNullMarked.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("dependentModulesNullMarked.kt")
|
||||
public void testDependentModulesNullMarked() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/warn/dependentModulesNullMarked.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("dontPropagateModuleAnnotationToAnotherModuleWithSamePackage.kt")
|
||||
public void testDontPropagateModuleAnnotationToAnotherModuleWithSamePackage() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/warn/dontPropagateModuleAnnotationToAnotherModuleWithSamePackage.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("dotNamedModule.kt")
|
||||
public void testDotNamedModule() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/warn/dotNamedModule.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("inheritanceAcrossModules.kt")
|
||||
public void testInheritanceAcrossModules() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/warn/inheritanceAcrossModules.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("nestedClasses.kt")
|
||||
public void testNestedClasses() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/warn/nestedClasses.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("overrideAtDeclarationLevel.kt")
|
||||
public void testOverrideAtDeclarationLevel() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/warn/overrideAtDeclarationLevel.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("severalModulesDifferentPackages.kt")
|
||||
public void testSeveralModulesDifferentPackages() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/warn/severalModulesDifferentPackages.kt");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+169
-9
@@ -1070,16 +1070,176 @@ public class ForeignAnnotationsSourceJavaTestGenerated extends AbstractForeignAn
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests"), Pattern.compile("^(.+)\\.kt$"), null, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("binaryModuleInfoAnnotation.kt")
|
||||
public void testBinaryModuleInfoAnnotation() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/binaryModuleInfoAnnotation.kt");
|
||||
}
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class Jspecify {
|
||||
@Test
|
||||
public void testAllFilesPresentInJspecify() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify"), Pattern.compile("^(.+)\\.kt$"), null, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("sourceModuleInfoAnnotation.kt")
|
||||
public void testSourceModuleInfoAnnotation() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/sourceModuleInfoAnnotation.kt");
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class ModuleAnnotations {
|
||||
@Test
|
||||
public void testAllFilesPresentInModuleAnnotations() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations"), Pattern.compile("^(.+)\\.kt$"), null, true);
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/strict")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class Strict {
|
||||
@Test
|
||||
public void testAllFilesPresentInStrict() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/strict"), Pattern.compile("^(.+)\\.kt$"), null, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("basic.kt")
|
||||
public void testBasic() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/strict/basic.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("composeWithClassDefaultAnnotation.kt")
|
||||
public void testComposeWithClassDefaultAnnotation() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/strict/composeWithClassDefaultAnnotation.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("composeWithPackageDefaultAnnotation.kt")
|
||||
public void testComposeWithPackageDefaultAnnotation() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/strict/composeWithPackageDefaultAnnotation.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("dependentModulesNoNullMarked.kt")
|
||||
public void testDependentModulesNoNullMarked() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/strict/dependentModulesNoNullMarked.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("dependentModulesNullMarked.kt")
|
||||
public void testDependentModulesNullMarked() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/strict/dependentModulesNullMarked.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("dontPropagateModuleAnnotationToAnotherModuleWithSamePackage.kt")
|
||||
public void testDontPropagateModuleAnnotationToAnotherModuleWithSamePackage() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/strict/dontPropagateModuleAnnotationToAnotherModuleWithSamePackage.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("dotNamedModule.kt")
|
||||
public void testDotNamedModule() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/strict/dotNamedModule.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("inheritanceAcrossModules.kt")
|
||||
public void testInheritanceAcrossModules() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/strict/inheritanceAcrossModules.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("nestedClasses.kt")
|
||||
public void testNestedClasses() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/strict/nestedClasses.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("overrideAtDeclarationLevel.kt")
|
||||
public void testOverrideAtDeclarationLevel() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/strict/overrideAtDeclarationLevel.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("severalModulesDifferentPackages.kt")
|
||||
public void testSeveralModulesDifferentPackages() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/strict/severalModulesDifferentPackages.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/warn")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class Warn {
|
||||
@Test
|
||||
public void testAllFilesPresentInWarn() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/warn"), Pattern.compile("^(.+)\\.kt$"), null, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("basic.kt")
|
||||
public void testBasic() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/warn/basic.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("composeWithClassDefaultAnnotation.kt")
|
||||
public void testComposeWithClassDefaultAnnotation() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/warn/composeWithClassDefaultAnnotation.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("composeWithPackageDefaultAnnotation.kt")
|
||||
public void testComposeWithPackageDefaultAnnotation() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/warn/composeWithPackageDefaultAnnotation.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("dependentModulesNoNullMarked.kt")
|
||||
public void testDependentModulesNoNullMarked() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/warn/dependentModulesNoNullMarked.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("dependentModulesNullMarked.kt")
|
||||
public void testDependentModulesNullMarked() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/warn/dependentModulesNullMarked.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("dontPropagateModuleAnnotationToAnotherModuleWithSamePackage.kt")
|
||||
public void testDontPropagateModuleAnnotationToAnotherModuleWithSamePackage() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/warn/dontPropagateModuleAnnotationToAnotherModuleWithSamePackage.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("dotNamedModule.kt")
|
||||
public void testDotNamedModule() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/warn/dotNamedModule.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("inheritanceAcrossModules.kt")
|
||||
public void testInheritanceAcrossModules() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/warn/inheritanceAcrossModules.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("nestedClasses.kt")
|
||||
public void testNestedClasses() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/warn/nestedClasses.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("overrideAtDeclarationLevel.kt")
|
||||
public void testOverrideAtDeclarationLevel() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/warn/overrideAtDeclarationLevel.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("severalModulesDifferentPackages.kt")
|
||||
public void testSeveralModulesDifferentPackages() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/jspecify/moduleAnnotations/warn/severalModulesDifferentPackages.kt");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+15
-7
@@ -19,10 +19,7 @@ package org.jetbrains.kotlin.load.java.typeEnhancement
|
||||
import org.jetbrains.kotlin.builtins.jvm.JavaToKotlinClassMap
|
||||
import org.jetbrains.kotlin.builtins.jvm.JavaToKotlinClassMapper
|
||||
import org.jetbrains.kotlin.descriptors.*
|
||||
import org.jetbrains.kotlin.descriptors.annotations.Annotated
|
||||
import org.jetbrains.kotlin.descriptors.annotations.AnnotationDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.annotations.Annotations
|
||||
import org.jetbrains.kotlin.descriptors.annotations.composeAnnotations
|
||||
import org.jetbrains.kotlin.descriptors.annotations.*
|
||||
import org.jetbrains.kotlin.load.java.*
|
||||
import org.jetbrains.kotlin.load.java.descriptors.*
|
||||
import org.jetbrains.kotlin.load.java.lazy.LazyJavaResolverContext
|
||||
@@ -36,8 +33,7 @@ import org.jetbrains.kotlin.load.kotlin.signature
|
||||
import org.jetbrains.kotlin.name.FqName
|
||||
import org.jetbrains.kotlin.resolve.constants.EnumValue
|
||||
import org.jetbrains.kotlin.resolve.deprecation.DEPRECATED_FUNCTION_KEY
|
||||
import org.jetbrains.kotlin.resolve.descriptorUtil.firstArgument
|
||||
import org.jetbrains.kotlin.resolve.descriptorUtil.fqNameOrNull
|
||||
import org.jetbrains.kotlin.resolve.descriptorUtil.*
|
||||
import org.jetbrains.kotlin.types.*
|
||||
import org.jetbrains.kotlin.types.checker.KotlinTypeChecker
|
||||
import org.jetbrains.kotlin.types.typeUtil.contains
|
||||
@@ -152,6 +148,18 @@ class SignatureEnhancement(
|
||||
}
|
||||
}
|
||||
|
||||
private fun <D : CallableMemberDescriptor> D.getDefaultAnnotations(c: LazyJavaResolverContext): Annotations {
|
||||
val topLevelClassifier = getTopLevelContainingClassifier() ?: return annotations
|
||||
val classId = topLevelClassifier.classId ?: return annotations
|
||||
val moduleAnnotations = c.components.javaModuleResolver.getModuleAnnotations(classId)
|
||||
|
||||
if (moduleAnnotations.isNullOrEmpty()) return annotations
|
||||
|
||||
val moduleAnnotationDescriptors = moduleAnnotations.map { LazyJavaAnnotationDescriptor(c, it, isFreshlySupportedAnnotation = true) }
|
||||
|
||||
return Annotations.create(annotations + moduleAnnotationDescriptors)
|
||||
}
|
||||
|
||||
private fun <D : CallableMemberDescriptor> D.enhanceSignature(c: LazyJavaResolverContext): D {
|
||||
// TODO type parameters
|
||||
// TODO use new type parameters while enhancing other types
|
||||
@@ -162,7 +170,7 @@ class SignatureEnhancement(
|
||||
// Fake overrides with one overridden has been enhanced before
|
||||
if (kind == CallableMemberDescriptor.Kind.FAKE_OVERRIDE && original.overriddenDescriptors.size == 1) return this
|
||||
|
||||
val memberContext = c.copyWithNewDefaultTypeQualifiers(annotations)
|
||||
val memberContext = c.copyWithNewDefaultTypeQualifiers(getDefaultAnnotations(c))
|
||||
|
||||
// When loading method as an override for a property, all annotations are stick to its getter
|
||||
val annotationOwnerForMember =
|
||||
|
||||
@@ -58,6 +58,20 @@ fun DeclarationDescriptor.isTopLevelInPackage(name: String, packageName: String)
|
||||
return packageName == packageFqName
|
||||
}
|
||||
|
||||
fun DeclarationDescriptor.isTopLevelInPackage() = containingDeclaration is PackageFragmentDescriptor
|
||||
|
||||
fun DeclarationDescriptor.getTopLevelContainingClassifier(): ClassifierDescriptor? {
|
||||
val containingDeclaration = containingDeclaration
|
||||
|
||||
if (containingDeclaration == null || this is PackageFragmentDescriptor) return null
|
||||
|
||||
return if (!containingDeclaration.isTopLevelInPackage()) {
|
||||
containingDeclaration.getTopLevelContainingClassifier()
|
||||
} else if (containingDeclaration is ClassifierDescriptor) {
|
||||
containingDeclaration
|
||||
} else null
|
||||
}
|
||||
|
||||
fun CallableDescriptor.isSupportedForCallableReference() = this is PropertyDescriptor || this is FunctionDescriptor
|
||||
|
||||
@OptIn(ExperimentalContracts::class)
|
||||
|
||||
Reference in New Issue
Block a user