"P. van Kemenade" <[EMAIL PROTECTED]> wrote:
> guess what .. I found the bug :-)
>
> I will snippet some code from MMObjectBuilder:
Yes, I was aiming at that particular code.
>
> but what if arguments.size() == 0 ?
>
> most methods I implemented in javabuilders that extend MMObjectBuilder
> dont take _any_ arguments in which case the backwards compatibility
> doesnt work.
>
> I tested that .. if I pass a bogus argument the methods work again.
> aw, it's so obvious now :-) ...
>
> >BTW I suppose that this is also the case in 1.6, and we should file it
> >as a bug ASAP.
>
> ehm .. ok ... should I do that ? .. how ?
I did it myself, and also fixed it.
For the record I'll also show test results:
The new 'executeFunction', which accepts a 'List' for arguments rather
then only a String (which can be a comma-separated list), was added
(by me) some time ago for 2 reasons:
- I suspected it to be more efficient, because you can avoid string-parsing then.
- More importantly, it enables you to define functions which do accept
arguments of other type then String. This can be used by the new
bridge function getFunctionValue and is e.g. used to acquire the
right path to image servlet in image-tag. But of course a lot of
other things can be thought of.
I added two 'test' builders in speeltuin/mihxil/org/mihxil, one adding
functions in the old way and one in the new way. As you pointed out,
the old way should stay working in all cases (A few cases did, but it
was indeed not tested well, so not all cases).
After my bugfix of today, here are some test results of a builder
extending in the old way:
[java] INFO Testing class org.mihxil.OldStyleFunctionBuilder
[java] INFO ============= (calling with string)
[java] INFO ----test()
[java] INFO TeSt
[java] INFO Time for test() : 4350 ms
[java] INFO ----test1(one)
[java] INFO TeSt-one
[java] INFO Time for test1(one) : 5004 ms
[java] INFO ----test2(one,two)
[java] INFO TeSt-one-two
[java] INFO Time for test2(one,two) : 7323 ms
[java] INFO ----test2(test(),test1(foo))
[java] INFO TeSt-test()-test1(foo)
[java] INFO Time for test2(test(),test1(foo)) : 9645 ms
[java] INFO ============== (calling with list)
[java] INFO ----testnull
[java] INFO TeSt
[java] INFO Time for test : 823 ms
[java] INFO ----test[]
[java] INFO TeSt
[java] INFO Time for test : 789 ms
[java] INFO ----test1[one]
[java] INFO TeSt-one
[java] INFO Time for test1 : 454 ms
[java] INFO ----test2[one, two]
[java] INFO TeSt-one-two
[java] INFO Time for test2 : 1902 ms
[java] INFO ----test2[test(), test1(foo)]
[java] INFO TeSt-test()-test1(foo)
[java] INFO Time for test2 : 2465 ms
And the new way:
[java] INFO Testing class org.mihxil.FunctionBuilder
[java] INFO ============= (calling with string)
[java] INFO ----test()
[java] INFO TeSt
[java] INFO Time for test() : 5119 ms
[java] INFO ----test1(one)
[java] INFO TeSt-one
[java] INFO Time for test1(one) : 6707 ms
[java] INFO ----test2(one,two)
[java] INFO TeSt-one-two
[java] INFO Time for test2(one,two) : 7992 ms
[java] INFO ----test2(test(),test1(foo))
[java] INFO TeSt-test()-test1(foo)
[java] INFO Time for test2(test(),test1(foo)) : 10180 ms
[java] INFO ============== (calling with list)
[java] INFO ----testnull
[java] INFO TeSt
[java] INFO Time for test : 184 ms
[java] INFO ----test[]
[java] INFO TeSt
[java] INFO Time for test : 207 ms
[java] INFO ----test1[one]
[java] INFO TeSt-one
[java] INFO Time for test1 : 813 ms
[java] INFO ----test2[one, two]
[java] INFO TeSt-one-two
[java] INFO Time for test2 : 650 ms
[java] INFO ----test2[test(), test1(foo)]
[java] INFO TeSt-test()-test1(foo)
[java] INFO Time for test2 : 788 ms
You see, the results are the same (first line after ----), but the
'new' way of overriding gives much quicker results (if at least also
calling the new function).
'Old' implementations also gain performance when called in the new
way, and it seems that 'new' style implementation are a little slower
when called in the old way (I think an extra list-join is done).
So, using the new bridge's 'getFunctionValue' function always benefits
performance. In 1.7 a taglib way will be added too. (<mm:function> I
think, with '<mm:param>'s.).
I hope this helps. Can you please test your extension again?
greetings,
Michiel
--
mihxil' Michiel Meeuwissen
Mediapark C101 Hilversum
+31 (0)35 6772979
[]()