JVM_IR KT-45195 generate non-static annotation members as ACC_ABSTRACT

This commit is contained in:
Dmitry Petrov
2021-03-18 16:02:53 +03:00
committed by TeamCityServer
parent 2fd69a5718
commit 17da240910
5 changed files with 101 additions and 11 deletions
@@ -156,18 +156,22 @@ class FunctionCodegen(
}
val isVararg = valueParameters.lastOrNull()?.varargElementType != null && !isBridge()
val modalityFlag = when ((this as? IrSimpleFunction)?.modality) {
Modality.FINAL -> when {
origin == JvmLoweredDeclarationOrigin.CLASS_STATIC_INITIALIZER -> 0
origin == IrDeclarationOrigin.ENUM_CLASS_SPECIAL_MEMBER -> 0
parentAsClass.isInterface && body != null -> 0
parentAsClass.isAnnotationClass -> if (isStatic) 0 else Opcodes.ACC_ABSTRACT
else -> Opcodes.ACC_FINAL
val modalityFlag =
if (parentAsClass.isAnnotationClass) {
if (isStatic) 0 else Opcodes.ACC_ABSTRACT
} else {
when ((this as? IrSimpleFunction)?.modality) {
Modality.FINAL -> when {
origin == JvmLoweredDeclarationOrigin.CLASS_STATIC_INITIALIZER -> 0
origin == IrDeclarationOrigin.ENUM_CLASS_SPECIAL_MEMBER -> 0
parentAsClass.isInterface && body != null -> 0
else -> Opcodes.ACC_FINAL
}
Modality.ABSTRACT -> Opcodes.ACC_ABSTRACT
// TODO transform interface modality on lowering to DefaultImpls
else -> if (parentAsClass.isJvmInterface && body == null) Opcodes.ACC_ABSTRACT else 0
}
}
Modality.ABSTRACT -> Opcodes.ACC_ABSTRACT
// TODO transform interface modality on lowering to DefaultImpls
else -> if (parentAsClass.isJvmInterface && body == null) Opcodes.ACC_ABSTRACT else 0
}
val isSynthetic = origin.isSynthetic ||
hasAnnotation(JVM_SYNTHETIC_ANNOTATION_FQ_NAME) ||
isReifiable() ||