Review fixes around type enhancement and loading type use annotations

This commit is contained in:
Victor Petukhov
2020-12-17 15:37:16 +03:00
parent 9a52863fbd
commit 48d9812d9e
19 changed files with 148 additions and 338 deletions
@@ -8,6 +8,7 @@ package org.jetbrains.kotlin.checkers;
import com.intellij.testFramework.TestDataPath;
import org.jetbrains.kotlin.test.JUnit3RunnerWithInners;
import org.jetbrains.kotlin.test.KotlinTestUtils;
import org.jetbrains.kotlin.test.util.KtTestUtil;
import org.jetbrains.kotlin.test.TestMetadata;
import org.junit.runner.RunWith;
@@ -25,7 +26,7 @@ public class ForeignAnnotationsCompiledJavaDiagnosticTestGenerated extends Abstr
}
public void testAllFilesPresentInTypeEnhancementOnCompiledJava() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/foreignAnnotationsJava8/tests/typeEnhancementOnCompiledJava"), Pattern.compile("^(.+)\\.kt$"), null, true);
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/foreignAnnotationsJava8/tests/typeEnhancementOnCompiledJava"), Pattern.compile("^(.+)\\.kt$"), null, true);
}
@TestMetadata("ClassTypeParameterBound.kt")
@@ -26,7 +26,7 @@ public class ForeignJava8AnnotationsNoAnnotationInClasspathTestGenerated extends
}
public void testAllFilesPresentInTests() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/foreignAnnotationsJava8/tests"), Pattern.compile("^(.+)\\.kt$"), null, true, "jspecify");
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/foreignAnnotationsJava8/tests"), Pattern.compile("^(.+)\\.kt$"), null, true, "jspecify", "typeEnhancementOnCompiledJava");
}
@TestMetadata("checkerFramework.kt")
@@ -129,47 +129,4 @@ public class ForeignJava8AnnotationsNoAnnotationInClasspathTestGenerated extends
runTest("compiler/testData/foreignAnnotationsJava8/tests/typeEnhancement/simple.kt");
}
}
@TestMetadata("compiler/testData/foreignAnnotationsJava8/tests/typeEnhancementOnCompiledJava")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class TypeEnhancementOnCompiledJava extends AbstractForeignJava8AnnotationsNoAnnotationInClasspathTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
}
public void testAllFilesPresentInTypeEnhancementOnCompiledJava() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/foreignAnnotationsJava8/tests/typeEnhancementOnCompiledJava"), Pattern.compile("^(.+)\\.kt$"), null, true);
}
@TestMetadata("ClassTypeParameterBound.kt")
public void testClassTypeParameterBound() throws Exception {
runTest("compiler/testData/foreignAnnotationsJava8/tests/typeEnhancementOnCompiledJava/ClassTypeParameterBound.kt");
}
@TestMetadata("ClassTypeParameterBoundWithWarnings.kt")
public void testClassTypeParameterBoundWithWarnings() throws Exception {
runTest("compiler/testData/foreignAnnotationsJava8/tests/typeEnhancementOnCompiledJava/ClassTypeParameterBoundWithWarnings.kt");
}
@TestMetadata("ReturnType.kt")
public void testReturnType() throws Exception {
runTest("compiler/testData/foreignAnnotationsJava8/tests/typeEnhancementOnCompiledJava/ReturnType.kt");
}
@TestMetadata("ReturnTypeWithWarnings.kt")
public void testReturnTypeWithWarnings() throws Exception {
runTest("compiler/testData/foreignAnnotationsJava8/tests/typeEnhancementOnCompiledJava/ReturnTypeWithWarnings.kt");
}
@TestMetadata("ValueParameter.kt")
public void testValueParameter() throws Exception {
runTest("compiler/testData/foreignAnnotationsJava8/tests/typeEnhancementOnCompiledJava/ValueParameter.kt");
}
@TestMetadata("ValueParameterWithWarnings.kt")
public void testValueParameterWithWarnings() throws Exception {
runTest("compiler/testData/foreignAnnotationsJava8/tests/typeEnhancementOnCompiledJava/ValueParameterWithWarnings.kt");
}
}
}
@@ -26,7 +26,7 @@ public class ForeignJava8AnnotationsNoAnnotationInClasspathWithPsiClassReadingTe
}
public void testAllFilesPresentInTests() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/foreignAnnotationsJava8/tests"), Pattern.compile("^(.+)\\.kt$"), null, true, "jspecify");
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/foreignAnnotationsJava8/tests"), Pattern.compile("^(.+)\\.kt$"), null, true, "jspecify", "typeEnhancementOnCompiledJava");
}
@TestMetadata("checkerFramework.kt")
@@ -129,47 +129,4 @@ public class ForeignJava8AnnotationsNoAnnotationInClasspathWithPsiClassReadingTe
runTest("compiler/testData/foreignAnnotationsJava8/tests/typeEnhancement/simple.kt");
}
}
@TestMetadata("compiler/testData/foreignAnnotationsJava8/tests/typeEnhancementOnCompiledJava")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class TypeEnhancementOnCompiledJava extends AbstractForeignJava8AnnotationsNoAnnotationInClasspathWithPsiClassReadingTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
}
public void testAllFilesPresentInTypeEnhancementOnCompiledJava() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/foreignAnnotationsJava8/tests/typeEnhancementOnCompiledJava"), Pattern.compile("^(.+)\\.kt$"), null, true);
}
@TestMetadata("ClassTypeParameterBound.kt")
public void testClassTypeParameterBound() throws Exception {
runTest("compiler/testData/foreignAnnotationsJava8/tests/typeEnhancementOnCompiledJava/ClassTypeParameterBound.kt");
}
@TestMetadata("ClassTypeParameterBoundWithWarnings.kt")
public void testClassTypeParameterBoundWithWarnings() throws Exception {
runTest("compiler/testData/foreignAnnotationsJava8/tests/typeEnhancementOnCompiledJava/ClassTypeParameterBoundWithWarnings.kt");
}
@TestMetadata("ReturnType.kt")
public void testReturnType() throws Exception {
runTest("compiler/testData/foreignAnnotationsJava8/tests/typeEnhancementOnCompiledJava/ReturnType.kt");
}
@TestMetadata("ReturnTypeWithWarnings.kt")
public void testReturnTypeWithWarnings() throws Exception {
runTest("compiler/testData/foreignAnnotationsJava8/tests/typeEnhancementOnCompiledJava/ReturnTypeWithWarnings.kt");
}
@TestMetadata("ValueParameter.kt")
public void testValueParameter() throws Exception {
runTest("compiler/testData/foreignAnnotationsJava8/tests/typeEnhancementOnCompiledJava/ValueParameter.kt");
}
@TestMetadata("ValueParameterWithWarnings.kt")
public void testValueParameterWithWarnings() throws Exception {
runTest("compiler/testData/foreignAnnotationsJava8/tests/typeEnhancementOnCompiledJava/ValueParameterWithWarnings.kt");
}
}
}
@@ -26,7 +26,7 @@ public class ForeignJava8AnnotationsTestGenerated extends AbstractForeignJava8An
}
public void testAllFilesPresentInTests() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/foreignAnnotationsJava8/tests"), Pattern.compile("^(.+)\\.kt$"), null, true, "jspecify");
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/foreignAnnotationsJava8/tests"), Pattern.compile("^(.+)\\.kt$"), null, true, "jspecify", "typeEnhancementOnCompiledJava");
}
@TestMetadata("checkerFramework.kt")
@@ -129,47 +129,4 @@ public class ForeignJava8AnnotationsTestGenerated extends AbstractForeignJava8An
runTest("compiler/testData/foreignAnnotationsJava8/tests/typeEnhancement/simple.kt");
}
}
@TestMetadata("compiler/testData/foreignAnnotationsJava8/tests/typeEnhancementOnCompiledJava")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class TypeEnhancementOnCompiledJava extends AbstractForeignJava8AnnotationsTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
}
public void testAllFilesPresentInTypeEnhancementOnCompiledJava() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/foreignAnnotationsJava8/tests/typeEnhancementOnCompiledJava"), Pattern.compile("^(.+)\\.kt$"), null, true);
}
@TestMetadata("ClassTypeParameterBound.kt")
public void testClassTypeParameterBound() throws Exception {
runTest("compiler/testData/foreignAnnotationsJava8/tests/typeEnhancementOnCompiledJava/ClassTypeParameterBound.kt");
}
@TestMetadata("ClassTypeParameterBoundWithWarnings.kt")
public void testClassTypeParameterBoundWithWarnings() throws Exception {
runTest("compiler/testData/foreignAnnotationsJava8/tests/typeEnhancementOnCompiledJava/ClassTypeParameterBoundWithWarnings.kt");
}
@TestMetadata("ReturnType.kt")
public void testReturnType() throws Exception {
runTest("compiler/testData/foreignAnnotationsJava8/tests/typeEnhancementOnCompiledJava/ReturnType.kt");
}
@TestMetadata("ReturnTypeWithWarnings.kt")
public void testReturnTypeWithWarnings() throws Exception {
runTest("compiler/testData/foreignAnnotationsJava8/tests/typeEnhancementOnCompiledJava/ReturnTypeWithWarnings.kt");
}
@TestMetadata("ValueParameter.kt")
public void testValueParameter() throws Exception {
runTest("compiler/testData/foreignAnnotationsJava8/tests/typeEnhancementOnCompiledJava/ValueParameter.kt");
}
@TestMetadata("ValueParameterWithWarnings.kt")
public void testValueParameterWithWarnings() throws Exception {
runTest("compiler/testData/foreignAnnotationsJava8/tests/typeEnhancementOnCompiledJava/ValueParameterWithWarnings.kt");
}
}
}
@@ -26,7 +26,7 @@ public class JavacForeignJava8AnnotationsTestGenerated extends AbstractJavacFore
}
public void testAllFilesPresentInTests() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/foreignAnnotationsJava8/tests"), Pattern.compile("^(.+)\\.kt$"), null, true, "jspecify");
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/foreignAnnotationsJava8/tests"), Pattern.compile("^(.+)\\.kt$"), null, true, "jspecify", "typeEnhancementOnCompiledJava");
}
@TestMetadata("checkerFramework.kt")
@@ -129,47 +129,4 @@ public class JavacForeignJava8AnnotationsTestGenerated extends AbstractJavacFore
runTest("compiler/testData/foreignAnnotationsJava8/tests/typeEnhancement/simple.kt");
}
}
@TestMetadata("compiler/testData/foreignAnnotationsJava8/tests/typeEnhancementOnCompiledJava")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class TypeEnhancementOnCompiledJava extends AbstractJavacForeignJava8AnnotationsTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
}
public void testAllFilesPresentInTypeEnhancementOnCompiledJava() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/foreignAnnotationsJava8/tests/typeEnhancementOnCompiledJava"), Pattern.compile("^(.+)\\.kt$"), null, true);
}
@TestMetadata("ClassTypeParameterBound.kt")
public void testClassTypeParameterBound() throws Exception {
runTest("compiler/testData/foreignAnnotationsJava8/tests/typeEnhancementOnCompiledJava/ClassTypeParameterBound.kt");
}
@TestMetadata("ClassTypeParameterBoundWithWarnings.kt")
public void testClassTypeParameterBoundWithWarnings() throws Exception {
runTest("compiler/testData/foreignAnnotationsJava8/tests/typeEnhancementOnCompiledJava/ClassTypeParameterBoundWithWarnings.kt");
}
@TestMetadata("ReturnType.kt")
public void testReturnType() throws Exception {
runTest("compiler/testData/foreignAnnotationsJava8/tests/typeEnhancementOnCompiledJava/ReturnType.kt");
}
@TestMetadata("ReturnTypeWithWarnings.kt")
public void testReturnTypeWithWarnings() throws Exception {
runTest("compiler/testData/foreignAnnotationsJava8/tests/typeEnhancementOnCompiledJava/ReturnTypeWithWarnings.kt");
}
@TestMetadata("ValueParameter.kt")
public void testValueParameter() throws Exception {
runTest("compiler/testData/foreignAnnotationsJava8/tests/typeEnhancementOnCompiledJava/ValueParameter.kt");
}
@TestMetadata("ValueParameterWithWarnings.kt")
public void testValueParameterWithWarnings() throws Exception {
runTest("compiler/testData/foreignAnnotationsJava8/tests/typeEnhancementOnCompiledJava/ValueParameterWithWarnings.kt");
}
}
}
@@ -30,19 +30,22 @@ fun main(args: Array<String>) {
generateTestGroupSuite(args) {
testGroup("compiler/tests-java8/tests", "compiler/testData") {
testClass<AbstractForeignJava8AnnotationsTest> {
model("foreignAnnotationsJava8/tests", excludeDirs = listOf("jspecify"))
model("foreignAnnotationsJava8/tests", excludeDirs = listOf("jspecify", "typeEnhancementOnCompiledJava"))
}
testClass<AbstractJavacForeignJava8AnnotationsTest> {
model("foreignAnnotationsJava8/tests", excludeDirs = listOf("jspecify"))
model("foreignAnnotationsJava8/tests", excludeDirs = listOf("jspecify", "typeEnhancementOnCompiledJava"))
}
testClass<AbstractForeignJava8AnnotationsNoAnnotationInClasspathTest> {
model("foreignAnnotationsJava8/tests", excludeDirs = listOf("jspecify"))
model("foreignAnnotationsJava8/tests", excludeDirs = listOf("jspecify", "typeEnhancementOnCompiledJava"))
}
testClass<AbstractForeignJava8AnnotationsNoAnnotationInClasspathWithPsiClassReadingTest> {
model("foreignAnnotationsJava8/tests", excludeDirs = listOf("jspecify"))
model(
"foreignAnnotationsJava8/tests",
excludeDirs = listOf("jspecify", "typeEnhancementOnCompiledJava")
)
}
testClass<AbstractJspecifyAnnotationsTest> {
@@ -55,7 +55,7 @@ public class LoadJava8TestGenerated extends AbstractLoadJava8Test {
}
public void testAllFilesPresentInTypeParameterAnnotations() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/loadJava8/compiledJava/typeParameterAnnotations"), Pattern.compile("^(.+)\\.java$"), null, true);
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/loadJava8/compiledJava/typeParameterAnnotations"), Pattern.compile("^(.+)\\.java$"), null, true);
}
@TestMetadata("Basic.java")
@@ -78,7 +78,7 @@ public class LoadJava8TestGenerated extends AbstractLoadJava8Test {
}
public void testAllFilesPresentInTypeUseAnnotations() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/loadJava8/compiledJava/typeUseAnnotations"), Pattern.compile("^(.+)\\.java$"), null, true);
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/loadJava8/compiledJava/typeUseAnnotations"), Pattern.compile("^(.+)\\.java$"), null, true);
}
@TestMetadata("BaseClassTypeArguments.java")
@@ -154,7 +154,7 @@ public class LoadJava8TestGenerated extends AbstractLoadJava8Test {
}
public void testAllFilesPresentInTypeParameterAnnotations() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/loadJava8/sourceJava/typeParameterAnnotations"), Pattern.compile("^(.+)\\.java$"), null, true);
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/loadJava8/sourceJava/typeParameterAnnotations"), Pattern.compile("^(.+)\\.java$"), null, true);
}
@TestMetadata("Basic.java")
@@ -177,7 +177,7 @@ public class LoadJava8TestGenerated extends AbstractLoadJava8Test {
}
public void testAllFilesPresentInTypeUseAnnotations() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/loadJava8/sourceJava/typeUseAnnotations"), Pattern.compile("^(.+)\\.java$"), null, true);
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/loadJava8/sourceJava/typeUseAnnotations"), Pattern.compile("^(.+)\\.java$"), null, true);
}
@TestMetadata("BaseClassTypeArguments.java")