diff --git a/compiler/fir/java/src/org/jetbrains/kotlin/fir/java/JavaUtils.kt b/compiler/fir/java/src/org/jetbrains/kotlin/fir/java/JavaUtils.kt index cd5a96248e3..644c64520f6 100644 --- a/compiler/fir/java/src/org/jetbrains/kotlin/fir/java/JavaUtils.kt +++ b/compiler/fir/java/src/org/jetbrains/kotlin/fir/java/JavaUtils.kt @@ -58,15 +58,14 @@ val JavaClass.classKind: ClassKind fun JavaClass.hasMetadataAnnotation(): Boolean = annotations.any { it.isResolvedTo(JvmAnnotationNames.METADATA_FQ_NAME) } -internal fun Any?.createConstantOrError(session: FirSession, expectedTypeRef: FirTypeRef? = null): FirExpression { - val coneType = expectedTypeRef?.coneTypeOrNull - val value = if (this is Int && coneType != null) { +internal fun Any?.createConstantOrError(session: FirSession, expectedConeType: ConeKotlinType? = null): FirExpression { + val value = if (this is Int && expectedConeType != null) { // special case for Java literals in annotation default values: // literal value is always integer, but an expected parameter type can be any other number type when { - coneType.isByte -> this.toByte() - coneType.isShort -> this.toShort() - coneType.isLong -> this.toLong() + expectedConeType.isByte -> this.toByte() + expectedConeType.isShort -> this.toShort() + expectedConeType.isLong -> this.toLong() else -> this } } else this diff --git a/compiler/fir/java/src/org/jetbrains/kotlin/fir/java/javaAnnotationsMapping.kt b/compiler/fir/java/src/org/jetbrains/kotlin/fir/java/javaAnnotationsMapping.kt index 2cedb765206..a7f5b038633 100644 --- a/compiler/fir/java/src/org/jetbrains/kotlin/fir/java/javaAnnotationsMapping.kt +++ b/compiler/fir/java/src/org/jetbrains/kotlin/fir/java/javaAnnotationsMapping.kt @@ -44,6 +44,7 @@ import org.jetbrains.kotlin.toKtPsiSourceElement import org.jetbrains.kotlin.utils.addToStdlib.firstIsInstanceOrNull import org.jetbrains.kotlin.utils.addToStdlib.ifNotEmpty import java.util.* +import kotlin.math.exp internal fun Iterable.convertAnnotationsToFir( session: FirSession, @@ -103,21 +104,18 @@ internal fun JavaValueParameter.toFirValueParameter( internal fun JavaAnnotationArgument.toFirExpression( session: FirSession, javaTypeParameterStack: JavaTypeParameterStack, expectedTypeRef: FirTypeRef? ): FirExpression { - return when (this) { + val expectedConeType = expectedTypeRef?.toConeKotlinTypeProbablyFlexible(session, javaTypeParameterStack) + val expectedArrayElementTypeIfArray = expectedConeType?.lowerBoundIfFlexible()?.arrayElementType() ?: expectedConeType + val argument = when (this) { is JavaLiteralAnnotationArgument -> value.createConstantOrError( session, - expectedTypeRef?.resolveIfJavaType(session, javaTypeParameterStack) + expectedArrayElementTypeIfArray ) is JavaArrayAnnotationArgument -> buildArrayLiteral { - val argumentTypeRef = expectedTypeRef?.let { - val type = if (it is FirJavaTypeRef) { - it.toConeKotlinTypeProbablyFlexible(session, javaTypeParameterStack) - } else { - it.coneType - } - coneTypeOrNull = type + val argumentTypeRef = expectedConeType?.let { + coneTypeOrNull = it buildResolvedTypeRef { - this.type = type.lowerBoundIfFlexible().arrayElementType() + this.type = it.lowerBoundIfFlexible().arrayElementType() ?: ConeErrorType(ConeSimpleDiagnostic("expected type is not array type")) } } @@ -131,7 +129,7 @@ internal fun JavaAnnotationArgument.toFirExpression( // a static import. In this case, the parameter default initializer will not have its type set, which isn't usually an // issue except in edge cases like KT-47702 where we do need to evaluate the default values of annotations. // As a fallback, we use the expected type which should be the type of the enum. - classId = requireNotNull(enumClassId ?: expectedTypeRef?.coneTypeOrNull?.lowerBoundIfFlexible()?.classId), + classId = requireNotNull(enumClassId ?: expectedArrayElementTypeIfArray?.lowerBoundIfFlexible()?.classId), entryName = entryName ) is JavaClassObjectAnnotationArgument -> buildGetClassCall { @@ -152,6 +150,17 @@ internal fun JavaAnnotationArgument.toFirExpression( diagnostic = ConeSimpleDiagnostic("Unknown JavaAnnotationArgument: ${this::class.java}", DiagnosticKind.Java) } } + + return if (expectedConeType?.lowerBoundIfFlexible()?.isArrayOrPrimitiveArray == true && argument !is FirArrayLiteral) { + buildArrayLiteral { + coneTypeOrNull = expectedConeType + argumentList = buildArgumentList { + arguments += argument + } + } + } else { + argument + } } private val JAVA_RETENTION_TO_KOTLIN: Map = mapOf( diff --git a/compiler/testData/ir/irText/declarations/annotations/javaAnnotationWithSingleArrayArgument.fir.ir.txt b/compiler/testData/ir/irText/declarations/annotations/javaAnnotationWithSingleArrayArgument.fir.ir.txt deleted file mode 100644 index 20a2ef6cee9..00000000000 --- a/compiler/testData/ir/irText/declarations/annotations/javaAnnotationWithSingleArrayArgument.fir.ir.txt +++ /dev/null @@ -1,271 +0,0 @@ -FILE fqName: fileName:/C.kt - CLASS ANNOTATION_CLASS name:Anno modality:OPEN visibility:public superTypes:[kotlin.Annotation] - $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Anno - 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 - CONSTRUCTOR visibility:public <> (token:kotlin.String) returnType:.Anno [primary] - VALUE_PARAMETER name:token index:0 type:kotlin.String - BLOCK_BODY - DELEGATING_CONSTRUCTOR_CALL 'public constructor () declared in kotlin.Any' - INSTANCE_INITIALIZER_CALL classDescriptor='CLASS ANNOTATION_CLASS name:Anno modality:OPEN visibility:public superTypes:[kotlin.Annotation]' - 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 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 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 declared in kotlin.Annotation - $this: VALUE_PARAMETER name: type:kotlin.Any - CLASS ANNOTATION_CLASS name:Annos modality:OPEN visibility:public superTypes:[kotlin.Annotation] - $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Annos - 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 - CONSTRUCTOR visibility:public <> (value:kotlin.Array<.Anno>) returnType:.Annos [primary] - VALUE_PARAMETER name:value index:0 type:kotlin.Array<.Anno> - BLOCK_BODY - DELEGATING_CONSTRUCTOR_CALL 'public constructor () declared in kotlin.Any' - INSTANCE_INITIALIZER_CALL classDescriptor='CLASS ANNOTATION_CLASS name:Annos modality:OPEN visibility:public superTypes:[kotlin.Annotation]' - 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 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 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 declared in kotlin.Annotation - $this: VALUE_PARAMETER name: type:kotlin.Any - CLASS ANNOTATION_CLASS name:Classes modality:OPEN visibility:public superTypes:[kotlin.Annotation] - $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Classes - 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 - CONSTRUCTOR visibility:public <> (value:kotlin.Array>) returnType:.Classes [primary] - VALUE_PARAMETER name:value index:0 type:kotlin.Array> - BLOCK_BODY - DELEGATING_CONSTRUCTOR_CALL 'public constructor () declared in kotlin.Any' - INSTANCE_INITIALIZER_CALL classDescriptor='CLASS ANNOTATION_CLASS name:Classes modality:OPEN visibility:public superTypes:[kotlin.Annotation]' - 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 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 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 declared in kotlin.Annotation - $this: VALUE_PARAMETER name: type:kotlin.Any - CLASS ANNOTATION_CLASS name:Enums modality:OPEN visibility:public superTypes:[kotlin.Annotation] - $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Enums - 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 - CONSTRUCTOR visibility:public <> (value:kotlin.Array<.E>) returnType:.Enums [primary] - VALUE_PARAMETER name:value index:0 type:kotlin.Array<.E> - BLOCK_BODY - DELEGATING_CONSTRUCTOR_CALL 'public constructor () declared in kotlin.Any' - INSTANCE_INITIALIZER_CALL classDescriptor='CLASS ANNOTATION_CLASS name:Enums modality:OPEN visibility:public superTypes:[kotlin.Annotation]' - 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 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 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 declared in kotlin.Annotation - $this: VALUE_PARAMETER name: type:kotlin.Any - CLASS ANNOTATION_CLASS name:Ints modality:OPEN visibility:public superTypes:[kotlin.Annotation] - $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Ints - 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 - CONSTRUCTOR visibility:public <> (value:kotlin.IntArray) returnType:.Ints [primary] - VALUE_PARAMETER name:value index:0 type:kotlin.IntArray - BLOCK_BODY - DELEGATING_CONSTRUCTOR_CALL 'public constructor () declared in kotlin.Any' - INSTANCE_INITIALIZER_CALL classDescriptor='CLASS ANNOTATION_CLASS name:Ints modality:OPEN visibility:public superTypes:[kotlin.Annotation]' - 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 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 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 declared in kotlin.Annotation - $this: VALUE_PARAMETER name: type:kotlin.Any - CLASS ANNOTATION_CLASS name:Strings modality:OPEN visibility:public superTypes:[kotlin.Annotation] - $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Strings - 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 - CONSTRUCTOR visibility:public <> (value:kotlin.Array) returnType:.Strings [primary] - VALUE_PARAMETER name:value index:0 type:kotlin.Array - BLOCK_BODY - DELEGATING_CONSTRUCTOR_CALL 'public constructor () declared in kotlin.Any' - INSTANCE_INITIALIZER_CALL classDescriptor='CLASS ANNOTATION_CLASS name:Strings modality:OPEN visibility:public superTypes:[kotlin.Annotation]' - 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 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 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 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 () declared in .A' - INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:C modality:FINAL visibility:public superTypes:[.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 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 declared in .A - $this: VALUE_PARAMETER name: type:kotlin.Any - 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:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] - overridden: - public open fun toString (): kotlin.String declared in .A - $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 - ENUM_ENTRY name:EA - init: EXPRESSION_BODY - ENUM_CONSTRUCTOR_CALL 'private constructor () declared in .E' - CONSTRUCTOR visibility:private <> () returnType:.E [primary] - BLOCK_BODY - ENUM_CONSTRUCTOR_CALL 'public constructor (name: kotlin.String, ordinal: kotlin.Int) declared in kotlin.Enum' - : .E - INSTANCE_INITIALIZER_CALL classDescriptor='CLASS ENUM_CLASS name:E modality:FINAL visibility:public superTypes:[kotlin.Enum<.E>]' - 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 - FUN ENUM_CLASS_SPECIAL_MEMBER name:values visibility:public modality:FINAL <> () returnType:kotlin.Array<.E> - SYNTHETIC_BODY kind=ENUM_VALUES - 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 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 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> - 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> - PROPERTY ENUM_CLASS_SPECIAL_MEMBER name:entries visibility:public modality:FINAL [val] - FUN ENUM_CLASS_SPECIAL_MEMBER name: visibility:public modality:FINAL <> () returnType:kotlin.enums.EnumEntries<.E> - correspondingProperty: PROPERTY ENUM_CLASS_SPECIAL_MEMBER name:entries visibility:public modality:FINAL [val] - SYNTHETIC_BODY kind=ENUM_ENTRIES - PROPERTY FAKE_OVERRIDE name:name visibility:public modality:FINAL [fake_override,val] - annotations: - IntrinsicConstEvaluation - overridden: - public final name: kotlin.String - 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 - 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> diff --git a/compiler/testData/ir/irText/declarations/annotations/javaAnnotationWithSingleArrayArgument.fir.sig.kt.txt b/compiler/testData/ir/irText/declarations/annotations/javaAnnotationWithSingleArrayArgument.fir.sig.kt.txt deleted file mode 100644 index 0f087bed5c5..00000000000 --- a/compiler/testData/ir/irText/declarations/annotations/javaAnnotationWithSingleArrayArgument.fir.sig.kt.txt +++ /dev/null @@ -1,246 +0,0 @@ -// CHECK: -// Mangled name: Anno -// Public signature: /Anno|null[0] -open annotation class Anno : Annotation { - // CHECK: - // Mangled name: Anno{}token - // Public signature: /Anno.token|-1474644848610526691[0] - // Public signature debug description: {}token - val token: String - // CHECK JVM_IR: - // Mangled name: Anno#(){}kotlin.String - // Public signature: /Anno.token.|-7990759666918264390[0] - // Public signature debug description: (){}kotlin.String - get - - // CHECK: - // Mangled name: Anno#(kotlin.String){} - // Public signature: /Anno.|1280618353163213788[0] - // Public signature debug description: (kotlin.String){} - constructor(token: String) /* primary */ - -} - -// CHECK: -// Mangled name: Annos -// Public signature: /Annos|null[0] -open annotation class Annos : Annotation { - // CHECK: - // Mangled name: Annos{}value - // Public signature: /Annos.value|1987073854177347439[0] - // Public signature debug description: {}value - val value: Array - // CHECK JVM_IR: - // Mangled name: Annos#(){}kotlin.Array - // Public signature: /Annos.value.|-4069060984573284016[0] - // Public signature debug description: (){}kotlin.Array - get - - // CHECK: - // Mangled name: Annos#(kotlin.Array){} - // Public signature: /Annos.|1175794361085023797[0] - // Public signature debug description: (kotlin.Array){} - constructor(value: Array) /* primary */ - -} - -// CHECK: -// Mangled name: Classes -// Public signature: /Classes|null[0] -open annotation class Classes : Annotation { - // CHECK: - // Mangled name: Classes{}value - // Public signature: /Classes.value|1987073854177347439[0] - // Public signature debug description: {}value - val value: Array> - // CHECK JVM_IR: - // Mangled name: Classes#(){}kotlin.Array> - // Public signature: /Classes.value.|7741303810693223775[0] - // Public signature debug description: (){}kotlin.Array> - get - - // CHECK: - // Mangled name: Classes#(kotlin.Array>){} - // Public signature: /Classes.|-7037593412282832873[0] - // Public signature debug description: (kotlin.Array>){} - constructor(value: Array>) /* primary */ - -} - -// CHECK: -// Mangled name: Enums -// Public signature: /Enums|null[0] -open annotation class Enums : Annotation { - // CHECK: - // Mangled name: Enums{}value - // Public signature: /Enums.value|1987073854177347439[0] - // Public signature debug description: {}value - val value: Array - // CHECK JVM_IR: - // Mangled name: Enums#(){}kotlin.Array - // Public signature: /Enums.value.|6387785805560718811[0] - // Public signature debug description: (){}kotlin.Array - get - - // CHECK: - // Mangled name: Enums#(kotlin.Array){} - // Public signature: /Enums.|-3621344537085490519[0] - // Public signature debug description: (kotlin.Array){} - constructor(value: Array) /* primary */ - -} - -// CHECK: -// Mangled name: Ints -// Public signature: /Ints|null[0] -open annotation class Ints : Annotation { - // CHECK: - // Mangled name: Ints{}value - // Public signature: /Ints.value|1987073854177347439[0] - // Public signature debug description: {}value - val value: IntArray - // CHECK JVM_IR: - // Mangled name: Ints#(){}kotlin.IntArray - // Public signature: /Ints.value.|-5427747971978269276[0] - // Public signature debug description: (){}kotlin.IntArray - get - - // CHECK: - // Mangled name: Ints#(kotlin.IntArray){} - // Public signature: /Ints.|6811679238332965682[0] - // Public signature debug description: (kotlin.IntArray){} - constructor(value: IntArray) /* primary */ - -} - -// CHECK: -// Mangled name: Strings -// Public signature: /Strings|null[0] -open annotation class Strings : Annotation { - // CHECK: - // Mangled name: Strings{}value - // Public signature: /Strings.value|1987073854177347439[0] - // Public signature debug description: {}value - val value: Array - // CHECK JVM_IR: - // Mangled name: Strings#(){}kotlin.Array - // Public signature: /Strings.value.|-7769950459445256373[0] - // Public signature debug description: (){}kotlin.Array - get - - // CHECK: - // Mangled name: Strings#(kotlin.Array){} - // Public signature: /Strings.|5393043463829665764[0] - // Public signature debug description: (kotlin.Array){} - constructor(value: Array) /* primary */ - -} - -// CHECK: -// Mangled name: C -// Public signature: /C|null[0] -class C : A { - // CHECK: - // Mangled name: C#(){} - // Public signature: /C.|-5645683436151566731[0] - // Public signature debug description: (){} - constructor() /* primary */ - - // CHECK: - // Mangled name: C#test(){} - // Public signature: /C.test|6620506149988718649[0] - // Public signature debug description: test(){} - @Annos(value = Anno(token = "OK")) - @Strings(value = "OK") - @Ints(value = 42) - @Enums(value = E.EA) - @Classes(value = Double::class) - /* fake */ override fun test(): Unit - -} - -// CHECK: -// Mangled name: E -// Public signature: /E|null[0] -enum class E : Enum { - // CHECK: - // Mangled name: E.EA - // Public signature: /E.EA|null[0] - EA - - // CHECK: - // Mangled name: E#(){} - // Public signature: /E.|-5645683436151566731[0] - // Public signature debug description: (){} - private constructor() /* primary */ - - // CHECK JVM_IR: - // Mangled name: E#valueOf#static(kotlin.String){}E - // Public signature: /E.valueOf|-1984843552149141556[0] - // Public signature debug description: valueOf#static(kotlin.String){}E - fun valueOf(value: String): E - - // CHECK JVM_IR: - // Mangled name: E#values#static(){}kotlin.Array - // Public signature: /E.values|4921695905454219855[0] - // Public signature debug description: values#static(){}kotlin.Array - fun values(): Array - - // CHECK JVM_IR: - // Mangled name: E#compareTo(E){}kotlin.Int - // Public signature: /E.compareTo|7895449182838894647[0] - // Public signature debug description: compareTo(E){}kotlin.Int - /* fake */ override operator fun compareTo(other: E): Int - - // CHECK JVM_IR: - // Mangled name: E#equals(kotlin.Any?){}kotlin.Boolean - // Public signature: /E.equals|722809408929142791[0] - // Public signature debug description: equals(kotlin.Any?){}kotlin.Boolean - /* fake */ override operator fun equals(other: Any?): Boolean - - // CHECK JVM_IR: - // Mangled name: E#hashCode(){}kotlin.Int - // Public signature: /E.hashCode|-8048879360829830756[0] - // Public signature debug description: hashCode(){}kotlin.Int - /* fake */ override fun hashCode(): Int - - // CHECK JVM_IR: - // Mangled name: E#toString(){}kotlin.String - // Public signature: /E.toString|6958853723545266802[0] - // Public signature debug description: toString(){}kotlin.String - /* fake */ override fun toString(): String - - // CHECK: - // Mangled name: E#static{}entries - // Public signature: /E.entries|-5134227801081826149[0] - // Public signature debug description: #static{}entries - val entries: EnumEntries - // CHECK JVM_IR: - // Mangled name: E##static(){}kotlin.enums.EnumEntries - // Public signature: /E.entries.|2481970109947815388[0] - // Public signature debug description: #static(){}kotlin.enums.EnumEntries - get(): EnumEntries - - // CHECK: - // Mangled name: E{}name - // Public signature: /E.name|4231860309499509769[0] - // Public signature debug description: {}name - /* fake */ override val name: String - // CHECK JVM_IR: - // Mangled name: E#(){}kotlin.String - // Public signature: /E.name.|-8006111524522882650[0] - // Public signature debug description: (){}kotlin.String - /* fake */ override get(): String - - // CHECK: - // Mangled name: E{}ordinal - // Public signature: /E.ordinal|1912745122988592376[0] - // Public signature debug description: {}ordinal - /* fake */ override val ordinal: Int - // CHECK JVM_IR: - // Mangled name: E#(){}kotlin.Int - // Public signature: /E.ordinal.|-6902664390061762634[0] - // Public signature debug description: (){}kotlin.Int - /* fake */ override get(): Int - -} diff --git a/compiler/testData/ir/irText/declarations/annotations/javaAnnotationWithSingleArrayArgument.kt b/compiler/testData/ir/irText/declarations/annotations/javaAnnotationWithSingleArrayArgument.kt index d17dd43ddcc..ec53d672b52 100644 --- a/compiler/testData/ir/irText/declarations/annotations/javaAnnotationWithSingleArrayArgument.kt +++ b/compiler/testData/ir/irText/declarations/annotations/javaAnnotationWithSingleArrayArgument.kt @@ -1,8 +1,6 @@ // SKIP_KT_DUMP // TARGET_BACKEND: JVM - -// SEPARATE_SIGNATURE_DUMP_FOR_K2 -// ^ Different types in annotations generated by K1 and K2 +// FIR_IDENTICAL // FILE: A.java