Inspectopedia Help

'arrayOf' call can be replaced with array literal [...]

Reports arrayOf calls that can be replaced with array literals [...].

Examples:

annotation class MyAnnotation(val strings: Array<String>) @MyAnnotation(arrayOf("alpha", "beta", "omega")) // replaceable 'arrayOf()' class MyClass

After the quick-fix is applied:

annotation class MyAnnotation(val strings: Array<String>) @MyAnnotation(["alpha", "beta", "omega"]) class MyClass

Inspection Details

Available in:

IntelliJ IDEA 2023.3, Qodana for JVM 2023.3

Plugin:

Kotlin, @snapshot@

Last modified: 13 July 2023