mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-05-16 08:31:35 +00:00
Rework jspecify tests
1) Add Java use sites which are similar to Kotlin use sites; 2) Use the new test format: separated Java and Kotlin sources (Java declarations + use sites and Kotlin corresponding use sites), Java declarations + use sites will be a sharable test suite; 3) Remove any dependencies from Java sources except `Object` and jspecify annotations; 4) Introduce a new test runner which compiles Java and Kotlin sources together and dumps all descriptors.
This commit is contained in:
15
compiler/testData/foreignAnnotationsJava8/tests/jspecify/java/testDefaults/DefaultsA.java
vendored
Normal file
15
compiler/testData/foreignAnnotationsJava8/tests/jspecify/java/testDefaults/DefaultsA.java
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
import org.jspecify.annotations.*;
|
||||
|
||||
@DefaultNotNull
|
||||
public class DefaultsA {
|
||||
static class Test {
|
||||
public Test foo() { return null; }
|
||||
}
|
||||
|
||||
public Test defaultField = null;
|
||||
@Nullable public Test field = null;
|
||||
|
||||
public Test everythingNotNullable(Test x) { return null; }
|
||||
|
||||
public Test explicitlyNullnessUnspecified(@NullnessUnspecified Test x) { return null; }
|
||||
}
|
||||
13
compiler/testData/foreignAnnotationsJava8/tests/jspecify/java/testDefaults/DefaultsB.java
vendored
Normal file
13
compiler/testData/foreignAnnotationsJava8/tests/jspecify/java/testDefaults/DefaultsB.java
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
public class DefaultsB {
|
||||
static void main(DefaultsA a) {
|
||||
a.everythingNotNullable(null).foo();
|
||||
a.everythingNotNullable(new DefaultsA.Test()).foo();
|
||||
|
||||
a.explicitlyNullnessUnspecified(new DefaultsA.Test()).foo();
|
||||
a.explicitlyNullnessUnspecified(null).foo();
|
||||
|
||||
a.defaultField.foo();
|
||||
|
||||
a.field.foo();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user