Is there a way to configure Eclipse to automatically create hashCodeand equalsannotated @NonNull? My Eclipse is currently generating code with unnecessary checks null, even in the fields marked @NonNull.
Note that FindBugs will trigger warnings that these null checks are redundant . Of course, we can add
@edu.umd.cs.findbugs.annotations.SuppressWarnings("RCN_REDUNDANT_NULLCHECK_OF_NONNULL_VALUE")to the methods, but this, apparently, first of all undermines the role of FindBugs and @NonNull.
I think that the best solution is to know Eclipse JSR 305 and generate equalsand hashCodeaccordingly without nullchecks (and if they are null, in any case, let it be and let a NullPointerExceptionthrown in a natural way, because there was a breach of contract).
In addition, it would be nice to customize the template equalsand hashCodegenerated by Eclipse.
Related Questions
source
share