src/share/classes/com/sun/tools/javac/comp/Check.java
Print this page
*** 391,400 ****
--- 391,404 ----
* @param pos Position to be used for error reporting.
* @param found The type that was found.
* @param req The type that was required.
*/
Type checkType(DiagnosticPosition pos, Type found, Type req) {
+ return checkType(pos, found, req, "incompatible.types");
+ }
+
+ Type checkType(DiagnosticPosition pos, Type found, Type req, String errKey) {
if (req.tag == ERROR)
return req;
if (found.tag == FORALL)
return instantiatePoly(pos, (ForAll)found, req, convertWarner(pos, found, req));
if (req.tag == NONE)
*** 409,419 ****
}
if (req.isExtendsBound()) {
log.error(pos, "assignment.to.extends-bound", req);
return types.createErrorType(found);
}
! return typeError(pos, diags.fragment("incompatible.types"), found, req);
}
/** Instantiate polymorphic type to some prototype, unless
* prototype is `anyPoly' in which case polymorphic type
* is returned unchanged.
--- 413,423 ----
}
if (req.isExtendsBound()) {
log.error(pos, "assignment.to.extends-bound", req);
return types.createErrorType(found);
}
! return typeError(pos, diags.fragment(errKey), found, req);
}
/** Instantiate polymorphic type to some prototype, unless
* prototype is `anyPoly' in which case polymorphic type
* is returned unchanged.