4

I am using the lombok @NonNull annotation for some of my fields, parameters and methods, partly for null checking, and also partly for documentation purpose. It is then confusing if I added a @NonNull/@NotNull annotation from other libraries.

Then if I also want to add a @Nullable/@CanNull annotation for some of my code, which one should I use? It doesn't exist in lombok (reasonably). If I declare my own annotation, IDEs may not understand them. If I use these annotations from existing libraries, other @NotNull annotations will also get added, and they may easily lead to using wrong annotations when I want the lombok one.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.