Skip to content

Commit 41bba0a

Browse files
qwwdfsadshanshin
authored andcommitted
[ABI Validation] Properly detect whether the given class is local
Parcelize bug explanation: With Kotlin 1.4.x, the corresponding $Creator class has been generated properly as an inner public class and its visibility was generated by internal outer class With Kotlin 1.5.0, $Creator is generated as local class within <clinit> block. Local classes do not have the corresponding 'outer_class_info_index' attribute and thus their visibility cannot be dominated by the outer class. But they do not constitute public API anyway. The bug was in incorrect detection on whether the class is local. Our isLocal check has been broken, but we had an additional guard in the code and also checked kotlinx.metadata.Flag.IS_LOCAL. Parcelize-generated classes lack such metadata and that guard also had failed Fixes Kotlin/binary-compatibility-validator#55 Pull request Kotlin/binary-compatibility-validator#60
1 parent 174839d commit 41bba0a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

libraries/tools/abi-validation/src/main/kotlin/api/AsmMetadataLoading.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ fun ClassNode.isEffectivelyPublic(classVisibility: ClassVisibility?) =
3636

3737

3838
val ClassNode.innerClassNode: InnerClassNode? get() = innerClasses.singleOrNull { it.name == name }
39-
fun ClassNode.isLocal() = innerClassNode?.run { innerName == null && outerName == null} ?: false
39+
fun ClassNode.isLocal() = outerMethod != null
4040
fun ClassNode.isInner() = innerClassNode != null
4141
fun ClassNode.isWhenMappings() = isSynthetic(access) && name.endsWith("\$WhenMappings")
4242

0 commit comments

Comments
 (0)