Reputation: 425
I was using a the reviewer "codePro Tools" by google and it flagged the flowing:
new Object[] { max }
with "Statically initialized array"
Explanation:
An array initializer is being used to initialize an array.
Recommendation
are there a good reason for this? or is just better to ignore.
this flag is on a section of rules called "code style".
Thanks
Upvotes: 2
Views: 131
Reputation: 61705
As always: it depends. It's a question of style. I personally can't see anything wrong with this at all. In this case, I think it would just obscure the code to initialise it dynamically.
I use statically initialized arrays all of the time. Code style is very subjective and varies from project to project, not just from person to person. It's up to you to decide whether it's a good thing for your project.
Upvotes: 4
Reputation: 308938
Take all automated code inspection tools with a grain of salt. They make recommendations, not issue commands.
If you have a good reason for writing your code that way, and can articulate it well to yourself and others, then stick with your code and ignore CodePro.
Upvotes: 2