src/share/classes/com/sun/tools/javac/code/Type.java

changeset 988
7ae6c0fd479b
parent 904
4baab658f357
child 1251
6f0ed5a89c25
equal deleted inserted replaced
987:c7841bbe1227 988:7ae6c0fd479b
22 * or visit www.oracle.com if you need additional information or have any 22 * or visit www.oracle.com if you need additional information or have any
23 * questions. 23 * questions.
24 */ 24 */
25 25
26 package com.sun.tools.javac.code; 26 package com.sun.tools.javac.code;
27
28 import java.util.Collections;
27 29
28 import com.sun.tools.javac.util.*; 30 import com.sun.tools.javac.util.*;
29 import com.sun.tools.javac.code.Symbol.*; 31 import com.sun.tools.javac.code.Symbol.*;
30 32
31 import javax.lang.model.type.*; 33 import javax.lang.model.type.*;
739 public boolean hasErasedSupertypes() { 741 public boolean hasErasedSupertypes() {
740 return true; 742 return true;
741 } 743 }
742 } 744 }
743 745
746 // a clone of a ClassType that knows about the alternatives of a union type.
747 public static class UnionClassType extends ClassType implements UnionType {
748 final List<? extends Type> alternatives_field;
749
750 public UnionClassType(ClassType ct, List<? extends Type> alternatives) {
751 super(ct.outer_field, ct.typarams_field, ct.tsym);
752 allparams_field = ct.allparams_field;
753 supertype_field = ct.supertype_field;
754 interfaces_field = ct.interfaces_field;
755 all_interfaces_field = ct.interfaces_field;
756 alternatives_field = alternatives;
757 }
758
759 public Type getLub() {
760 return tsym.type;
761 }
762
763 public java.util.List<? extends TypeMirror> getAlternatives() {
764 return Collections.unmodifiableList(alternatives_field);
765 }
766
767 @Override
768 public TypeKind getKind() {
769 return TypeKind.UNION;
770 }
771
772 @Override
773 public <R, P> R accept(TypeVisitor<R, P> v, P p) {
774 return v.visitUnion(this, p);
775 }
776 }
777
744 public static class ArrayType extends Type 778 public static class ArrayType extends Type
745 implements javax.lang.model.type.ArrayType { 779 implements javax.lang.model.type.ArrayType {
746 780
747 public Type elemtype; 781 public Type elemtype;
748 782

mercurial