diff -r 5a72ba18c471 -r dda7e13f09fb src/share/classes/com/sun/tools/javac/code/Type.java --- a/src/share/classes/com/sun/tools/javac/code/Type.java Mon Aug 31 19:43:06 2009 -0700 +++ b/src/share/classes/com/sun/tools/javac/code/Type.java Tue Sep 01 14:53:39 2009 +0100 @@ -1068,7 +1068,7 @@ /** * Replaces this ForAll's typevars with a set of concrete Java types - * and returns the instantiated generic type. Subclasses might override + * and returns the instantiated generic type. Subclasses should override * in order to check that the list of types is a valid instantiation * of the ForAll's typevars. * @@ -1081,6 +1081,42 @@ return types.subst(qtype, tvars, actuals); } + /** + * Kind of type-constraint derived during type inference + */ + public enum ConstraintKind { + /** + * upper bound constraint (a type variable must be instantiated + * with a type T, where T is a subtype of all the types specified by + * its EXTENDS constraints). + */ + EXTENDS, + /** + * lower bound constraint (a type variable must be instantiated + * with a type T, where T is a supertype of all the types specified by + * its SUPER constraints). + */ + SUPER, + /** + * equality constraint (a type variable must be instantiated to the type + * specified by its EQUAL constraint. + */ + EQUAL; + } + + /** + * Get the type-constraints of a given kind for a given type-variable of + * this ForAll type. Subclasses should override in order to return more + * accurate sets of constraints. + * + * @param tv the type-variable for which the constraint is to be retrieved + * @param ck the constraint kind to be retrieved + * @return the list of types specified by the selected constraint + */ + public List getConstraints(TypeVar tv, ConstraintKind ck) { + return List.nil(); + } + public Type map(Mapping f) { return f.apply(qtype); }