Index: modules/pvm/src/main/java/org/jbpm/pvm/internal/util/ReflectUtil.java =================================================================== --- modules/pvm/src/main/java/org/jbpm/pvm/internal/util/ReflectUtil.java (revision 6341) +++ modules/pvm/src/main/java/org/jbpm/pvm/internal/util/ReflectUtil.java (working copy) @@ -5,7 +5,10 @@ import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.util.Arrays; +import java.util.Collections; +import java.util.HashMap; import java.util.List; +import java.util.Map; import org.jbpm.api.JbpmException; import org.jbpm.internal.log.Log; @@ -21,6 +24,22 @@ public abstract class ReflectUtil { private static Log log = Log.getLog(ReflectUtil.class.getName()); + + // this map contains relationship between primivite type and wrapped type + private static final Map WRAP_CLASS_MAP; + + static { + Map tempMap = new HashMap(); + tempMap.put(boolean.class, Boolean.class); + tempMap.put(char.class, Character.class); + tempMap.put(byte.class, Byte.class); + tempMap.put(short.class, Short.class); + tempMap.put(int.class, Integer.class); + tempMap.put(long.class, Long.class); + tempMap.put(float.class, Float.class); + tempMap.put(double.class, Double.class); + WRAP_CLASS_MAP = Collections.unmodifiableMap(tempMap); + } /** searches for the field in the given class and in its super classes */ public static Field findField(Class clazz, String fieldName) { @@ -224,7 +243,7 @@ return false; } } else if ( (args[i]!=null) - && (! parameterType.isAssignableFrom(args[i].getClass())) + && (! isTypeEquals(parameterType, args[i].getClass(), true)) ) { return false; } @@ -232,6 +251,19 @@ return true; } + public static boolean isTypeEquals(Class srcType, Class destType, boolean autoBoxing) { + if (autoBoxing) { + if (WRAP_CLASS_MAP.containsKey(srcType)) { + srcType = WRAP_CLASS_MAP.get(srcType); + } + if (WRAP_CLASS_MAP.containsKey(destType)) { + destType = WRAP_CLASS_MAP.get(destType); + } + } + + return srcType.isAssignableFrom(destType); + } + public static String getSignature(String methodName, List argDescriptors, Object[] args) { String signature = methodName+"("; if (args!=null) { Index: modules/pvm/src/test/java/org/jbpm/pvm/internal/wire/ObjectWireTest.java =================================================================== --- modules/pvm/src/test/java/org/jbpm/pvm/internal/wire/ObjectWireTest.java (revision 6341) +++ modules/pvm/src/test/java/org/jbpm/pvm/internal/wire/ObjectWireTest.java (working copy) @@ -627,12 +627,22 @@ String q = null; String propertyP = null; String propertyQ = null; + Boolean propertyR = null; + Boolean r = null; + boolean propertyS = false; + boolean s = false; public void setP(String p) { propertyP = p; } public void setQ(String q) { propertyQ = q; } + public void setR(Boolean r) { + propertyR = r; + } + public void setS(boolean s) { + propertyS = s; + } } public void testPropertyInjection() { @@ -645,6 +655,12 @@ " " + " " + " " + + " " + + " " + + " " + + " " + + " " + + " " + " " + "" ); @@ -655,8 +671,12 @@ assertEquals(PropertyInjectionClass.class, o.getClass()); assertNull(((PropertyInjectionClass)o).p); assertNull(((PropertyInjectionClass)o).q); + assertNull(((PropertyInjectionClass)o).r); + assertFalse(((PropertyInjectionClass)o).s); assertEquals("hello", ((PropertyInjectionClass)o).propertyP); assertEquals("world", ((PropertyInjectionClass)o).propertyQ); + assertTrue(((PropertyInjectionClass)o).propertyR); + assertTrue(((PropertyInjectionClass)o).propertyS); } public void testPropertyInjectionWithSetter() {