2015-06-21 13:43 GMT+02:00 sebb <seb...@gmail.com>:

>
> > I'm not sure I understand; the equivalent of
> >
> > Boolean result = (Boolean) isSymbolicLink.invoke(null, path);
> > return result.booleanValue();
> >
> > Gives a style warning (uneccssary unboxing) in IntelliJ.
>
> That warning is wrong.
>
> Unboxing is clearly necessary here; it's just a question of whether it
> is implicit or explicit.
>
> I have seen several cases where implicit boxing was associated with a code
> bug.
> For example, a local variable was defined as Boolean but always used as
> boolean.
>

This makes me curious; the only bug I know of in this context is the clasic
NPE you can get in the automatic unboxing. Is there some other scenario
you're thinking of ?  (Uneccessary object allocation is obvious and
something we try to avoid but hardly a bug. In this case I also think the
object is unavoidable...)

Kristian

Reply via email to