JVM_IR: discard parameter annotations in anonymous object constructors

This commit is contained in:
pyos
2019-09-05 10:22:59 +02:00
committed by max-kammerer
parent 78465e280f
commit d3992826e4
23 changed files with 7 additions and 48 deletions
@@ -61,15 +61,11 @@ open class FunctionCodegen(
) )
} }
// FIXME: The following test is a workaround for a bug in anonymous object regeneration. // Since the only arguments to anonymous object constructors are captured variables and complex
// We currently need to avoid parameter annotations on the (synthetic) constructors of inlined anonymous objects, // super constructor arguments, there shouldn't be any annotations on them other than @NonNull,
// since otherwise anonymous object regeneration can fail with an ArrayIndexOutOfBounds exception if the number // and those are meaningless on synthetic parameters. (Also, the inliner cannot handle them and
// or arguments to the constructor changes. // will throw an exception if we generate any.)
if (!hasSyntheticFlag || if (irFunction !is IrConstructor || (!hasSyntheticFlag && !irFunction.parentAsClass.isAnonymousObject)) {
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
) {
generateParameterAnnotations(functionView, methodVisitor, signature, classCodegen, context) generateParameterAnnotations(functionView, methodVisitor, signature, classCodegen, context)
} }
@@ -1,4 +1,3 @@
// IGNORE_BACKEND: JVM_IR
// WITH_RUNTIME // WITH_RUNTIME
interface Wrapper { fun runBlock() } interface Wrapper { fun runBlock() }
@@ -1,4 +1,3 @@
// IGNORE_BACKEND: JVM_IR
// TARGET_BACKEND: JVM // TARGET_BACKEND: JVM
// WITH_RUNTIME // WITH_RUNTIME
// KOTLIN_CONFIGURATION_FLAGS: CONSTRUCTOR_CALL_NORMALIZATION_MODE=enable // KOTLIN_CONFIGURATION_FLAGS: CONSTRUCTOR_CALL_NORMALIZATION_MODE=enable
@@ -1,5 +1,4 @@
// !LANGUAGE: +NormalizeConstructorCalls // !LANGUAGE: +NormalizeConstructorCalls
// IGNORE_BACKEND: JVM_IR
// TARGET_BACKEND: JVM // TARGET_BACKEND: JVM
// WITH_RUNTIME // WITH_RUNTIME
open class A(val s: String) open class A(val s: String)
@@ -1,4 +1,3 @@
// IGNORE_BACKEND: JVM_IR
// FILE: J.java // FILE: J.java
// FULL_JDK // FULL_JDK
// WITH_RUNTIME // WITH_RUNTIME
@@ -1,5 +1,3 @@
// IGNORE_BACKEND: JVM_IR
// IGNORE_BACKEND_MULTI_MODULE: JVM_IR
// FILE: 1.kt // FILE: 1.kt
package test package test
@@ -1,5 +1,3 @@
// IGNORE_BACKEND: JVM_IR
// IGNORE_BACKEND_MULTI_MODULE: JVM_IR
// FILE: 1.kt // FILE: 1.kt
package test package test
@@ -1,5 +1,3 @@
// IGNORE_BACKEND: JVM_IR
// IGNORE_BACKEND_MULTI_MODULE: JVM_IR
// FILE: 1.kt // FILE: 1.kt
package test package test
@@ -1,5 +1,3 @@
// IGNORE_BACKEND: JVM_IR
// IGNORE_BACKEND_MULTI_MODULE: JVM_IR
// TARGET_BACKEND: JVM // TARGET_BACKEND: JVM
//WITH_RUNTIME //WITH_RUNTIME
//FULL_JDK //FULL_JDK
@@ -1,5 +1,3 @@
// IGNORE_BACKEND: JVM_IR
// IGNORE_BACKEND_MULTI_MODULE: JVM_IR
// TARGET_BACKEND: JVM // TARGET_BACKEND: JVM
// FILE: 1.kt // FILE: 1.kt
//WITH_RUNTIME //WITH_RUNTIME
@@ -1,5 +1,3 @@
// IGNORE_BACKEND: JVM_IR
// IGNORE_BACKEND_MULTI_MODULE: JVM_IR
// TARGET_BACKEND: JVM // TARGET_BACKEND: JVM
// FILE: 1.kt // FILE: 1.kt
//WITH_RUNTIME //WITH_RUNTIME
@@ -1,5 +1,3 @@
// IGNORE_BACKEND: JVM_IR
// IGNORE_BACKEND_MULTI_MODULE: JVM_IR
// FILE: 1.kt // FILE: 1.kt
package test package test
@@ -1,5 +1,3 @@
// IGNORE_BACKEND: JVM_IR
// IGNORE_BACKEND_MULTI_MODULE: JVM_IR
// TARGET_BACKEND: JVM // TARGET_BACKEND: JVM
// FILE: 1.kt // FILE: 1.kt
// WITH_REFLECT // WITH_REFLECT
@@ -1,8 +1,6 @@
// FILE: 1.kt // FILE: 1.kt
// FULL_JDK // FULL_JDK
// WITH_REFLECT // WITH_REFLECT
// IGNORE_BACKEND: JVM_IR
// IGNORE_BACKEND_MULTI_MODULE: JVM_IR
// TARGET_BACKEND: JVM // TARGET_BACKEND: JVM
package test package test
@@ -1,5 +1,3 @@
// IGNORE_BACKEND: JVM_IR
// IGNORE_BACKEND_MULTI_MODULE: JVM_IR
// TARGET_BACKEND: JVM // TARGET_BACKEND: JVM
// FILE: 1.kt // FILE: 1.kt
// WITH_REFLECT // WITH_REFLECT
@@ -1,5 +1,3 @@
// IGNORE_BACKEND: JVM_IR
// IGNORE_BACKEND_MULTI_MODULE: JVM_IR
// TARGET_BACKEND: JVM // TARGET_BACKEND: JVM
// FILE: 1.kt // FILE: 1.kt
// WITH_REFLECT // WITH_REFLECT
@@ -1,5 +1,3 @@
// IGNORE_BACKEND: JVM_IR
// IGNORE_BACKEND_MULTI_MODULE: JVM_IR
// TARGET_BACKEND: JVM // TARGET_BACKEND: JVM
// FILE: 1.kt // FILE: 1.kt
// WITH_REFLECT // WITH_REFLECT
@@ -1,5 +1,3 @@
// IGNORE_BACKEND: JVM_IR
// IGNORE_BACKEND_MULTI_MODULE: JVM_IR
// TARGET_BACKEND: JVM // TARGET_BACKEND: JVM
// FILE: 1.kt // FILE: 1.kt
// WITH_REFLECT // WITH_REFLECT
@@ -1,5 +1,3 @@
// IGNORE_BACKEND: JVM_IR
// IGNORE_BACKEND_MULTI_MODULE: JVM_IR
// TARGET_BACKEND: JVM // TARGET_BACKEND: JVM
// FILE: 1.kt // FILE: 1.kt
// WITH_REFLECT // WITH_REFLECT
@@ -1,5 +1,3 @@
// IGNORE_BACKEND: JVM_IR
// IGNORE_BACKEND_MULTI_MODULE: JVM_IR
// TARGET_BACKEND: JVM // TARGET_BACKEND: JVM
// FILE: 1.kt // FILE: 1.kt
// WITH_REFLECT // WITH_REFLECT
@@ -1,5 +1,3 @@
// IGNORE_BACKEND: JVM_IR
// IGNORE_BACKEND_MULTI_MODULE: JVM_IR
// TARGET_BACKEND: JVM // TARGET_BACKEND: JVM
// FILE: 1.kt // FILE: 1.kt
// WITH_REFLECT // WITH_REFLECT
@@ -1,6 +1,6 @@
// FILE: 1.kt // FILE: 1.kt
// IGNORE_BACKEND: JVM_IR
// IGNORE_BACKEND_MULTI_MODULE: JVM_IR
package builders package builders
//TODO there is a bug in asm it's skips linenumber on same line on reading bytecode //TODO there is a bug in asm it's skips linenumber on same line on reading bytecode
inline fun call(crossinline init: () -> Unit) { inline fun call(crossinline init: () -> Unit) {
@@ -1,4 +1,3 @@
// IGNORE_BACKEND: JVM_IR
//ALLOW_AST_ACCESS //ALLOW_AST_ACCESS
package test package test