Steve Bosman
Steve Bosman

Reputation: 2618

IntelliJ inspection for verbose array initialisation

Is there an inspection in IntelliJ which will detect when I have written

final String[] args = new String[]{​"a", "b"}​;

instead of the shorter (and equally valid)

final String[] args = {​​​"a", "b"}​​​;

I can't find one and I would like a weak warning when I use the more verbose form.

Upvotes: 1

Views: 59

Answers (1)

Bas Leijdekkers
Bas Leijdekkers

Reputation: 26462

Yes, there is: Java | Code style issues | Redundant 'new' expression in constant array creation

Upvotes: 1

Related Questions