JetBrains / java-annotations

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

Change RetentionPolicy on @Nullable from CLASS to RUNTIME #1

Closed awallgren closed 6 years ago

awallgren commented 6 years ago

Change RetentionPolicy on @Nullable from CLASS to RUNTIME. A use case for this change is to be able to write unit tests for verify and/or enforce use of such annotations.

amaembo commented 6 years ago

Hello and thank you for your interest to this repository. Unfortunately I have to reject your pull request. Changing retention to runtime will increase the amount of class metadata necessary to store in VM memory for everybody in production environment just to cover specific need of few users in testing environment. Also with class-level retention you still can easily check the annotation presence using bytecode reading libraries like ASM. So while it requires a little bit more efforts, such kind of test still could be written.