commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Benedikt Ritter <brit...@apache.org>
Subject Re: svn commit: r1449456 - in /commons/proper/beanutils/trunk/src: changes/changes.xml main/java/org/apache/commons/beanutils/ConstructorUtils.java test/java/org/apache/commons/beanutils/ConstructorUtilsTestCase.java
Date Mon, 25 Feb 2013 12:43:03 GMT
2013/2/25 Jörg Schaible <Joerg.Schaible@scalaris.com>

> Benedikt Ritter wrote:
>
> > Hi Simo,
> >
> > 2013/2/24 Simone Tripodi <simonetripodi@apache.org>
> >
> >> Hi there Bene,
> >>
> >> > @@ -82,6 +82,9 @@ public class ConstructorUtils {
> >> >              InstantiationException {
> >> >
> >> >          Object[] args = { arg };
> >> > +        if (arg == null) {
> >> > +            args = null;
> >> > +        }
> >> >          return invokeConstructor(klass, args);
> >> >      }
> >>
> >> I'd invert the logic to
> >>
> >>         Object[] args = null;
> >>         if (arg != null) {
> >>             args = { arg };
> >>         }
> >>         return invokeConstructor(klass, args);
> >>
> >
> > In fact this is what I implemented first but the compiler won't let you
> do
> > this:
> > Array constants can only be used in initializers.
> >
> > I don't like my solution to much, because it is a bit counter intuitive.
> > But as the compile tells you why this is implemented this why, I think it
> > can stay like this. WDYT?
>
> You might use "new Object[]{arg}". In the end the compiler does the same.
>
>
yep, that's better. I'll change it when I'm at home.


> Cheers,
> Jörg
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org
>
>


-- 
http://people.apache.org/~britter/
http://www.systemoutprintln.de/
http://twitter.com/BenediktRitter
http://github.com/britter

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message