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

Print this page
rev 108 : 6638712: Inference with wildcard types causes selection of inapplicable method
Summary: Added global sanity check in order to make sure that return type inference does not violate bounds constraints
Reviewed-by: jjg


1044         public String toString() {
1045             return "<" + tvars + ">" + qtype;
1046         }
1047 
1048         public List<Type> getTypeArguments()   { return tvars; }
1049 
1050         public void setThrown(List<Type> t) {
1051             qtype.setThrown(t);
1052         }
1053 
1054         public Object clone() {
1055             ForAll result = (ForAll)super.clone();
1056             result.qtype = (Type)result.qtype.clone();
1057             return result;
1058         }
1059 
1060         public boolean isErroneous()  {
1061             return qtype.isErroneous();
1062         }
1063 















1064         public Type map(Mapping f) {
1065             return f.apply(qtype);
1066         }
1067 
1068         public boolean contains(Type elem) {
1069             return qtype.contains(elem);
1070         }
1071 
1072         public MethodType asMethodType() {
1073             return qtype.asMethodType();
1074         }
1075 
1076         public void complete() {
1077             for (List<Type> l = tvars; l.nonEmpty(); l = l.tail) {
1078                 ((TypeVar)l.head).bound.complete();
1079             }
1080             qtype.complete();
1081         }
1082 
1083         public List<TypeVar> getTypeVariables() {




1044         public String toString() {
1045             return "<" + tvars + ">" + qtype;
1046         }
1047 
1048         public List<Type> getTypeArguments()   { return tvars; }
1049 
1050         public void setThrown(List<Type> t) {
1051             qtype.setThrown(t);
1052         }
1053 
1054         public Object clone() {
1055             ForAll result = (ForAll)super.clone();
1056             result.qtype = (Type)result.qtype.clone();
1057             return result;
1058         }
1059 
1060         public boolean isErroneous()  {
1061             return qtype.isErroneous();
1062         }
1063 
1064         /**
1065          * Replaces this ForAll's typevars with a set of concrete Java types
1066          * and returns the instantiated generic type. Subclasses might override
1067          * in order to check that the list of types is a valid instantiation
1068          * of the ForAll's typevars.
1069          *
1070          * @param actuals list of actual types
1071          * @param types types instance
1072          * @return qtype where all occurrences of tvars are replaced
1073          * by types in actuals
1074          */
1075         public Type inst(List<Type> actuals, Types types) {
1076             return types.subst(qtype, tvars, actuals);
1077         }
1078 
1079         public Type map(Mapping f) {
1080             return f.apply(qtype);
1081         }
1082 
1083         public boolean contains(Type elem) {
1084             return qtype.contains(elem);
1085         }
1086 
1087         public MethodType asMethodType() {
1088             return qtype.asMethodType();
1089         }
1090 
1091         public void complete() {
1092             for (List<Type> l = tvars; l.nonEmpty(); l = l.tail) {
1093                 ((TypeVar)l.head).bound.complete();
1094             }
1095             qtype.complete();
1096         }
1097 
1098         public List<TypeVar> getTypeVariables() {