diff --git a/compiler/testData/codegen/boxWithStdlib/annotations/parameterWithPrimitiveType.kt b/compiler/testData/codegen/boxWithStdlib/annotations/parameterWithPrimitiveType.kt new file mode 100644 index 00000000000..28ee905bb8c --- /dev/null +++ b/compiler/testData/codegen/boxWithStdlib/annotations/parameterWithPrimitiveType.kt @@ -0,0 +1,30 @@ +import java.lang.annotation.Retention +import java.lang.annotation.RetentionPolicy + +Retention(RetentionPolicy.RUNTIME) +annotation class Ann( + val b: Byte, + val s: Short, + val i: Int, + val f: Float, + val d: Double, + val l: Long, + val c: Char, + val bool: Boolean +) + +fun box(): String { + val ann = javaClass().getAnnotation(javaClass()) + if (ann == null) return "fail: cannot find Ann on MyClass}" + if (ann.b != 1.toByte()) return "fail: annotation parameter b should be 1, but was ${ann.b}" + if (ann.s != 1.toShort()) return "fail: annotation parameter s should be 1, but was ${ann.s}" + if (ann.i != 1) return "fail: annotation parameter i should be 1, but was ${ann.i}" + if (ann.f != 1.toFloat()) return "fail: annotation parameter f should be 1, but was ${ann.f}" + if (ann.d != 1.0) return "fail: annotation parameter d should be 1, but was ${ann.d}" + if (ann.l != 1.toLong()) return "fail: annotation parameter l should be 1, but was ${ann.l}" + if (ann.c != 'c') return "fail: annotation parameter c should be 1, but was ${ann.c}" + if (!ann.bool) return "fail: annotation parameter bool should be 1, but was ${ann.bool}" + return "OK" +} + +Ann(1, 1, 1, 1.0, 1.0, 1, 'c', true) class MyClass diff --git a/compiler/tests/org/jetbrains/jet/codegen/generated/BlackBoxWithStdlibCodegenTestGenerated.java b/compiler/tests/org/jetbrains/jet/codegen/generated/BlackBoxWithStdlibCodegenTestGenerated.java index 94fe12b1200..58dd57a23f2 100644 --- a/compiler/tests/org/jetbrains/jet/codegen/generated/BlackBoxWithStdlibCodegenTestGenerated.java +++ b/compiler/tests/org/jetbrains/jet/codegen/generated/BlackBoxWithStdlibCodegenTestGenerated.java @@ -48,6 +48,11 @@ public class BlackBoxWithStdlibCodegenTestGenerated extends AbstractBlackBoxCode doTestWithStdlib("compiler/testData/codegen/boxWithStdlib/annotations/defaultParameterValues.kt"); } + @TestMetadata("parameterWithPrimitiveType.kt") + public void testParameterWithPrimitiveType() throws Exception { + doTestWithStdlib("compiler/testData/codegen/boxWithStdlib/annotations/parameterWithPrimitiveType.kt"); + } + @TestMetadata("varargInAnnotationParameter.kt") public void testVarargInAnnotationParameter() throws Exception { doTestWithStdlib("compiler/testData/codegen/boxWithStdlib/annotations/varargInAnnotationParameter.kt");