简体   繁体   English

禁止在Eclipse中丢失@Override批注的警告

[英]Suppress warnings for missing @Override annotation in Eclipse

I have warnings for the missing @Override annotation enabled by default in Eclipse, but for a couple of classes I'd rather have it disabled. 我有关于默认情况下在Eclipse中启用的缺少@Override注释的警告,但对于几个类,我希望将其禁用。

Is there a way to do this? 有没有办法做到这一点? Intuitively one would expect something like @SuppressWarnings("override") but that is of course not supported. @SuppressWarnings("override")直觉,人们会期望像@SuppressWarnings("override")这样的东西,但是当然不支持。

In eclipse -> windows -> preferences , select java -> compiler -> Errors/warnings Eclipse-> Windows->首选项中 ,选择Java->编译器-> 错误/警告

type override in the search bar then for "missing @overriden annotation" set level to ignore. 在搜索栏中输入替代,然后将“缺少@overriden注释”设置为忽略级别。

在此处输入图片说明

You should annotate all methods with @Override 您应该使用@Override注释所有方法

or when you don´t want to annotate with this annotation, than you should edit compiler settings in 或者,当您不想使用此注释进行注释时,则应在

eclipse to not show a warning when you don´t annotate with @Override. 不使用@Override注释时,Eclipse不会显示警告。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM