기본이지만 가끔 헷갈릴때가 있다. java:S1124
Modifiers should be declared in the correct order
- Code Smell
- Minor
- Available SinceJul 31, 2018
- SonarQube (Java)
- Constant/issue: 2min
The Java Language Specification recommends listing modifiers in the following order:
1. Annotations
2. public
3. protected
4. private
5. abstract
6. static
7. final
8. transient
9. volatile
10. synchronized
11. native
12. 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.
Noncompliant Code Example
static public void main(String[] args) { // Noncompliant }
Compliant Solution
public static void main(String[] args) { // Compliant }
'Programing > JVM(Java, Kotlin)' 카테고리의 다른 글
[Java] var는 키워드가 아니다. (3) | 2020.11.25 |
---|---|
[Java] 지역변수 이름과 죄수번호...? (1) | 2020.11.01 |
[Java] 배열 in 자바 (0) | 2020.09.14 |
[책] 프로그래머의 장점과 단점 (0) | 2020.09.04 |
[Java] Effective Java의 Dogma (0) | 2020.08.19 |