changeset 2086:d3e0fe2c10b2

S6638712: Inference with wildcard types causes selection of inapplicable method S6650759: Inference of formal type parameter (unused in formal parameters) is not performed 2010-09-09 Andrew John Hughes <ahughes@redhat.com> * Makefile.am: Add new patches. * NEWS: Document new patches. * patches/openjdk/6638712-wildcard_types.patch, * patches/openjdk/6650759-missing_inference.patch: Fix failure in javac compilation.
author Andrew John Hughes <ahughes@redhat.com>
date Thu, 30 Sep 2010 16:46:39 +0100
parents 4e8e7394fd77
children eab926d1eb04
files ChangeLog Makefile.am NEWS patches/openjdk/6638712-wildcard_types.patch patches/openjdk/6650759-missing_inference.patch
diffstat 5 files changed, 1580 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Mon Sep 06 14:48:38 2010 +0100
+++ b/ChangeLog	Thu Sep 30 16:46:39 2010 +0100
@@ -1,3 +1,11 @@
+2010-09-09  Andrew John Hughes  <ahughes@redhat.com>
+
+	* Makefile.am: Add new patches.
+	* NEWS: Document new patches.
+	* patches/openjdk/6638712-wildcard_types.patch,
+	* patches/openjdk/6650759-missing_inference.patch:
+	Fix failure in javac compilation.
+
 2010-09-03  Andrew John Hughes  <ahughes@redhat.com>
 
 	* Makefile.am: Add new patch.
--- a/Makefile.am	Mon Sep 06 14:48:38 2010 +0100
+++ b/Makefile.am	Thu Sep 30 16:46:39 2010 +0100
@@ -332,7 +332,9 @@
 	patches/openjdk/6678385.patch \
 	patches/fonts-gentoo.patch \
 	patches/fonts-rhel.patch \
-	patches/icedtea-too-many-args.patch
+	patches/icedtea-too-many-args.patch \
+	patches/openjdk/6638712-wildcard_types.patch \
+	patches/openjdk/6650759-missing_inference.patch
 
 if WITH_RHINO
 ICEDTEA_PATCHES += \
--- a/NEWS	Mon Sep 06 14:48:38 2010 +0100
+++ b/NEWS	Thu Sep 30 16:46:39 2010 +0100
@@ -6,6 +6,8 @@
   - Provide font configuration for RHEL 6.
   - S6951319: enable solaris builds using Sun Studio 12 update 1 (fixes PR398)
   - S6539464, RH500077: Ensure java.lang.Math functions provide consistent results.
+  - S6638712: Inference with wildcard types causes selection of inapplicable method
+  - S6650759: Inference of formal type parameter (unused in formal parameters) is not performed
 - NetX:
   - Fix browser command in BasicService.showDocument(URL)
   - Run programs that inherit main(String[]) in their main-class
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/patches/openjdk/6638712-wildcard_types.patch	Thu Sep 30 16:46:39 2010 +0100
@@ -0,0 +1,669 @@
+diff -Nru openjdk.orig/langtools/src/share/classes/com/sun/tools/javac/code/Type.java openjdk/langtools/src/share/classes/com/sun/tools/javac/code/Type.java
+--- openjdk.orig/langtools/src/share/classes/com/sun/tools/javac/code/Type.java	2010-06-21 22:16:20.000000000 +0100
++++ openjdk/langtools/src/share/classes/com/sun/tools/javac/code/Type.java	2010-09-09 19:54:58.054019539 +0100
+@@ -1061,6 +1061,21 @@
+             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);
+         }
+diff -Nru openjdk.orig/langtools/src/share/classes/com/sun/tools/javac/code/Types.java openjdk/langtools/src/share/classes/com/sun/tools/javac/code/Types.java
+--- openjdk.orig/langtools/src/share/classes/com/sun/tools/javac/code/Types.java	2010-06-21 22:16:20.000000000 +0100
++++ openjdk/langtools/src/share/classes/com/sun/tools/javac/code/Types.java	2010-09-09 19:54:58.054019539 +0100
+@@ -331,6 +331,14 @@
+         if (s.tag >= firstPartialTag)
+             return isSuperType(s, t);
+ 
++        if (s.isCompound()) {
++            for (Type s2 : interfaces(s).prepend(supertype(s))) {
++                if (!isSubtype(t, s2, capture))
++                    return false;
++            }
++            return true;
++        }
++
+         Type lower = lowerBound(s);
+         if (s != lower)
+             return isSubtype(capture ? capture(t) : t, lower, false);
+@@ -2766,6 +2774,14 @@
+     /**
+      * Capture conversion as specified by JLS 3rd Ed.
+      */
++
++    public List<Type> capture(List<Type> ts) {
++        List<Type> buf = List.nil();
++        for (Type t : ts) {
++            buf = buf.prepend(capture(t));
++        }
++        return buf.reverse();
++    }
+     public Type capture(Type t) {
+         if (t.tag != CLASS)
+             return t;
+diff -Nru openjdk.orig/langtools/src/share/classes/com/sun/tools/javac/comp/Check.java openjdk/langtools/src/share/classes/com/sun/tools/javac/comp/Check.java
+--- openjdk.orig/langtools/src/share/classes/com/sun/tools/javac/comp/Check.java	2010-06-21 22:16:20.000000000 +0100
++++ openjdk/langtools/src/share/classes/com/sun/tools/javac/comp/Check.java	2010-09-09 19:54:58.054019539 +0100
+@@ -383,6 +383,10 @@
+                                      JCDiagnostic.fragment("incompatible.types" + (d!=null ? ".1" : ""), d),
+                                      t, pt);
+                 }
++            } catch (Infer.InvalidInstanceException ex) {
++                JCDiagnostic d = ex.getDiagnostic();
++                log.error(pos, "invalid.inferred.types", t.tvars, d);
++                return syms.errType;
+             }
+         }
+     }
+diff -Nru openjdk.orig/langtools/src/share/classes/com/sun/tools/javac/comp/Infer.java openjdk/langtools/src/share/classes/com/sun/tools/javac/comp/Infer.java
+--- openjdk.orig/langtools/src/share/classes/com/sun/tools/javac/comp/Infer.java	2010-06-21 22:16:20.000000000 +0100
++++ openjdk/langtools/src/share/classes/com/sun/tools/javac/comp/Infer.java	2010-09-09 20:00:32.891268438 +0100
+@@ -29,6 +29,7 @@
+ import com.sun.tools.javac.util.List;
+ import com.sun.tools.javac.code.*;
+ import com.sun.tools.javac.code.Type.*;
++import com.sun.tools.javac.code.Symbol.*;
+ 
+ import static com.sun.tools.javac.code.Flags.*;
+ import static com.sun.tools.javac.code.Kinds.*;
+@@ -50,6 +51,7 @@
+ 
+     Symtab syms;
+     Types types;
++    Resolve rs;
+ 
+     public static Infer instance(Context context) {
+         Infer instance = context.get(inferKey);
+@@ -62,43 +64,51 @@
+         context.put(inferKey, this);
+         syms = Symtab.instance(context);
+         types = Types.instance(context);
++        rs = Resolve.instance(context);
+     }
+ 
+-    public static class NoInstanceException extends RuntimeException {
++    public static class InferenceException extends RuntimeException {
+         private static final long serialVersionUID = 0;
+ 
+-        boolean isAmbiguous; // exist several incomparable best instances?
+-
+         JCDiagnostic diagnostic;
+ 
+-        NoInstanceException(boolean isAmbiguous) {
++        InferenceException() {
+             this.diagnostic = null;
+-            this.isAmbiguous = isAmbiguous;
+-        }
+-        NoInstanceException setMessage(String key) {
+-            this.diagnostic = JCDiagnostic.fragment(key);
+-            return this;
+-        }
+-        NoInstanceException setMessage(String key, Object arg1) {
+-            this.diagnostic = JCDiagnostic.fragment(key, arg1);
+-            return this;
+-        }
+-        NoInstanceException setMessage(String key, Object arg1, Object arg2) {
+-            this.diagnostic = JCDiagnostic.fragment(key, arg1, arg2);
+-            return this;
+         }
+-        NoInstanceException setMessage(String key, Object arg1, Object arg2, Object arg3) {
+-            this.diagnostic = JCDiagnostic.fragment(key, arg1, arg2, arg3);
++        InferenceException setMessage(String key, Object... args) {
++            this.diagnostic = JCDiagnostic.fragment(key, args);
+             return this;
+         }
++
+         public JCDiagnostic getDiagnostic() {
+             return diagnostic;
+         }
+     }
++
++    public static class NoInstanceException extends InferenceException {
++        private static final long serialVersionUID = 1;
++
++        boolean isAmbiguous; // exist several incomparable best instances?
++
++        NoInstanceException(boolean isAmbiguous) {
++            super();
++            this.isAmbiguous = isAmbiguous;
++       }
++    }
++
++    public static class InvalidInstanceException extends InferenceException {
++        private static final long serialVersionUID = 2;
++
++        InvalidInstanceException() {
++            super();
++        }
++    }
++
+     private final NoInstanceException ambiguousNoInstanceException =
+         new NoInstanceException(true);
+     private final NoInstanceException unambiguousNoInstanceException =
+         new NoInstanceException(false);
++    private final InvalidInstanceException invalidInstanceException = new InvalidInstanceException();
+ 
+ /***************************************************************************
+  * Auxiliary type values and classes
+@@ -247,7 +257,7 @@
+      */
+     public Type instantiateExpr(ForAll that,
+                                 Type to,
+-                                Warner warn) throws NoInstanceException {
++                                Warner warn) throws InferenceException {
+         List<Type> undetvars = Type.map(that.tvars, fromTypeVarFun);
+         for (List<Type> l = undetvars; l.nonEmpty(); l = l.tail) {
+             UndetVar v = (UndetVar) l.head;
+@@ -273,8 +283,7 @@
+         List<Type> targs = Type.map(undetvars, getInstFun);
+         targs = types.subst(targs, that.tvars, targs);
+         checkWithinBounds(that.tvars, targs, warn);
+-
+-        return getInstFun.apply(qtype1);
++        return that.inst(targs, types);
+     }
+ 
+     /** Instantiate method type `mt' by finding instantiations of
+@@ -282,36 +291,42 @@
+      */
+     public Type instantiateMethod(List<Type> tvars,
+                                   MethodType mt,
+-                                  List<Type> argtypes,
+-                                  boolean allowBoxing,
+-                                  boolean useVarargs,
+-                                  Warner warn) throws NoInstanceException {
++                                  final List<Type> argtypes,
++                                  final boolean allowBoxing,
++                                  final boolean useVarargs,
++                                  final Warner warn) throws InferenceException {
+         //-System.err.println("instantiateMethod(" + tvars + ", " + mt + ", " + argtypes + ")"); //DEBUG
+         List<Type> undetvars = Type.map(tvars, fromTypeVarFun);
+         List<Type> formals = mt.argtypes;
+-
++        //need to capture exactly once - otherwise subsequent
++        //applicability checks might fail
++        final List<Type> capturedArgs = types.capture(argtypes);
++        List<Type> actuals = capturedArgs;
++        List<Type> actualsNoCapture = argtypes;
+         // instantiate all polymorphic argument types and
+         // set up lower bounds constraints for undetvars
+         Type varargsFormal = useVarargs ? formals.last() : null;
+-        while (argtypes.nonEmpty() && formals.head != varargsFormal) {
+-            Type ft = formals.head;
+-            Type at = argtypes.head.baseType();
+-            if (at.tag == FORALL)
+-                at = instantiateArg((ForAll) at, ft, tvars, warn);
+-            Type sft = types.subst(ft, tvars, undetvars);
++        while (actuals.nonEmpty() && formals.head != varargsFormal) {
++            Type formal = formals.head;
++            Type actual = actuals.head.baseType();
++            Type actualNoCapture = actualsNoCapture.head.baseType();
++            if (actual.tag == FORALL)
++                actual = instantiateArg((ForAll)actual, formal, tvars, warn);
++            Type undetFormal = types.subst(formal, tvars, undetvars);
+             boolean works = allowBoxing
+-                ? types.isConvertible(at, sft, warn)
+-                : types.isSubtypeUnchecked(at, sft, warn);
++                ? types.isConvertible(actual, undetFormal, warn)
++                : types.isSubtypeUnchecked(actual, undetFormal, warn);
+             if (!works) {
+                 throw unambiguousNoInstanceException
+                     .setMessage("no.conforming.assignment.exists",
+-                                tvars, at, ft);
++                                tvars, actualNoCapture, formal);
+             }
+             formals = formals.tail;
+-            argtypes = argtypes.tail;
++            actuals = actuals.tail;
++            actualsNoCapture = actualsNoCapture.tail;
+         }
+         if (formals.head != varargsFormal || // not enough args
+-            !useVarargs && argtypes.nonEmpty()) { // too many args
++            !useVarargs && actuals.nonEmpty()) { // too many args
+             // argument lists differ in length
+             throw unambiguousNoInstanceException
+                 .setMessage("arg.length.mismatch");
+@@ -319,20 +334,21 @@
+ 
+         // for varargs arguments as well
+         if (useVarargs) {
+-            Type elt = types.elemtype(varargsFormal);
+-            Type sft = types.subst(elt, tvars, undetvars);
+-            while (argtypes.nonEmpty()) {
+-                Type ft = sft;
+-                Type at = argtypes.head.baseType();
+-                if (at.tag == FORALL)
+-                    at = instantiateArg((ForAll) at, ft, tvars, warn);
+-                boolean works = types.isConvertible(at, sft, warn);
++            Type elemType = types.elemtype(varargsFormal);
++            Type elemUndet = types.subst(elemType, tvars, undetvars);
++            while (actuals.nonEmpty()) {
++                Type actual = actuals.head.baseType();
++                Type actualNoCapture = actualsNoCapture.head.baseType();
++                if (actual.tag == FORALL)
++                    actual = instantiateArg((ForAll)actual, elemType, tvars, warn);
++                boolean works = types.isConvertible(actual, elemUndet, warn);
+                 if (!works) {
+                     throw unambiguousNoInstanceException
+                         .setMessage("no.conforming.assignment.exists",
+-                                    tvars, at, ft);
++                                    tvars, actualNoCapture, elemType);
+                 }
+-                argtypes = argtypes.tail;
++                actuals = actuals.tail;
++                actualsNoCapture = actualsNoCapture.tail;
+             }
+         }
+ 
+@@ -363,16 +379,38 @@
+         }
+         checkWithinBounds(tvars, undettypes.toList(), warn);
+ 
++        mt = (MethodType)types.subst(mt, tvars, insttypes.toList());
++
+         if (!restvars.isEmpty()) {
+             // if there are uninstantiated variables,
+             // quantify result type with them
+-            mt = new MethodType(mt.argtypes,
+-                                new ForAll(restvars.toList(), mt.restype),
+-                                mt.thrown, syms.methodClass);
++            final List<Type> inferredTypes = insttypes.toList();
++            final List<Type> all_tvars = tvars; //this is the wrong tvars
++            final MethodType mt2 = new MethodType(mt.argtypes, null, mt.thrown, syms.methodClass);
++            mt2.restype = new ForAll(restvars.toList(), mt.restype) {
++                @Override
++                public Type inst(List<Type> inferred, Types types) throws NoInstanceException {
++                    List<Type> formals = types.subst(mt2.argtypes, tvars, inferred);
++                   if (!rs.argumentsAcceptable(capturedArgs, formals,
++                           allowBoxing, useVarargs, warn)) {
++                      // inferred method is not applicable
++                      throw invalidInstanceException.setMessage("inferred.do.not.conform.to.params", formals, argtypes);
++                   }
++                   // check that inferred bounds conform to their bounds
++                   checkWithinBounds(all_tvars,
++                           types.subst(inferredTypes, tvars, inferred), warn);
++                   return super.inst(inferred, types);
++            }};
++            return mt2;
++        }
++        else if (!rs.argumentsAcceptable(capturedArgs, mt.getParameterTypes(), allowBoxing, useVarargs, warn)) {
++            // inferred method is not applicable
++            throw invalidInstanceException.setMessage("inferred.do.not.conform.to.params", mt.getParameterTypes(), argtypes);
++        }
++        else {
++            // return instantiated version of method type
++            return mt;
+         }
+-
+-        // return instantiated version of method type
+-        return types.subst(mt, tvars, insttypes.toList());
+     }
+     //where
+ 
+@@ -384,7 +422,7 @@
+         private Type instantiateArg(ForAll that,
+                                     Type to,
+                                     List<Type> tvars,
+-                                    Warner warn) throws NoInstanceException {
++                                    Warner warn) throws InferenceException {
+             List<Type> targs;
+             try {
+                 return instantiateExpr(that, to, warn);
+@@ -401,16 +439,16 @@
+     private void checkWithinBounds(List<Type> tvars,
+                                    List<Type> arguments,
+                                    Warner warn)
+-        throws NoInstanceException {
++        throws InvalidInstanceException {
+         for (List<Type> tvs = tvars, args = arguments;
+              tvs.nonEmpty();
+              tvs = tvs.tail, args = args.tail) {
+             if (args.head instanceof UndetVar) continue;
+             List<Type> bounds = types.subst(types.getBounds((TypeVar)tvs.head), tvars, arguments);
+             if (!types.isSubtypeUnchecked(args.head, bounds, warn))
+-                throw unambiguousNoInstanceException
++                throw invalidInstanceException
+                     .setMessage("inferred.do.not.conform.to.bounds",
+-                                arguments, tvars);
++                                args.head, bounds);
+         }
+     }
+ }
+diff -Nru openjdk.orig/langtools/src/share/classes/com/sun/tools/javac/comp/Resolve.java openjdk/langtools/src/share/classes/com/sun/tools/javac/comp/Resolve.java
+--- openjdk.orig/langtools/src/share/classes/com/sun/tools/javac/comp/Resolve.java	2010-06-21 22:16:20.000000000 +0100
++++ openjdk/langtools/src/share/classes/com/sun/tools/javac/comp/Resolve.java	2010-09-09 19:54:58.058019555 +0100
+@@ -279,7 +279,7 @@
+                         boolean allowBoxing,
+                         boolean useVarargs,
+                         Warner warn)
+-        throws Infer.NoInstanceException {
++        throws Infer.InferenceException {
+         if (useVarargs && (m.flags() & VARARGS) == 0) return null;
+         Type mt = types.memberType(site, m);
+ 
+@@ -350,7 +350,7 @@
+         try {
+             return rawInstantiate(env, site, m, argtypes, typeargtypes,
+                                   allowBoxing, useVarargs, warn);
+-        } catch (Infer.NoInstanceException ex) {
++        } catch (Infer.InferenceException ex) {
+             return null;
+         }
+     }
+@@ -562,7 +562,7 @@
+                 default: return bestSoFar;
+                 }
+             }
+-        } catch (Infer.NoInstanceException ex) {
++        } catch (Infer.InferenceException ex) {
+             switch (bestSoFar.kind) {
+             case ABSENT_MTH:
+                 return wrongMethod.setWrongSym(sym, ex.getDiagnostic());
+diff -Nru openjdk.orig/langtools/src/share/classes/com/sun/tools/javac/resources/compiler.properties openjdk/langtools/src/share/classes/com/sun/tools/javac/resources/compiler.properties
+--- openjdk.orig/langtools/src/share/classes/com/sun/tools/javac/resources/compiler.properties	2010-06-21 22:16:21.000000000 +0100
++++ openjdk/langtools/src/share/classes/com/sun/tools/javac/resources/compiler.properties	2010-09-09 19:54:58.058019555 +0100
+@@ -454,6 +454,8 @@
+     type parameters of {0} cannot be determined
+ compiler.err.undetermined.type.1=\
+     type parameters of {0} cannot be determined; {1}
++compiler.err.invalid.inferred.types=\
++    invalid inferred types for {0}; {1}
+ compiler.err.unreachable.stmt=\
+     unreachable statement
+ compiler.err.initializer.must.be.able.to.complete.normally=\
+@@ -960,7 +962,13 @@
+ compiler.misc.arg.length.mismatch=\
+     cannot instantiate from arguments because actual and formal argument lists differ in length
+ compiler.misc.inferred.do.not.conform.to.bounds=\
+-    inferred type argument(s) {0} do not conform to bounds of type variable(s) {1}
++    inferred type does not conform to declared bound(s)\n\
++    inferred: {0}\n\
++    bound(s): {1}
++compiler.misc.inferred.do.not.conform.to.params=\
++    actual arguments do not conforms to inferred formal arguments\n\
++    required: {0}\n\
++    found: {1}
+ 
+ #####
+ 
+diff -Nru openjdk.orig/langtools/test/tools/javac/generics/inference/6302954/T6476073.java openjdk/langtools/test/tools/javac/generics/inference/6302954/T6476073.java
+--- openjdk.orig/langtools/test/tools/javac/generics/inference/6302954/T6476073.java	2010-06-21 22:16:25.000000000 +0100
++++ openjdk/langtools/test/tools/javac/generics/inference/6302954/T6476073.java	2010-09-09 19:54:58.058019555 +0100
+@@ -25,6 +25,7 @@
+  * @test
+  * @bug     6476073
+  * @summary Capture using super wildcard of type variables doesn't work
++ * @ignore awaiting for 6650759 (see bug report for a detailed evaluation)
+  * @compile T6476073.java
+  */
+ 
+diff -Nru openjdk.orig/langtools/test/tools/javac/generics/inference/6638712/T6638712a.java openjdk/langtools/test/tools/javac/generics/inference/6638712/T6638712a.java
+--- openjdk.orig/langtools/test/tools/javac/generics/inference/6638712/T6638712a.java	1970-01-01 01:00:00.000000000 +0100
++++ openjdk/langtools/test/tools/javac/generics/inference/6638712/T6638712a.java	2010-09-09 19:54:58.062019572 +0100
+@@ -0,0 +1,41 @@
++/*
++ * Copyright 2009 Sun Microsystems, Inc.  All Rights Reserved.
++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
++ *
++ * This code is free software; you can redistribute it and/or modify it
++ * under the terms of the GNU General Public License version 2 only, as
++ * published by the Free Software Foundation.
++ *
++ * This code is distributed in the hope that it will be useful, but WITHOUT
++ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
++ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
++ * version 2 for more details (a copy is included in the LICENSE file that
++ * accompanied this code).
++ *
++ * You should have received a copy of the GNU General Public License version
++ * 2 along with this work; if not, write to the Free Software Foundation,
++ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
++ *
++ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
++ * CA 95054 USA or visit www.sun.com if you need additional information or
++ * have any questions.
++ */
++
++/*
++ * @test
++ * @bug     6638712
++ * @author  mcimadamore
++ * @summary Inference with wildcard types causes selection of inapplicable method
++ * @compile/fail/ref=T6638712a.out -XDrawDiagnostics T6638712a.java
++ */
++
++import java.util.*;
++
++class T6638712a {
++
++    <T> Comparator<T> compound(Iterable<? extends Comparator<? super T>> it) {}
++
++    public void test(List<Comparator<?>> x) {
++        Comparator<String> c3 = compound(x);
++    }
++}
+diff -Nru openjdk.orig/langtools/test/tools/javac/generics/inference/6638712/T6638712a.out openjdk/langtools/test/tools/javac/generics/inference/6638712/T6638712a.out
+--- openjdk.orig/langtools/test/tools/javac/generics/inference/6638712/T6638712a.out	1970-01-01 01:00:00.000000000 +0100
++++ openjdk/langtools/test/tools/javac/generics/inference/6638712/T6638712a.out	2010-09-09 19:54:58.062019572 +0100
+@@ -0,0 +1,2 @@
++T6638712a.java:39:41: compiler.err.invalid.inferred.types: T, (compiler.misc.inferred.do.not.conform.to.params: java.lang.Iterable<? extends java.util.Comparator<? super java.lang.String>>, java.util.List<java.util.Comparator<?>>)
++1 error
+diff -Nru openjdk.orig/langtools/test/tools/javac/generics/inference/6638712/T6638712b.java openjdk/langtools/test/tools/javac/generics/inference/6638712/T6638712b.java
+--- openjdk.orig/langtools/test/tools/javac/generics/inference/6638712/T6638712b.java	1970-01-01 01:00:00.000000000 +0100
++++ openjdk/langtools/test/tools/javac/generics/inference/6638712/T6638712b.java	2010-09-09 19:54:58.066019583 +0100
+@@ -0,0 +1,39 @@
++/*
++ * Copyright 2009 Sun Microsystems, Inc.  All Rights Reserved.
++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
++ *
++ * This code is free software; you can redistribute it and/or modify it
++ * under the terms of the GNU General Public License version 2 only, as
++ * published by the Free Software Foundation.
++ *
++ * This code is distributed in the hope that it will be useful, but WITHOUT
++ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
++ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
++ * version 2 for more details (a copy is included in the LICENSE file that
++ * accompanied this code).
++ *
++ * You should have received a copy of the GNU General Public License version
++ * 2 along with this work; if not, write to the Free Software Foundation,
++ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
++ *
++ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
++ * CA 95054 USA or visit www.sun.com if you need additional information or
++ * have any questions.
++ */
++
++/*
++ * @test
++ * @bug     6638712
++ * @author  mcimadamore
++ * @summary Inference with wildcard types causes selection of inapplicable method
++ * @compile/fail/ref=T6638712b.out -XDrawDiagnostics T6638712b.java
++ */
++
++class T6638712b<X> {
++
++    <I extends T6638712b<T>, T> T m(I test) { return null; }
++
++    void test(T6638712b<Integer> x) {
++        String i = m(x);
++    }
++}
+diff -Nru openjdk.orig/langtools/test/tools/javac/generics/inference/6638712/T6638712b.out openjdk/langtools/test/tools/javac/generics/inference/6638712/T6638712b.out
+--- openjdk.orig/langtools/test/tools/javac/generics/inference/6638712/T6638712b.out	1970-01-01 01:00:00.000000000 +0100
++++ openjdk/langtools/test/tools/javac/generics/inference/6638712/T6638712b.out	2010-09-09 19:54:58.066019583 +0100
+@@ -0,0 +1,2 @@
++T6638712b.java:37:21: compiler.err.invalid.inferred.types: T, (compiler.misc.inferred.do.not.conform.to.bounds: T6638712b<java.lang.Integer>, T6638712b<java.lang.String>)
++1 error
+diff -Nru openjdk.orig/langtools/test/tools/javac/generics/inference/6638712/T6638712c.java openjdk/langtools/test/tools/javac/generics/inference/6638712/T6638712c.java
+--- openjdk.orig/langtools/test/tools/javac/generics/inference/6638712/T6638712c.java	1970-01-01 01:00:00.000000000 +0100
++++ openjdk/langtools/test/tools/javac/generics/inference/6638712/T6638712c.java	2010-09-09 19:54:58.066019583 +0100
+@@ -0,0 +1,41 @@
++/*
++ * Copyright 2009 Sun Microsystems, Inc.  All Rights Reserved.
++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
++ *
++ * This code is free software; you can redistribute it and/or modify it
++ * under the terms of the GNU General Public License version 2 only, as
++ * published by the Free Software Foundation.
++ *
++ * This code is distributed in the hope that it will be useful, but WITHOUT
++ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
++ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
++ * version 2 for more details (a copy is included in the LICENSE file that
++ * accompanied this code).
++ *
++ * You should have received a copy of the GNU General Public License version
++ * 2 along with this work; if not, write to the Free Software Foundation,
++ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
++ *
++ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
++ * CA 95054 USA or visit www.sun.com if you need additional information or
++ * have any questions.
++ */
++
++/*
++ * @test
++ * @bug     6638712 6707034
++ * @author  mcimadamore
++ * @summary Inference with wildcard types causes selection of inapplicable method
++ * @compile/fail/ref=T6638712c.out -XDrawDiagnostics T6638712c.java
++ */
++
++import java.util.*;
++
++class T6638712c {
++
++    <T> T sort(T[] a, Comparator<? super T> c) { return null; }
++
++    void test(Enum[] e, Comparator<Enum<?>> comp) {
++        sort(e, comp);
++    }
++}
+diff -Nru openjdk.orig/langtools/test/tools/javac/generics/inference/6638712/T6638712c.out openjdk/langtools/test/tools/javac/generics/inference/6638712/T6638712c.out
+--- openjdk.orig/langtools/test/tools/javac/generics/inference/6638712/T6638712c.out	1970-01-01 01:00:00.000000000 +0100
++++ openjdk/langtools/test/tools/javac/generics/inference/6638712/T6638712c.out	2010-09-09 19:54:58.066019583 +0100
+@@ -0,0 +1,2 @@
++T6638712c.java:39:9: compiler.err.cant.apply.symbol: kindname.method, sort, T[],java.util.Comparator<? super T>, java.lang.Enum[],java.util.Comparator<java.lang.Enum<?>>, kindname.class, T6638712c, null
++1 error
+diff -Nru openjdk.orig/langtools/test/tools/javac/generics/inference/6638712/T6638712d.java openjdk/langtools/test/tools/javac/generics/inference/6638712/T6638712d.java
+--- openjdk.orig/langtools/test/tools/javac/generics/inference/6638712/T6638712d.java	1970-01-01 01:00:00.000000000 +0100
++++ openjdk/langtools/test/tools/javac/generics/inference/6638712/T6638712d.java	2010-09-09 19:54:58.066019583 +0100
+@@ -0,0 +1,41 @@
++/*
++ * Copyright 2009 Sun Microsystems, Inc.  All Rights Reserved.
++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
++ *
++ * This code is free software; you can redistribute it and/or modify it
++ * under the terms of the GNU General Public License version 2 only, as
++ * published by the Free Software Foundation.
++ *
++ * This code is distributed in the hope that it will be useful, but WITHOUT
++ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
++ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
++ * version 2 for more details (a copy is included in the LICENSE file that
++ * accompanied this code).
++ *
++ * You should have received a copy of the GNU General Public License version
++ * 2 along with this work; if not, write to the Free Software Foundation,
++ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
++ *
++ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
++ * CA 95054 USA or visit www.sun.com if you need additional information or
++ * have any questions.
++ */
++
++/*
++ * @test
++ * @bug     6638712 6730468
++ * @author  mcimadamore
++ * @summary Inference with wildcard types causes selection of inapplicable method
++ * @compile/fail/ref=T6638712d.out -XDrawDiagnostics T6638712d.java
++ */
++
++import java.util.*;
++
++public class T6638712d {
++
++    <U> U m(U u, List<List<U>> list) { return null; }
++
++    void test(List<List<String>> lls) {
++        m(1, lls);
++    }
++}
+diff -Nru openjdk.orig/langtools/test/tools/javac/generics/inference/6638712/T6638712d.out openjdk/langtools/test/tools/javac/generics/inference/6638712/T6638712d.out
+--- openjdk.orig/langtools/test/tools/javac/generics/inference/6638712/T6638712d.out	1970-01-01 01:00:00.000000000 +0100
++++ openjdk/langtools/test/tools/javac/generics/inference/6638712/T6638712d.out	2010-09-09 19:54:58.066019583 +0100
+@@ -0,0 +1,2 @@
++T6638712d.java:39:9: compiler.err.cant.apply.symbol: kindname.method, m, U,java.util.List<java.util.List<U>>, int,java.util.List<java.util.List<java.lang.String>>, kindname.class, T6638712d, null
++1 error
+diff -Nru openjdk.orig/langtools/test/tools/javac/generics/inference/6638712/T6638712e.java openjdk/langtools/test/tools/javac/generics/inference/6638712/T6638712e.java
+--- openjdk.orig/langtools/test/tools/javac/generics/inference/6638712/T6638712e.java	1970-01-01 01:00:00.000000000 +0100
++++ openjdk/langtools/test/tools/javac/generics/inference/6638712/T6638712e.java	2010-09-09 19:54:58.066019583 +0100
+@@ -0,0 +1,43 @@
++/*
++ * Copyright 2009 Sun Microsystems, Inc.  All Rights Reserved.
++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
++ *
++ * This code is free software; you can redistribute it and/or modify it
++ * under the terms of the GNU General Public License version 2 only, as
++ * published by the Free Software Foundation.
++ *
++ * This code is distributed in the hope that it will be useful, but WITHOUT
++ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
++ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
++ * version 2 for more details (a copy is included in the LICENSE file that
++ * accompanied this code).
++ *
++ * You should have received a copy of the GNU General Public License version
++ * 2 along with this work; if not, write to the Free Software Foundation,
++ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
++ *
++ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
++ * CA 95054 USA or visit www.sun.com if you need additional information or
++ * have any questions.
++ */
++
++/*
++ * @test
++ * @bug     6638712 6795689
++ * @author  mcimadamore
++ * @summary Inference with wildcard types causes selection of inapplicable method
++ * @compile/fail/ref=T6638712e.out -XDrawDiagnostics T6638712e.java
++ */
++
++class T6638712e {
++
++    static class Foo<A, B> {
++        <X> Foo<X, B> m(Foo<? super X, ? extends A> foo) { return null;}
++    }
++
++    static class Test {
++        Foo<Object, String> test(Foo<Boolean, String> foo1, Foo<Boolean, Boolean> foo2) {
++             return foo1.m(foo2);
++        }
++    }
++}
+diff -Nru openjdk.orig/langtools/test/tools/javac/generics/inference/6638712/T6638712e.out openjdk/langtools/test/tools/javac/generics/inference/6638712/T6638712e.out
+--- openjdk.orig/langtools/test/tools/javac/generics/inference/6638712/T6638712e.out	1970-01-01 01:00:00.000000000 +0100
++++ openjdk/langtools/test/tools/javac/generics/inference/6638712/T6638712e.out	2010-09-09 19:54:58.066019583 +0100
+@@ -0,0 +1,2 @@
++T6638712e.java:40:27: compiler.err.invalid.inferred.types: X, (compiler.misc.inferred.do.not.conform.to.params: T6638712e.Foo<? super java.lang.Object,? extends java.lang.Boolean>, T6638712e.Foo<java.lang.Boolean,java.lang.Boolean>)
++1 error
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/patches/openjdk/6650759-missing_inference.patch	Thu Sep 30 16:46:39 2010 +0100
@@ -0,0 +1,898 @@
+diff -Nru openjdk.orig/langtools/src/share/classes/com/sun/tools/javac/code/Type.java openjdk/langtools/src/share/classes/com/sun/tools/javac/code/Type.java
+--- openjdk.orig/langtools/src/share/classes/com/sun/tools/javac/code/Type.java	2010-09-09 20:03:34.000000000 +0100
++++ openjdk/langtools/src/share/classes/com/sun/tools/javac/code/Type.java	2010-09-09 20:24:56.236744893 +0100
+@@ -1063,7 +1063,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.
+          *
+@@ -1076,6 +1076,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<Type> getConstraints(TypeVar tv, ConstraintKind ck) {
++            return List.nil();
++        }
++
+         public Type map(Mapping f) {
+             return f.apply(qtype);
+         }
+diff -Nru openjdk.orig/langtools/src/share/classes/com/sun/tools/javac/comp/Infer.java openjdk/langtools/src/share/classes/com/sun/tools/javac/comp/Infer.java
+--- openjdk.orig/langtools/src/share/classes/com/sun/tools/javac/comp/Infer.java	2010-09-09 20:03:34.000000000 +0100
++++ openjdk/langtools/src/share/classes/com/sun/tools/javac/comp/Infer.java	2010-09-09 20:25:15.752817376 +0100
+@@ -29,6 +29,7 @@
+ import com.sun.tools.javac.util.List;
+ import com.sun.tools.javac.code.*;
+ import com.sun.tools.javac.code.Type.*;
++import com.sun.tools.javac.code.Type.ForAll.ConstraintKind;
+ import com.sun.tools.javac.code.Symbol.*;
+ 
+ import static com.sun.tools.javac.code.Flags.*;
+@@ -51,6 +52,7 @@
+ 
+     Symtab syms;
+     Types types;
++    Check chk;
+     Resolve rs;
+ 
+     public static Infer instance(Context context) {
+@@ -65,6 +67,7 @@
+         syms = Symtab.instance(context);
+         types = Types.instance(context);
+         rs = Resolve.instance(context);
++        chk = Check.instance(context);
+     }
+ 
+     public static class InferenceException extends RuntimeException {
+@@ -260,14 +263,19 @@
+                                 Warner warn) throws InferenceException {
+         List<Type> undetvars = Type.map(that.tvars, fromTypeVarFun);
+         for (List<Type> l = undetvars; l.nonEmpty(); l = l.tail) {
+-            UndetVar v = (UndetVar) l.head;
++            UndetVar uv = (UndetVar) l.head;
++            TypeVar tv = (TypeVar)uv.qtype;
+             ListBuffer<Type> hibounds = new ListBuffer<Type>();
+-            for (List<Type> l1 = types.getBounds((TypeVar) v.qtype); l1.nonEmpty(); l1 = l1.tail) {
+-                if (!l1.head.containsSome(that.tvars)) {
+-                    hibounds.append(l1.head);
++            for (Type t : that.getConstraints(tv, ConstraintKind.EXTENDS).prependList(types.getBounds(tv))) {
++                if (!t.containsSome(that.tvars) && t.tag != BOT) {
++                    hibounds.append(t);
+                 }
+             }
+-            v.hibounds = hibounds.toList();
++            List<Type> inst = that.getConstraints(tv, ConstraintKind.EQUAL);
++            if (inst.nonEmpty() && inst.head.tag != BOT) {
++                uv.inst = inst.head;
++            }
++            uv.hibounds = hibounds.toList();
+         }
+         Type qtype1 = types.subst(that.qtype, that.tvars, undetvars);
+         if (!types.isSubtype(qtype1, to)) {
+@@ -283,7 +291,7 @@
+         List<Type> targs = Type.map(undetvars, getInstFun);
+         targs = types.subst(targs, that.tvars, targs);
+         checkWithinBounds(that.tvars, targs, warn);
+-        return that.inst(targs, types);
++        return chk.checkType(warn.pos(), that.inst(targs, types), to);
+     }
+ 
+     /** Instantiate method type `mt' by finding instantiations of
+@@ -359,6 +367,9 @@
+         /** Type variables instantiated to bottom */
+         ListBuffer<Type> restvars = new ListBuffer<Type>();
+ 
++        /** Undet vars instantiated to bottom */
++        final ListBuffer<Type> restundet = new ListBuffer<Type>();
++
+         /** Instantiated types or TypeVars if under-constrained */
+         ListBuffer<Type> insttypes = new ListBuffer<Type>();
+ 
+@@ -369,6 +380,7 @@
+             UndetVar uv = (UndetVar)t;
+             if (uv.inst.tag == BOT) {
+                 restvars.append(uv.qtype);
++                restundet.append(uv);
+                 insttypes.append(uv.qtype);
+                 undettypes.append(uv);
+                 uv.inst = null;
+@@ -389,17 +401,32 @@
+             final MethodType mt2 = new MethodType(mt.argtypes, null, mt.thrown, syms.methodClass);
+             mt2.restype = new ForAll(restvars.toList(), mt.restype) {
+                 @Override
++                public List<Type> getConstraints(TypeVar tv, ConstraintKind ck) {
++                    for (Type t : restundet.toList()) {
++                        UndetVar uv = (UndetVar)t;
++                        if (uv.qtype == tv) {
++                            switch (ck) {
++                                case EXTENDS: return uv.hibounds;
++                                case SUPER: return uv.lobounds;
++                                case EQUAL: return uv.inst != null ? List.of(uv.inst) : List.<Type>nil();
++                            }
++                        }
++                    }
++                    return List.nil();
++                }
++
++                @Override
+                 public Type inst(List<Type> inferred, Types types) throws NoInstanceException {
+                     List<Type> formals = types.subst(mt2.argtypes, tvars, inferred);
+-                   if (!rs.argumentsAcceptable(capturedArgs, formals,
++                    if (!rs.argumentsAcceptable(capturedArgs, formals,
+                            allowBoxing, useVarargs, warn)) {
+                       // inferred method is not applicable
+                       throw invalidInstanceException.setMessage("inferred.do.not.conform.to.params", formals, argtypes);
+-                   }
+-                   // check that inferred bounds conform to their bounds
+-                   checkWithinBounds(all_tvars,
++                    }
++                    // check that inferred bounds conform to their bounds
++                    checkWithinBounds(all_tvars,
+                            types.subst(inferredTypes, tvars, inferred), warn);
+-                   return super.inst(inferred, types);
++                    return super.inst(inferred, types);
+             }};
+             return mt2;
+         }
+diff -Nru openjdk.orig/langtools/test/tools/javac/generics/inference/6302954/T6476073.java openjdk/langtools/test/tools/javac/generics/inference/6302954/T6476073.java
+--- openjdk.orig/langtools/test/tools/javac/generics/inference/6302954/T6476073.java	2010-09-09 20:03:34.000000000 +0100
++++ openjdk/langtools/test/tools/javac/generics/inference/6302954/T6476073.java	2010-09-09 20:24:56.236744893 +0100
+@@ -25,7 +25,6 @@
+  * @test
+  * @bug     6476073
+  * @summary Capture using super wildcard of type variables doesn't work
+- * @ignore awaiting for 6650759 (see bug report for a detailed evaluation)
+  * @compile T6476073.java
+  */
+ 
+diff -Nru openjdk.orig/langtools/test/tools/javac/generics/inference/6638712/T6638712b.out openjdk/langtools/test/tools/javac/generics/inference/6638712/T6638712b.out
+--- openjdk.orig/langtools/test/tools/javac/generics/inference/6638712/T6638712b.out	2010-09-09 20:03:34.000000000 +0100
++++ openjdk/langtools/test/tools/javac/generics/inference/6638712/T6638712b.out	2010-09-09 20:26:25.205075284 +0100
+@@ -1,2 +1,2 @@
+-T6638712b.java:37:21: compiler.err.invalid.inferred.types: T, (compiler.misc.inferred.do.not.conform.to.bounds: T6638712b<java.lang.Integer>, T6638712b<java.lang.String>)
+++T6638712b.java:37:21: compiler.err.prob.found.req: (compiler.misc.incompatible.types.1: (compiler.misc.no.conforming.instance.exists: T, T, java.lang.String)), <T>T, java.lang.String
+ 1 error
+diff -Nru openjdk.orig/langtools/test/tools/javac/generics/inference/6638712/T6638712e.out openjdk/langtools/test/tools/javac/generics/inference/6638712/T6638712e.out
+--- openjdk.orig/langtools/test/tools/javac/generics/inference/6638712/T6638712e.out	2010-09-09 20:03:34.000000000 +0100
++++ openjdk/langtools/test/tools/javac/generics/inference/6638712/T6638712e.out	2010-09-09 20:27:14.405257916 +0100
+@@ -1,2 +1,2 @@
+-T6638712e.java:40:27: compiler.err.invalid.inferred.types: X, (compiler.misc.inferred.do.not.conform.to.params: T6638712e.Foo<? super java.lang.Object,? extends java.lang.Boolean>, T6638712e.Foo<java.lang.Boolean,java.lang.Boolean>)
++T6638712e.java:40:27: compiler.err.prob.found.req: (compiler.misc.incompatible.types.1: (compiler.misc.no.conforming.instance.exists: X, T6638712e.Foo<X,java.lang.String>, T6638712e.Foo<java.lang.Object,java.lang.String>)), <X>T6638712e.Foo<X,java.lang.String>, T6638712e.Foo<java.lang.Object,java.lang.String>
+ 1 error
+diff -Nru openjdk.orig/langtools/test/tools/javac/generics/inference/6650759/T6650759a.java openjdk/langtools/test/tools/javac/generics/inference/6650759/T6650759a.java
+--- openjdk.orig/langtools/test/tools/javac/generics/inference/6650759/T6650759a.java	1970-01-01 01:00:00.000000000 +0100
++++ openjdk/langtools/test/tools/javac/generics/inference/6650759/T6650759a.java	2010-09-09 20:24:56.248744934 +0100
+@@ -0,0 +1,45 @@
++/*
++ * Copyright 2009 Sun Microsystems, Inc.  All Rights Reserved.
++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
++ *
++ * This code is free software; you can redistribute it and/or modify it
++ * under the terms of the GNU General Public License version 2 only, as
++ * published by the Free Software Foundation.
++ *
++ * This code is distributed in the hope that it will be useful, but WITHOUT
++ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
++ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
++ * version 2 for more details (a copy is included in the LICENSE file that
++ * accompanied this code).
++ *
++ * You should have received a copy of the GNU General Public License version
++ * 2 along with this work; if not, write to the Free Software Foundation,
++ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
++ *
++ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
++ * CA 95054 USA or visit www.sun.com if you need additional information or
++ * have any questions.
++ */
++
++/*
++ * @test
++ * @bug     6650759
++ * @author  mcimadamore
++ * @summary Inference of formal type parameter (unused in formal parameters) is not performed
++ * @compile T6650759a.java
++ */
++
++class T6650759a {
++
++    public static interface Interface<T> { }
++    public static class IntegerInterface implements Interface<Integer> { }
++
++    <I extends Interface<T>, T> T getGenericValue(I test) { return null; }
++
++    void testSet(Integer test) { }
++
++    void test() {
++        Integer test = getGenericValue(new IntegerInterface());
++        testSet(getGenericValue(new IntegerInterface()));
++    }
++}
+\ No newline at end of file
+diff -Nru openjdk.orig/langtools/test/tools/javac/generics/inference/6650759/T6650759b.java openjdk/langtools/test/tools/javac/generics/inference/6650759/T6650759b.java
+--- openjdk.orig/langtools/test/tools/javac/generics/inference/6650759/T6650759b.java	1970-01-01 01:00:00.000000000 +0100
++++ openjdk/langtools/test/tools/javac/generics/inference/6650759/T6650759b.java	2010-09-09 20:24:56.248744934 +0100
+@@ -0,0 +1,52 @@
++/*
++ * Copyright 2009 Sun Microsystems, Inc.  All Rights Reserved.
++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
++ *
++ * This code is free software; you can redistribute it and/or modify it
++ * under the terms of the GNU General Public License version 2 only, as
++ * published by the Free Software Foundation.
++ *
++ * This code is distributed in the hope that it will be useful, but WITHOUT
++ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
++ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
++ * version 2 for more details (a copy is included in the LICENSE file that
++ * accompanied this code).
++ *
++ * You should have received a copy of the GNU General Public License version
++ * 2 along with this work; if not, write to the Free Software Foundation,
++ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
++ *
++ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
++ * CA 95054 USA or visit www.sun.com if you need additional information or
++ * have any questions.
++ */
++
++/*
++ * @test
++ * @bug     6650759
++ * @author  mcimadamore
++ * @summary Inference of formal type parameter (unused in formal parameters) is not performed
++ * @compile T6650759b.java
++ */
++
++public class T6650759b {
++
++    interface A<X extends A<X, Y>, Y extends B<X>> {}
++
++    static class B<X extends A<X, ?>> {}
++
++    interface C<X extends A<X, Y>, Y extends B<X>> {}
++
++    interface D<X extends A<X, Y>, Y extends B<X>> {}
++
++    static class E<X extends A<X, Y>, Y extends B<X>, W extends C<X, Y>> implements D<X, Y> {
++
++        static <X extends A<X, Y>, Y extends B<X>, W extends C<X, Y>> D<X, Y> of(W w) {
++            return null;
++        }
++    }
++
++    <X extends A<X, Y>, Y extends B<X>, W extends C<X, Y>, Z extends D<X, Y>> Z test(W w) {
++        return (Z) E.of(w);
++    }
++}
+diff -Nru openjdk.orig/langtools/test/tools/javac/generics/inference/6650759/T6650759c.java openjdk/langtools/test/tools/javac/generics/inference/6650759/T6650759c.java
+--- openjdk.orig/langtools/test/tools/javac/generics/inference/6650759/T6650759c.java	1970-01-01 01:00:00.000000000 +0100
++++ openjdk/langtools/test/tools/javac/generics/inference/6650759/T6650759c.java	2010-09-09 20:24:56.248744934 +0100
+@@ -0,0 +1,49 @@
++/*
++ * Copyright 2009 Sun Microsystems, Inc.  All Rights Reserved.
++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
++ *
++ * This code is free software; you can redistribute it and/or modify it
++ * under the terms of the GNU General Public License version 2 only, as
++ * published by the Free Software Foundation.
++ *
++ * This code is distributed in the hope that it will be useful, but WITHOUT
++ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
++ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
++ * version 2 for more details (a copy is included in the LICENSE file that
++ * accompanied this code).
++ *
++ * You should have received a copy of the GNU General Public License version
++ * 2 along with this work; if not, write to the Free Software Foundation,
++ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
++ *
++ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
++ * CA 95054 USA or visit www.sun.com if you need additional information or
++ * have any questions.
++ */
++
++/*
++ * @test
++ * @bug     6650759
++ * @summary Inference of formal type parameter (unused in formal parameters) is not performed
++ * @compile T6650759c.java
++ */
++
++import java.util.Collection;
++import java.util.Collections;
++
++public class T6650759c {
++
++  static interface A {}
++
++  static interface B<X extends A> {}
++
++  static interface C<X extends A, Y extends B<X>> {}
++
++  public static <T extends A, U extends B<T>> Collection<C<T,U>> get(U u) {
++    return null;
++  }
++
++  public <T extends A, U extends B<T>> Collection<C<T,U>> test(U u) {
++    return Collections.unmodifiableCollection(get(u));
++  }
++}
+diff -Nru openjdk.orig/langtools/test/tools/javac/generics/inference/6650759/T6650759d.java openjdk/langtools/test/tools/javac/generics/inference/6650759/T6650759d.java
+--- openjdk.orig/langtools/test/tools/javac/generics/inference/6650759/T6650759d.java	1970-01-01 01:00:00.000000000 +0100
++++ openjdk/langtools/test/tools/javac/generics/inference/6650759/T6650759d.java	2010-09-09 20:24:56.248744934 +0100
+@@ -0,0 +1,51 @@
++/*
++ * Copyright 2009 Sun Microsystems, Inc.  All Rights Reserved.
++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
++ *
++ * This code is free software; you can redistribute it and/or modify it
++ * under the terms of the GNU General Public License version 2 only, as
++ * published by the Free Software Foundation.
++ *
++ * This code is distributed in the hope that it will be useful, but WITHOUT
++ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
++ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
++ * version 2 for more details (a copy is included in the LICENSE file that
++ * accompanied this code).
++ *
++ * You should have received a copy of the GNU General Public License version
++ * 2 along with this work; if not, write to the Free Software Foundation,
++ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
++ *
++ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
++ * CA 95054 USA or visit www.sun.com if you need additional information or
++ * have any questions.
++ */
++
++/*
++ * @test
++ * @bug     6650759
++ * @summary Inference of formal type parameter (unused in formal parameters) is not performed
++ * @compile T6650759d.java
++ */
++
++public class T6650759d {
++
++    static abstract class A<X> {
++
++        static <T> A<T> m(Iterable<? extends T> elements) {
++            return null;
++        }
++    }
++
++    static abstract class B {}
++
++    static abstract class C<X extends B> {}
++
++    <U extends C<V>, V extends B> Iterable<V> get(U u) {
++        return null;
++    }
++
++    <U extends C<V>, V extends B> void m(U u) {
++        A<V> a = A.m(get(u));
++    }
++}
+diff -Nru openjdk.orig/langtools/test/tools/javac/generics/inference/6650759/T6650759e.java openjdk/langtools/test/tools/javac/generics/inference/6650759/T6650759e.java
+--- openjdk.orig/langtools/test/tools/javac/generics/inference/6650759/T6650759e.java	1970-01-01 01:00:00.000000000 +0100
++++ openjdk/langtools/test/tools/javac/generics/inference/6650759/T6650759e.java	2010-09-09 20:24:56.248744934 +0100
+@@ -0,0 +1,52 @@
++/*
++ * Copyright 2009 Sun Microsystems, Inc.  All Rights Reserved.
++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
++ *
++ * This code is free software; you can redistribute it and/or modify it
++ * under the terms of the GNU General Public License version 2 only, as
++ * published by the Free Software Foundation.
++ *
++ * This code is distributed in the hope that it will be useful, but WITHOUT
++ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
++ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
++ * version 2 for more details (a copy is included in the LICENSE file that
++ * accompanied this code).
++ *
++ * You should have received a copy of the GNU General Public License version
++ * 2 along with this work; if not, write to the Free Software Foundation,
++ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
++ *
++ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
++ * CA 95054 USA or visit www.sun.com if you need additional information or
++ * have any questions.
++ */
++
++/*
++ * @test
++ * @bug     6650759
++ * @summary Inference of formal type parameter (unused in formal parameters) is not performed
++ * @compile T6650759e.java
++ */
++
++import java.util.List;
++
++public class T6650759e {
++
++    static abstract class A<X extends B> {}
++
++    interface B<X extends A> extends D {}
++
++    static abstract class C<X extends D> {}
++
++    interface D {}
++
++    static abstract class E<X extends C<? extends B<?>>> {}
++
++    <U extends C<V>, V extends B<W>, W extends A<V>> W m1(E<U> e) {
++        return m2(e);
++    }
++
++    <U extends C<V>, V extends B<W>, W extends A<V>> W m2(E<U> e) {
++        return null;
++    }
++}
+diff -Nru openjdk.orig/langtools/test/tools/javac/generics/inference/6650759/T6650759f.java openjdk/langtools/test/tools/javac/generics/inference/6650759/T6650759f.java
+--- openjdk.orig/langtools/test/tools/javac/generics/inference/6650759/T6650759f.java	1970-01-01 01:00:00.000000000 +0100
++++ openjdk/langtools/test/tools/javac/generics/inference/6650759/T6650759f.java	2010-09-09 20:24:56.248744934 +0100
+@@ -0,0 +1,50 @@
++/*
++ * Copyright 2009 Sun Microsystems, Inc.  All Rights Reserved.
++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
++ *
++ * This code is free software; you can redistribute it and/or modify it
++ * under the terms of the GNU General Public License version 2 only, as
++ * published by the Free Software Foundation.
++ *
++ * This code is distributed in the hope that it will be useful, but WITHOUT
++ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
++ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
++ * version 2 for more details (a copy is included in the LICENSE file that
++ * accompanied this code).
++ *
++ * You should have received a copy of the GNU General Public License version
++ * 2 along with this work; if not, write to the Free Software Foundation,
++ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
++ *
++ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
++ * CA 95054 USA or visit www.sun.com if you need additional information or
++ * have any questions.
++ */
++
++/*
++ * @test
++ * @bug     6650759
++ * @summary Inference of formal type parameter (unused in formal parameters) is not performed
++ * @compile T6650759f.java
++ */
++
++import java.util.Collections;
++
++public class T6650759f {
++
++    interface A<X extends A> {}
++
++    static abstract class B<X extends B> implements A<X> {}
++
++    static abstract class C<X extends D> extends B<X> {}
++
++    static class D extends C<D> {}
++
++    <X extends B, Y extends B<X>> Iterable<X> m(Y node) {
++        return null;
++    }
++
++    public void test(D d) {
++        Iterable<D> ops = (true) ? Collections.singletonList(d) : m(d);
++    }
++}
+diff -Nru openjdk.orig/langtools/test/tools/javac/generics/inference/6650759/T6650759g.java openjdk/langtools/test/tools/javac/generics/inference/6650759/T6650759g.java
+--- openjdk.orig/langtools/test/tools/javac/generics/inference/6650759/T6650759g.java	1970-01-01 01:00:00.000000000 +0100
++++ openjdk/langtools/test/tools/javac/generics/inference/6650759/T6650759g.java	2010-09-09 20:24:56.248744934 +0100
+@@ -0,0 +1,59 @@
++/*
++ * Copyright 2009 Sun Microsystems, Inc.  All Rights Reserved.
++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
++ *
++ * This code is free software; you can redistribute it and/or modify it
++ * under the terms of the GNU General Public License version 2 only, as
++ * published by the Free Software Foundation.
++ *
++ * This code is distributed in the hope that it will be useful, but WITHOUT
++ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
++ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
++ * version 2 for more details (a copy is included in the LICENSE file that
++ * accompanied this code).
++ *
++ * You should have received a copy of the GNU General Public License version
++ * 2 along with this work; if not, write to the Free Software Foundation,
++ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
++ *
++ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
++ * CA 95054 USA or visit www.sun.com if you need additional information or
++ * have any questions.
++ */
++
++/*
++ * @test
++ * @bug     6650759
++ * @summary Inference of formal type parameter (unused in formal parameters) is not performed
++ * @compile T6650759g.java
++ */
++
++public class T6650759g {
++
++    static abstract class A<X extends A<X>> {}
++
++    static abstract class B<X extends A<X>> {}
++
++    interface C<X, Y> {}
++
++    static abstract class D<X extends A<X>, Y extends B<X>> implements C<X, Y> {}
++
++    static class E extends A<E> {}
++
++    static class F extends B<E> {}
++
++    static void test(Iterable<E> data) {
++        m3(m2(data, m1(F.class)));
++    }
++
++    static <X extends A<X>, Y extends B<X>> D<X, Y> m1(Class<Y> c) {
++        return null;
++    }
++
++    static <U, V> Iterable<V> m2(Iterable<U> x1, C<? super U, ? extends V> x2) {
++        return null;
++    }
++
++    static void m3(Iterable<F> data) {
++    }
++}
+diff -Nru openjdk.orig/langtools/test/tools/javac/generics/inference/6650759/T6650759h.java openjdk/langtools/test/tools/javac/generics/inference/6650759/T6650759h.java
+--- openjdk.orig/langtools/test/tools/javac/generics/inference/6650759/T6650759h.java	1970-01-01 01:00:00.000000000 +0100
++++ openjdk/langtools/test/tools/javac/generics/inference/6650759/T6650759h.java	2010-09-09 20:24:56.248744934 +0100
+@@ -0,0 +1,39 @@
++/*
++ * Copyright 2009 Sun Microsystems, Inc.  All Rights Reserved.
++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
++ *
++ * This code is free software; you can redistribute it and/or modify it
++ * under the terms of the GNU General Public License version 2 only, as
++ * published by the Free Software Foundation.
++ *
++ * This code is distributed in the hope that it will be useful, but WITHOUT
++ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
++ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
++ * version 2 for more details (a copy is included in the LICENSE file that
++ * accompanied this code).
++ *
++ * You should have received a copy of the GNU General Public License version
++ * 2 along with this work; if not, write to the Free Software Foundation,
++ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
++ *
++ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
++ * CA 95054 USA or visit www.sun.com if you need additional information or
++ * have any questions.
++ */
++
++/*
++ * @test
++ * @bug     6650759
++ * @summary Inference of formal type parameter (unused in formal parameters) is not performed
++ * @compile T6650759h.java
++ */
++class T6650759h<X, Y> {
++
++    <A> Object m(A a, T6650759h<?, ? super A> t) {
++        return null;
++    }
++
++    void test(T6650759h<?, Void> t) {
++        m(null, t);
++    }
++}
+diff -Nru openjdk.orig/langtools/test/tools/javac/generics/inference/6650759/T6650759i.java openjdk/langtools/test/tools/javac/generics/inference/6650759/T6650759i.java
+--- openjdk.orig/langtools/test/tools/javac/generics/inference/6650759/T6650759i.java	1970-01-01 01:00:00.000000000 +0100
++++ openjdk/langtools/test/tools/javac/generics/inference/6650759/T6650759i.java	2010-09-09 20:24:56.248744934 +0100
+@@ -0,0 +1,54 @@
++/*
++ * Copyright 2009 Sun Microsystems, Inc.  All Rights Reserved.
++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
++ *
++ * This code is free software; you can redistribute it and/or modify it
++ * under the terms of the GNU General Public License version 2 only, as
++ * published by the Free Software Foundation.
++ *
++ * This code is distributed in the hope that it will be useful, but WITHOUT
++ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
++ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
++ * version 2 for more details (a copy is included in the LICENSE file that
++ * accompanied this code).
++ *
++ * You should have received a copy of the GNU General Public License version
++ * 2 along with this work; if not, write to the Free Software Foundation,
++ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
++ *
++ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
++ * CA 95054 USA or visit www.sun.com if you need additional information or
++ * have any questions.
++ */
++
++/*
++ * @test
++ * @bug     6650759
++ * @summary Inference of formal type parameter (unused in formal parameters) is not performed
++ * @compile T6650759i.java
++ */
++public class T6650759i {
++
++    static class A<X extends A, Y extends B> {}
++
++    static class B<X extends B> {}
++
++    static class C<X extends A<X, Y>, Y extends B<Y>> {}
++
++    static <U extends A<U, V>, V extends B<V>> Class<U> m1(U x) {
++        return null;
++    }
++
++    static <U extends A<U, V>, V extends B<V>> U m2(Class<U> c) {
++        return null;
++    }
++
++    static <W, U extends A<U, V>, V extends B<V>> W m3(Class<W> c1, C<U, V> c2) {
++        return null;
++    }
++
++    static <U extends A<U, V>, V extends B<V>> void test(U u, C<U, V> c) {
++        m2(m1(u));
++        U res = m3(m1(u), c);
++    }
++}
+diff -Nru openjdk.orig/langtools/test/tools/javac/generics/inference/6650759/T6650759j.java openjdk/langtools/test/tools/javac/generics/inference/6650759/T6650759j.java
+--- openjdk.orig/langtools/test/tools/javac/generics/inference/6650759/T6650759j.java	1970-01-01 01:00:00.000000000 +0100
++++ openjdk/langtools/test/tools/javac/generics/inference/6650759/T6650759j.java	2010-09-09 20:24:56.248744934 +0100
+@@ -0,0 +1,54 @@
++/*
++ * Copyright 2009 Sun Microsystems, Inc.  All Rights Reserved.
++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
++ *
++ * This code is free software; you can redistribute it and/or modify it
++ * under the terms of the GNU General Public License version 2 only, as
++ * published by the Free Software Foundation.
++ *
++ * This code is distributed in the hope that it will be useful, but WITHOUT
++ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
++ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
++ * version 2 for more details (a copy is included in the LICENSE file that
++ * accompanied this code).
++ *
++ * You should have received a copy of the GNU General Public License version
++ * 2 along with this work; if not, write to the Free Software Foundation,
++ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
++ *
++ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
++ * CA 95054 USA or visit www.sun.com if you need additional information or
++ * have any questions.
++ */
++
++/*
++ * @test
++ * @bug     6650759
++ * @summary Inference of formal type parameter (unused in formal parameters) is not performed
++ * @compile T6650759j.java
++ */
++
++public class T6650759j {
++
++    static abstract class A<X extends A<X>> {}
++
++    static abstract class B<X extends B<X, Y>, Y> extends A<X> {}
++
++    static abstract class C<X extends C<X, Y>, Y> extends B<X, Y> {}
++
++    interface D {}
++
++    static class E extends C<E, D> {}
++
++    static abstract class F<X extends F<X, Y>, Y extends A<Y>> extends A<X> {}
++
++    static class G extends F<G, E> {}
++
++    static <X extends F<X, Y>, Y extends A<Y>> X m(Iterable<X> it) {
++        return null;
++    }
++
++    static G test(Iterable<G> c) {
++        return m(c);
++    }
++}
+diff -Nru openjdk.orig/langtools/test/tools/javac/generics/inference/6650759/T6650759k.java openjdk/langtools/test/tools/javac/generics/inference/6650759/T6650759k.java
+--- openjdk.orig/langtools/test/tools/javac/generics/inference/6650759/T6650759k.java	1970-01-01 01:00:00.000000000 +0100
++++ openjdk/langtools/test/tools/javac/generics/inference/6650759/T6650759k.java	2010-09-09 20:24:56.248744935 +0100
+@@ -0,0 +1,44 @@
++/*
++ * Copyright 2009 Sun Microsystems, Inc.  All Rights Reserved.
++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
++ *
++ * This code is free software; you can redistribute it and/or modify it
++ * under the terms of the GNU General Public License version 2 only, as
++ * published by the Free Software Foundation.
++ *
++ * This code is distributed in the hope that it will be useful, but WITHOUT
++ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
++ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
++ * version 2 for more details (a copy is included in the LICENSE file that
++ * accompanied this code).
++ *
++ * You should have received a copy of the GNU General Public License version
++ * 2 along with this work; if not, write to the Free Software Foundation,
++ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
++ *
++ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
++ * CA 95054 USA or visit www.sun.com if you need additional information or
++ * have any questions.
++ */
++
++/*
++ * @test
++ * @bug     6650759
++ * @summary Inference of formal type parameter (unused in formal parameters) is not performed
++ * @compile T6650759k.java
++ */
++
++public class T6650759k {
++
++    static class A<X extends A> {}
++
++    static class B<X extends B, Y extends A> {}
++
++    <U extends A<U>, V extends B<V, U>> Object m(Class<V> c) {
++        return null;
++    }
++
++    <U extends A<U>, V extends B<V, U>> void test(Class<V> c) {
++        m(c);
++    }
++}
+diff -Nru openjdk.orig/langtools/test/tools/javac/generics/inference/6650759/T6650759l.java openjdk/langtools/test/tools/javac/generics/inference/6650759/T6650759l.java
+--- openjdk.orig/langtools/test/tools/javac/generics/inference/6650759/T6650759l.java	1970-01-01 01:00:00.000000000 +0100
++++ openjdk/langtools/test/tools/javac/generics/inference/6650759/T6650759l.java	2010-09-09 20:24:56.248744935 +0100
+@@ -0,0 +1,46 @@
++/*
++ * Copyright 2009 Sun Microsystems, Inc.  All Rights Reserved.
++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
++ *
++ * This code is free software; you can redistribute it and/or modify it
++ * under the terms of the GNU General Public License version 2 only, as
++ * published by the Free Software Foundation.
++ *
++ * This code is distributed in the hope that it will be useful, but WITHOUT
++ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
++ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
++ * version 2 for more details (a copy is included in the LICENSE file that
++ * accompanied this code).
++ *
++ * You should have received a copy of the GNU General Public License version
++ * 2 along with this work; if not, write to the Free Software Foundation,
++ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
++ *
++ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
++ * CA 95054 USA or visit www.sun.com if you need additional information or
++ * have any questions.
++ */
++
++/*
++ * @test
++ * @bug     6650759
++ * @summary Inference of formal type parameter (unused in formal parameters) is not performed
++ * @compile T6650759l.java
++ */
++
++public class T6650759l {
++
++    public static interface A<X> {}
++
++    public static class B implements A<Integer> {}
++
++    public static <X extends A<Y>, Y> Y m1(X x) {
++        return null;
++    }
++
++    public static void m2(Integer i) {}
++
++    public static void test(B b) {
++        m2(m1(b));
++    }
++}
+diff -Nru openjdk.orig/langtools/test/tools/javac/generics/inference/6650759/T6650759m.java openjdk/langtools/test/tools/javac/generics/inference/6650759/T6650759m.java
+--- openjdk.orig/langtools/test/tools/javac/generics/inference/6650759/T6650759m.java	1970-01-01 01:00:00.000000000 +0100
++++ openjdk/langtools/test/tools/javac/generics/inference/6650759/T6650759m.java	2010-09-09 20:24:56.248744935 +0100
+@@ -0,0 +1,47 @@
++/*
++ * Copyright 2009 Sun Microsystems, Inc.  All Rights Reserved.
++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
++ *
++ * This code is free software; you can redistribute it and/or modify it
++ * under the terms of the GNU General Public License version 2 only, as
++ * published by the Free Software Foundation.
++ *
++ * This code is distributed in the hope that it will be useful, but WITHOUT
++ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
++ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
++ * version 2 for more details (a copy is included in the LICENSE file that
++ * accompanied this code).
++ *
++ * You should have received a copy of the GNU General Public License version
++ * 2 along with this work; if not, write to the Free Software Foundation,
++ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
++ *
++ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
++ * CA 95054 USA or visit www.sun.com if you need additional information or
++ * have any questions.
++ */
++
++/*
++ * @test
++ * @bug     6650759
++ * @summary Inference of formal type parameter (unused in formal parameters) is not performed
++ * @compile/fail/ref=T6650759m.out T6650759m.java -XDrawDiagnostics
++ */
++
++import java.util.*;
++
++class T6650759m {
++    <Z> List<? super Z> m(List<? extends List<? super Z>> ls) {
++        return ls.get(0);
++    }
++
++    void test() {
++        ArrayList<ArrayList<Integer>> lli = new ArrayList<ArrayList<Integer>>();
++        ArrayList<Integer> li = new ArrayList<Integer>();
++        li.add(2);
++        lli.add(li);
++        List<? super String> ls = m(lli); //here
++        ls.add("crash");
++        Integer i = li.get(1);
++    }
++}
+diff -Nru openjdk.orig/langtools/test/tools/javac/generics/inference/6650759/T6650759m.out openjdk/langtools/test/tools/javac/generics/inference/6650759/T6650759m.out
+--- openjdk.orig/langtools/test/tools/javac/generics/inference/6650759/T6650759m.out	1970-01-01 01:00:00.000000000 +0100
++++ openjdk/langtools/test/tools/javac/generics/inference/6650759/T6650759m.out	2010-09-09 20:24:56.248744935 +0100
+@@ -0,0 +1,2 @@
++T6650759m.java:43:36: compiler.err.prob.found.req: (compiler.misc.incompatible.types), java.util.List<? super java.lang.Integer>, java.util.List<? super java.lang.String>
++1 error