接口方法在Eclipse中有冗余修饰符会不会报警告?
It is possible to get a warning if a interface method has redundant modifiers in Eclipse?
您可能知道,接口中的方法默认是 public 抽象的。
JLS7 说:"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."
如果现有接口方法有多余的修饰符,Eclipse 中是否有生成警告的选项?我没有在 Preferences -> Java -> Compiler -> Errors / Warnings
中找到任何选项
Intellij IDEA 有类似的功能,默认开启。
我发现了一些类似的问题,但它们涉及代码生成:
Eclipse generating useless 'public abstract' modifier in interface method signatures
eclipse refactoring - pull up method to interface
Eclipse 修复的错误:
[code style] don't generate redundant modifiers
此致。
根据 ΦXocę 웃 Пepeúpa ツ 评论,我发现有一个名为 SonarLint 的 Eclipse 插件,它可以连接到 SonarQube 实例并在 Java 编辑器中标记检测到的问题.
您可能知道,接口中的方法默认是 public 抽象的。
JLS7 说:"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."
如果现有接口方法有多余的修饰符,Eclipse 中是否有生成警告的选项?我没有在 Preferences -> Java -> Compiler -> Errors / Warnings
中找到任何选项Intellij IDEA 有类似的功能,默认开启。
我发现了一些类似的问题,但它们涉及代码生成:
Eclipse generating useless 'public abstract' modifier in interface method signatures
eclipse refactoring - pull up method to interface
Eclipse 修复的错误:
[code style] don't generate redundant modifiers
此致。
根据 ΦXocę 웃 Пepeúpa ツ 评论,我发现有一个名为 SonarLint 的 Eclipse 插件,它可以连接到 SonarQube 实例并在 Java 编辑器中标记检测到的问题.