Inspectopedia Help

Unnecessary 'def'

Reports unnecessary def modifiers when used with explicit type declaration.

Example:

def boolean foo() {} // modifier is unnecessary def Object bar // modifier is unnecessary // modifier is required and therefore not highlighted def (int a, String b) = []

Inspection options

Option

Type

Default

Only report in explicitly typed declarations

Checkbox

true

Inspection Details

Available in:

IntelliJ IDEA 2023.3, Qodana for JVM 2023.3

Plugin:

Groovy, 233.SNAPSHOT

Last modified: 13 July 2023