As it is sensible for some projects to permit autoboxing completely, it would be nice to have a check for this purpose.
I don't believe that this is a check that CheckStyle would be able to handle because variable types are hard to determine with any kind of certainty. For example:
i++; //is i an Integer or int? Before you can figure that out you need to figure out where i is declared and deal with variable shadowing, etc. Then of course i might not be declared in a class accessible to CheckStyle.
See how this type of Check is difficult? This is the type of Check that is perfect for tools like findbugs because they work on the bytecode level rather than the source code level.
Correct me if I'm wrong anyone.
I agree - Checkstyle does not have easy access to the required information for autoboxing checks. This is a job for findbugs.
Log in to post a comment.