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.
// 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)
}
@@ -1,4 +1,3 @@
// IGNORE_BACKEND: JVM_IR
// WITH_RUNTIME
interface Wrapper { fun runBlock() }
@@ -1,4 +1,3 @@
// IGNORE_BACKEND: JVM_IR
// TARGET_BACKEND: JVM
// WITH_RUNTIME
// KOTLIN_CONFIGURATION_FLAGS: CONSTRUCTOR_CALL_NORMALIZATION_MODE=enable
@@ -1,5 +1,4 @@
// !LANGUAGE: +NormalizeConstructorCalls
// IGNORE_BACKEND: JVM_IR
// TARGET_BACKEND: JVM
// WITH_RUNTIME
open class A(val s: String)
@@ -1,4 +1,3 @@
// IGNORE_BACKEND: JVM_IR
// FILE: J.java
// FULL_JDK
// WITH_RUNTIME
@@ -1,5 +1,3 @@
// IGNORE_BACKEND: JVM_IR
// IGNORE_BACKEND_MULTI_MODULE: JVM_IR
// FILE: 1.kt
package test
@@ -1,5 +1,3 @@
// IGNORE_BACKEND: JVM_IR
// IGNORE_BACKEND_MULTI_MODULE: JVM_IR
// FILE: 1.kt
package test
@@ -1,5 +1,3 @@
// IGNORE_BACKEND: JVM_IR
// IGNORE_BACKEND_MULTI_MODULE: JVM_IR
// FILE: 1.kt
package test
@@ -1,5 +1,3 @@
// IGNORE_BACKEND: JVM_IR
// IGNORE_BACKEND_MULTI_MODULE: JVM_IR
// TARGET_BACKEND: JVM
//WITH_RUNTIME
//FULL_JDK
@@ -1,5 +1,3 @@
// IGNORE_BACKEND: JVM_IR
// IGNORE_BACKEND_MULTI_MODULE: JVM_IR
// TARGET_BACKEND: JVM
// FILE: 1.kt
//WITH_RUNTIME
@@ -1,5 +1,3 @@
// IGNORE_BACKEND: JVM_IR
// IGNORE_BACKEND_MULTI_MODULE: JVM_IR
// TARGET_BACKEND: JVM
// FILE: 1.kt
//WITH_RUNTIME
@@ -1,5 +1,3 @@
// IGNORE_BACKEND: JVM_IR
// IGNORE_BACKEND_MULTI_MODULE: JVM_IR
// FILE: 1.kt
package test
@@ -1,5 +1,3 @@
// IGNORE_BACKEND: JVM_IR
// IGNORE_BACKEND_MULTI_MODULE: JVM_IR
// TARGET_BACKEND: JVM
// FILE: 1.kt
// WITH_REFLECT
@@ -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
@@ -1,5 +1,3 @@
// IGNORE_BACKEND: JVM_IR
// IGNORE_BACKEND_MULTI_MODULE: JVM_IR
// TARGET_BACKEND: JVM
// FILE: 1.kt
// WITH_REFLECT
@@ -1,5 +1,3 @@
// IGNORE_BACKEND: JVM_IR
// IGNORE_BACKEND_MULTI_MODULE: JVM_IR
// TARGET_BACKEND: JVM
// FILE: 1.kt
// WITH_REFLECT
@@ -1,5 +1,3 @@
// IGNORE_BACKEND: JVM_IR
// IGNORE_BACKEND_MULTI_MODULE: JVM_IR
// TARGET_BACKEND: JVM
// FILE: 1.kt
// WITH_REFLECT
@@ -1,5 +1,3 @@
// IGNORE_BACKEND: JVM_IR
// IGNORE_BACKEND_MULTI_MODULE: JVM_IR
// TARGET_BACKEND: JVM
// FILE: 1.kt
// WITH_REFLECT
@@ -1,5 +1,3 @@
// IGNORE_BACKEND: JVM_IR
// IGNORE_BACKEND_MULTI_MODULE: JVM_IR
// TARGET_BACKEND: JVM
// FILE: 1.kt
// WITH_REFLECT
@@ -1,5 +1,3 @@
// IGNORE_BACKEND: JVM_IR
// IGNORE_BACKEND_MULTI_MODULE: JVM_IR
// TARGET_BACKEND: JVM
// FILE: 1.kt
// WITH_REFLECT
@@ -1,5 +1,3 @@
// IGNORE_BACKEND: JVM_IR
// IGNORE_BACKEND_MULTI_MODULE: JVM_IR
// TARGET_BACKEND: JVM
// FILE: 1.kt
// WITH_REFLECT
@@ -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) {
@@ -1,4 +1,3 @@
// IGNORE_BACKEND: JVM_IR
//ALLOW_AST_ACCESS
package test