[jopr-dev] autoboxing

John Mazzitelli mazz at redhat.com
Wed Feb 4 09:57:02 EST 2009


What's the thought on auto-boxing? I saw some checkins related:

-  timeout = timeoutProperty.getIntegerValue().intValue();
+  timeout = timeoutProperty.getIntegerValue();

I hate autoboxing. If I see an explicit "intValue()", it tells me right 
away this is an Integer and not an int (and I need to therefore worry 
about nulls and NPEs).So it helps code-readability to explicitly not 
rely on autoboxing, and can avoid coding errors.

If I do not see the explicit "intValue" (or similar things), I either 
think its an "int" or I have to hunt around to find the declaration to 
find out for sure what it is.

I always thought autoboxing was a mistake and leads to more problems 
than it solves.





More information about the jopr-dev mailing list