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
- The array should be initialized dynamically.
are ther开发者_高级运维e a good reason for this? or is just better to ignore.
this flag is on a section of rules called "code style".
Thanks
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.
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.
精彩评论