Exclude clinit from ABI classes
This commit is contained in:
@@ -22,7 +22,7 @@ internal class AbiClassBuilder(private val cv: ClassVisitor) : AbstractClassBuil
|
||||
signature: String?,
|
||||
exceptions: Array<out String>?
|
||||
): MethodVisitor {
|
||||
if (isPrivate(access)) return EMPTY_METHOD_VISITOR
|
||||
if (isPrivate(access) || isClinit(name, access)) return EMPTY_METHOD_VISITOR
|
||||
|
||||
val mv = super.newMethod(origin, access, name, desc, signature, exceptions)
|
||||
val descriptor = origin.descriptor
|
||||
@@ -62,4 +62,7 @@ internal class AbiClassBuilder(private val cv: ClassVisitor) : AbstractClassBuil
|
||||
|
||||
private fun isPrivate(access: Int): Boolean =
|
||||
(access and Opcodes.ACC_PRIVATE) == Opcodes.ACC_PRIVATE
|
||||
|
||||
private fun isClinit(name: String, access: Int): Boolean =
|
||||
name == "<clinit>" && (access and Opcodes.ACC_STATIC) == Opcodes.ACC_STATIC
|
||||
}
|
||||
+5
@@ -39,6 +39,11 @@ public class CompareJvmAbiTestGenerated extends AbstractCompareJvmAbiTest {
|
||||
runTest("plugins/jvm-abi-gen/testData/compare/classPrivateMemebers/");
|
||||
}
|
||||
|
||||
@TestMetadata("clinit")
|
||||
public void testClinit() throws Exception {
|
||||
runTest("plugins/jvm-abi-gen/testData/compare/clinit/");
|
||||
}
|
||||
|
||||
@TestMetadata("functionBody")
|
||||
public void testFunctionBody() throws Exception {
|
||||
runTest("plugins/jvm-abi-gen/testData/compare/functionBody/");
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
package test
|
||||
|
||||
object Object {
|
||||
val x = 0
|
||||
val y = x
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
package test
|
||||
|
||||
val x = 0
|
||||
val y = x
|
||||
@@ -0,0 +1,6 @@
|
||||
package test
|
||||
|
||||
object Object {
|
||||
val x = 0
|
||||
val y = 0
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
package test
|
||||
|
||||
val x = 0
|
||||
val y = 0
|
||||
Reference in New Issue
Block a user