@Override public Type visitArrayType(final Type t, final Type p) { return isSubtype(t, p) ? p : null; }
public static boolean isConvertible(final Type sourceType, final Type targetType) { final boolean tPrimitive = sourceType.isPrimitive(); final boolean sPrimitive = targetType.isPrimitive(); if (sourceType == Type.NullType) { return !targetType.isPrimitive(); } if (targetType == Types.Object) { return true; } if (targetType.isGenericParameter()) { return isConvertible(sourceType, targetType.getExtendsBound()); } if (tPrimitive == sPrimitive) { return isSubtypeUnchecked(sourceType, targetType); } return tPrimitive ? isSubtype(TypeUtils.getBoxedTypeOrSelf(sourceType), targetType) : isSubtype(TypeUtils.getUnderlyingPrimitiveOrSelf(sourceType), targetType); }
@Override public Type visitArrayType(final Type t, final Type p) { return isSubtype(t, p) ? p : null; }
public static boolean isConvertible(final Type sourceType, final Type targetType) { final boolean tPrimitive = sourceType.isPrimitive(); final boolean sPrimitive = targetType.isPrimitive(); if (sourceType == Type.NullType) { return !targetType.isPrimitive(); } if (targetType == Types.Object) { return true; } if (targetType.isGenericParameter()) { return isConvertible(sourceType, targetType.getExtendsBound()); } if (tPrimitive == sPrimitive) { return isSubtypeUnchecked(sourceType, targetType); } return tPrimitive ? isSubtype(TypeUtils.getBoxedTypeOrSelf(sourceType), targetType) : isSubtype(TypeUtils.getUnderlyingPrimitiveOrSelf(sourceType), targetType); }
public static boolean isSubtype(final Type t, final Type p) { return isSubtype(t, p, true); }
public static boolean isConvertible(final Type sourceType, final Type targetType) { final boolean tPrimitive = sourceType.isPrimitive(); final boolean sPrimitive = targetType.isPrimitive(); if (sourceType == Type.NullType) { return !targetType.isPrimitive(); } if (targetType == Types.Object) { return true; } if (targetType.isGenericParameter()) { return isConvertible(sourceType, targetType.getExtendsBound()); } if (tPrimitive == sPrimitive) { return isSubtypeUnchecked(sourceType, targetType); } return tPrimitive ? isSubtype(TypeUtils.getBoxedTypeOrSelf(sourceType), targetType) : isSubtype(TypeUtils.getUnderlyingPrimitiveOrSelf(sourceType), targetType); }
public boolean isSubTypeOf(final Type type) { return type == this || type != null && Helper.isSubtype(this, type); }
@Override public Type visitArrayType(final Type t, final Type p) { return isSubtype(t, p) ? p : null; }
public boolean isSubTypeOf(final Type type) { return type == this || type != null && Helper.isSubtype(this, type); }
public boolean isSubTypeOf(final Type type) { return type == this || type != null && Helper.isSubtype(this, type); }
public static boolean isSubtype(final Type t, final Type p) { return isSubtype(t, p, true); }
public static boolean isSubtypeNoCapture(final Type t, final Type p) { return isSubtype(t, p, false); }
public static boolean isSubtypeNoCapture(final Type t, final Type p) { return isSubtype(t, p, false); }
public static boolean isSubtype(final Type t, final Type p) { return isSubtype(t, p, true); }
public static boolean isSubtypeNoCapture(final Type t, final Type p) { return isSubtype(t, p, false); }
public static boolean isSuperType(final Type type, final Type other) { if (type == other || other == Type.Bottom) { return true; } if (type.isGenericParameter()) { return isSuperType(type.getExtendsBound(), other); } return isSubtype(other, type); }
public static boolean isSuperType(final Type type, final Type other) { if (type == other || other == Type.Bottom) { return true; } if (type.isGenericParameter()) { return isSuperType(type.getExtendsBound(), other); } return isSubtype(other, type); }
public static boolean isSuperType(final Type type, final Type other) { if (type == other || other == Type.Bottom) { return true; } if (type.isGenericParameter()) { return isSuperType(type.getExtendsBound(), other); } return isSubtype(other, type); }
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; } }