问题:
定义了一个常量
public final atatic String MSG = "XXX";
出现警告SonarLint: Reorder the modifiers to comply with the Java Languages Specification.
点开提示 Modifiers should be declared in the correct order(修饰符应该以正确的顺序声明)
原因:
The Java Language Specification recommends listing modifiers in the following order:
(Java 语言规范建议按以下顺序列出修饰符:)
- Annotations
- public
- protected
- private
- abstract
- static
- final
- transient
- volatile
- synchronized
- native
- strictfp
Not following this convention has no technical impact, but will reduce the code’s readability because most developers are used to the standard order.
(不遵循这个约定没有技术影响,但会降低代码的可读性,因为大多数开发人员都习惯于标准顺序。)
解决:
将
public final static String MSG = "XXX";
修改为
public static final String MSG = "XXX";