public static boolean returnTypeSubstitutable(final MethodInfo r1, final MethodInfo r2) { if (hasSameArgs(r1, r2)) { return resultSubtype(r1, r2); } return covariantReturnType( r1.getReturnType(), erasure(r2.getReturnType()) ); }
public static boolean returnTypeSubstitutable(final MethodInfo r1, final MethodInfo r2) { if (hasSameArgs(r1, r2)) { return resultSubtype(r1, r2); } return covariantReturnType( r1.getReturnType(), erasure(r2.getReturnType()) ); }
public static boolean returnTypeSubstitutable(final MethodInfo r1, final MethodInfo r2) { if (hasSameArgs(r1, r2)) { return resultSubtype(r1, r2); } return covariantReturnType( r1.getReturnType(), erasure(r2.getReturnType()) ); }
public static boolean overrides(final MethodInfo method, final MethodInfo other, final boolean checkResult) { if (method == other) { return true; } if (!isOverridableIn(other, method.getDeclaringType())) { return false; } // Check for a direct implementation if (asSuper(method.getDeclaringType(), other.getDeclaringType()) != null) { if (isSubSignature(method, other)) { if (!checkResult) { return true; } if (returnTypeSubstitutable(method, other)) { return true; } } } // Check for an inherited implementation //noinspection SimplifiableIfStatement if (method.isAbstract() || !other.isAbstract()) { return false; } return isSubSignature(method, other) && (!checkResult || resultSubtype(method, other)); }
public static boolean overrides(final MethodInfo method, final MethodInfo other, final boolean checkResult) { if (method == other) { return true; } if (!isOverridableIn(other, method.getDeclaringType())) { return false; } // Check for a direct implementation if (asSuper(method.getDeclaringType(), other.getDeclaringType()) != null) { if (isSubSignature(method, other)) { if (!checkResult) { return true; } if (returnTypeSubstitutable(method, other)) { return true; } } } // Check for an inherited implementation //noinspection SimplifiableIfStatement if (method.isAbstract() || !other.isAbstract()) { return false; } return isSubSignature(method, other) && (!checkResult || resultSubtype(method, other)); }
public static boolean overrides(final MethodInfo method, final MethodInfo other, final boolean checkResult) { if (method == other) { return true; } if (!isOverridableIn(other, method.getDeclaringType())) { return false; } // Check for a direct implementation if (asSuper(method.getDeclaringType(), other.getDeclaringType()) != null) { if (isSubSignature(method, other)) { if (!checkResult) { return true; } if (returnTypeSubstitutable(method, other)) { return true; } } } // Check for an inherited implementation //noinspection SimplifiableIfStatement if (method.isAbstract() || !other.isAbstract()) { return false; } return isSubSignature(method, other) && (!checkResult || resultSubtype(method, other)); }