private void put(Method method) { String methodKey = makeMethodKey(method); // We don't overwrite methods because we fill the // cache from defined class towards java.lang.Object // and that would cause overridden methods to appear // as if they were not overridden. if (cache.get(methodKey) == null) { cache.put(methodKey, method); methodMap.add(method); if (debugReflection) { log.debug("Adding {}", method); } } }
throws AmbiguousException List methodList = get(methodName); return getBestMatch(methodList, classes);
/** * Returns all methods that are applicable to actual argument types. * @param methods list of all candidate methods * @param classes the actual types of the arguments * @return a list that contains only applicable methods (number of * formal and actual arguments matches, and argument types are assignable * to formal types through a method invocation conversion). */ private static LinkedList getApplicables(List methods, Class[] classes) { LinkedList list = new LinkedList(); for (Iterator imethod = methods.iterator(); imethod.hasNext();) { Method method = (Method) imethod.next(); if(isApplicable(method, classes)) { list.add(method); } } return list; }
throws AmbiguousException List methodList = get(methodName); return getMostSpecific(methodList, classes);
cacheEntry = methodMap.find(name, params);
if (!isStrictConvertible(methodArgs[i], classes[i], false)) if (isConvertible(methodArgs[i], classes[i], false)) else if (isExplicitlyConvertible(methodArgs[i], classes[i], false)) if (!isStrictConvertible(methodArgs[i], classes[i], i == classes.length - 1 && methodArgs[i].isArray())) if (isConvertible(methodArgs[i], classes[i], i == classes.length - 1 && methodArgs[i].isArray())) else if (isExplicitlyConvertible(methodArgs[i], classes[i], i == classes.length - 1 && methodArgs[i].isArray())) if (!isStrictConvertible(methodArgs[i], classes[i], false)) if (isConvertible(methodArgs[i], classes[i], false)) else if (isExplicitlyConvertible(methodArgs[i], classes[i], false)) for (int i = methodArgs.length - 1; i < classes.length; ++i) if (!isStrictConvertible(vararg, classes[i], false)) if (isConvertible(vararg, classes[i], false)) else if (isExplicitlyConvertible(vararg, classes[i], false))
if (isApplicable(method, args)) switch (compare(methodTypes, bestMatchTypes)) switch (compare(methodTypes, other.getParameterTypes()))
/** * Add a method to a list of methods by name. * For a particular class we are keeping track * of all the methods with the same name. * @param method */ public void add(Method method) { String methodName = method.getName(); List l = get( methodName ); if ( l == null) { l = new ArrayList(); methodByNameMap.put(methodName, l); } l.add(method); }
int applicability = getApplicability(method, unboxedArgs); if (applicability > NOT_CONVERTIBLE) if (onlyNullOrObjects(args)) switch (compare(match.methodTypes, best.methodTypes))
c1MoreSpecific = c1MoreSpecific || isStrictConvertible(c2[i], c1[i], last); c2MoreSpecific = c2MoreSpecific || isStrictConvertible(c1[i], c2[i], last);
if (!isConvertible(methodArgs[i], classes[i], false)) if(!isConvertible(methodArgs[i], classes[i], false)) return isConvertible(methodArgs[i], classes[i], true); if (!isConvertible(methodArgs[i], classes[i], false)) for (int i = methodArgs.length - 1; i < classes.length; ++i) if (!isConvertible(vararg, classes[i], false))
cacheEntry = methodMap.find(name, params);
if (isStrictConvertible(c2[i], c1[i], last)) break; fromC1toC2 = IMPLCITLY_CONVERTIBLE; case IMPLCITLY_CONVERTIBLE: if (isConvertible(c2[i], c1[i], last)) break; fromC1toC2 = EXPLICITLY_CONVERTIBLE; case EXPLICITLY_CONVERTIBLE: if (isExplicitlyConvertible(c2[i], c1[i], last)) break; fromC1toC2 = NOT_CONVERTIBLE; if (isStrictConvertible(c1[i], c2[i], last)) break; fromC2toC1 = IMPLCITLY_CONVERTIBLE; case IMPLCITLY_CONVERTIBLE: if (isConvertible(c1[i], c2[i], last)) break; fromC2toC1 = EXPLICITLY_CONVERTIBLE; case EXPLICITLY_CONVERTIBLE: if (isExplicitlyConvertible(c1[i], c2[i], last)) break; fromC2toC1 = NOT_CONVERTIBLE;
if (isApplicable(method, args)) switch (compare(methodTypes, bestMatchTypes)) switch (compare(methodTypes, other.getParameterTypes()))
/** * Add a method to a list of methods by name. * For a particular class we are keeping track * of all the methods with the same name. * @param method */ public void add(Method method) { String methodName = method.getName(); List l = get( methodName ); if ( l == null) { l = new ArrayList(); methodByNameMap.put(methodName, l); } l.add(method); }
c1MoreSpecific = c1MoreSpecific || isStrictConvertible(c2[i], c1[i], last) || c2[i] == Object.class;//Object is always least-specific c2MoreSpecific = c2MoreSpecific || isStrictConvertible(c1[i], c2[i], last) || c1[i] == Object.class;//Object is always least-specific
if (!isConvertible(methodArgs[i], classes[i], false)) if(!isConvertible(methodArgs[i], classes[i], false)) return isConvertible(methodArgs[i], classes[i], true); if (!isConvertible(methodArgs[i], classes[i], false)) for (int i = methodArgs.length - 1; i < classes.length; ++i) if (!isConvertible(vararg, classes[i], false))
throws AmbiguousException List methodList = get(methodName); return getBestMatch(methodList, classes);
cacheEntry = methodMap.find(name, params);
/** * Add a method to a list of methods by name. * For a particular class we are keeping track * of all the methods with the same name. * @param method */ public void add(Method method) { String methodName = method.getName(); List l = get( methodName ); if ( l == null) { l = new ArrayList(); methodByNameMap.put(methodName, l); } l.add(method); }