JetBrains / java-annotations

Annotations for JVM-based languages.
Apache License 2.0
404 stars 47 forks source link

VisibleForTesting is missing #26

Closed sergeyshp closed 4 years ago

sergeyshp commented 4 years ago

Hi team, I'm surprised I haven't found this one raised before, maybe it's just my OCD or I am missing something. @TestOnly is great, but is not enough I believe as a common (maybe not perfect) pattern is increasing visibility of a method to make it reachable for tests while it is still actually used in production. You can argue that you shouldn't have such methods, but than there shouldn't be TestOnly methods either. I believe we either need a new annotation only applying to visibility, or if it feels more natural add some property to the TestOnly to indicate that it only applies to visibility. Having said that I believe it'd be too verbose and is probably more restricting in future. Maybe this has been discussed before and ruled out for some reason, I'd love to hear the reasoning, but I feed strongly that it is just missing and would be a great benefit if it existed. Thank you, Sergey

amaembo commented 4 years ago

Added, thanks.

sergeyshp commented 4 years ago

Awesome, thanks a ton Tagir for a quick turnaround! Sergey