How can I annotate enum.values() as NotNull?
Answered
It is not possible for an MyEnum.values() call to return a null, however Idea's annotation processing tags it as nullable.
Since values isn't actually a method call, I can't figure out how to use the External Annotations file to tag it as NonNull.
I can create a getValues() wrapper around values(), annotate it as @NotNull and then ignore the warnings but that really seems wrong and verbose since you'd have to do this for EVERY enum you define and couldn't do it for external enums at all.
Please sign in to leave a comment.
There is an open request: https://youtrack.jetbrains.com/issue/IDEA-135858, please vote.