Support reading from class files of the type use annotations on type parameters and type arguments

^KT-11454 Fixed
This commit is contained in:
Victor Petukhov
2020-12-01 18:21:44 +03:00
parent 0833719a79
commit a89329e077
54 changed files with 2077 additions and 262 deletions
@@ -46,14 +46,70 @@ public class LoadJava8TestGenerated extends AbstractLoadJava8Test {
runTest("compiler/testData/loadJava8/compiledJava/ParameterNames.java");
}
@TestMetadata("TypeAnnotations.java")
public void testTypeAnnotations() throws Exception {
runTest("compiler/testData/loadJava8/compiledJava/TypeAnnotations.java");
@TestMetadata("compiler/testData/loadJava8/compiledJava/typeParameterAnnotations")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class TypeParameterAnnotations extends AbstractLoadJava8Test {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTestCompiledJava, this, testDataFilePath);
}
public void testAllFilesPresentInTypeParameterAnnotations() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/loadJava8/compiledJava/typeParameterAnnotations"), Pattern.compile("^(.+)\\.java$"), null, true);
}
@TestMetadata("Basic.java")
public void testBasic() throws Exception {
runTest("compiler/testData/loadJava8/compiledJava/typeParameterAnnotations/Basic.java");
}
}
@TestMetadata("TypeParameterAnnotations.java")
public void testTypeParameterAnnotations() throws Exception {
runTest("compiler/testData/loadJava8/compiledJava/TypeParameterAnnotations.java");
@TestMetadata("compiler/testData/loadJava8/compiledJava/typeUseAnnotations")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class TypeUseAnnotations extends AbstractLoadJava8Test {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTestCompiledJava, this, testDataFilePath);
}
public void testAllFilesPresentInTypeUseAnnotations() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/loadJava8/compiledJava/typeUseAnnotations"), Pattern.compile("^(.+)\\.java$"), null, true);
}
@TestMetadata("BaseClassTypeArguments.java")
public void testBaseClassTypeArguments() throws Exception {
runTest("compiler/testData/loadJava8/compiledJava/typeUseAnnotations/BaseClassTypeArguments.java");
}
@TestMetadata("Basic.java")
public void testBasic() throws Exception {
runTest("compiler/testData/loadJava8/compiledJava/typeUseAnnotations/Basic.java");
}
@TestMetadata("ClassTypeParameterBounds.java")
public void testClassTypeParameterBounds() throws Exception {
runTest("compiler/testData/loadJava8/compiledJava/typeUseAnnotations/ClassTypeParameterBounds.java");
}
@TestMetadata("MethodReceiver.java")
public void testMethodReceiver() throws Exception {
runTest("compiler/testData/loadJava8/compiledJava/typeUseAnnotations/MethodReceiver.java");
}
@TestMetadata("MethodTypeParameterBounds.java")
public void testMethodTypeParameterBounds() throws Exception {
runTest("compiler/testData/loadJava8/compiledJava/typeUseAnnotations/MethodTypeParameterBounds.java");
}
@TestMetadata("ReturnType.java")
public void testReturnType() throws Exception {
runTest("compiler/testData/loadJava8/compiledJava/typeUseAnnotations/ReturnType.java");
}
@TestMetadata("ValueArguments.java")
public void testValueArguments() throws Exception {
runTest("compiler/testData/loadJava8/compiledJava/typeUseAnnotations/ValueArguments.java");
}
}
}
@@ -74,14 +130,75 @@ public class LoadJava8TestGenerated extends AbstractLoadJava8Test {
runTest("compiler/testData/loadJava8/sourceJava/MapRemove.java");
}
@TestMetadata("TypeAnnotations.java")
public void testTypeAnnotations() throws Exception {
runTest("compiler/testData/loadJava8/sourceJava/TypeAnnotations.java");
}
@TestMetadata("TypeParameterAnnotations.java")
public void testTypeParameterAnnotations() throws Exception {
runTest("compiler/testData/loadJava8/sourceJava/TypeParameterAnnotations.java");
}
@TestMetadata("compiler/testData/loadJava8/sourceJava/typeParameterAnnotations")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class TypeParameterAnnotations extends AbstractLoadJava8Test {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTestSourceJava, this, testDataFilePath);
}
public void testAllFilesPresentInTypeParameterAnnotations() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/loadJava8/sourceJava/typeParameterAnnotations"), Pattern.compile("^(.+)\\.java$"), null, true);
}
@TestMetadata("Basic.java")
public void testBasic() throws Exception {
runTest("compiler/testData/loadJava8/sourceJava/typeParameterAnnotations/Basic.java");
}
}
@TestMetadata("compiler/testData/loadJava8/sourceJava/typeUseAnnotations")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class TypeUseAnnotations extends AbstractLoadJava8Test {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTestSourceJava, this, testDataFilePath);
}
public void testAllFilesPresentInTypeUseAnnotations() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/loadJava8/sourceJava/typeUseAnnotations"), Pattern.compile("^(.+)\\.java$"), null, true);
}
@TestMetadata("BaseClassTypeArguments.java")
public void testBaseClassTypeArguments() throws Exception {
runTest("compiler/testData/loadJava8/sourceJava/typeUseAnnotations/BaseClassTypeArguments.java");
}
@TestMetadata("Basic.java")
public void testBasic() throws Exception {
runTest("compiler/testData/loadJava8/sourceJava/typeUseAnnotations/Basic.java");
}
@TestMetadata("ClassTypeParameterBounds.java")
public void testClassTypeParameterBounds() throws Exception {
runTest("compiler/testData/loadJava8/sourceJava/typeUseAnnotations/ClassTypeParameterBounds.java");
}
@TestMetadata("MethodReceiver.java")
public void testMethodReceiver() throws Exception {
runTest("compiler/testData/loadJava8/sourceJava/typeUseAnnotations/MethodReceiver.java");
}
@TestMetadata("MethodTypeParameterBounds.java")
public void testMethodTypeParameterBounds() throws Exception {
runTest("compiler/testData/loadJava8/sourceJava/typeUseAnnotations/MethodTypeParameterBounds.java");
}
@TestMetadata("ReturnType.java")
public void testReturnType() throws Exception {
runTest("compiler/testData/loadJava8/sourceJava/typeUseAnnotations/ReturnType.java");
}
@TestMetadata("ValueArguments.java")
public void testValueArguments() throws Exception {
runTest("compiler/testData/loadJava8/sourceJava/typeUseAnnotations/ValueArguments.java");
}
}
}
}
@@ -44,13 +44,69 @@ public class LoadJava8WithPsiClassReadingTestGenerated extends AbstractLoadJava8
runTest("compiler/testData/loadJava8/compiledJava/ParameterNames.java");
}
@TestMetadata("TypeAnnotations.java")
public void testTypeAnnotations() throws Exception {
runTest("compiler/testData/loadJava8/compiledJava/TypeAnnotations.java");
@TestMetadata("compiler/testData/loadJava8/compiledJava/typeParameterAnnotations")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class TypeParameterAnnotations extends AbstractLoadJava8WithPsiClassReadingTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTestCompiledJava, this, testDataFilePath);
}
public void testAllFilesPresentInTypeParameterAnnotations() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/loadJava8/compiledJava/typeParameterAnnotations"), Pattern.compile("^(.+)\\.java$"), null, true);
}
@TestMetadata("Basic.java")
public void testBasic() throws Exception {
runTest("compiler/testData/loadJava8/compiledJava/typeParameterAnnotations/Basic.java");
}
}
@TestMetadata("TypeParameterAnnotations.java")
public void testTypeParameterAnnotations() throws Exception {
runTest("compiler/testData/loadJava8/compiledJava/TypeParameterAnnotations.java");
@TestMetadata("compiler/testData/loadJava8/compiledJava/typeUseAnnotations")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class TypeUseAnnotations extends AbstractLoadJava8WithPsiClassReadingTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTestCompiledJava, this, testDataFilePath);
}
public void testAllFilesPresentInTypeUseAnnotations() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/loadJava8/compiledJava/typeUseAnnotations"), Pattern.compile("^(.+)\\.java$"), null, true);
}
@TestMetadata("BaseClassTypeArguments.java")
public void testBaseClassTypeArguments() throws Exception {
runTest("compiler/testData/loadJava8/compiledJava/typeUseAnnotations/BaseClassTypeArguments.java");
}
@TestMetadata("Basic.java")
public void testBasic() throws Exception {
runTest("compiler/testData/loadJava8/compiledJava/typeUseAnnotations/Basic.java");
}
@TestMetadata("ClassTypeParameterBounds.java")
public void testClassTypeParameterBounds() throws Exception {
runTest("compiler/testData/loadJava8/compiledJava/typeUseAnnotations/ClassTypeParameterBounds.java");
}
@TestMetadata("MethodReceiver.java")
public void testMethodReceiver() throws Exception {
runTest("compiler/testData/loadJava8/compiledJava/typeUseAnnotations/MethodReceiver.java");
}
@TestMetadata("MethodTypeParameterBounds.java")
public void testMethodTypeParameterBounds() throws Exception {
runTest("compiler/testData/loadJava8/compiledJava/typeUseAnnotations/MethodTypeParameterBounds.java");
}
@TestMetadata("ReturnType.java")
public void testReturnType() throws Exception {
runTest("compiler/testData/loadJava8/compiledJava/typeUseAnnotations/ReturnType.java");
}
@TestMetadata("ValueArguments.java")
public void testValueArguments() throws Exception {
runTest("compiler/testData/loadJava8/compiledJava/typeUseAnnotations/ValueArguments.java");
}
}
}
@@ -46,14 +46,70 @@ public class LoadJava8UsingJavacTestGenerated extends AbstractLoadJava8UsingJava
runTest("compiler/testData/loadJava8/compiledJava/ParameterNames.java");
}
@TestMetadata("TypeAnnotations.java")
public void testTypeAnnotations() throws Exception {
runTest("compiler/testData/loadJava8/compiledJava/TypeAnnotations.java");
@TestMetadata("compiler/testData/loadJava8/compiledJava/typeParameterAnnotations")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class TypeParameterAnnotations extends AbstractLoadJava8UsingJavacTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTestCompiledJava, this, testDataFilePath);
}
public void testAllFilesPresentInTypeParameterAnnotations() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/loadJava8/compiledJava/typeParameterAnnotations"), Pattern.compile("^(.+)\\.java$"), null, true);
}
@TestMetadata("Basic.java")
public void testBasic() throws Exception {
runTest("compiler/testData/loadJava8/compiledJava/typeParameterAnnotations/Basic.java");
}
}
@TestMetadata("TypeParameterAnnotations.java")
public void testTypeParameterAnnotations() throws Exception {
runTest("compiler/testData/loadJava8/compiledJava/TypeParameterAnnotations.java");
@TestMetadata("compiler/testData/loadJava8/compiledJava/typeUseAnnotations")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class TypeUseAnnotations extends AbstractLoadJava8UsingJavacTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTestCompiledJava, this, testDataFilePath);
}
public void testAllFilesPresentInTypeUseAnnotations() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/loadJava8/compiledJava/typeUseAnnotations"), Pattern.compile("^(.+)\\.java$"), null, true);
}
@TestMetadata("BaseClassTypeArguments.java")
public void testBaseClassTypeArguments() throws Exception {
runTest("compiler/testData/loadJava8/compiledJava/typeUseAnnotations/BaseClassTypeArguments.java");
}
@TestMetadata("Basic.java")
public void testBasic() throws Exception {
runTest("compiler/testData/loadJava8/compiledJava/typeUseAnnotations/Basic.java");
}
@TestMetadata("ClassTypeParameterBounds.java")
public void testClassTypeParameterBounds() throws Exception {
runTest("compiler/testData/loadJava8/compiledJava/typeUseAnnotations/ClassTypeParameterBounds.java");
}
@TestMetadata("MethodReceiver.java")
public void testMethodReceiver() throws Exception {
runTest("compiler/testData/loadJava8/compiledJava/typeUseAnnotations/MethodReceiver.java");
}
@TestMetadata("MethodTypeParameterBounds.java")
public void testMethodTypeParameterBounds() throws Exception {
runTest("compiler/testData/loadJava8/compiledJava/typeUseAnnotations/MethodTypeParameterBounds.java");
}
@TestMetadata("ReturnType.java")
public void testReturnType() throws Exception {
runTest("compiler/testData/loadJava8/compiledJava/typeUseAnnotations/ReturnType.java");
}
@TestMetadata("ValueArguments.java")
public void testValueArguments() throws Exception {
runTest("compiler/testData/loadJava8/compiledJava/typeUseAnnotations/ValueArguments.java");
}
}
}
@@ -74,14 +130,75 @@ public class LoadJava8UsingJavacTestGenerated extends AbstractLoadJava8UsingJava
runTest("compiler/testData/loadJava8/sourceJava/MapRemove.java");
}
@TestMetadata("TypeAnnotations.java")
public void testTypeAnnotations() throws Exception {
runTest("compiler/testData/loadJava8/sourceJava/TypeAnnotations.java");
}
@TestMetadata("TypeParameterAnnotations.java")
public void testTypeParameterAnnotations() throws Exception {
runTest("compiler/testData/loadJava8/sourceJava/TypeParameterAnnotations.java");
}
@TestMetadata("compiler/testData/loadJava8/sourceJava/typeParameterAnnotations")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class TypeParameterAnnotations extends AbstractLoadJava8UsingJavacTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTestSourceJava, this, testDataFilePath);
}
public void testAllFilesPresentInTypeParameterAnnotations() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/loadJava8/sourceJava/typeParameterAnnotations"), Pattern.compile("^(.+)\\.java$"), null, true);
}
@TestMetadata("Basic.java")
public void testBasic() throws Exception {
runTest("compiler/testData/loadJava8/sourceJava/typeParameterAnnotations/Basic.java");
}
}
@TestMetadata("compiler/testData/loadJava8/sourceJava/typeUseAnnotations")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class TypeUseAnnotations extends AbstractLoadJava8UsingJavacTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTestSourceJava, this, testDataFilePath);
}
public void testAllFilesPresentInTypeUseAnnotations() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/loadJava8/sourceJava/typeUseAnnotations"), Pattern.compile("^(.+)\\.java$"), null, true);
}
@TestMetadata("BaseClassTypeArguments.java")
public void testBaseClassTypeArguments() throws Exception {
runTest("compiler/testData/loadJava8/sourceJava/typeUseAnnotations/BaseClassTypeArguments.java");
}
@TestMetadata("Basic.java")
public void testBasic() throws Exception {
runTest("compiler/testData/loadJava8/sourceJava/typeUseAnnotations/Basic.java");
}
@TestMetadata("ClassTypeParameterBounds.java")
public void testClassTypeParameterBounds() throws Exception {
runTest("compiler/testData/loadJava8/sourceJava/typeUseAnnotations/ClassTypeParameterBounds.java");
}
@TestMetadata("MethodReceiver.java")
public void testMethodReceiver() throws Exception {
runTest("compiler/testData/loadJava8/sourceJava/typeUseAnnotations/MethodReceiver.java");
}
@TestMetadata("MethodTypeParameterBounds.java")
public void testMethodTypeParameterBounds() throws Exception {
runTest("compiler/testData/loadJava8/sourceJava/typeUseAnnotations/MethodTypeParameterBounds.java");
}
@TestMetadata("ReturnType.java")
public void testReturnType() throws Exception {
runTest("compiler/testData/loadJava8/sourceJava/typeUseAnnotations/ReturnType.java");
}
@TestMetadata("ValueArguments.java")
public void testValueArguments() throws Exception {
runTest("compiler/testData/loadJava8/sourceJava/typeUseAnnotations/ValueArguments.java");
}
}
}
}