diff --git a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/FunctionCodegen.kt b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/FunctionCodegen.kt index 7c6a2ee0777..928c90dbbb1 100644 --- a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/FunctionCodegen.kt +++ b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/FunctionCodegen.kt @@ -61,15 +61,11 @@ open class FunctionCodegen( ) } - // FIXME: The following test is a workaround for a bug in anonymous object regeneration. - // We currently need to avoid parameter annotations on the (synthetic) constructors of inlined anonymous objects, - // since otherwise anonymous object regeneration can fail with an ArrayIndexOutOfBounds exception if the number - // or arguments to the constructor changes. - if (!hasSyntheticFlag || - irFunction.origin == JvmLoweredDeclarationOrigin.SYNTHETIC_METHOD_FOR_PROPERTY_ANNOTATIONS || - //TODO: investigate this case: annotation here is generated twice in lowered function and in interface method overload - irFunction.origin == JvmLoweredDeclarationOrigin.GENERATED_SAM_IMPLEMENTATION - ) { + // Since the only arguments to anonymous object constructors are captured variables and complex + // super constructor arguments, there shouldn't be any annotations on them other than @NonNull, + // and those are meaningless on synthetic parameters. (Also, the inliner cannot handle them and + // will throw an exception if we generate any.) + if (irFunction !is IrConstructor || (!hasSyntheticFlag && !irFunction.parentAsClass.isAnonymousObject)) { generateParameterAnnotations(functionView, methodVisitor, signature, classCodegen, context) } diff --git a/compiler/testData/codegen/box/closures/crossinlineLocalDeclaration.kt b/compiler/testData/codegen/box/closures/crossinlineLocalDeclaration.kt index 200c3863356..602f32029a8 100644 --- a/compiler/testData/codegen/box/closures/crossinlineLocalDeclaration.kt +++ b/compiler/testData/codegen/box/closures/crossinlineLocalDeclaration.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND: JVM_IR // WITH_RUNTIME interface Wrapper { fun runBlock() } diff --git a/compiler/testData/codegen/box/constructorCall/loopInInlineFunInSuperConstructorCallWithEnabledNormalization.kt b/compiler/testData/codegen/box/constructorCall/loopInInlineFunInSuperConstructorCallWithEnabledNormalization.kt index e898611b9d1..fc914fa55c6 100644 --- a/compiler/testData/codegen/box/constructorCall/loopInInlineFunInSuperConstructorCallWithEnabledNormalization.kt +++ b/compiler/testData/codegen/box/constructorCall/loopInInlineFunInSuperConstructorCallWithEnabledNormalization.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND: JVM_IR // TARGET_BACKEND: JVM // WITH_RUNTIME // KOTLIN_CONFIGURATION_FLAGS: CONSTRUCTOR_CALL_NORMALIZATION_MODE=enable diff --git a/compiler/testData/codegen/box/constructorCall/loopInInlineFunInSuperConstructorCallWithEnabledNormalizationSince13.kt b/compiler/testData/codegen/box/constructorCall/loopInInlineFunInSuperConstructorCallWithEnabledNormalizationSince13.kt index 0ff06f56586..c97858d3372 100644 --- a/compiler/testData/codegen/box/constructorCall/loopInInlineFunInSuperConstructorCallWithEnabledNormalizationSince13.kt +++ b/compiler/testData/codegen/box/constructorCall/loopInInlineFunInSuperConstructorCallWithEnabledNormalizationSince13.kt @@ -1,5 +1,4 @@ // !LANGUAGE: +NormalizeConstructorCalls -// IGNORE_BACKEND: JVM_IR // TARGET_BACKEND: JVM // WITH_RUNTIME open class A(val s: String) diff --git a/compiler/testData/codegen/boxAgainstJava/inline/kt19910.kt b/compiler/testData/codegen/boxAgainstJava/inline/kt19910.kt index cfd861620c3..44f766f071b 100644 --- a/compiler/testData/codegen/boxAgainstJava/inline/kt19910.kt +++ b/compiler/testData/codegen/boxAgainstJava/inline/kt19910.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND: JVM_IR // FILE: J.java // FULL_JDK // WITH_RUNTIME diff --git a/compiler/testData/codegen/boxInline/anonymousObject/anonymousObjectOnDeclarationSiteSuperParams.kt b/compiler/testData/codegen/boxInline/anonymousObject/anonymousObjectOnDeclarationSiteSuperParams.kt index 492413d9800..9344cbacd75 100644 --- a/compiler/testData/codegen/boxInline/anonymousObject/anonymousObjectOnDeclarationSiteSuperParams.kt +++ b/compiler/testData/codegen/boxInline/anonymousObject/anonymousObjectOnDeclarationSiteSuperParams.kt @@ -1,5 +1,3 @@ -// IGNORE_BACKEND: JVM_IR -// IGNORE_BACKEND_MULTI_MODULE: JVM_IR // FILE: 1.kt package test diff --git a/compiler/testData/codegen/boxInline/anonymousObject/capturedLambdaInInlineObject.kt b/compiler/testData/codegen/boxInline/anonymousObject/capturedLambdaInInlineObject.kt index 3cd74cf2fde..575323aa02a 100644 --- a/compiler/testData/codegen/boxInline/anonymousObject/capturedLambdaInInlineObject.kt +++ b/compiler/testData/codegen/boxInline/anonymousObject/capturedLambdaInInlineObject.kt @@ -1,5 +1,3 @@ -// IGNORE_BACKEND: JVM_IR -// IGNORE_BACKEND_MULTI_MODULE: JVM_IR // FILE: 1.kt package test diff --git a/compiler/testData/codegen/boxInline/anonymousObject/kt13374.kt b/compiler/testData/codegen/boxInline/anonymousObject/kt13374.kt index 06fbf935672..5db8f48053e 100644 --- a/compiler/testData/codegen/boxInline/anonymousObject/kt13374.kt +++ b/compiler/testData/codegen/boxInline/anonymousObject/kt13374.kt @@ -1,5 +1,3 @@ -// IGNORE_BACKEND: JVM_IR -// IGNORE_BACKEND_MULTI_MODULE: JVM_IR // FILE: 1.kt package test diff --git a/compiler/testData/codegen/boxInline/anonymousObject/kt16193.kt b/compiler/testData/codegen/boxInline/anonymousObject/kt16193.kt index a65b4add6a1..7f612614e5a 100644 --- a/compiler/testData/codegen/boxInline/anonymousObject/kt16193.kt +++ b/compiler/testData/codegen/boxInline/anonymousObject/kt16193.kt @@ -1,5 +1,3 @@ -// IGNORE_BACKEND: JVM_IR -// IGNORE_BACKEND_MULTI_MODULE: JVM_IR // TARGET_BACKEND: JVM //WITH_RUNTIME //FULL_JDK diff --git a/compiler/testData/codegen/boxInline/anonymousObject/kt19434.kt b/compiler/testData/codegen/boxInline/anonymousObject/kt19434.kt index 4a8c20685e4..88cfdd9de98 100644 --- a/compiler/testData/codegen/boxInline/anonymousObject/kt19434.kt +++ b/compiler/testData/codegen/boxInline/anonymousObject/kt19434.kt @@ -1,5 +1,3 @@ -// IGNORE_BACKEND: JVM_IR -// IGNORE_BACKEND_MULTI_MODULE: JVM_IR // TARGET_BACKEND: JVM // FILE: 1.kt //WITH_RUNTIME diff --git a/compiler/testData/codegen/boxInline/anonymousObject/kt19434_2.kt b/compiler/testData/codegen/boxInline/anonymousObject/kt19434_2.kt index 0ccbc6ad8e7..7f397cb3469 100644 --- a/compiler/testData/codegen/boxInline/anonymousObject/kt19434_2.kt +++ b/compiler/testData/codegen/boxInline/anonymousObject/kt19434_2.kt @@ -1,5 +1,3 @@ -// IGNORE_BACKEND: JVM_IR -// IGNORE_BACKEND_MULTI_MODULE: JVM_IR // TARGET_BACKEND: JVM // FILE: 1.kt //WITH_RUNTIME diff --git a/compiler/testData/codegen/boxInline/delegatedProperty/localInAnonymousObject.kt b/compiler/testData/codegen/boxInline/delegatedProperty/localInAnonymousObject.kt index 71d317bc691..c098619f778 100644 --- a/compiler/testData/codegen/boxInline/delegatedProperty/localInAnonymousObject.kt +++ b/compiler/testData/codegen/boxInline/delegatedProperty/localInAnonymousObject.kt @@ -1,5 +1,3 @@ -// IGNORE_BACKEND: JVM_IR -// IGNORE_BACKEND_MULTI_MODULE: JVM_IR // FILE: 1.kt package test diff --git a/compiler/testData/codegen/boxInline/enclosingInfo/objectInInlineFun.kt b/compiler/testData/codegen/boxInline/enclosingInfo/objectInInlineFun.kt index beec6058389..aaf8ff5d5d9 100644 --- a/compiler/testData/codegen/boxInline/enclosingInfo/objectInInlineFun.kt +++ b/compiler/testData/codegen/boxInline/enclosingInfo/objectInInlineFun.kt @@ -1,5 +1,3 @@ -// IGNORE_BACKEND: JVM_IR -// IGNORE_BACKEND_MULTI_MODULE: JVM_IR // TARGET_BACKEND: JVM // FILE: 1.kt // WITH_REFLECT diff --git a/compiler/testData/codegen/boxInline/reified/kt15997_2.kt b/compiler/testData/codegen/boxInline/reified/kt15997_2.kt index 03d98c0d4d7..8124757b654 100644 --- a/compiler/testData/codegen/boxInline/reified/kt15997_2.kt +++ b/compiler/testData/codegen/boxInline/reified/kt15997_2.kt @@ -1,8 +1,6 @@ // FILE: 1.kt // FULL_JDK // WITH_REFLECT -// IGNORE_BACKEND: JVM_IR -// IGNORE_BACKEND_MULTI_MODULE: JVM_IR // TARGET_BACKEND: JVM package test diff --git a/compiler/testData/codegen/boxInline/signature/inProjectionSubstitution.kt b/compiler/testData/codegen/boxInline/signature/inProjectionSubstitution.kt index 882c4bbb826..ca3f588d679 100644 --- a/compiler/testData/codegen/boxInline/signature/inProjectionSubstitution.kt +++ b/compiler/testData/codegen/boxInline/signature/inProjectionSubstitution.kt @@ -1,5 +1,3 @@ -// IGNORE_BACKEND: JVM_IR -// IGNORE_BACKEND_MULTI_MODULE: JVM_IR // TARGET_BACKEND: JVM // FILE: 1.kt // WITH_REFLECT diff --git a/compiler/testData/codegen/boxInline/signature/outProjectionSubstitution.kt b/compiler/testData/codegen/boxInline/signature/outProjectionSubstitution.kt index 97b87caa2ec..dc05def5a23 100644 --- a/compiler/testData/codegen/boxInline/signature/outProjectionSubstitution.kt +++ b/compiler/testData/codegen/boxInline/signature/outProjectionSubstitution.kt @@ -1,5 +1,3 @@ -// IGNORE_BACKEND: JVM_IR -// IGNORE_BACKEND_MULTI_MODULE: JVM_IR // TARGET_BACKEND: JVM // FILE: 1.kt // WITH_REFLECT diff --git a/compiler/testData/codegen/boxInline/signature/sameFormalParameterName.kt b/compiler/testData/codegen/boxInline/signature/sameFormalParameterName.kt index bda5926d0bb..2c58a9da41b 100644 --- a/compiler/testData/codegen/boxInline/signature/sameFormalParameterName.kt +++ b/compiler/testData/codegen/boxInline/signature/sameFormalParameterName.kt @@ -1,5 +1,3 @@ -// IGNORE_BACKEND: JVM_IR -// IGNORE_BACKEND_MULTI_MODULE: JVM_IR // TARGET_BACKEND: JVM // FILE: 1.kt // WITH_REFLECT diff --git a/compiler/testData/codegen/boxInline/signature/sameReifiedFormalParameterName.kt b/compiler/testData/codegen/boxInline/signature/sameReifiedFormalParameterName.kt index 8d0a3b828c2..22c8776122e 100644 --- a/compiler/testData/codegen/boxInline/signature/sameReifiedFormalParameterName.kt +++ b/compiler/testData/codegen/boxInline/signature/sameReifiedFormalParameterName.kt @@ -1,5 +1,3 @@ -// IGNORE_BACKEND: JVM_IR -// IGNORE_BACKEND_MULTI_MODULE: JVM_IR // TARGET_BACKEND: JVM // FILE: 1.kt // WITH_REFLECT diff --git a/compiler/testData/codegen/boxInline/signature/starProjectionSubstitution.kt b/compiler/testData/codegen/boxInline/signature/starProjectionSubstitution.kt index 207779cf3cf..b795b338486 100644 --- a/compiler/testData/codegen/boxInline/signature/starProjectionSubstitution.kt +++ b/compiler/testData/codegen/boxInline/signature/starProjectionSubstitution.kt @@ -1,5 +1,3 @@ -// IGNORE_BACKEND: JVM_IR -// IGNORE_BACKEND_MULTI_MODULE: JVM_IR // TARGET_BACKEND: JVM // FILE: 1.kt // WITH_REFLECT diff --git a/compiler/testData/codegen/boxInline/signature/typeParametersSubstitution.kt b/compiler/testData/codegen/boxInline/signature/typeParametersSubstitution.kt index 6ca79f84fec..06d63ce0a21 100644 --- a/compiler/testData/codegen/boxInline/signature/typeParametersSubstitution.kt +++ b/compiler/testData/codegen/boxInline/signature/typeParametersSubstitution.kt @@ -1,5 +1,3 @@ -// IGNORE_BACKEND: JVM_IR -// IGNORE_BACKEND_MULTI_MODULE: JVM_IR // TARGET_BACKEND: JVM // FILE: 1.kt // WITH_REFLECT diff --git a/compiler/testData/codegen/boxInline/signature/typeParametersSubstitution2.kt b/compiler/testData/codegen/boxInline/signature/typeParametersSubstitution2.kt index e429002f610..143856ebb2f 100644 --- a/compiler/testData/codegen/boxInline/signature/typeParametersSubstitution2.kt +++ b/compiler/testData/codegen/boxInline/signature/typeParametersSubstitution2.kt @@ -1,5 +1,3 @@ -// IGNORE_BACKEND: JVM_IR -// IGNORE_BACKEND_MULTI_MODULE: JVM_IR // TARGET_BACKEND: JVM // FILE: 1.kt // WITH_REFLECT diff --git a/compiler/testData/codegen/boxInline/smap/anonymous/objectOnInlineCallSiteWithCapture.kt b/compiler/testData/codegen/boxInline/smap/anonymous/objectOnInlineCallSiteWithCapture.kt index 9eb29b119ac..41b7502d7d0 100644 --- a/compiler/testData/codegen/boxInline/smap/anonymous/objectOnInlineCallSiteWithCapture.kt +++ b/compiler/testData/codegen/boxInline/smap/anonymous/objectOnInlineCallSiteWithCapture.kt @@ -1,6 +1,6 @@ // FILE: 1.kt -// IGNORE_BACKEND: JVM_IR -// IGNORE_BACKEND_MULTI_MODULE: JVM_IR + + package builders //TODO there is a bug in asm it's skips linenumber on same line on reading bytecode inline fun call(crossinline init: () -> Unit) { diff --git a/compiler/testData/loadJava/compiledKotlin/inline/inlineFunction.kt b/compiler/testData/loadJava/compiledKotlin/inline/inlineFunction.kt index ee1ce9c4ba6..7691e8c76e1 100644 --- a/compiler/testData/loadJava/compiledKotlin/inline/inlineFunction.kt +++ b/compiler/testData/loadJava/compiledKotlin/inline/inlineFunction.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND: JVM_IR //ALLOW_AST_ACCESS package test