History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: IDEA-15679
Type: New Feature New Feature
Status: Open Open
Assignee: Bas Leijdekkers
Reporter: Eugene Vigdorchik
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
IDEA: Feedback

ArrayList declaration unnecessary inspection & quickfix

Created: 12 Oct 07 15:54   Updated: 12 Oct 07 16:53
Component/s: Code Analysis. Inspection

Build: 7,324


 Description  « Hide
Sometimes the code like this is written:

ArrayList<ModuleWizardStep> steps = new ArrayList<ModuleWizardStep>();
steps.add(wizardFactory.createSourcePathsStep(wizardContext, moduleBuilder, getWizardIcon(), "reference.dialogs.new.project.fromScratch.source"));
steps.add(wizardFactory.createProjectJdkStep(wizardContext));
final ModuleWizardStep[] wizardSteps = steps.toArray(new ModuleWizardStep[steps.size()]);

Here list declaration is unnecessary, and the length of array could be computed statically. The fix would thus convert it to array declaration in the first place.
Note that array length need not be constant, it should just be known when constructing the array.



 All   Comments   Work Log   Change History      Sort Order:
There are no comments yet on this issue.