Ah, true, but you get my point...


On 22 March 2013 13:33, javornikolov <notifications@github.com> wrote:

> In dbfit-java/core/src/main/java/dbfit/util/TypeNormaliserFactory.java:
>
> >              for (Class c: normalisers.keySet()) {
> > -                if (c.isAssignableFrom(bestCandidate)) {
> > -                    // c is parent
> > +                if (bestCandidate == null) {
> > +                    if (c.isAssignableFrom(targetClass)) {
> > +                        bestCandidate = c;
> > +                    }
> > +                } else if (bestCandidate.isAssignableFrom(c)) {
>
> I also wondered about combining the nested ifs but I think it's getting a
> bit more complicated.
>
> boolean isBestCandidate = (bestCandidate == null && c.isAssignableFrom(targetClass)) || bestCandidate.isAssignableFrom(c);
>
> What if *bestCandidate == null* resolves to true and *
> c.isAssignableFrom(targetClass)* resolves to false - it's not exactly
> equivalent.
>
> But I agree it got a bit hairy. I'll try to break it a bit.
>
> —
> Reply to this email directly or view it on GitHub<https://github.com/benilovj/dbfit/pull/63/files#r3489236>
> .
>