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

changeset 2157
963c57175e40
parent 2149
e5d3cd43c85e
child 2167
d2fa3f7e964e
     1.1 --- a/src/share/classes/com/sun/tools/javac/comp/Attr.java	Tue Oct 22 10:08:49 2013 +0200
     1.2 +++ b/src/share/classes/com/sun/tools/javac/comp/Attr.java	Tue Oct 22 13:54:49 2013 +0100
     1.3 @@ -250,6 +250,14 @@
     1.4          Type owntype = found;
     1.5          if (!owntype.hasTag(ERROR) && !resultInfo.pt.hasTag(METHOD) && !resultInfo.pt.hasTag(FORALL)) {
     1.6              if (allowPoly && inferenceContext.free(found)) {
     1.7 +                if ((ownkind & ~resultInfo.pkind) == 0) {
     1.8 +                    owntype = resultInfo.check(tree, inferenceContext.asFree(owntype));
     1.9 +                } else {
    1.10 +                    log.error(tree.pos(), "unexpected.type",
    1.11 +                            kindNames(resultInfo.pkind),
    1.12 +                            kindName(ownkind));
    1.13 +                    owntype = types.createErrorType(owntype);
    1.14 +                }
    1.15                  inferenceContext.addFreeTypeListener(List.of(found, resultInfo.pt), new FreeTypeListener() {
    1.16                      @Override
    1.17                      public void typesInferred(InferenceContext inferenceContext) {
    1.18 @@ -511,6 +519,15 @@
    1.19          protected ResultInfo dup(CheckContext newContext) {
    1.20              return new ResultInfo(pkind, pt, newContext);
    1.21          }
    1.22 +
    1.23 +        @Override
    1.24 +        public String toString() {
    1.25 +            if (pt != null) {
    1.26 +                return pt.toString();
    1.27 +            } else {
    1.28 +                return "";
    1.29 +            }
    1.30 +        }
    1.31      }
    1.32  
    1.33      class RecoveryInfo extends ResultInfo {

mercurial