I have annotated a method returning null
with the @javax.annotations.Nonnull
annotation but FindBugs does not generate any warnings on this.
@Nonnull
public EventBuilder forCreateEvent() {
return null;
}
Maybe I misunderstood the meaning of @Nonnull
but I thought it means Method will not return null .
Additional comment: Please see my comment below for the cause of the problem.
The annotations that Findbugs understands are documented here .
At the time I originally answered this question, the javax.annotations.*
annotations are not listed. They are listed now.
As assylias said, May be its conflicting. Try changing it to
@edu.umd.cs.findbugs.annotations.NonNull
public EventBuilder forCreateEvent() {
return null;
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.