Issue #270308 - NullPointerException at com.sun.tools.javac.comp.Annotate.getAnnotationArrayValue - fixed.
authorDusan Balek <dbalek@netbeans.org>
Fri, 01 Sep 2017 15:28:56 +0200
changeset 5961740e1ee04027
parent 5960 9b58471932b6
child 5962 0911c6d1f671
Issue #270308 - NullPointerException at com.sun.tools.javac.comp.Annotate.getAnnotationArrayValue - fixed.
src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Annotate.java
     1.1 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Annotate.java	Fri Aug 25 16:36:44 2017 +0200
     1.2 +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Annotate.java	Fri Sep 01 15:28:56 2017 +0200
     1.3 @@ -648,10 +648,12 @@
     1.4              log.error(na.elemtype.pos(), "new.not.allowed.in.annotation");
     1.5          }
     1.6          ListBuffer<Attribute> buf = new ListBuffer<>();
     1.7 -        for (List<JCExpression> l = na.elems; l.nonEmpty(); l=l.tail) {
     1.8 -            buf.append(attributeAnnotationValue(types.elemtype(expectedElementType),
     1.9 -                    l.head,
    1.10 -                    env));
    1.11 +        if (na.elems != null) {
    1.12 +            for (List<JCExpression> l = na.elems; l.nonEmpty(); l=l.tail) {
    1.13 +                buf.append(attributeAnnotationValue(types.elemtype(expectedElementType),
    1.14 +                        l.head,
    1.15 +                        env));
    1.16 +            }
    1.17          }
    1.18          na.type = expectedElementType;
    1.19          return new Attribute.