Inspectopedia Help

Missorted modifiers

Reports declarations whose modifiers are not in the canonical preferred order (as stated in the Java Language Specification).

Example:

class Foo { native public final void foo(); }

After the quick-fix is applied:

class Foo { public final native void foo(); }

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

Last modified: 13 July 2023