6797463: 6557199 breaks the jax-ws workspace

Sat, 24 Jan 2009 11:07:32 -0800

author
tbell
date
Sat, 24 Jan 2009 11:07:32 -0800
changeset 202
3b2c55b7bd01
parent 201
e3930187199c
child 203
40fd14d94c3c

6797463: 6557199 breaks the jax-ws workspace
Reviewed-by: jjg

src/share/classes/com/sun/tools/javac/code/Types.java file | annotate | diff | comparison | revisions
src/share/classes/com/sun/tools/javac/comp/Check.java file | annotate | diff | comparison | revisions
     1.1 --- a/src/share/classes/com/sun/tools/javac/code/Types.java	Fri Jan 23 11:23:10 2009 -0800
     1.2 +++ b/src/share/classes/com/sun/tools/javac/code/Types.java	Sat Jan 24 11:07:32 2009 -0800
     1.3 @@ -2933,16 +2933,32 @@
     1.4       * Language Specification, Third Ed. (8.4.5)</a>
     1.5       */
     1.6      public boolean returnTypeSubstitutable(Type r1, Type r2) {
     1.7 -        return returnTypeSubstitutable(r1, r2, Warner.noWarnings);
     1.8 -    }
     1.9 -    //where
    1.10 -    public boolean returnTypeSubstitutable(Type r1, Type r2, Warner warner) {
    1.11          if (hasSameArgs(r1, r2))
    1.12 -            return resultSubtype(r1, r2, warner);
    1.13 +            return resultSubtype(r1, r2, Warner.noWarnings);
    1.14          else
    1.15              return covariantReturnType(r1.getReturnType(),
    1.16 -                                       r2.getReturnType(),
    1.17 -                                       warner);
    1.18 +                                       erasure(r2.getReturnType()),
    1.19 +                                       Warner.noWarnings);
    1.20 +    }
    1.21 +
    1.22 +    public boolean returnTypeSubstitutable(Type r1,
    1.23 +                                           Type r2, Type r2res,
    1.24 +                                           Warner warner) {
    1.25 +        if (isSameType(r1.getReturnType(), r2res))
    1.26 +            return true;
    1.27 +        if (r1.getReturnType().isPrimitive() || r2res.isPrimitive())
    1.28 +            return false;
    1.29 +
    1.30 +        if (hasSameArgs(r1, r2))
    1.31 +            return covariantReturnType(r1.getReturnType(), r2res, warner);
    1.32 +        if (!source.allowCovariantReturns())
    1.33 +            return false;
    1.34 +        if (isSubtypeUnchecked(r1.getReturnType(), r2res, warner))
    1.35 +            return true;
    1.36 +        if (!isSubtype(r1.getReturnType(), erasure(r2res)))
    1.37 +            return false;
    1.38 +        warner.warnUnchecked();
    1.39 +        return true;
    1.40      }
    1.41  
    1.42      /**
    1.43 @@ -2950,24 +2966,12 @@
    1.44       * method that returns s?
    1.45       */
    1.46      public boolean covariantReturnType(Type t, Type s, Warner warner) {
    1.47 -        //are return types identical?
    1.48 -        if (isSameType(t, s))
    1.49 -            return true;
    1.50 -        //if t and s are both reference types...
    1.51 -        else if(source.allowCovariantReturns() &&
    1.52 +        return
    1.53 +            isSameType(t, s) ||
    1.54 +            source.allowCovariantReturns() &&
    1.55              !t.isPrimitive() &&
    1.56 -            !s.isPrimitive()) {
    1.57 -            //check that t is some unchecked subtype of s
    1.58 -            if (isSubtypeUnchecked(t, s, warner))
    1.59 -                return true;
    1.60 -            //otherwise check that t = |s|
    1.61 -            else if (isSameType(t, erasure(s))) {
    1.62 -                warner.warnUnchecked();
    1.63 -                return true;
    1.64 -            }
    1.65 -        }
    1.66 -        //otherwise t is not return type substitutable for s
    1.67 -        return false;
    1.68 +            !s.isPrimitive() &&
    1.69 +            isAssignable(t, s, warner);
    1.70      }
    1.71      // </editor-fold>
    1.72  
     2.1 --- a/src/share/classes/com/sun/tools/javac/comp/Check.java	Fri Jan 23 11:23:10 2009 -0800
     2.2 +++ b/src/share/classes/com/sun/tools/javac/comp/Check.java	Sat Jan 24 11:07:32 2009 -0800
     2.3 @@ -1163,7 +1163,7 @@
     2.4  
     2.5          overrideWarner.warned = false;
     2.6          boolean resultTypesOK =
     2.7 -            types.covariantReturnType(mtres, otres, overrideWarner);
     2.8 +            types.returnTypeSubstitutable(mt, ot, otres, overrideWarner);
     2.9          if (!resultTypesOK) {
    2.10              if (!source.allowCovariantReturns() &&
    2.11                  m.owner != origin &&

mercurial