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 there 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.