Missorted modifiers
Reports declarations whose modifiers are not in the canonical preferred order (as stated in the Java Language Specification).
Example:
After the quick-fix is applied:
Use the inspection settings to:
toggle the reporting of misplaced annotations: (annotations with
ElementType.TYPE_USE
not directly before the type and after the modifier keywords, or other annotations not before the modifier keywords). When this option is disabled, any annotation can be positioned before or after the modifier keywords. Modifier lists with annotations in between the modifier keywords will always be reported.specify whether the
ElementType.TYPE_USE
annotation should be positioned directly before a type, even when the annotation has other targets specified.
Inspection options
Option | Type | Default |
---|---|---|
Check annotation order | Checkbox | true |
Target TYPE_USE annotations always go before type | Checkbox | false |
Inspection Details | |
---|---|
Available in: | IntelliJ IDEA 2023.3, Qodana for JVM 2023.3 |
Plugin: | Java, 233.SNAPSHOT |