diff --git a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirBlackBoxCodegenTestGenerated.java b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirBlackBoxCodegenTestGenerated.java index 069cc08b2aa..91914b4405f 100644 --- a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirBlackBoxCodegenTestGenerated.java +++ b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirBlackBoxCodegenTestGenerated.java @@ -184,6 +184,12 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT runTest("compiler/testData/codegen/box/annotations/javaAnnotationOnSecondaryConstructorOfLocalClass.kt"); } + @Test + @TestMetadata("javaAnnotationWithSingleArrayArgument.kt") + public void testJavaAnnotationWithSingleArrayArgument() throws Exception { + runTest("compiler/testData/codegen/box/annotations/javaAnnotationWithSingleArrayArgument.kt"); + } + @Test @TestMetadata("javaNegativePropertyAsAnnotationParameter.kt") public void testJavaNegativePropertyAsAnnotationParameter() throws Exception { diff --git a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/ir/Fir2IrTextTestGenerated.java b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/ir/Fir2IrTextTestGenerated.java index b7f1302589c..5da81bdddaa 100644 --- a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/ir/Fir2IrTextTestGenerated.java +++ b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/ir/Fir2IrTextTestGenerated.java @@ -629,6 +629,12 @@ public class Fir2IrTextTestGenerated extends AbstractFir2IrTextTest { runTest("compiler/testData/ir/irText/declarations/annotations/javaAnnotation.kt"); } + @Test + @TestMetadata("javaAnnotationWithSingleArrayArgument.kt") + public void testJavaAnnotationWithSingleArrayArgument() throws Exception { + runTest("compiler/testData/ir/irText/declarations/annotations/javaAnnotationWithSingleArrayArgument.kt"); + } + @Test @TestMetadata("localDelegatedPropertiesWithAnnotations.kt") public void testLocalDelegatedPropertiesWithAnnotations() throws Exception { diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/ConstantValueGenerator.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/ConstantValueGenerator.kt index ae4d14b6a5d..cab9b887c48 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/ConstantValueGenerator.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/ConstantValueGenerator.kt @@ -5,9 +5,11 @@ package org.jetbrains.kotlin.ir.util +import org.jetbrains.kotlin.builtins.KotlinBuiltIns import org.jetbrains.kotlin.descriptors.ClassDescriptor import org.jetbrains.kotlin.descriptors.ModuleDescriptor import org.jetbrains.kotlin.descriptors.NotFoundClasses +import org.jetbrains.kotlin.descriptors.ValueParameterDescriptor import org.jetbrains.kotlin.descriptors.annotations.AnnotationDescriptor import org.jetbrains.kotlin.incremental.components.NoLookupLocation import org.jetbrains.kotlin.ir.UNDEFINED_OFFSET @@ -170,7 +172,7 @@ abstract class ConstantValueGenerator( val irArgument = generateConstantOrAnnotationValueAsExpression( UNDEFINED_OFFSET, UNDEFINED_OFFSET, - argumentValue, + adjustAnnotationArgumentValue(argumentValue, valueParameter), valueParameter.type, valueParameter.varargElementType ) @@ -182,5 +184,15 @@ abstract class ConstantValueGenerator( return irCall } + private fun adjustAnnotationArgumentValue(value: ConstantValue<*>, parameter: ValueParameterDescriptor): ConstantValue<*> { + // In Java source code, annotation argument for an array-typed parameter can be a single value instead of an array. + // In that case, wrap it into an array manually. Ideally, this should be fixed in the code which loads Java annotation arguments, + // but it would require resolving the annotation class on each request of an annotation argument. + if (KotlinBuiltIns.isArrayOrPrimitiveArray(parameter.type) && value !is ArrayValue) { + return ArrayValue(listOf(value)) { parameter.type } + } + return value + } + private fun KotlinType.getArrayElementType() = builtIns.getArrayElementType(this) } diff --git a/compiler/testData/codegen/box/annotations/javaAnnotationWithSingleArrayArgument.kt b/compiler/testData/codegen/box/annotations/javaAnnotationWithSingleArrayArgument.kt new file mode 100644 index 00000000000..6c4597fbd64 --- /dev/null +++ b/compiler/testData/codegen/box/annotations/javaAnnotationWithSingleArrayArgument.kt @@ -0,0 +1,39 @@ +// TARGET_BACKEND: JVM +// IGNORE_BACKEND_FIR: JVM_IR +// WITH_RUNTIME +// FILE: A.java + +public class A { + @Annos(value = @Anno(token = "OK")) + @Strings(value = "OK") + @Ints(value = 42) + @Enums(value = E.EA) + @Classes(value = double.class) + public void test() {} +} + +// FILE: box.kt + +import kotlin.reflect.KClass +import kotlin.test.assertEquals + +annotation class Anno(val token: String) +enum class E { EA } + +annotation class Annos(val value: Array) +annotation class Strings(val value: Array) +annotation class Ints(val value: IntArray) +annotation class Enums(val value: Array) +annotation class Classes(val value: Array>) + +class C : A() + +fun box(): String { + val annotations = C::class.java.getMethod("test").annotations.toList() + assertEquals("OK", annotations.filterIsInstance().single().value.single().token) + assertEquals("OK", annotations.filterIsInstance().single().value.single()) + assertEquals(42, annotations.filterIsInstance().single().value.single()) + assertEquals(E.EA, annotations.filterIsInstance().single().value.single()) + assertEquals(Double::class, annotations.filterIsInstance().single().value.single()) + return "OK" +} diff --git a/compiler/testData/ir/irText/declarations/annotations/javaAnnotationWithSingleArrayArgument.kt b/compiler/testData/ir/irText/declarations/annotations/javaAnnotationWithSingleArrayArgument.kt new file mode 100644 index 00000000000..30308c659e5 --- /dev/null +++ b/compiler/testData/ir/irText/declarations/annotations/javaAnnotationWithSingleArrayArgument.kt @@ -0,0 +1,28 @@ +// SKIP_KT_DUMP +// TARGET_BACKEND: JVM +// IGNORE_BACKEND_FIR: JVM_IR +// FILE: A.java + +public class A { + @Annos(value = @Anno(token = "OK")) + @Strings(value = "OK") + @Ints(value = 42) + @Enums(value = E.EA) + @Classes(value = double.class) + public void test() {} +} + +// FILE: C.kt + +import kotlin.reflect.KClass + +annotation class Anno(val token: String) +enum class E { EA } + +annotation class Annos(val value: Array) +annotation class Strings(val value: Array) +annotation class Ints(val value: IntArray) +annotation class Enums(val value: Array) +annotation class Classes(val value: Array>) + +class C : A() diff --git a/compiler/testData/ir/irText/declarations/annotations/javaAnnotationWithSingleArrayArgument.txt b/compiler/testData/ir/irText/declarations/annotations/javaAnnotationWithSingleArrayArgument.txt new file mode 100644 index 00000000000..c0d3c792dc4 --- /dev/null +++ b/compiler/testData/ir/irText/declarations/annotations/javaAnnotationWithSingleArrayArgument.txt @@ -0,0 +1,259 @@ +FILE fqName: fileName:/C.kt + CLASS ANNOTATION_CLASS name:Anno modality:FINAL visibility:public superTypes:[kotlin.Annotation] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Anno + CONSTRUCTOR visibility:public <> (token:kotlin.String) returnType:.Anno [primary] + VALUE_PARAMETER name:token index:0 type:kotlin.String + PROPERTY name:token visibility:public modality:FINAL [val] + FIELD PROPERTY_BACKING_FIELD name:token type:kotlin.String visibility:private [final] + EXPRESSION_BODY + GET_VAR 'token: kotlin.String declared in .Anno.' type=kotlin.String origin=INITIALIZE_PROPERTY_FROM_PARAMETER + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> ($this:.Anno) returnType:kotlin.String + correspondingProperty: PROPERTY name:token visibility:public modality:FINAL [val] + $this: VALUE_PARAMETER name: type:.Anno + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun (): kotlin.String declared in .Anno' + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:token type:kotlin.String visibility:private [final]' type=kotlin.String origin=null + receiver: GET_VAR ': .Anno declared in .Anno.' type=.Anno origin=null + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean [fake_override,operator] declared in kotlin.Annotation + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int [fake_override] declared in kotlin.Annotation + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String [fake_override] declared in kotlin.Annotation + $this: VALUE_PARAMETER name: type:kotlin.Any + CLASS ENUM_CLASS name:E modality:FINAL visibility:public superTypes:[kotlin.Enum<.E>] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.E + CONSTRUCTOR visibility:private <> () returnType:.E [primary] + BLOCK_BODY + ENUM_CONSTRUCTOR_CALL 'public constructor (name: kotlin.String, ordinal: kotlin.Int) [primary] declared in kotlin.Enum' + : .E + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS ENUM_CLASS name:E modality:FINAL visibility:public superTypes:[kotlin.Enum<.E>]' + ENUM_ENTRY name:EA + init: EXPRESSION_BODY + ENUM_CONSTRUCTOR_CALL 'private constructor () [primary] declared in .E' + FUN FAKE_OVERRIDE name:clone visibility:protected modality:FINAL <> ($this:kotlin.Enum<.E>) returnType:kotlin.Any [fake_override] + overridden: + protected final fun clone (): kotlin.Any declared in kotlin.Enum + $this: VALUE_PARAMETER name: type:kotlin.Enum<.E> + FUN FAKE_OVERRIDE name:finalize visibility:protected/*protected and package*/ modality:FINAL <> ($this:kotlin.Enum<.E>) returnType:kotlin.Unit [fake_override] + overridden: + protected/*protected and package*/ final fun finalize (): kotlin.Unit declared in kotlin.Enum + $this: VALUE_PARAMETER name: type:kotlin.Enum<.E> + FUN FAKE_OVERRIDE name:getDeclaringClass visibility:public modality:FINAL <> ($this:kotlin.Enum<.E>) returnType:@[FlexibleNullability] java.lang.Class<@[FlexibleNullability] .E?>? [fake_override] + overridden: + public final fun getDeclaringClass (): @[FlexibleNullability] java.lang.Class<@[FlexibleNullability] E of kotlin.Enum?>? declared in kotlin.Enum + $this: VALUE_PARAMETER name: type:kotlin.Enum<.E> + FUN FAKE_OVERRIDE name:compareTo visibility:public modality:FINAL <> ($this:kotlin.Enum<.E>, other:.E) returnType:kotlin.Int [fake_override,operator] + overridden: + public final fun compareTo (other: E of kotlin.Enum): kotlin.Int [operator] declared in kotlin.Enum + $this: VALUE_PARAMETER name: type:kotlin.Enum<.E> + VALUE_PARAMETER name:other index:0 type:.E + FUN FAKE_OVERRIDE name:equals visibility:public modality:FINAL <> ($this:kotlin.Enum<.E>, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public final fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in kotlin.Enum + $this: VALUE_PARAMETER name: type:kotlin.Enum<.E> + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:FINAL <> ($this:kotlin.Enum<.E>) returnType:kotlin.Int [fake_override] + overridden: + public final fun hashCode (): kotlin.Int declared in kotlin.Enum + $this: VALUE_PARAMETER name: type:kotlin.Enum<.E> + PROPERTY FAKE_OVERRIDE name:name visibility:public modality:FINAL [fake_override,val] + overridden: + public final name: kotlin.String [val] + FUN FAKE_OVERRIDE name: visibility:public modality:FINAL <> ($this:kotlin.Enum<.E>) returnType:kotlin.String [fake_override] + correspondingProperty: PROPERTY FAKE_OVERRIDE name:name visibility:public modality:FINAL [fake_override,val] + overridden: + public final fun (): kotlin.String declared in kotlin.Enum + $this: VALUE_PARAMETER name: type:kotlin.Enum<.E> + PROPERTY FAKE_OVERRIDE name:ordinal visibility:public modality:FINAL [fake_override,val] + overridden: + public final ordinal: kotlin.Int [val] + FUN FAKE_OVERRIDE name: visibility:public modality:FINAL <> ($this:kotlin.Enum<.E>) returnType:kotlin.Int [fake_override] + correspondingProperty: PROPERTY FAKE_OVERRIDE name:ordinal visibility:public modality:FINAL [fake_override,val] + overridden: + public final fun (): kotlin.Int declared in kotlin.Enum + $this: VALUE_PARAMETER name: type:kotlin.Enum<.E> + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Enum<.E>) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String declared in kotlin.Enum + $this: VALUE_PARAMETER name: type:kotlin.Enum<.E> + FUN ENUM_CLASS_SPECIAL_MEMBER name:values visibility:public modality:FINAL <> () returnType:kotlin.Array<.E> + SYNTHETIC_BODY kind=ENUM_VALUES + FUN ENUM_CLASS_SPECIAL_MEMBER name:valueOf visibility:public modality:FINAL <> (value:kotlin.String) returnType:.E + VALUE_PARAMETER name:value index:0 type:kotlin.String + SYNTHETIC_BODY kind=ENUM_VALUEOF + CLASS ANNOTATION_CLASS name:Annos modality:FINAL visibility:public superTypes:[kotlin.Annotation] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Annos + CONSTRUCTOR visibility:public <> (value:kotlin.Array<.Anno>) returnType:.Annos [primary] + VALUE_PARAMETER name:value index:0 type:kotlin.Array<.Anno> + PROPERTY name:value visibility:public modality:FINAL [val] + FIELD PROPERTY_BACKING_FIELD name:value type:kotlin.Array<.Anno> visibility:private [final] + EXPRESSION_BODY + GET_VAR 'value: kotlin.Array<.Anno> declared in .Annos.' type=kotlin.Array<.Anno> origin=INITIALIZE_PROPERTY_FROM_PARAMETER + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> ($this:.Annos) returnType:kotlin.Array<.Anno> + correspondingProperty: PROPERTY name:value visibility:public modality:FINAL [val] + $this: VALUE_PARAMETER name: type:.Annos + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun (): kotlin.Array<.Anno> declared in .Annos' + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:value type:kotlin.Array<.Anno> visibility:private [final]' type=kotlin.Array<.Anno> origin=null + receiver: GET_VAR ': .Annos declared in .Annos.' type=.Annos origin=null + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean [fake_override,operator] declared in kotlin.Annotation + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int [fake_override] declared in kotlin.Annotation + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String [fake_override] declared in kotlin.Annotation + $this: VALUE_PARAMETER name: type:kotlin.Any + CLASS ANNOTATION_CLASS name:Strings modality:FINAL visibility:public superTypes:[kotlin.Annotation] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Strings + CONSTRUCTOR visibility:public <> (value:kotlin.Array) returnType:.Strings [primary] + VALUE_PARAMETER name:value index:0 type:kotlin.Array + PROPERTY name:value visibility:public modality:FINAL [val] + FIELD PROPERTY_BACKING_FIELD name:value type:kotlin.Array visibility:private [final] + EXPRESSION_BODY + GET_VAR 'value: kotlin.Array declared in .Strings.' type=kotlin.Array origin=INITIALIZE_PROPERTY_FROM_PARAMETER + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> ($this:.Strings) returnType:kotlin.Array + correspondingProperty: PROPERTY name:value visibility:public modality:FINAL [val] + $this: VALUE_PARAMETER name: type:.Strings + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun (): kotlin.Array declared in .Strings' + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:value type:kotlin.Array visibility:private [final]' type=kotlin.Array origin=null + receiver: GET_VAR ': .Strings declared in .Strings.' type=.Strings origin=null + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean [fake_override,operator] declared in kotlin.Annotation + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int [fake_override] declared in kotlin.Annotation + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String [fake_override] declared in kotlin.Annotation + $this: VALUE_PARAMETER name: type:kotlin.Any + CLASS ANNOTATION_CLASS name:Ints modality:FINAL visibility:public superTypes:[kotlin.Annotation] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Ints + CONSTRUCTOR visibility:public <> (value:kotlin.IntArray) returnType:.Ints [primary] + VALUE_PARAMETER name:value index:0 type:kotlin.IntArray + PROPERTY name:value visibility:public modality:FINAL [val] + FIELD PROPERTY_BACKING_FIELD name:value type:kotlin.IntArray visibility:private [final] + EXPRESSION_BODY + GET_VAR 'value: kotlin.IntArray declared in .Ints.' type=kotlin.IntArray origin=INITIALIZE_PROPERTY_FROM_PARAMETER + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> ($this:.Ints) returnType:kotlin.IntArray + correspondingProperty: PROPERTY name:value visibility:public modality:FINAL [val] + $this: VALUE_PARAMETER name: type:.Ints + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun (): kotlin.IntArray declared in .Ints' + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:value type:kotlin.IntArray visibility:private [final]' type=kotlin.IntArray origin=null + receiver: GET_VAR ': .Ints declared in .Ints.' type=.Ints origin=null + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean [fake_override,operator] declared in kotlin.Annotation + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int [fake_override] declared in kotlin.Annotation + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String [fake_override] declared in kotlin.Annotation + $this: VALUE_PARAMETER name: type:kotlin.Any + CLASS ANNOTATION_CLASS name:Enums modality:FINAL visibility:public superTypes:[kotlin.Annotation] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Enums + CONSTRUCTOR visibility:public <> (value:kotlin.Array<.E>) returnType:.Enums [primary] + VALUE_PARAMETER name:value index:0 type:kotlin.Array<.E> + PROPERTY name:value visibility:public modality:FINAL [val] + FIELD PROPERTY_BACKING_FIELD name:value type:kotlin.Array<.E> visibility:private [final] + EXPRESSION_BODY + GET_VAR 'value: kotlin.Array<.E> declared in .Enums.' type=kotlin.Array<.E> origin=INITIALIZE_PROPERTY_FROM_PARAMETER + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> ($this:.Enums) returnType:kotlin.Array<.E> + correspondingProperty: PROPERTY name:value visibility:public modality:FINAL [val] + $this: VALUE_PARAMETER name: type:.Enums + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun (): kotlin.Array<.E> declared in .Enums' + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:value type:kotlin.Array<.E> visibility:private [final]' type=kotlin.Array<.E> origin=null + receiver: GET_VAR ': .Enums declared in .Enums.' type=.Enums origin=null + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean [fake_override,operator] declared in kotlin.Annotation + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int [fake_override] declared in kotlin.Annotation + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String [fake_override] declared in kotlin.Annotation + $this: VALUE_PARAMETER name: type:kotlin.Any + CLASS ANNOTATION_CLASS name:Classes modality:FINAL visibility:public superTypes:[kotlin.Annotation] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Classes + CONSTRUCTOR visibility:public <> (value:kotlin.Array>) returnType:.Classes [primary] + VALUE_PARAMETER name:value index:0 type:kotlin.Array> + PROPERTY name:value visibility:public modality:FINAL [val] + FIELD PROPERTY_BACKING_FIELD name:value type:kotlin.Array> visibility:private [final] + EXPRESSION_BODY + GET_VAR 'value: kotlin.Array> declared in .Classes.' type=kotlin.Array> origin=INITIALIZE_PROPERTY_FROM_PARAMETER + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> ($this:.Classes) returnType:kotlin.Array> + correspondingProperty: PROPERTY name:value visibility:public modality:FINAL [val] + $this: VALUE_PARAMETER name: type:.Classes + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun (): kotlin.Array> declared in .Classes' + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:value type:kotlin.Array> visibility:private [final]' type=kotlin.Array> origin=null + receiver: GET_VAR ': .Classes declared in .Classes.' type=.Classes origin=null + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean [fake_override,operator] declared in kotlin.Annotation + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int [fake_override] declared in kotlin.Annotation + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String [fake_override] declared in kotlin.Annotation + $this: VALUE_PARAMETER name: type:kotlin.Any + CLASS CLASS name:C modality:FINAL visibility:public superTypes:[.A] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.C + CONSTRUCTOR visibility:public <> () returnType:.C [primary] + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in .A' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:C modality:FINAL visibility:public superTypes:[.A]' + FUN FAKE_OVERRIDE name:test visibility:public modality:OPEN <> ($this:.A) returnType:kotlin.Unit [fake_override] + annotations: + Annos(value = [Anno(token = 'OK')]) + Strings(value = ['OK']) + Ints(value = ['42']) + Enums(value = [GET_ENUM 'ENUM_ENTRY name:EA' type=.E]) + Classes(value = [CLASS_REFERENCE 'CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Double modality:FINAL visibility:public superTypes:[kotlin.Number; kotlin.Comparable; java.io.Serializable]' type=kotlin.reflect.KClass]) + overridden: + public open fun test (): kotlin.Unit declared in .A + $this: VALUE_PARAMETER name: type:.A + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean [fake_override,operator] declared in .A + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int [fake_override] declared in .A + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String [fake_override] declared in .A + $this: VALUE_PARAMETER name: type:kotlin.Any diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BlackBoxCodegenTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BlackBoxCodegenTestGenerated.java index 847a4a9dd6f..4d0a655ad18 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BlackBoxCodegenTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BlackBoxCodegenTestGenerated.java @@ -184,6 +184,12 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { runTest("compiler/testData/codegen/box/annotations/javaAnnotationOnSecondaryConstructorOfLocalClass.kt"); } + @Test + @TestMetadata("javaAnnotationWithSingleArrayArgument.kt") + public void testJavaAnnotationWithSingleArrayArgument() throws Exception { + runTest("compiler/testData/codegen/box/annotations/javaAnnotationWithSingleArrayArgument.kt"); + } + @Test @TestMetadata("javaNegativePropertyAsAnnotationParameter.kt") public void testJavaNegativePropertyAsAnnotationParameter() throws Exception { diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenTestGenerated.java index 6f4e81ffc43..31325fa5c8e 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenTestGenerated.java @@ -184,6 +184,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes runTest("compiler/testData/codegen/box/annotations/javaAnnotationOnSecondaryConstructorOfLocalClass.kt"); } + @Test + @TestMetadata("javaAnnotationWithSingleArrayArgument.kt") + public void testJavaAnnotationWithSingleArrayArgument() throws Exception { + runTest("compiler/testData/codegen/box/annotations/javaAnnotationWithSingleArrayArgument.kt"); + } + @Test @TestMetadata("javaNegativePropertyAsAnnotationParameter.kt") public void testJavaNegativePropertyAsAnnotationParameter() throws Exception { diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/ir/IrTextTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/ir/IrTextTestGenerated.java index fffa0711c72..8b004c1ed90 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/ir/IrTextTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/ir/IrTextTestGenerated.java @@ -629,6 +629,12 @@ public class IrTextTestGenerated extends AbstractIrTextTest { runTest("compiler/testData/ir/irText/declarations/annotations/javaAnnotation.kt"); } + @Test + @TestMetadata("javaAnnotationWithSingleArrayArgument.kt") + public void testJavaAnnotationWithSingleArrayArgument() throws Exception { + runTest("compiler/testData/ir/irText/declarations/annotations/javaAnnotationWithSingleArrayArgument.kt"); + } + @Test @TestMetadata("localDelegatedPropertiesWithAnnotations.kt") public void testLocalDelegatedPropertiesWithAnnotations() throws Exception { diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java index 38bb7d1ba40..1222496897b 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java @@ -167,6 +167,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes runTest("compiler/testData/codegen/box/annotations/javaAnnotationOnSecondaryConstructorOfLocalClass.kt"); } + @TestMetadata("javaAnnotationWithSingleArrayArgument.kt") + public void testJavaAnnotationWithSingleArrayArgument() throws Exception { + runTest("compiler/testData/codegen/box/annotations/javaAnnotationWithSingleArrayArgument.kt"); + } + @TestMetadata("javaNegativePropertyAsAnnotationParameter.kt") public void testJavaNegativePropertyAsAnnotationParameter() throws Exception { runTest("compiler/testData/codegen/box/annotations/javaNegativePropertyAsAnnotationParameter.kt");