/** * Returns true if all the classes supplied as a's can be assigned * to the classes supplied as b's */ private static boolean isAssignable(final Class< ? >[] as, final Class< ? >[] bs) { if (as == null && bs == null) return true; if (as == null || bs == null) return false; if (as.length != bs.length) return false; for (int i = 0; i < as.length; i++) { if (!isAssignable(as[i], bs[i])) return false; } return true; }
private Method getBridgedWriteMethod() { try { return BridgedMethodFinder.findMethod(getWriteMethod(), clazz); } catch (Exception ignore) { } return null; }
private Method getBridgedWriteMethod() { try { return BridgedMethodFinder.findMethod(getWriteMethod(), clazz); } catch (Exception ignore) { } return null; }
private Method getBridgedWriteMethod() { try { return BridgedMethodFinder.findMethod(getWriteMethod(), clazz); } catch (Exception ignore) { } return null; }
/** * Returns true if all the classes supplied as a's can be assigned to the * classes supplied as b's */ private static boolean isAssignable(final Class<?>[] as, final Class<?>[] bs) { if (as == null && bs == null) return true; if (as == null || bs == null) return false; if (as.length != bs.length) return false; for (int i = 0; i < as.length; i++) { if (!isAssignable(as[i], bs[i])) return false; } return true; }
private Method getBridgedReadMethod() { try { return BridgedMethodFinder.findMethod(getReadMethod(), clazz); } catch (Exception ignore) { } return null; }
/** * returns true if the supplied method can handle the invocation of the * candidate Method. * * @param candidate the method to inspect * @param method the proposed bridge method * @return true if the supplied method can handle the invocation of the * candidate Method. */ private static boolean isAssignable(final Method candidate, final Method method) { if (!method.getName().equals(candidate.getName())) return false; if (method.getParameterTypes().length != candidate.getParameterTypes().length) return false; if (!isAssignable(method.getReturnType(), candidate.getReturnType())) return false; if (!isAssignable(method.getParameterTypes(), candidate.getParameterTypes())) return false; return true; }
private Method getBridgedReadMethod() { try { return BridgedMethodFinder.findMethod(getReadMethod(), clazz); } catch (Exception ignore) { } return null; }
/** * returns true if the supplied method can handle the invocation * of the candidate Method. * * @param candidate the method to inspect * @param method the proposed bridge method * @return * true if the supplied method can handle the invocation * of the candidate Method. */ private static boolean isAssignable(final Method candidate, final Method method) { if (!method.getName().equals(candidate.getName())) return false; if (method.getParameterTypes().length != candidate.getParameterTypes().length) return false; if (!isAssignable(method.getReturnType(), candidate.getReturnType())) return false; if (!isAssignable(method.getParameterTypes(), candidate.getParameterTypes())) return false; return true; }
private Method getBridgedReadMethod() { try { return BridgedMethodFinder.findMethod(getReadMethod(), clazz); } catch (Exception ignore) { } return null; }
/** * Find the original method for the Java5 bridge Method. If the supplied method * is not a bridge method then the supplied method is returned. * If the supplied method is a bridge method, the algorithm tries to find a more * specific method with parameters and return types that can be assigned to the * the supplied method parameters and return type. * * Informally, method A is more specific than method B if * any invocation handled by method A can also be handled by method B. * * @param bridgeMethod the bridge method (Java 5 specific) * @param targetClass the class the method belongs to * @return the original method or a more specific method if available */ public static Method findMethod(final Method bridgeMethod, final Class< ? > targetClass) { if (bridgeMethod == null || targetClass == null) return bridgeMethod; if (!bridgeMethod.isBridge()) return bridgeMethod; Method[] methods = bridgeMethod.getDeclaringClass().getDeclaredMethods(); for (Method method : methods) { // don't care about methods that are bridge methods if (method.isBridge()) continue; // check if the method is more specific if (isAssignable(method, bridgeMethod)) return method; } return bridgeMethod; }
/** * Find the original method for the Java5 bridge Method. If the supplied * method is not a bridge method then the supplied method is returned. If * the supplied method is a bridge method, the algorithm tries to find a * more specific method with parameters and return types that can be * assigned to the the supplied method parameters and return type. * * Informally, method A is more specific than method B if any invocation * handled by method A can also be handled by method B. * * @param bridgeMethod the bridge method (Java 5 specific) * @param targetClass the class the method belongs to * @return the original method or a more specific method if available */ public static Method findMethod(final Method bridgeMethod, final Class<?> targetClass) { if (bridgeMethod == null || targetClass == null) return bridgeMethod; if (!bridgeMethod.isBridge()) return bridgeMethod; Method[] methods = bridgeMethod.getDeclaringClass().getDeclaredMethods(); for (Method method : methods) { // don't care about methods that are bridge methods if (method.isBridge()) continue; // check if the method is more specific if (isAssignable(method, bridgeMethod)) return method; } return bridgeMethod; }