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 48c1a1e7d7d..e0b40713182 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 @@ -5,6 +5,7 @@ package org.jetbrains.kotlin.backend.jvm.codegen +import org.jetbrains.kotlin.backend.jvm.JvmLoweredDeclarationOrigin import org.jetbrains.kotlin.builtins.KotlinBuiltIns.FQ_NAMES import org.jetbrains.kotlin.codegen.AsmUtil import org.jetbrains.kotlin.codegen.ClassBuilderMode @@ -17,7 +18,6 @@ import org.jetbrains.kotlin.ir.expressions.* import org.jetbrains.kotlin.ir.util.* import org.jetbrains.kotlin.name.FqName import org.jetbrains.kotlin.psi.KtElement -import org.jetbrains.kotlin.resolve.jvm.AsmTypes import org.jetbrains.kotlin.resolve.jvm.annotations.JVM_SYNTHETIC_ANNOTATION_FQ_NAME import org.jetbrains.kotlin.resolve.jvm.annotations.STRICTFP_ANNOTATION_FQ_NAME import org.jetbrains.kotlin.resolve.jvm.annotations.SYNCHRONIZED_ANNOTATION_FQ_NAME @@ -50,9 +50,14 @@ open class FunctionCodegen( val flags = calculateMethodFlags(irFunction.isStatic) var methodVisitor = createMethod(flags, signature) - generateParameterNames(irFunction, methodVisitor, signature, state, flags.and(Opcodes.ACC_SYNTHETIC) != 0) + val hasSyntheticFlag = flags.and(Opcodes.ACC_SYNTHETIC) != 0 + generateParameterNames(irFunction, methodVisitor, signature, state, hasSyntheticFlag) - if (irFunction.origin != IrDeclarationOrigin.FUNCTION_FOR_DEFAULT_PARAMETER) { + 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 + ) { AnnotationCodegen(classCodegen, state, methodVisitor::visitAnnotation).genAnnotations( irFunction, signature.asmMethod.returnType @@ -137,7 +142,7 @@ open class FunctionCodegen( irFunction.OtherOrigin, flags, signature.asmMethod.name, signature.asmMethod.descriptor, - if (irFunction.origin == IrDeclarationOrigin.BRIDGE) null else signature.genericsSignature, + if (flags.and(Opcodes.ACC_SYNTHETIC) != 0) null else signature.genericsSignature, exceptions ) } diff --git a/compiler/testData/codegen/box/coroutines/tailCallOptimizations/tailCallIntrinsics.kt b/compiler/testData/codegen/box/coroutines/tailCallOptimizations/tailCallIntrinsics.kt index c23d7a3107d..81bd0db3bec 100644 --- a/compiler/testData/codegen/box/coroutines/tailCallOptimizations/tailCallIntrinsics.kt +++ b/compiler/testData/codegen/box/coroutines/tailCallOptimizations/tailCallIntrinsics.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND: JVM_IR // TARGET_BACKEND: JVM // FULL_JDK // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/reflection/genericSignature/samWrappedLambdaVsReference.kt b/compiler/testData/codegen/box/reflection/genericSignature/samWrappedLambdaVsReference.kt index 420dffe2411..a89030a4d27 100644 --- a/compiler/testData/codegen/box/reflection/genericSignature/samWrappedLambdaVsReference.kt +++ b/compiler/testData/codegen/box/reflection/genericSignature/samWrappedLambdaVsReference.kt @@ -1,5 +1,4 @@ // SKIP_JDK6 -// IGNORE_BACKEND: JVM_IR // TARGET_BACKEND: JVM // WITH_RUNTIME // FULL_JDK diff --git a/compiler/testData/codegen/boxInline/anonymousObject/capturedLambdaInInline.kt b/compiler/testData/codegen/boxInline/anonymousObject/capturedLambdaInInline.kt index 83efb058754..e93b5834074 100644 --- a/compiler/testData/codegen/boxInline/anonymousObject/capturedLambdaInInline.kt +++ b/compiler/testData/codegen/boxInline/anonymousObject/capturedLambdaInInline.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND: JVM_IR // FILE: 1.kt package test diff --git a/compiler/testData/codegen/boxInline/anonymousObject/capturedLambdaInInline2.kt b/compiler/testData/codegen/boxInline/anonymousObject/capturedLambdaInInline2.kt index fdb89bc4374..65bd20276ef 100644 --- a/compiler/testData/codegen/boxInline/anonymousObject/capturedLambdaInInline2.kt +++ b/compiler/testData/codegen/boxInline/anonymousObject/capturedLambdaInInline2.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND: JVM_IR // FILE: 1.kt package test diff --git a/compiler/testData/codegen/boxInline/complexStack/asCheck2.kt b/compiler/testData/codegen/boxInline/complexStack/asCheck2.kt index 62680555ced..18a0bd3273d 100644 --- a/compiler/testData/codegen/boxInline/complexStack/asCheck2.kt +++ b/compiler/testData/codegen/boxInline/complexStack/asCheck2.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND: JVM_IR // FILE: 1.kt package test diff --git a/compiler/testData/codegen/boxInline/reified/capturedLambda.kt b/compiler/testData/codegen/boxInline/reified/capturedLambda.kt index dff930dd6b1..baab480f19f 100644 --- a/compiler/testData/codegen/boxInline/reified/capturedLambda.kt +++ b/compiler/testData/codegen/boxInline/reified/capturedLambda.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND: JVM_IR // FILE: 1.kt // WITH_RUNTIME package test diff --git a/compiler/testData/codegen/boxInline/reified/capturedLambda2.kt b/compiler/testData/codegen/boxInline/reified/capturedLambda2.kt index 5f45ef9ca0a..dcc09a82265 100644 --- a/compiler/testData/codegen/boxInline/reified/capturedLambda2.kt +++ b/compiler/testData/codegen/boxInline/reified/capturedLambda2.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND: JVM_IR // FILE: 1.kt // WITH_REFLECT package test