Is there a way to configure Eclipse to automatically generate hashCode and equals with awareness of @NonNull annotations? Currently my Eclipse generates the code with unnecessary null checks, even on fields that are marked @NonNull.
Note that FindBugs will raise 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 that seems to undermine the role of FindBugs and @NonNull in the first place.
It looks to me that the best solution is to have Eclipse be aware of JSR 305 and generate equals and hashCode accordingly without null checks (and if they are null anyway then so be it and let a NullPointerException be thrown naturally, because a contract violation has occurred).
Short of that, having a way to customize the equals and hashCode template generated by Eclipse would also be nice.
 
     
    