You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@velocity.apache.org by cf...@bluedolphin.com on 2002/07/26 05:44:21 UTC
[patch] Possible improvement to MethodMap
Ooops. �Should have run the unit-tests instead of my own ad-hoc test. �This
patch will work much better at handling null arguments.
Chris Felaco
Principal Software Engineer
Blue Dolphin Group
(508) 358-6758
----- Forwarded by Chris Felaco/Bdg on 07/25/2002 11:39 PM -----
|+---------+---------------------------------------------|
|| Chris | |
|| Felaco| � � � � To: |
|| | velocity-dev@jakarta.apache.org |
|| 07/25/| � � � � cc: |
|| 2002 | � � � � Subject: � � � �[patch] Possible |
|| 10:15 | improvement to MethodMap |
|| PM | |
|| | |
|+---------+---------------------------------------------|
I think that this patch improves the readability of the
MethodMap.calcDistance() method, and also will improve the speed. �With
this version, the null check is performed only once, and when the argument
is null, the more expensive isAssignableFrom() check is skipped.
Furthermore, this avoids the second redundant null-check with array
indexing, and the dummy OBJECT variable.
I'll understand if this does not make it into 1.3.1, but perhaps should be
included in 1.4.
<orignal embarassing NPE producing patch deleted>
Chris Felaco
Principal Software Engineer
Blue Dolphin Group
(508) 358-6758