binary-compatibility-validator icon indicating copy to clipboard operation
binary-compatibility-validator copied to clipboard

Nested classes is present in dump when outer class is annotated with nonPublicMarker

Open ekursakov opened this issue 3 years ago • 1 comments

apiValidation {
    nonPublicMarkers += ["com.example.InternalApi"]
}
package com.example

@InternalApi
class Example {
    class Nested {
        fun foo() {}
    }
}

produces following dump:

public final class com/example/Example$Nested {
	public fun <init> ()V
	public final fun foo ()V
}

In Kotlin, an opt-in annotations is propagated to an all class members, including a nested classes. But binary-compatibility-validator filters only classes that are directly annotated with one of the annotations from nonPublicMarkers.

I think this behaviour should be aligned with opt-in annotations as they are often used as nonPublicMarkers.

ekursakov avatar Jul 07 '22 09:07 ekursakov

Ran into this with companion objects 😞.

JakeWharton avatar Mar 14 '24 02:03 JakeWharton