diff --git a/compiler/testData/codegen/boxWithJava/properties/annotationWithKotlinProperty/JavaClass.java b/compiler/testData/codegen/boxWithJava/properties/annotationWithKotlinProperty/JavaClass.java new file mode 100644 index 00000000000..36e889b6abd --- /dev/null +++ b/compiler/testData/codegen/boxWithJava/properties/annotationWithKotlinProperty/JavaClass.java @@ -0,0 +1,16 @@ +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; + +public class JavaClass { + + @Retention(RetentionPolicy.RUNTIME) + @interface Foo { + int value(); + } + + @Foo(KotlinClass.FOO_INT) + public String test() throws NoSuchMethodException { + return KotlinClass.FOO_STRING + + JavaClass.class.getMethod("test").getAnnotation(Foo.class).value(); + } +} \ No newline at end of file diff --git a/compiler/testData/codegen/boxWithJava/properties/annotationWithKotlinProperty/kotlinClass.kt b/compiler/testData/codegen/boxWithJava/properties/annotationWithKotlinProperty/kotlinClass.kt new file mode 100644 index 00000000000..6770e1d7dd2 --- /dev/null +++ b/compiler/testData/codegen/boxWithJava/properties/annotationWithKotlinProperty/kotlinClass.kt @@ -0,0 +1,11 @@ +class KotlinClass { + companion object { + val FOO_INT: Int = 10 + val FOO_STRING: String = "OK" + } +} + +fun box(): String { + val test = JavaClass().test() + return if (test == "OK10") "OK" else "fail : $test" +} diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/generated/BlackBoxWithJavaCodegenTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/generated/BlackBoxWithJavaCodegenTestGenerated.java index 361e89009b9..97d6ab11fe0 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/generated/BlackBoxWithJavaCodegenTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/generated/BlackBoxWithJavaCodegenTestGenerated.java @@ -189,6 +189,12 @@ public class BlackBoxWithJavaCodegenTestGenerated extends AbstractBlackBoxCodege JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/boxWithJava/properties"), Pattern.compile("^([^\\.]+)$"), true); } + @TestMetadata("annotationWithKotlinProperty") + public void testAnnotationWithKotlinProperty() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/properties/annotationWithKotlinProperty/"); + doTestWithJava(fileName); + } + @TestMetadata("classObjectProperties") public void testClassObjectProperties() throws Exception { String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/properties/classObjectProperties/");