简体   繁体   中英

It is possible to get a warning if a interface method has redundant modifiers in Eclipse?

As you probably know, methods in interfaces are by default public abstract.

The JLS7 says: "It is permitted, but discouraged as a matter of style, to redundantly specify the public and/or abstract modifier for a method declared in an interface."

Is there any option in Eclipse to generate warnings if existing interface methods have redundant modifiers? I didn't find any option in Preferences -> Java -> Compiler -> Errors / Warnings

Intellij IDEA has a similar feature, turned on by default.

I found some similar questions but they deal with code generation:

Eclipse generating useless 'public abstract' modifier in interface method signatures

eclipse refactoring - pull up method to interface

Eclipse fixed bug:

[code style] don't generate redundant modifiers

Regards.

基于ΦXocę웃Пepeúpaツ评论,我发现有一个名为SonarLint的Eclipse插件可以连接到SonarQube实例并在Java编辑器中标记检测到的问题。

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.

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