Inspectopedia Help

Redundant 'new' expression in constant array creation

Reports constant new array expressions that can be replaced with an array initializer. Array initializers can omit the type because it is already specified in the left side of the assignment.

Example:

int[] foo = new int[] {42};

After the quick-fix is applied:

int[] foo = {42};

Inspection Details

Available in:

IntelliJ IDEA 2023.3, Qodana for JVM 2023.3

Plugin:

Java, 233.SNAPSHOT

Last modified: 13 July 2023