Example:
class Item {
// Public zero-length array constant that can be reused
public static final Item[] EMPTY_ARRAY = new Item[0];
}
class EmptyNode {
Item[] getChildren() {
// Unnecessary zero-length array creation
return new Item[0];
}
}
After the quick-fix is applied:
class EmptyNode {
Item[] getChildren() {
return Item.EMPTY_ARRAY;
}
}