Exclude clinit from ABI classes

This commit is contained in:
Alexey Tsvetkov
2018-12-02 23:04:17 +03:00
parent 519211036d
commit 5891617674
6 changed files with 29 additions and 1 deletions
@@ -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
}
@@ -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