JVM_IR KT-45195 generate non-static annotation members as ACC_ABSTRACT
This commit is contained in:
committed by
TeamCityServer
parent
2fd69a5718
commit
17da240910
+15
-11
@@ -156,18 +156,22 @@ class FunctionCodegen(
|
|||||||
}
|
}
|
||||||
|
|
||||||
val isVararg = valueParameters.lastOrNull()?.varargElementType != null && !isBridge()
|
val isVararg = valueParameters.lastOrNull()?.varargElementType != null && !isBridge()
|
||||||
val modalityFlag = when ((this as? IrSimpleFunction)?.modality) {
|
val modalityFlag =
|
||||||
Modality.FINAL -> when {
|
if (parentAsClass.isAnnotationClass) {
|
||||||
origin == JvmLoweredDeclarationOrigin.CLASS_STATIC_INITIALIZER -> 0
|
if (isStatic) 0 else Opcodes.ACC_ABSTRACT
|
||||||
origin == IrDeclarationOrigin.ENUM_CLASS_SPECIAL_MEMBER -> 0
|
} else {
|
||||||
parentAsClass.isInterface && body != null -> 0
|
when ((this as? IrSimpleFunction)?.modality) {
|
||||||
parentAsClass.isAnnotationClass -> if (isStatic) 0 else Opcodes.ACC_ABSTRACT
|
Modality.FINAL -> when {
|
||||||
else -> Opcodes.ACC_FINAL
|
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 ||
|
val isSynthetic = origin.isSynthetic ||
|
||||||
hasAnnotation(JVM_SYNTHETIC_ANNOTATION_FQ_NAME) ||
|
hasAnnotation(JVM_SYNTHETIC_ANNOTATION_FQ_NAME) ||
|
||||||
isReifiable() ||
|
isReifiable() ||
|
||||||
|
|||||||
+5
@@ -39,6 +39,11 @@ public class BytecodeListingTestForAllOpenGenerated extends AbstractBytecodeList
|
|||||||
runTest("plugins/allopen/allopen-cli/testData/bytecodeListing/alreadyOpen.kt");
|
runTest("plugins/allopen/allopen-cli/testData/bytecodeListing/alreadyOpen.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("annotationMembers.kt")
|
||||||
|
public void testAnnotationMembers() throws Exception {
|
||||||
|
runTest("plugins/allopen/allopen-cli/testData/bytecodeListing/annotationMembers.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("anonymousObject.kt")
|
@TestMetadata("anonymousObject.kt")
|
||||||
public void testAnonymousObject() throws Exception {
|
public void testAnonymousObject() throws Exception {
|
||||||
runTest("plugins/allopen/allopen-cli/testData/bytecodeListing/anonymousObject.kt");
|
runTest("plugins/allopen/allopen-cli/testData/bytecodeListing/anonymousObject.kt");
|
||||||
|
|||||||
+5
@@ -39,6 +39,11 @@ public class IrBytecodeListingTestForAllOpenGenerated extends AbstractIrBytecode
|
|||||||
runTest("plugins/allopen/allopen-cli/testData/bytecodeListing/alreadyOpen.kt");
|
runTest("plugins/allopen/allopen-cli/testData/bytecodeListing/alreadyOpen.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("annotationMembers.kt")
|
||||||
|
public void testAnnotationMembers() throws Exception {
|
||||||
|
runTest("plugins/allopen/allopen-cli/testData/bytecodeListing/annotationMembers.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("anonymousObject.kt")
|
@TestMetadata("anonymousObject.kt")
|
||||||
public void testAnonymousObject() throws Exception {
|
public void testAnonymousObject() throws Exception {
|
||||||
runTest("plugins/allopen/allopen-cli/testData/bytecodeListing/anonymousObject.kt");
|
runTest("plugins/allopen/allopen-cli/testData/bytecodeListing/anonymousObject.kt");
|
||||||
|
|||||||
@@ -0,0 +1,18 @@
|
|||||||
|
// WITH_RUNTIME
|
||||||
|
|
||||||
|
annotation class AllOpen
|
||||||
|
|
||||||
|
annotation class Plain(val name: String, val index: Int) {
|
||||||
|
companion object {
|
||||||
|
@JvmStatic val staticProperty = 42
|
||||||
|
@JvmStatic fun staticFun() {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@AllOpen
|
||||||
|
annotation class MyComponent(val name: String, val index: Int) {
|
||||||
|
companion object {
|
||||||
|
@JvmStatic val staticProperty = 42
|
||||||
|
@JvmStatic fun staticFun() {}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,58 @@
|
|||||||
|
@java.lang.annotation.Retention
|
||||||
|
@kotlin.Metadata
|
||||||
|
public annotation class AllOpen {
|
||||||
|
// source: 'annotationMembers.kt'
|
||||||
|
}
|
||||||
|
|
||||||
|
@kotlin.Metadata
|
||||||
|
public final class MyComponent$Companion {
|
||||||
|
// source: 'annotationMembers.kt'
|
||||||
|
synthetic final static field $$INSTANCE: MyComponent$Companion
|
||||||
|
private final static field staticProperty: int
|
||||||
|
static method <clinit>(): void
|
||||||
|
private method <init>(): void
|
||||||
|
public synthetic deprecated static @kotlin.jvm.JvmStatic method getStaticProperty$annotations(): void
|
||||||
|
public final method getStaticProperty(): int
|
||||||
|
public final @kotlin.jvm.JvmStatic method staticFun(): void
|
||||||
|
public final inner class MyComponent$Companion
|
||||||
|
}
|
||||||
|
|
||||||
|
@AllOpen
|
||||||
|
@java.lang.annotation.Retention
|
||||||
|
@kotlin.Metadata
|
||||||
|
public annotation class MyComponent {
|
||||||
|
// source: 'annotationMembers.kt'
|
||||||
|
public final static @org.jetbrains.annotations.NotNull field Companion: MyComponent$Companion
|
||||||
|
static method <clinit>(): void
|
||||||
|
public static method getStaticProperty(): int
|
||||||
|
public abstract method index(): int
|
||||||
|
public abstract method name(): java.lang.String
|
||||||
|
public static @kotlin.jvm.JvmStatic method staticFun(): void
|
||||||
|
public final inner class MyComponent$Companion
|
||||||
|
}
|
||||||
|
|
||||||
|
@kotlin.Metadata
|
||||||
|
public final class Plain$Companion {
|
||||||
|
// source: 'annotationMembers.kt'
|
||||||
|
synthetic final static field $$INSTANCE: Plain$Companion
|
||||||
|
private final static field staticProperty: int
|
||||||
|
static method <clinit>(): void
|
||||||
|
private method <init>(): void
|
||||||
|
public synthetic deprecated static @kotlin.jvm.JvmStatic method getStaticProperty$annotations(): void
|
||||||
|
public final method getStaticProperty(): int
|
||||||
|
public final @kotlin.jvm.JvmStatic method staticFun(): void
|
||||||
|
public final inner class Plain$Companion
|
||||||
|
}
|
||||||
|
|
||||||
|
@java.lang.annotation.Retention
|
||||||
|
@kotlin.Metadata
|
||||||
|
public annotation class Plain {
|
||||||
|
// source: 'annotationMembers.kt'
|
||||||
|
public final static @org.jetbrains.annotations.NotNull field Companion: Plain$Companion
|
||||||
|
static method <clinit>(): void
|
||||||
|
public static method getStaticProperty(): int
|
||||||
|
public abstract method index(): int
|
||||||
|
public abstract method name(): java.lang.String
|
||||||
|
public static @kotlin.jvm.JvmStatic method staticFun(): void
|
||||||
|
public final inner class Plain$Companion
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user