@Override public Type visitTypeParameter(final Type t, final Void ignored) { final Type bound = t.getExtendsBound(); if (!bound.isCompoundType() && !bound.isInterface()) { return bound; } return superType(bound); }
@Override public Type visitTypeParameter(final Type t, final Void ignored) { final Type bound = t.getExtendsBound(); if (!bound.isCompoundType() && !bound.isInterface()) { return bound; } return superType(bound); }
@Override public Type visitTypeParameter(final Type t, final Void ignored) { final Type bound = t.getExtendsBound(); if (!bound.isCompoundType() && !bound.isInterface()) { return bound; } return superType(bound); }
@Override public Type visitArrayType(final Type t, final Void ignored) { final Type elementType = t.getElementType(); if (elementType.isPrimitive() || isSameType(elementType, Types.Object)) { return arraySuperType(); } else { return new ArrayType(superType(elementType)); } } };
@Override public Type visitArrayType(final Type t, final Void ignored) { final Type elementType = t.getElementType(); if (elementType.isPrimitive() || isSameType(elementType, Types.Object)) { return arraySuperType(); } else { return new ArrayType(superType(elementType)); } } };
@Override public Type visitArrayType(final Type t, final Void ignored) { final Type elementType = t.getElementType(); if (elementType.isPrimitive() || isSameType(elementType, Types.Object)) { return arraySuperType(); } else { return new ArrayType(superType(elementType)); } } };
public static int rank(final Type t) { if (t == null) { return 0; } if (t.isPrimitive() || t.isWildcardType() || t.isArray() || t == Type.Bottom || t == Type.NullType) { throw new AssertionError(); } if (t == Types.Object) { return 0; } int r = rank(superType(t)); for (ImmutableList<Type<?>> l = interfaces(t); l.nonEmpty(); l = l.tail) { final int headRank = rank(l.head); if (headRank > r) { r = headRank; } } return r + 1; }
public static int rank(final Type t) { if (t == null) { return 0; } if (t.isPrimitive() || t.isWildcardType() || t.isArray() || t == Type.Bottom || t == Type.NullType) { throw new AssertionError(); } if (t == Types.Object) { return 0; } int r = rank(superType(t)); for (ImmutableList<Type<?>> l = interfaces(t); l.nonEmpty(); l = l.tail) { final int headRank = rank(l.head); if (headRank > r) { r = headRank; } } return r + 1; }
public static ImmutableList<Type<?>> closure(final Type<?> t) { ImmutableList<Type<?>> cl = closureCache.get(t); if (cl == null) { final Type st = superType(t); if (!t.isCompoundType()) { if (st != null && st.getKind() == TypeKind.DECLARED) { cl = insert(closure(st), t); } else if (st != null && st.getKind() == TypeKind.TYPEVAR) { cl = closure(st).prepend(t); } else { cl = ImmutableList.<Type<?>>of(t); } } else { cl = closure(superType(t)); } for (ImmutableList<Type<?>> l = interfaces(t); l.nonEmpty(); l = l.tail) { cl = union(cl, closure(l.head)); } closureCache.put(t, cl); } return cl; }
public static int rank(final Type t) { if (t == null) { return 0; } if (t.isPrimitive() || t.isWildcardType() || t.isArray() || t == Type.Bottom || t == Type.NullType) { throw new AssertionError(); } if (t == Types.Object) { return 0; } int r = rank(superType(t)); for (ImmutableList<Type<?>> l = interfaces(t); l.nonEmpty(); l = l.tail) { final int headRank = rank(l.head); if (headRank > r) { r = headRank; } } return r + 1; }
public static ImmutableList<Type<?>> closure(final Type<?> t) { ImmutableList<Type<?>> cl = closureCache.get(t); if (cl == null) { final Type st = superType(t); if (!t.isCompoundType()) { if (st != null && st.getKind() == TypeKind.DECLARED) { cl = insert(closure(st), t); } else if (st != null && st.getKind() == TypeKind.TYPEVAR) { cl = closure(st).prepend(t); } else { cl = ImmutableList.<Type<?>>of(t); } } else { cl = closure(superType(t)); } for (ImmutableList<Type<?>> l = interfaces(t); l.nonEmpty(); l = l.tail) { cl = union(cl, closure(l.head)); } closureCache.put(t, cl); } return cl; }
public static ImmutableList<Type<?>> closure(final Type<?> t) { ImmutableList<Type<?>> cl = closureCache.get(t); if (cl == null) { final Type st = superType(t); if (!t.isCompoundType()) { if (st != null && st.getKind() == TypeKind.DECLARED) { cl = insert(closure(st), t); } else if (st != null && st.getKind() == TypeKind.TYPEVAR) { cl = closure(st).prepend(t); } else { cl = ImmutableList.<Type<?>>of(t); } } else { cl = closure(superType(t)); } for (ImmutableList<Type<?>> l = interfaces(t); l.nonEmpty(); l = l.tail) { cl = union(cl, closure(l.head)); } closureCache.put(t, cl); } return cl; }
final Type superType = superType(t);
final Type superType = superType(t);
final Type superType = superType(t);