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

changeset 1268
af6a4c24f4e3
parent 1251
6f0ed5a89c25
child 1305
9d47f4850714
     1.1 --- a/src/share/classes/com/sun/tools/javac/code/Type.java	Fri May 25 16:32:56 2012 -0700
     1.2 +++ b/src/share/classes/com/sun/tools/javac/code/Type.java	Thu May 31 17:42:14 2012 +0100
     1.3 @@ -54,7 +54,7 @@
     1.4   *  package types (tag: PACKAGE, class: PackageType),
     1.5   *  type variables (tag: TYPEVAR, class: TypeVar),
     1.6   *  type arguments (tag: WILDCARD, class: WildcardType),
     1.7 - *  polymorphic types (tag: FORALL, class: ForAll),
     1.8 + *  generic method types (tag: FORALL, class: ForAll),
     1.9   *  the error type (tag: ERROR, class: ErrorType).
    1.10   *  </pre>
    1.11   *
    1.12 @@ -1108,11 +1108,16 @@
    1.13          public boolean isErroneous() { return qtype.isErroneous(); }
    1.14      }
    1.15  
    1.16 +    /**
    1.17 +     * The type of a generic method type. It consists of a method type and
    1.18 +     * a list of method type-parameters that are used within the method
    1.19 +     * type.
    1.20 +     */
    1.21      public static class ForAll extends DelegatedType implements ExecutableType {
    1.22          public List<Type> tvars;
    1.23  
    1.24          public ForAll(List<Type> tvars, Type qtype) {
    1.25 -            super(FORALL, qtype);
    1.26 +            super(FORALL, (MethodType)qtype);
    1.27              this.tvars = tvars;
    1.28          }
    1.29  
    1.30 @@ -1131,34 +1136,6 @@
    1.31              return qtype.isErroneous();
    1.32          }
    1.33  
    1.34 -        /**
    1.35 -         * Replaces this ForAll's typevars with a set of concrete Java types
    1.36 -         * and returns the instantiated generic type. Subclasses should override
    1.37 -         * in order to check that the list of types is a valid instantiation
    1.38 -         * of the ForAll's typevars.
    1.39 -         *
    1.40 -         * @param actuals list of actual types
    1.41 -         * @param types types instance
    1.42 -         * @return qtype where all occurrences of tvars are replaced
    1.43 -         * by types in actuals
    1.44 -         */
    1.45 -        public Type inst(List<Type> actuals, Types types) {
    1.46 -            return types.subst(qtype, tvars, actuals);
    1.47 -        }
    1.48 -
    1.49 -        /**
    1.50 -         * Get the type-constraints of a given kind for a given type-variable of
    1.51 -         * this ForAll type. Subclasses should override in order to return more
    1.52 -         * accurate sets of constraints.
    1.53 -         *
    1.54 -         * @param tv the type-variable for which the constraint is to be retrieved
    1.55 -         * @param ck the constraint kind to be retrieved
    1.56 -         * @return the list of types specified by the selected constraint
    1.57 -         */
    1.58 -        public List<Type> undetvars() {
    1.59 -            return List.nil();
    1.60 -        }
    1.61 -
    1.62          public Type map(Mapping f) {
    1.63              return f.apply(qtype);
    1.64          }
    1.65 @@ -1168,7 +1145,7 @@
    1.66          }
    1.67  
    1.68          public MethodType asMethodType() {
    1.69 -            return qtype.asMethodType();
    1.70 +            return (MethodType)qtype;
    1.71          }
    1.72  
    1.73          public void complete() {

mercurial