6797463: 6557199 breaks the jax-ws workspace

Reviewed-by: jjg
This commit is contained in:
Tim Bell 2009-01-24 11:07:32 -08:00
parent cf1252d823
commit e6ce4c2488
2 changed files with 29 additions and 25 deletions

View File

@ -2933,16 +2933,32 @@ public class Types {
* Language Specification, Third Ed. (8.4.5)</a>
*/
public boolean returnTypeSubstitutable(Type r1, Type r2) {
return returnTypeSubstitutable(r1, r2, Warner.noWarnings);
}
//where
public boolean returnTypeSubstitutable(Type r1, Type r2, Warner warner) {
if (hasSameArgs(r1, r2))
return resultSubtype(r1, r2, warner);
return resultSubtype(r1, r2, Warner.noWarnings);
else
return covariantReturnType(r1.getReturnType(),
r2.getReturnType(),
warner);
erasure(r2.getReturnType()),
Warner.noWarnings);
}
public boolean returnTypeSubstitutable(Type r1,
Type r2, Type r2res,
Warner warner) {
if (isSameType(r1.getReturnType(), r2res))
return true;
if (r1.getReturnType().isPrimitive() || r2res.isPrimitive())
return false;
if (hasSameArgs(r1, r2))
return covariantReturnType(r1.getReturnType(), r2res, warner);
if (!source.allowCovariantReturns())
return false;
if (isSubtypeUnchecked(r1.getReturnType(), r2res, warner))
return true;
if (!isSubtype(r1.getReturnType(), erasure(r2res)))
return false;
warner.warnUnchecked();
return true;
}
/**
@ -2950,24 +2966,12 @@ public class Types {
* method that returns s?
*/
public boolean covariantReturnType(Type t, Type s, Warner warner) {
//are return types identical?
if (isSameType(t, s))
return true;
//if t and s are both reference types...
else if(source.allowCovariantReturns() &&
return
isSameType(t, s) ||
source.allowCovariantReturns() &&
!t.isPrimitive() &&
!s.isPrimitive()) {
//check that t is some unchecked subtype of s
if (isSubtypeUnchecked(t, s, warner))
return true;
//otherwise check that t = |s|
else if (isSameType(t, erasure(s))) {
warner.warnUnchecked();
return true;
}
}
//otherwise t is not return type substitutable for s
return false;
!s.isPrimitive() &&
isAssignable(t, s, warner);
}
// </editor-fold>

View File

@ -1163,7 +1163,7 @@ public class Check {
overrideWarner.warned = false;
boolean resultTypesOK =
types.covariantReturnType(mtres, otres, overrideWarner);
types.returnTypeSubstitutable(mt, ot, otres, overrideWarner);
if (!resultTypesOK) {
if (!source.allowCovariantReturns() &&
m.owner != origin &&