src/share/classes/com/sun/tools/javac/comp/Infer.java

changeset 1519
97bd5e7151bc
parent 1510
7873d37f5b37
child 1550
1df20330f6bd
     1.1 --- a/src/share/classes/com/sun/tools/javac/comp/Infer.java	Tue Jan 22 19:07:20 2013 -0800
     1.2 +++ b/src/share/classes/com/sun/tools/javac/comp/Infer.java	Wed Jan 23 15:08:03 2013 +0000
     1.3 @@ -321,8 +321,10 @@
     1.4                              mt.getReturnType() : syms.objectType;
     1.5                  }
     1.6                  Type qtype1 = inferenceContext.asFree(mt.getReturnType(), types);
     1.7 -                if (!types.isSubtype(qtype1,
     1.8 -                        qtype1.hasTag(UNDETVAR) ? types.boxedTypeOrType(to) : to)) {
     1.9 +                Warner retWarn = new Warner();
    1.10 +                if (!resultInfo.checkContext.compatible(qtype1, qtype1.hasTag(UNDETVAR) ? types.boxedTypeOrType(to) : to, retWarn) ||
    1.11 +                        //unchecked conversion is not allowed
    1.12 +                        retWarn.hasLint(Lint.LintCategory.UNCHECKED)) {
    1.13                      throw inferenceException
    1.14                              .setMessage("infer.no.conforming.instance.exists",
    1.15                              inferenceContext.restvars(), mt.getReturnType(), to);

mercurial