Kotlin / binary-compatibility-validator

Public API management tool
Apache License 2.0
761 stars 55 forks source link

File annotations should be copied to `ClassBinarySignature` #163

Open dovchinnikov opened 6 months ago

dovchinnikov commented 6 months ago

Without this, file annotations are not considered when filtering the classes with non-public markers. Please find the reproducer in the attached pull request.

fzhinkin commented 6 months ago

File-targeting annotations (@file:..) seem to be only emitted for file-facade classes, and in all other cases, they are just lost.

If a file contains top-level declarations and has some @file-annotation registered as a non-public marker, a facade class generated to hold these declarations will be filtered out from the dump.

dovchinnikov commented 6 months ago

I understand how it behaves at the moment.

I'm arguing that non-public marker on file-level should affect the whole file, including types defined in the file.

fzhinkin commented 6 months ago

I mean, there's no info about such an annotation (except the file-facade case), so there's nothing we can do on the BCV side at the moment. Trying to figure out how @file-annotations are supposed to work (and if they are supposed to work the way they do).

fzhinkin commented 6 months ago

Corresponding YT issue: https://youtrack.jetbrains.com/issue/KT-64981