diff --git a/core/src/main/java/lucee/runtime/reflection/Reflector.java b/core/src/main/java/lucee/runtime/reflection/Reflector.java index 09e195eed6..a57e895e54 100755 --- a/core/src/main/java/lucee/runtime/reflection/Reflector.java +++ b/core/src/main/java/lucee/runtime/reflection/Reflector.java @@ -184,20 +184,22 @@ public static boolean isInstaneOf(Class src, String trg) { * */ public static boolean isInstaneOf(Class src, Class trg, boolean exatctMatch) { + if (exatctMatch) return trg.isAssignableFrom(src); + if (src.isArray() && trg.isArray()) { - return isInstaneOf(src.getComponentType(), trg.getComponentType(), exatctMatch); + return isInstaneOf(src.getComponentType(), trg.getComponentType(), false); } - if (src == trg || (!exatctMatch && src.getName().equals(trg.getName()))) return true; + if (src == trg || (src.getName().equals(trg.getName()))) return true; // Interface if (trg.isInterface()) { - return _checkInterfaces(src, trg, exatctMatch); + return _checkInterfaces(src, trg, false); } // Extends while (src != null) { - if (src == trg || (!exatctMatch && src.getName().equals(trg.getName()))) return true; + if (src == trg || (src.getName().equals(trg.getName()))) return true; src = src.getSuperclass(); } return trg == Object.class; diff --git a/core/src/main/java/lucee/transformer/dynamic/meta/Clazz.java b/core/src/main/java/lucee/transformer/dynamic/meta/Clazz.java index 369ebdbd1c..474103fb47 100644 --- a/core/src/main/java/lucee/transformer/dynamic/meta/Clazz.java +++ b/core/src/main/java/lucee/transformer/dynamic/meta/Clazz.java @@ -110,31 +110,16 @@ public static Method getMethodMatch(Clazz clazz, final Collection.Key methodName Reflector.checkAccessibility(clazz, methodName); - // exact comparsion - outer: for (Method m: methods) { - if (m != null) { - Class[] parameterTypes = m.getArgumentClasses(); - for (int y = 0; y < parameterTypes.length; y++) { - if (Reflector.toReferenceClass(parameterTypes[y]) != clazzArgs[y]) continue outer; - } - return m; - } - } - // exact += (SystemUtil.millis() - start); - // start = SystemUtil.millis(); - // like comparsion outer: for (Method m: methods) { if (m != null) { Class[] parameterTypes = m.getArgumentClasses(); for (int y = 0; y < parameterTypes.length; y++) { - if (!Reflector.like(clazzArgs[y], Reflector.toReferenceClass(parameterTypes[y]))) continue outer; + if (!Reflector.toReferenceClass(parameterTypes[y]).isAssignableFrom(clazzArgs[y])) continue outer; } return m; } } - // like += (SystemUtil.millis() - start); - // start = SystemUtil.millis(); // cache StringBuilder sb = new StringBuilder(100).append(clazz.id()).append(methodName).append(';'); @@ -290,27 +275,18 @@ public static Constructor getConstructorMatch(Clazz clazz, Object[] args, boolea List constructors = clazz.getConstructors(args.length); if (constructors != null && constructors.size() > 0) { Class[] clazzArgs = Reflector.getClasses(args); - // exact comparsion - outer: for (Constructor c: constructors) { - if (c != null) { - - Class[] parameterTypes = c.getArgumentClasses(); - for (int y = 0; y < parameterTypes.length; y++) { - if (Reflector.toReferenceClass(parameterTypes[y]) != clazzArgs[y]) continue outer; - } - return c; - } - } // like comparsion outer: for (Constructor c: constructors) { if (c != null) { + Class[] parameterTypes = c.getArgumentClasses(); for (int y = 0; y < parameterTypes.length; y++) { - if (!Reflector.like(clazzArgs[y], Reflector.toReferenceClass(parameterTypes[y]))) continue outer; + if (!Reflector.toReferenceClass(parameterTypes[y]).isAssignableFrom(clazzArgs[y])) continue outer; } return c; } } + // convert comparsion Pair result = null; int _rating = 0; diff --git a/loader/build.xml b/loader/build.xml index 44c79fb453..b5a380d481 100644 --- a/loader/build.xml +++ b/loader/build.xml @@ -2,7 +2,7 @@ - + diff --git a/loader/pom.xml b/loader/pom.xml index fabb061884..272402f4ee 100644 --- a/loader/pom.xml +++ b/loader/pom.xml @@ -3,7 +3,7 @@ org.lucee lucee - 6.2.0.224-SNAPSHOT + 6.2.0.225-SNAPSHOT jar Lucee Loader Build