1.1 --- a/src/share/classes/com/sun/tools/javac/code/Type.java Fri Nov 30 15:14:36 2012 +0000 1.2 +++ b/src/share/classes/com/sun/tools/javac/code/Type.java Fri Nov 30 15:14:48 2012 +0000 1.3 @@ -839,6 +839,49 @@ 1.4 } 1.5 } 1.6 1.7 + // a clone of a ClassType that knows about the bounds of an intersection type. 1.8 + public static class IntersectionClassType extends ClassType implements IntersectionType { 1.9 + 1.10 + public boolean allInterfaces; 1.11 + 1.12 + public enum IntersectionKind { 1.13 + EXPLICIT, 1.14 + IMPLICT; 1.15 + } 1.16 + 1.17 + public IntersectionKind intersectionKind; 1.18 + 1.19 + public IntersectionClassType(List<Type> bounds, ClassSymbol csym, boolean allInterfaces) { 1.20 + super(Type.noType, List.<Type>nil(), csym); 1.21 + this.allInterfaces = allInterfaces; 1.22 + Assert.check((csym.flags() & COMPOUND) != 0); 1.23 + supertype_field = bounds.head; 1.24 + interfaces_field = bounds.tail; 1.25 + Assert.check(supertype_field.tsym.completer != null || 1.26 + !supertype_field.isInterface(), supertype_field); 1.27 + } 1.28 + 1.29 + public java.util.List<? extends TypeMirror> getBounds() { 1.30 + return Collections.unmodifiableList(getComponents()); 1.31 + } 1.32 + 1.33 + public List<Type> getComponents() { 1.34 + return interfaces_field.prepend(supertype_field); 1.35 + } 1.36 + 1.37 + @Override 1.38 + public TypeKind getKind() { 1.39 + return TypeKind.INTERSECTION; 1.40 + } 1.41 + 1.42 + @Override 1.43 + public <R, P> R accept(TypeVisitor<R, P> v, P p) { 1.44 + return intersectionKind == IntersectionKind.EXPLICIT ? 1.45 + v.visitIntersection(this, p) : 1.46 + v.visitDeclared(this, p); 1.47 + } 1.48 + } 1.49 + 1.50 public static class ArrayType extends Type 1.51 implements javax.lang.model.type.ArrayType { 1.52