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

changeset 2188
f3ca12d680f3
parent 2136
7f6481e5fe3a
child 2525
2eb010b6cb22
     1.1 --- a/src/share/classes/com/sun/tools/javac/comp/Annotate.java	Mon Nov 11 09:47:46 2013 -0500
     1.2 +++ b/src/share/classes/com/sun/tools/javac/comp/Annotate.java	Mon Nov 11 17:26:09 2013 +0100
     1.3 @@ -255,6 +255,9 @@
     1.4                    : attr.attribType(a.annotationType, env));
     1.5          a.type = chk.checkType(a.annotationType.pos(), at, expected);
     1.6          if (a.type.isErroneous()) {
     1.7 +            // Need to make sure nested (anno)trees does not have null as .type
     1.8 +            attr.postAttr(a);
     1.9 +
    1.10              if (typeAnnotation) {
    1.11                  return new Attribute.TypeCompound(a.type, List.<Pair<MethodSymbol,Attribute>>nil(),
    1.12                          new TypeAnnotationPosition());
    1.13 @@ -265,6 +268,10 @@
    1.14          if ((a.type.tsym.flags() & Flags.ANNOTATION) == 0) {
    1.15              log.error(a.annotationType.pos(),
    1.16                        "not.annotation.type", a.type.toString());
    1.17 +
    1.18 +            // Need to make sure nested (anno)trees does not have null as .type
    1.19 +            attr.postAttr(a);
    1.20 +
    1.21              if (typeAnnotation) {
    1.22                  return new Attribute.TypeCompound(a.type, List.<Pair<MethodSymbol,Attribute>>nil(), null);
    1.23              } else {
    1.24 @@ -278,7 +285,7 @@
    1.25                  Assign(make.Ident(names.value), args.head);
    1.26          }
    1.27          ListBuffer<Pair<MethodSymbol,Attribute>> buf =
    1.28 -            new ListBuffer<Pair<MethodSymbol,Attribute>>();
    1.29 +            new ListBuffer<>();
    1.30          for (List<JCExpression> tl = args; tl.nonEmpty(); tl = tl.tail) {
    1.31              JCExpression t = tl.head;
    1.32              if (!t.hasTag(ASSIGN)) {
    1.33 @@ -304,8 +311,7 @@
    1.34              Type result = method.type.getReturnType();
    1.35              Attribute value = enterAttributeValue(result, assign.rhs, env);
    1.36              if (!method.type.isErroneous())
    1.37 -                buf.append(new Pair<MethodSymbol,Attribute>
    1.38 -                           ((MethodSymbol)method, value));
    1.39 +                buf.append(new Pair<>((MethodSymbol)method, value));
    1.40              t.type = result;
    1.41          }
    1.42          if (typeAnnotation) {

mercurial