@Override public Void visitWildcardType(final Type source, final Type target) throws AdaptFailure { if (source.hasExtendsBound()) { adaptRecursive(upperBound(source), upperBound(target)); } else if (source.hasSuperBound()) { adaptRecursive(lowerBound(source), lowerBound(target)); } return null; }
@Override public Void visitWildcardType(final Type source, final Type target) throws AdaptFailure { if (source.hasExtendsBound()) { adaptRecursive(upperBound(source), upperBound(target)); } else if (source.hasSuperBound()) { adaptRecursive(lowerBound(source), lowerBound(target)); } return null; }
@Override public Void visitWildcardType(final Type source, final Type target) throws AdaptFailure { if (source.hasExtendsBound()) { adaptRecursive(upperBound(source), upperBound(target)); } else if (source.hasSuperBound()) { adaptRecursive(lowerBound(source), lowerBound(target)); } return null; }
@Override public Void visitTypeParameter(final Type source, final Type target) throws AdaptFailure { // Check to see if there is // already a mapping for $source$, in which case // the old mapping will be merged with the new Type val = mapping.get(source); if (val != null) { if (val.hasSuperBound() && target.hasSuperBound()) { val = isSubtype(lowerBound(val), lowerBound(target)) ? target : val; } else if (val.hasExtendsBound() && target.hasExtendsBound()) { val = isSubtype(upperBound(val), upperBound(target)) ? val : target; } else if (!isSameType(val, target)) { throw new AdaptFailure(); } } else { val = target; from.append(source); to.append(target); } mapping.put(source, val); return null; }
@Override public Void visitTypeParameter(final Type source, final Type target) throws AdaptFailure { // Check to see if there is // already a mapping for $source$, in which case // the old mapping will be merged with the new Type val = mapping.get(source); if (val != null) { if (val.hasSuperBound() && target.hasSuperBound()) { val = isSubtype(lowerBound(val), lowerBound(target)) ? target : val; } else if (val.hasExtendsBound() && target.hasExtendsBound()) { val = isSubtype(upperBound(val), upperBound(target)) ? val : target; } else if (!isSameType(val, target)) { throw new AdaptFailure(); } } else { val = target; from.append(source); to.append(target); } mapping.put(source, val); return null; }
@Override public Void visitTypeParameter(final Type source, final Type target) throws AdaptFailure { // Check to see if there is // already a mapping for $source$, in which case // the old mapping will be merged with the new Type val = mapping.get(source); if (val != null) { if (val.hasSuperBound() && target.hasSuperBound()) { val = isSubtype(lowerBound(val), lowerBound(target)) ? target : val; } else if (val.hasExtendsBound() && target.hasExtendsBound()) { val = isSubtype(upperBound(val), upperBound(target)) ? val : target; } else if (!isSameType(val, target)) { throw new AdaptFailure(); } } else { val = target; from.append(source); to.append(target); } mapping.put(source, val); return null; }
@Override public Boolean visitWildcardType(final Type t, final Type p) { return isSameWildcard(t, p) || isCaptureOf(p, t) || ((t.hasExtendsBound() || isSubtypeNoCapture(L(t), lowerBound(p))) && (t.hasSuperBound() || isSubtypeNoCapture(upperBound(p), U(t)))); } };
@Override public Boolean visitWildcardType(final Type t, final Type p) { return isSameWildcard(t, p) || isCaptureOf(p, t) || ((t.hasExtendsBound() || isSubtypeNoCapture(L(t), lowerBound(p))) && (t.hasSuperBound() || isSubtypeNoCapture(upperBound(p), U(t)))); } };
@Override public Boolean visitWildcardType(final Type t, final Type p) { return isSameWildcard(t, p) || isCaptureOf(p, t) || ((t.hasExtendsBound() || isSubtypeNoCapture(L(t), lowerBound(p))) && (t.hasSuperBound() || isSubtypeNoCapture(upperBound(p), U(t)))); } };
public static boolean isSubtype(final Type t, final Type p, final boolean capture) { if (t == p) { return true; } if (p == null) { return false; } if (p == Types.Object) { return true; } if (p.isCompoundType()) { final Type baseType = p.getBaseType(); if (baseType != null && !isSubtype(t, baseType, capture)) { return false; } final TypeList interfaces = p.getExplicitInterfaces(); for (int i = 0, n = interfaces.size(); i < n; i++) { final Type type = interfaces.get(i); if (!isSubtype(t, type, capture)) { return false; } } return true; } final Type lower = lowerBound(p); if (p != lower) { return isSubtype(capture ? capture(t) : t, lower, false); } return IsSubtypeRelation.visit(capture ? capture(t) : t, p); }
public static boolean isSubtype(final Type t, final Type p, final boolean capture) { if (t == p) { return true; } if (p == null) { return false; } if (p == Types.Object) { return true; } if (p.isCompoundType()) { final Type baseType = p.getBaseType(); if (baseType != null && !isSubtype(t, baseType, capture)) { return false; } final TypeList interfaces = p.getExplicitInterfaces(); for (int i = 0, n = interfaces.size(); i < n; i++) { final Type type = interfaces.get(i); if (!isSubtype(t, type, capture)) { return false; } } return true; } final Type lower = lowerBound(p); if (p != lower) { return isSubtype(capture ? capture(t) : t, lower, false); } return IsSubtypeRelation.visit(capture ? capture(t) : t, p); }
final Type lower = lowerBound(p);