Add basic Java 9 module tests

This commit is contained in:
Victor Petukhov
2021-04-15 11:30:10 +03:00
parent 757fdb2b32
commit cdcde634e8
8 changed files with 116 additions and 126 deletions
@@ -0,0 +1,18 @@
// 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)
}
@@ -0,0 +1,11 @@
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
}
@@ -0,0 +1,19 @@
// 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)
}
@@ -0,0 +1,11 @@
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
}
@@ -1059,51 +1059,27 @@ public class ForeignAnnotationsNoAnnotationInClasspathTestGenerated extends Abst
}
}
}
}
@Nested
@TestMetadata("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/typeEnhancementOnCompiledJava")
@TestDataPath("$PROJECT_ROOT")
public class TypeEnhancementOnCompiledJava {
@Test
public void testAllFilesPresentInTypeEnhancementOnCompiledJava() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/typeEnhancementOnCompiledJava"), Pattern.compile("^(.+)\\.kt$"), null, true);
}
@Nested
@TestMetadata("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests")
@TestDataPath("$PROJECT_ROOT")
public class Java9Tests {
@Test
public void testAllFilesPresentInJava9Tests() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests"), Pattern.compile("^(.+)\\.kt$"), null, true);
}
@Test
@TestMetadata("ClassTypeParameterBound.kt")
public void testClassTypeParameterBound() throws Exception {
runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/typeEnhancementOnCompiledJava/ClassTypeParameterBound.kt");
}
@Test
@TestMetadata("binaryModuleInfoAnnotation.kt")
public void testBinaryModuleInfoAnnotation() throws Exception {
runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/binaryModuleInfoAnnotation.kt");
}
@Test
@TestMetadata("ClassTypeParameterBoundWithWarnings.kt")
public void testClassTypeParameterBoundWithWarnings() throws Exception {
runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/typeEnhancementOnCompiledJava/ClassTypeParameterBoundWithWarnings.kt");
}
@Test
@TestMetadata("ReturnType.kt")
public void testReturnType() throws Exception {
runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/typeEnhancementOnCompiledJava/ReturnType.kt");
}
@Test
@TestMetadata("ReturnTypeWithWarnings.kt")
public void testReturnTypeWithWarnings() throws Exception {
runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/typeEnhancementOnCompiledJava/ReturnTypeWithWarnings.kt");
}
@Test
@TestMetadata("ValueParameter.kt")
public void testValueParameter() throws Exception {
runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/typeEnhancementOnCompiledJava/ValueParameter.kt");
}
@Test
@TestMetadata("ValueParameterWithWarnings.kt")
public void testValueParameterWithWarnings() throws Exception {
runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/typeEnhancementOnCompiledJava/ValueParameterWithWarnings.kt");
}
@Test
@TestMetadata("sourceModuleInfoAnnotation.kt")
public void testSourceModuleInfoAnnotation() throws Exception {
runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/sourceModuleInfoAnnotation.kt");
}
}
}
@@ -1059,51 +1059,27 @@ public class ForeignAnnotationsNoAnnotationInClasspathWithPsiClassReadingTestGen
}
}
}
}
@Nested
@TestMetadata("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/typeEnhancementOnCompiledJava")
@TestDataPath("$PROJECT_ROOT")
public class TypeEnhancementOnCompiledJava {
@Test
public void testAllFilesPresentInTypeEnhancementOnCompiledJava() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/typeEnhancementOnCompiledJava"), Pattern.compile("^(.+)\\.kt$"), null, true);
}
@Nested
@TestMetadata("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests")
@TestDataPath("$PROJECT_ROOT")
public class Java9Tests {
@Test
public void testAllFilesPresentInJava9Tests() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests"), Pattern.compile("^(.+)\\.kt$"), null, true);
}
@Test
@TestMetadata("ClassTypeParameterBound.kt")
public void testClassTypeParameterBound() throws Exception {
runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/typeEnhancementOnCompiledJava/ClassTypeParameterBound.kt");
}
@Test
@TestMetadata("binaryModuleInfoAnnotation.kt")
public void testBinaryModuleInfoAnnotation() throws Exception {
runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/binaryModuleInfoAnnotation.kt");
}
@Test
@TestMetadata("ClassTypeParameterBoundWithWarnings.kt")
public void testClassTypeParameterBoundWithWarnings() throws Exception {
runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/typeEnhancementOnCompiledJava/ClassTypeParameterBoundWithWarnings.kt");
}
@Test
@TestMetadata("ReturnType.kt")
public void testReturnType() throws Exception {
runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/typeEnhancementOnCompiledJava/ReturnType.kt");
}
@Test
@TestMetadata("ReturnTypeWithWarnings.kt")
public void testReturnTypeWithWarnings() throws Exception {
runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/typeEnhancementOnCompiledJava/ReturnTypeWithWarnings.kt");
}
@Test
@TestMetadata("ValueParameter.kt")
public void testValueParameter() throws Exception {
runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/typeEnhancementOnCompiledJava/ValueParameter.kt");
}
@Test
@TestMetadata("ValueParameterWithWarnings.kt")
public void testValueParameterWithWarnings() throws Exception {
runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/typeEnhancementOnCompiledJava/ValueParameterWithWarnings.kt");
}
@Test
@TestMetadata("sourceModuleInfoAnnotation.kt")
public void testSourceModuleInfoAnnotation() throws Exception {
runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/sourceModuleInfoAnnotation.kt");
}
}
}
@@ -1059,51 +1059,27 @@ public class ForeignAnnotationsTestGenerated extends AbstractForeignAnnotationsT
}
}
}
}
@Nested
@TestMetadata("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/typeEnhancementOnCompiledJava")
@TestDataPath("$PROJECT_ROOT")
public class TypeEnhancementOnCompiledJava {
@Test
public void testAllFilesPresentInTypeEnhancementOnCompiledJava() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/typeEnhancementOnCompiledJava"), Pattern.compile("^(.+)\\.kt$"), null, true);
}
@Nested
@TestMetadata("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests")
@TestDataPath("$PROJECT_ROOT")
public class Java9Tests {
@Test
public void testAllFilesPresentInJava9Tests() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests"), Pattern.compile("^(.+)\\.kt$"), null, true);
}
@Test
@TestMetadata("ClassTypeParameterBound.kt")
public void testClassTypeParameterBound() throws Exception {
runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/typeEnhancementOnCompiledJava/ClassTypeParameterBound.kt");
}
@Test
@TestMetadata("binaryModuleInfoAnnotation.kt")
public void testBinaryModuleInfoAnnotation() throws Exception {
runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/binaryModuleInfoAnnotation.kt");
}
@Test
@TestMetadata("ClassTypeParameterBoundWithWarnings.kt")
public void testClassTypeParameterBoundWithWarnings() throws Exception {
runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/typeEnhancementOnCompiledJava/ClassTypeParameterBoundWithWarnings.kt");
}
@Test
@TestMetadata("ReturnType.kt")
public void testReturnType() throws Exception {
runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/typeEnhancementOnCompiledJava/ReturnType.kt");
}
@Test
@TestMetadata("ReturnTypeWithWarnings.kt")
public void testReturnTypeWithWarnings() throws Exception {
runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/typeEnhancementOnCompiledJava/ReturnTypeWithWarnings.kt");
}
@Test
@TestMetadata("ValueParameter.kt")
public void testValueParameter() throws Exception {
runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/typeEnhancementOnCompiledJava/ValueParameter.kt");
}
@Test
@TestMetadata("ValueParameterWithWarnings.kt")
public void testValueParameterWithWarnings() throws Exception {
runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/typeEnhancementOnCompiledJava/ValueParameterWithWarnings.kt");
}
@Test
@TestMetadata("sourceModuleInfoAnnotation.kt")
public void testSourceModuleInfoAnnotation() throws Exception {
runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java9Tests/sourceModuleInfoAnnotation.kt");
}
}
}
@@ -50,16 +50,19 @@ fun generateJUnit5CompilerTests(args: Array<String>) {
testClass<AbstractForeignAnnotationsTest> {
model("diagnostics/foreignAnnotationsTests/tests")
model("diagnostics/foreignAnnotationsTests/java8Tests")
model("diagnostics/foreignAnnotationsTests/java9Tests")
}
testClass<AbstractForeignAnnotationsNoAnnotationInClasspathTest> {
model("diagnostics/foreignAnnotationsTests/tests")
model("diagnostics/foreignAnnotationsTests/java8Tests")
model("diagnostics/foreignAnnotationsTests/java9Tests")
}
testClass<AbstractForeignAnnotationsNoAnnotationInClasspathWithPsiClassReadingTest> {
model("diagnostics/foreignAnnotationsTests/tests")
model("diagnostics/foreignAnnotationsTests/java8Tests")
model("diagnostics/foreignAnnotationsTests/java9Tests")
}
testClass<AbstractBlackBoxCodegenTest> {