Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support meta annotations for nonPublicMarkers #280

Open
fsladkey opened this issue Nov 19, 2024 · 0 comments
Open

Support meta annotations for nonPublicMarkers #280

fsladkey opened this issue Nov 19, 2024 · 0 comments
Assignees

Comments

@fsladkey
Copy link

fsladkey commented Nov 19, 2024

In AndroidX we exclude experimental APIs from our compatibility tracking. The way we do this is by ignoring anything which is annotated by an annotation which itself is annotated with RequiresOptin.

Enumerating all the nonPublicMarkers is brittle (see here) so it would bee great if we could add meta annotations which should not be tracked. e.g. do not track anything annotated with an annotation which itself is annotated with @RequiresOptin.

I took a quick look into implementing it and it seems doable for JVM, however for klibs an AbiReadingFilter doesn't seem to have access to the necessary information to do such a check. Specifically, the list of annotations on a declaration and the associated classes with their annotations.

configure<kotlinx.validation.ApiValidationExtension> {
    nonPublicMetaMarkers.add("annotations.MetaHide")
}
@Target(AnnotationTarget.ANNOTATION_CLASS)
annotation class MetaHide

@MetaHide
@Target(AnnotationTarget.CLASS)
annotation class MyExperimentalApi

@MetaHide
@Target(AnnotationTarget.CLASS)
annotation class AnotherExperimentalAPi

@MyExperimentalApi
class A {} // should be hidden

@AnotherExperimentalApi
class B {} // so should this
@fzhinkin fzhinkin self-assigned this Nov 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants