equal
deleted
inserted
replaced
2410 if (t.bound.isInterface()) |
2410 if (t.bound.isInterface()) |
2411 return List.of(t.bound); |
2411 return List.of(t.bound); |
2412 |
2412 |
2413 return List.nil(); |
2413 return List.nil(); |
2414 } |
2414 } |
|
2415 }; |
|
2416 |
|
2417 public List<Type> directSupertypes(Type t) { |
|
2418 return directSupertypes.visit(t); |
|
2419 } |
|
2420 // where |
|
2421 private final UnaryVisitor<List<Type>> directSupertypes = new UnaryVisitor<List<Type>>() { |
|
2422 |
|
2423 public List<Type> visitType(final Type type, final Void ignored) { |
|
2424 if (!type.isCompound()) { |
|
2425 final Type sup = supertype(type); |
|
2426 return (sup == Type.noType || sup == type || sup == null) |
|
2427 ? interfaces(type) |
|
2428 : interfaces(type).prepend(sup); |
|
2429 } else { |
|
2430 return visitIntersectionType((IntersectionClassType) type); |
|
2431 } |
|
2432 } |
|
2433 |
|
2434 private List<Type> visitIntersectionType(final IntersectionClassType it) { |
|
2435 return it.getExplicitComponents(); |
|
2436 } |
|
2437 |
2415 }; |
2438 }; |
2416 |
2439 |
2417 public boolean isDirectSuperInterface(TypeSymbol isym, TypeSymbol origin) { |
2440 public boolean isDirectSuperInterface(TypeSymbol isym, TypeSymbol origin) { |
2418 for (Type i2 : interfaces(origin.type)) { |
2441 for (Type i2 : interfaces(origin.type)) { |
2419 if (isym == i2.tsym) return true; |
2442 if (isym == i2.tsym) return true; |