319 if (to.hasTag(NONE) || resultInfo.checkContext.inferenceContext().free(resultInfo.pt)) { |
319 if (to.hasTag(NONE) || resultInfo.checkContext.inferenceContext().free(resultInfo.pt)) { |
320 to = mt.getReturnType().isPrimitiveOrVoid() ? |
320 to = mt.getReturnType().isPrimitiveOrVoid() ? |
321 mt.getReturnType() : syms.objectType; |
321 mt.getReturnType() : syms.objectType; |
322 } |
322 } |
323 Type qtype1 = inferenceContext.asFree(mt.getReturnType(), types); |
323 Type qtype1 = inferenceContext.asFree(mt.getReturnType(), types); |
324 if (!types.isSubtype(qtype1, |
324 Warner retWarn = new Warner(); |
325 qtype1.hasTag(UNDETVAR) ? types.boxedTypeOrType(to) : to)) { |
325 if (!resultInfo.checkContext.compatible(qtype1, qtype1.hasTag(UNDETVAR) ? types.boxedTypeOrType(to) : to, retWarn) || |
|
326 //unchecked conversion is not allowed |
|
327 retWarn.hasLint(Lint.LintCategory.UNCHECKED)) { |
326 throw inferenceException |
328 throw inferenceException |
327 .setMessage("infer.no.conforming.instance.exists", |
329 .setMessage("infer.no.conforming.instance.exists", |
328 inferenceContext.restvars(), mt.getReturnType(), to); |
330 inferenceContext.restvars(), mt.getReturnType(), to); |
329 } |
331 } |
330 } |
332 } |