Java
Redundant 'new' expression in constant array creation
Warning
New
Last modified: 03 December 2024Reports 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};
- By ID
Can be used to locate inspection in e.g. Qodana configuration files, where you can quickly enable or disable it, or adjust its settings.
UnnecessaryConstantArrayCreationExpression
Inspection Details | |
---|---|
By default bundled with: | |
Can be installed with plugin: | Java, 243.23126 |
Thanks for your feedback!
Was this page helpful?