JetBrains / JetBrains/java-annotations

VisibleForTesting behaviour is undefined for Kotlin code

Offen
#97 0 Kommentare 1 Reaktion 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
Kotlin
Sterne
463
Forks
72
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

The documentation for the `VisibleForTesting` documentation is unclear on what the intended behaviour should be for Kotlin code.

The documentation leads you to believe that a Kotlin public member annotated with `@VisibleForTesting` should otherwise be considered package-private; however, Kotlin has no package-private visibility, and the one-less-than-public visibility to apply is [`internal`](https://kotlinlang.org/docs/visibility-modifiers.html).

This makes the annotation useless in Kotlin code, because if it is enforced, it means you can't use annotated symbols in the `internal` scope, but you can use them in the narrower but inexistent package-private scope.

Beitragsleitfaden

Beitragsleitfaden öffnen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.