You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@velocity.apache.org by jv...@locus.apache.org on 2000/12/07 18:39:38 UTC
cvs commit: jakarta-velocity/src/java/org/apache/velocity/util/introspection MethodMap.java
jvanzyl 00/12/07 09:39:37
Modified: src/java/org/apache/velocity/util/introspection
MethodMap.java
Log:
- applied patch sent by Christoph Reck to fix the problem where
isAssignableFrom did not consider primitive types.
Revision Changes Path
1.7 +17 -2 jakarta-velocity/src/java/org/apache/velocity/util/introspection/MethodMap.java
Index: MethodMap.java
===================================================================
RCS file: /home/cvs/jakarta-velocity/src/java/org/apache/velocity/util/introspection/MethodMap.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- MethodMap.java 2000/11/10 03:27:39 1.6
+++ MethodMap.java 2000/12/07 17:39:36 1.7
@@ -65,7 +65,7 @@
*
* @author <a href="mailto:jvanzyl@periapt.com">Jason van Zyl</a>
* @author <a href="mailto:bob@werken.com">Bob McWhirter</a>
- * @version $Id: MethodMap.java,v 1.6 2000/11/10 03:27:39 jvanzyl Exp $
+ * @version $Id: MethodMap.java,v 1.7 2000/12/07 17:39:36 jvanzyl Exp $
*/
public class MethodMap
@@ -124,7 +124,22 @@
if (j >= parameterTypes.length)
return method;
- if (!parameterTypes[j].isAssignableFrom(params[j].getClass()))
+ Class c = parameterTypes[j];
+ Object p = params[j];
+ if ( c.isPrimitive() )
+ {
+ try
+ {
+ if ( c != p.getClass().getField("TYPE").get(p) )
+ break;
+ }
+ catch (Exception ex)
+ {
+ break; // p is not a primitive derivate
+ }
+ }
+ else if ( (p != null) &&
+ !c.isAssignableFrom( p.getClass() ) )
break;
}
}