Hi again,
Something looks wrong in the ASTMethod.execute() method.
Look at this piece of code:
...
/*
* check the cache
*/
IntrospectionCacheData icd = context.icacheGet( this );
Class c = o.getClass();
/*
* like ASTIdentifier, if we have cache information, and the
* Class of Object o is the same as that in the cache, we are
* safe.
*/
if ( icd != null && icd.contextData == c )
{
/*
* sadly, we do need recalc the values of the args, as this
can
* change from visit to visit
*/
for (int j = 0; j < paramCount; j++)
params[j] = jjtGetChild(j + 1).value(context);
/*
* and get the method from the cache
*/
method = (Method) icd.thingy;
}
...
Now, it looks like the Method to call is cached by node (as in the Iterator
class), with
context.icacheGet( this );
and by class, with
if ( ... && icd.contextData == c )
Now, this commentary in the code
/*
* like ASTIdentifier, if we have cache information, and the
* Class of Object o is the same as that in the cache, we are
* safe.
*/
looks wrong. It is even a practical contradiction to this one:
/*
* sadly, we do need recalc the values of the args, as this
can
* change from visit to visit
*/
since it is _not only_ the values of the arguments that might change. Their
_class_ might change too and that can determine that another method would be
the right match.
The right method match depends on the object class, the method name _AND_
the
number and classes of the passed arguments.
The strange part is that the org.apache.velocity.util.introspection package
considers all these bits!
=:o)
Again, I am putting my hands on this, but just want to check if I am missing
something.
Have fun... and say something,
Paulo Gaspar