[英]No FindBugs warning for null return value if annotated with @Nonnull
I have annotated a method returning null
with the @javax.annotations.Nonnull
annotation but FindBugs does not generate any warnings on this.我已经用@javax.annotations.Nonnull
注释注释了一个返回null
的方法,但 FindBugs 没有对此产生任何警告。
@Nonnull
public EventBuilder forCreateEvent() {
return null;
}
Maybe I misunderstood the meaning of @Nonnull
but I thought it means Method will not return null .也许我误解了@Nonnull
的含义,但我认为这意味着Method 不会返回 null 。
Additional comment: Please see my comment below for the cause of the problem.附加评论:请参阅下面我的评论以了解问题的原因。
As assylias said, May be its conflicting.正如 assylias 所说,可能是自相矛盾的。 Try changing it to尝试将其更改为
@edu.umd.cs.findbugs.annotations.NonNull
public EventBuilder forCreateEvent() {
return null;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.