@Override public Type visitTypeParameter(final Type t, final Type p) { if (t == p) { return t; } return asSuper(t.getExtendsBound(), p); }
@Override public Type visitTypeParameter(final Type t, final Type p) { if (t == p) { return t; } return asSuper(t.getExtendsBound(), p); }
@Override public Type visitTypeParameter(final Type t, final Type p) { if (t == p) { return t; } return asSuper(t.getExtendsBound(), p); }
public Type<?> asSuperTypeOf(@NotNull final Type<?> type) { return Helper.asSuper(VerifyArgument.notNull(type, "type"), this); }
public static Type asOuterSuper(Type t, final Type type) { switch (t.getKind()) { case DECLARED: do { final Type s = asSuper(t, type); if (s != null) { return s; } t = t.getDeclaringType(); } while (t.getKind() == TypeKind.DECLARED); return null; case ARRAY: return isSubtype(t, type) ? type : null; case TYPEVAR: return asSuper(t, type); case ERROR: return t; default: return null; } }
public static Type asOuterSuper(Type t, final Type type) { switch (t.getKind()) { case DECLARED: do { final Type s = asSuper(t, type); if (s != null) { return s; } t = t.getDeclaringType(); } while (t.getKind() == TypeKind.DECLARED); return null; case ARRAY: return isSubtype(t, type) ? type : null; case TYPEVAR: return asSuper(t, type); case ERROR: return t; default: return null; } }
public static Type asOuterSuper(Type t, final Type type) { switch (t.getKind()) { case DECLARED: do { final Type s = asSuper(t, type); if (s != null) { return s; } t = t.getDeclaringType(); } while (t.getKind() == TypeKind.DECLARED); return null; case ARRAY: return isSubtype(t, type) ? type : null; case TYPEVAR: return asSuper(t, type); case ERROR: return t; default: return null; } }
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)); }
isSubtypeNoCapture(superDeclaringType, sDeclaringType); final Type asSuper = asSuper(t, s); return asSuper != null //&& asSuper == s
isSubtypeNoCapture(superDeclaringType, sDeclaringType); final Type asSuper = asSuper(t, s); return asSuper != null //&& asSuper == s
isSubtypeNoCapture(superDeclaringType, sDeclaringType); final Type asSuper = asSuper(t, s); return asSuper != null //&& asSuper == s
public static boolean isSubtypeUnchecked(final Type t, final Type s) { if (t.isArray() && s.isArray()) { if (t.getElementType().isPrimitive()) { return isSameType(elementType(t), elementType(s)); } return isSubtypeUnchecked(elementType(t), elementType(s)); } else if (isSubtype(t, s)) { return true; } else if (t.isGenericParameter()) { return isSubtypeUnchecked(t.getExtendsBound(), s); } else if (s.isGenericParameter()) { return isSubtypeUnchecked(t, s.getExtendsBound()); } else if (s.isGenericType() && !s.isGenericTypeDefinition()) { final Type t2 = asSuper(t, s); if (t2 != null) { return true; } } return false; }
public static boolean isSubtypeUnchecked(final Type t, final Type s) { if (t.isArray() && s.isArray()) { if (t.getElementType().isPrimitive()) { return isSameType(elementType(t), elementType(s)); } return isSubtypeUnchecked(elementType(t), elementType(s)); } else if (isSubtype(t, s)) { return true; } else if (t.isGenericParameter()) { return isSubtypeUnchecked(t.getExtendsBound(), s); } else if (s.isGenericParameter()) { return isSubtypeUnchecked(t, s.getExtendsBound()); } else if (s.isGenericType() && !s.isGenericTypeDefinition()) { final Type t2 = asSuper(t, s); if (t2 != null) { return true; } } return false; }
public static boolean isSubtypeUnchecked(final Type t, final Type s) { if (t.isArray() && s.isArray()) { if (t.getElementType().isPrimitive()) { return isSameType(elementType(t), elementType(s)); } return isSubtypeUnchecked(elementType(t), elementType(s)); } else if (isSubtype(t, s)) { return true; } else if (t.isGenericParameter()) { return isSubtypeUnchecked(t.getExtendsBound(), s); } else if (s.isGenericParameter()) { return isSubtypeUnchecked(t, s.getExtendsBound()); } else if (s.isGenericType() && !s.isGenericTypeDefinition()) { final Type t2 = asSuper(t, s); if (t2 != null) { return true; } } return false; }