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

@@ -1059,10 +1059,25 @@
 
         public boolean isErroneous()  {
             return qtype.isErroneous();
         }
 
+        /**
+         * Replaces this ForAll's typevars with a set of concrete Java types
+         * and returns the instantiated generic type. Subclasses might override
+         * in order to check that the list of types is a valid instantiation
+         * of the ForAll's typevars.
+         *
+         * @param actuals list of actual types
+         * @param types types instance
+         * @return qtype where all occurrences of tvars are replaced
+         * by types in actuals
+         */
+        public Type inst(List<Type> actuals, Types types) {
+            return types.subst(qtype, tvars, actuals);
+        }
+
         public Type map(Mapping f) {
             return f.apply(qtype);
         }
 
         public boolean contains(Type elem) {