Add test for KT-14751
This commit is contained in:
@@ -0,0 +1,21 @@
|
|||||||
|
package test;
|
||||||
|
|
||||||
|
// SKIP_IN_RUNTIME_TEST
|
||||||
|
|
||||||
|
import java.lang.annotation.ElementType;
|
||||||
|
import java.lang.annotation.Retention;
|
||||||
|
import java.lang.annotation.RetentionPolicy;
|
||||||
|
import java.lang.annotation.Target;
|
||||||
|
|
||||||
|
public class InnerClassTypeAnnotation {
|
||||||
|
|
||||||
|
public class Inner {
|
||||||
|
public Inner(@Foo String foo) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Retention(RetentionPolicy.CLASS)
|
||||||
|
@Target({ElementType.TYPE_USE})
|
||||||
|
public @interface Foo {}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
package test
|
||||||
|
|
||||||
|
public open class InnerClassTypeAnnotation {
|
||||||
|
public constructor InnerClassTypeAnnotation()
|
||||||
|
|
||||||
|
@kotlin.annotation.Retention(value = AnnotationRetention.BINARY) @kotlin.annotation.Target(allowedTargets = {AnnotationTarget.TYPE}) public final annotation class Foo : kotlin.Annotation {
|
||||||
|
public constructor Foo()
|
||||||
|
}
|
||||||
|
|
||||||
|
public open inner class Inner {
|
||||||
|
public constructor Inner(/*0*/ @test.InnerClassTypeAnnotation.Foo p0: @test.InnerClassTypeAnnotation.Foo kotlin.String!)
|
||||||
|
}
|
||||||
|
}
|
||||||
+8
-4
@@ -186,10 +186,14 @@ abstract class AbstractJvmRuntimeDescriptorLoaderTest : TestCaseWithTmpdir() {
|
|||||||
|
|
||||||
private fun adaptJavaSource(text: String): String {
|
private fun adaptJavaSource(text: String): String {
|
||||||
val typeAnnotations = arrayOf("NotNull", "Nullable", "ReadOnly", "Mutable")
|
val typeAnnotations = arrayOf("NotNull", "Nullable", "ReadOnly", "Mutable")
|
||||||
return typeAnnotations.fold(text) { text, annotation -> text.replace("@$annotation", "") }.replace(
|
val adaptedSource = typeAnnotations.fold(text) { text, annotation -> text.replace("@$annotation", "") }
|
||||||
"@interface",
|
if ("@Retention" !in adaptedSource) {
|
||||||
"@java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.RUNTIME) @interface"
|
return adaptedSource.replace(
|
||||||
)
|
"@interface",
|
||||||
|
"@java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.RUNTIME) @interface"
|
||||||
|
)
|
||||||
|
}
|
||||||
|
return adaptedSource
|
||||||
}
|
}
|
||||||
|
|
||||||
private class SyntheticPackageViewForTest(override val module: ModuleDescriptor,
|
private class SyntheticPackageViewForTest(override val module: ModuleDescriptor,
|
||||||
|
|||||||
+6
@@ -38,6 +38,12 @@ public class LoadJava8TestGenerated extends AbstractLoadJava8Test {
|
|||||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/loadJava8/compiledJava"), Pattern.compile("^(.+)\\.java$"), TargetBackend.ANY, true);
|
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/loadJava8/compiledJava"), Pattern.compile("^(.+)\\.java$"), TargetBackend.ANY, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("InnerClassTypeAnnotation.java")
|
||||||
|
public void testInnerClassTypeAnnotation() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/loadJava8/compiledJava/InnerClassTypeAnnotation.java");
|
||||||
|
doTestCompiledJava(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("MapRemove.java")
|
@TestMetadata("MapRemove.java")
|
||||||
public void testMapRemove() throws Exception {
|
public void testMapRemove() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/loadJava8/compiledJava/MapRemove.java");
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/loadJava8/compiledJava/MapRemove.java");
|
||||||
|
|||||||
+6
@@ -36,6 +36,12 @@ public class Jvm8RuntimeDescriptorLoaderTestGenerated extends AbstractJvm8Runtim
|
|||||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/loadJava8/compiledJava"), Pattern.compile("^(.+)\\.java$"), TargetBackend.ANY, true, "sam", "kotlinSignature/propagation");
|
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/loadJava8/compiledJava"), Pattern.compile("^(.+)\\.java$"), TargetBackend.ANY, true, "sam", "kotlinSignature/propagation");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("InnerClassTypeAnnotation.java")
|
||||||
|
public void testInnerClassTypeAnnotation() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/loadJava8/compiledJava/InnerClassTypeAnnotation.java");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("MapRemove.java")
|
@TestMetadata("MapRemove.java")
|
||||||
public void testMapRemove() throws Exception {
|
public void testMapRemove() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/loadJava8/compiledJava/MapRemove.java");
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/loadJava8/compiledJava/MapRemove.java");
|
||||||
|
|||||||
Reference in New Issue
Block a user