本文介绍了IntelliJ建议错误的@NotNull注释的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
IntelliJ建议在以下程序中导入 com.sun.istack.internal.NotNull
@NotNull注释(这是错误的):
IntelliJ is suggesting to import com.sun.istack.internal.NotNull
the @NotNull annotation (which is wrong) in the following program:
public class Test implements Comparable<Test> {
@Override
public int compareTo(@NotNull Test o) {
return 0;
}
}
尝试正确导入时 com.intellij.annotations.NotNull
(我认为)看起来它找不到类:
When trying the correct import com.intellij.annotations.NotNull
(I think) it looks like it can't find the class:
推荐答案
你在添加注释之前,可以在警告上按Alt + Enter,按向右,选择编辑检查设置,然后选择配置注释并指定要在其中插入的注释。
You can Alt+Enter on the warning before you add the annotation, press Right, choose Edit Inspection Settings, then Configure Annotations and specify the annotation you want to be inserted there.
这篇关于IntelliJ建议错误的@NotNull注释的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!