Merge jdk8-b77

Mon, 11 Feb 2013 16:15:09 -0800

author
lana
date
Mon, 11 Feb 2013 16:15:09 -0800
changeset 1547
89c664151689
parent 1527
6fde20398015
parent 1546
2480aec9a3f1
child 1548
bc24411bcc37
child 1566
3f9875aa5d67

Merge

     1.1 --- a/make/Makefile-classic	Thu Feb 07 12:33:21 2013 -0800
     1.2 +++ b/make/Makefile-classic	Mon Feb 11 16:15:09 2013 -0800
     1.3 @@ -241,6 +241,7 @@
     1.4  	javax/annotation/processing \
     1.5  	javax/lang/model \
     1.6  	javax/tools \
     1.7 +        jdk/ \
     1.8  	com/sun/source \
     1.9  	com/sun/tools/javac 
    1.10  
     2.1 --- a/make/build.properties	Thu Feb 07 12:33:21 2013 -0800
     2.2 +++ b/make/build.properties	Mon Feb 11 16:15:09 2013 -0800
     2.3 @@ -116,6 +116,7 @@
     2.4          javax/annotation/processing/ \
     2.5          javax/lang/model/ \
     2.6          javax/tools/ \
     2.7 +        jdk/ \
     2.8          com/sun/source/ \
     2.9          com/sun/tools/javac/ \
    2.10          com/sun/tools/doclint/
     3.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/PackageIndexWriter.java	Thu Feb 07 12:33:21 2013 -0800
     3.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/PackageIndexWriter.java	Mon Feb 11 16:15:09 2013 -0800
     3.3 @@ -1,5 +1,5 @@
     3.4  /*
     3.5 - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
     3.6 + * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
     3.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3.8   *
     3.9   * This code is free software; you can redistribute it and/or modify it
    3.10 @@ -196,10 +196,7 @@
    3.11      protected void addOverviewComment(Content htmltree) {
    3.12          if (root.inlineTags().length > 0) {
    3.13              htmltree.addContent(getMarkerAnchor("overview_description"));
    3.14 -            HtmlTree div = new HtmlTree(HtmlTag.DIV);
    3.15 -            div.addStyle(HtmlStyle.subTitle);
    3.16 -            addInlineComment(root, div);
    3.17 -            htmltree.addContent(div);
    3.18 +            addInlineComment(root, htmltree);
    3.19          }
    3.20      }
    3.21  
    3.22 @@ -211,7 +208,7 @@
    3.23       */
    3.24      protected void addOverview(Content body) throws IOException {
    3.25          HtmlTree div = new HtmlTree(HtmlTag.DIV);
    3.26 -        div.addStyle(HtmlStyle.footer);
    3.27 +        div.addStyle(HtmlStyle.contentContainer);
    3.28          addOverviewComment(div);
    3.29          addTagsInfo(root, div);
    3.30          body.addContent(div);
     4.1 --- a/src/share/classes/com/sun/tools/javac/code/Symbol.java	Thu Feb 07 12:33:21 2013 -0800
     4.2 +++ b/src/share/classes/com/sun/tools/javac/code/Symbol.java	Mon Feb 11 16:15:09 2013 -0800
     4.3 @@ -496,9 +496,9 @@
     4.4          return l.toList();
     4.5      }
     4.6  
     4.7 -    public static class DelegatedSymbol extends Symbol {
     4.8 -        protected Symbol other;
     4.9 -        public DelegatedSymbol(Symbol other) {
    4.10 +    public static class DelegatedSymbol<T extends Symbol> extends Symbol {
    4.11 +        protected T other;
    4.12 +        public DelegatedSymbol(T other) {
    4.13              super(other.kind, other.flags_field, other.name, other.type, other.owner);
    4.14              this.other = other;
    4.15          }
    4.16 @@ -532,6 +532,10 @@
    4.17          public <R, P> R accept(Symbol.Visitor<R, P> v, P p) {
    4.18              return v.visitSymbol(other, p);
    4.19          }
    4.20 +
    4.21 +        public T getUnderlyingSymbol() {
    4.22 +            return other;
    4.23 +        }
    4.24      }
    4.25  
    4.26      /** A class for type symbols. Type variables are represented by instances
     5.1 --- a/src/share/classes/com/sun/tools/javac/comp/Lower.java	Thu Feb 07 12:33:21 2013 -0800
     5.2 +++ b/src/share/classes/com/sun/tools/javac/comp/Lower.java	Mon Feb 11 16:15:09 2013 -0800
     5.3 @@ -570,10 +570,19 @@
     5.4       *  @param flags    The class symbol's flags
     5.5       *  @param owner    The class symbol's owner
     5.6       */
     5.7 -    ClassSymbol makeEmptyClass(long flags, ClassSymbol owner) {
     5.8 +    JCClassDecl makeEmptyClass(long flags, ClassSymbol owner) {
     5.9 +        return makeEmptyClass(flags, owner, null, true);
    5.10 +    }
    5.11 +
    5.12 +    JCClassDecl makeEmptyClass(long flags, ClassSymbol owner, Name flatname,
    5.13 +            boolean addToDefs) {
    5.14          // Create class symbol.
    5.15          ClassSymbol c = reader.defineClass(names.empty, owner);
    5.16 -        c.flatname = chk.localClassName(c);
    5.17 +        if (flatname != null) {
    5.18 +            c.flatname = flatname;
    5.19 +        } else {
    5.20 +            c.flatname = chk.localClassName(c);
    5.21 +        }
    5.22          c.sourcefile = owner.sourcefile;
    5.23          c.completer = null;
    5.24          c.members_field = new Scope(c);
    5.25 @@ -597,9 +606,8 @@
    5.26          cdef.type = c.type;
    5.27  
    5.28          // Append class definition tree to owner's definitions.
    5.29 -        odef.defs = odef.defs.prepend(cdef);
    5.30 -
    5.31 -        return c;
    5.32 +        if (addToDefs) odef.defs = odef.defs.prepend(cdef);
    5.33 +        return cdef;
    5.34      }
    5.35  
    5.36  /**************************************************************************
    5.37 @@ -706,7 +714,7 @@
    5.38       * and synthethise a class (with makeEmptyClass) if one is not available.
    5.39       * However, there is a small possibility that an existing class will not
    5.40       * be generated as expected if it is inside a conditional with a constant
    5.41 -     * expression. If that is found to be the case, create an empty class here.
    5.42 +     * expression. If that is found to be the case, create an empty class tree here.
    5.43       */
    5.44      private void checkAccessConstructorTags() {
    5.45          for (List<ClassSymbol> l = accessConstrTags; l.nonEmpty(); l = l.tail) {
    5.46 @@ -714,14 +722,10 @@
    5.47              if (isTranslatedClassAvailable(c))
    5.48                  continue;
    5.49              // Create class definition tree.
    5.50 -            JCClassDecl cdef = make.ClassDef(
    5.51 -                make.Modifiers(STATIC | SYNTHETIC), names.empty,
    5.52 -                List.<JCTypeParameter>nil(),
    5.53 -                null, List.<JCExpression>nil(), List.<JCTree>nil());
    5.54 -            cdef.sym = c;
    5.55 -            cdef.type = c.type;
    5.56 -            // add it to the list of classes to be generated
    5.57 -            translated.append(cdef);
    5.58 +            JCClassDecl cdec = makeEmptyClass(STATIC | SYNTHETIC,
    5.59 +                    c.outermostClass(), c.flatname, false);
    5.60 +            swapAccessConstructorTag(c, cdec.sym);
    5.61 +            translated.append(cdec);
    5.62          }
    5.63      }
    5.64      // where
    5.65 @@ -735,6 +739,19 @@
    5.66          return false;
    5.67      }
    5.68  
    5.69 +    void swapAccessConstructorTag(ClassSymbol oldCTag, ClassSymbol newCTag) {
    5.70 +        for (MethodSymbol methodSymbol : accessConstrs.values()) {
    5.71 +            Assert.check(methodSymbol.type.hasTag(METHOD));
    5.72 +            MethodType oldMethodType =
    5.73 +                    (MethodType)methodSymbol.type;
    5.74 +            if (oldMethodType.argtypes.head.tsym == oldCTag)
    5.75 +                methodSymbol.type =
    5.76 +                    types.createMethodTypeWithParameters(oldMethodType,
    5.77 +                        oldMethodType.getParameterTypes().tail
    5.78 +                            .prepend(newCTag.erasure(types)));
    5.79 +        }
    5.80 +    }
    5.81 +
    5.82  /**************************************************************************
    5.83   * Access methods
    5.84   *************************************************************************/
    5.85 @@ -1211,7 +1228,7 @@
    5.86                                           "1");
    5.87          ClassSymbol ctag = chk.compiled.get(flatname);
    5.88          if (ctag == null)
    5.89 -            ctag = makeEmptyClass(STATIC | SYNTHETIC, topClass);
    5.90 +            ctag = makeEmptyClass(STATIC | SYNTHETIC, topClass).sym;
    5.91          // keep a record of all tags, to verify that all are generated as required
    5.92          accessConstrTags = accessConstrTags.prepend(ctag);
    5.93          return ctag;
    5.94 @@ -1778,7 +1795,7 @@
    5.95              if (e.sym.kind == TYP &&
    5.96                  e.sym.name == names.empty &&
    5.97                  (e.sym.flags() & INTERFACE) == 0) return (ClassSymbol) e.sym;
    5.98 -        return makeEmptyClass(STATIC | SYNTHETIC, clazz);
    5.99 +        return makeEmptyClass(STATIC | SYNTHETIC, clazz).sym;
   5.100      }
   5.101  
   5.102      /** Return symbol for "class$" method. If there is no method definition
     6.1 --- a/src/share/classes/com/sun/tools/javac/jvm/ClassWriter.java	Thu Feb 07 12:33:21 2013 -0800
     6.2 +++ b/src/share/classes/com/sun/tools/javac/jvm/ClassWriter.java	Mon Feb 11 16:15:09 2013 -0800
     6.3 @@ -482,10 +482,8 @@
     6.4          while (i < pool.pp) {
     6.5              Object value = pool.pool[i];
     6.6              Assert.checkNonNull(value);
     6.7 -            if (value instanceof Method)
     6.8 -                value = ((Method)value).m;
     6.9 -            else if (value instanceof Variable)
    6.10 -                value = ((Variable)value).v;
    6.11 +            if (value instanceof Method || value instanceof Variable)
    6.12 +                value = ((DelegatedSymbol)value).getUnderlyingSymbol();
    6.13  
    6.14              if (value instanceof MethodSymbol) {
    6.15                  MethodSymbol m = (MethodSymbol)value;
     7.1 --- a/src/share/classes/com/sun/tools/javac/jvm/Pool.java	Thu Feb 07 12:33:21 2013 -0800
     7.2 +++ b/src/share/classes/com/sun/tools/javac/jvm/Pool.java	Mon Feb 11 16:15:09 2013 -0800
     7.3 @@ -1,5 +1,5 @@
     7.4  /*
     7.5 - * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
     7.6 + * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
     7.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     7.8   *
     7.9   * This code is free software; you can redistribute it and/or modify it
    7.10 @@ -140,23 +140,23 @@
    7.11          return n == null ? -1 : n.intValue();
    7.12      }
    7.13  
    7.14 -    static class Method extends DelegatedSymbol {
    7.15 -        MethodSymbol m;
    7.16 +    static class Method extends DelegatedSymbol<MethodSymbol> {
    7.17          UniqueType uniqueType;
    7.18          Method(MethodSymbol m, Types types) {
    7.19              super(m);
    7.20 -            this.m = m;
    7.21              this.uniqueType = new UniqueType(m.type, types);
    7.22          }
    7.23 -        public boolean equals(Object other) {
    7.24 -            if (!(other instanceof Method)) return false;
    7.25 -            MethodSymbol o = ((Method)other).m;
    7.26 +        public boolean equals(Object any) {
    7.27 +            if (!(any instanceof Method)) return false;
    7.28 +            MethodSymbol o = ((Method)any).other;
    7.29 +            MethodSymbol m = this.other;
    7.30              return
    7.31                  o.name == m.name &&
    7.32                  o.owner == m.owner &&
    7.33 -                ((Method)other).uniqueType.equals(uniqueType);
    7.34 +                ((Method)any).uniqueType.equals(uniqueType);
    7.35          }
    7.36          public int hashCode() {
    7.37 +            MethodSymbol m = this.other;
    7.38              return
    7.39                  m.name.hashCode() * 33 +
    7.40                  m.owner.hashCode() * 9 +
    7.41 @@ -173,21 +173,21 @@
    7.42          }
    7.43  
    7.44          @Override
    7.45 -        public boolean equals(Object other) {
    7.46 -            if (!super.equals(other)) return false;
    7.47 -            if (!(other instanceof DynamicMethod)) return false;
    7.48 -            DynamicMethodSymbol dm1 = (DynamicMethodSymbol)m;
    7.49 -            DynamicMethodSymbol dm2 = (DynamicMethodSymbol)((DynamicMethod)other).m;
    7.50 +        public boolean equals(Object any) {
    7.51 +            if (!super.equals(any)) return false;
    7.52 +            if (!(any instanceof DynamicMethod)) return false;
    7.53 +            DynamicMethodSymbol dm1 = (DynamicMethodSymbol)other;
    7.54 +            DynamicMethodSymbol dm2 = (DynamicMethodSymbol)((DynamicMethod)any).other;
    7.55              return dm1.bsm == dm2.bsm &&
    7.56                          dm1.bsmKind == dm2.bsmKind &&
    7.57                          Arrays.equals(uniqueStaticArgs,
    7.58 -                            ((DynamicMethod)other).uniqueStaticArgs);
    7.59 +                            ((DynamicMethod)any).uniqueStaticArgs);
    7.60          }
    7.61  
    7.62          @Override
    7.63          public int hashCode() {
    7.64              int hash = super.hashCode();
    7.65 -            DynamicMethodSymbol dm = (DynamicMethodSymbol)m;
    7.66 +            DynamicMethodSymbol dm = (DynamicMethodSymbol)other;
    7.67              hash += dm.bsmKind * 7 +
    7.68                      dm.bsm.hashCode() * 11;
    7.69              for (int i = 0; i < dm.staticArgs.length; i++) {
    7.70 @@ -209,23 +209,23 @@
    7.71          }
    7.72      }
    7.73  
    7.74 -    static class Variable extends DelegatedSymbol {
    7.75 -        VarSymbol v;
    7.76 +    static class Variable extends DelegatedSymbol<VarSymbol> {
    7.77          UniqueType uniqueType;
    7.78          Variable(VarSymbol v, Types types) {
    7.79              super(v);
    7.80 -            this.v = v;
    7.81              this.uniqueType = new UniqueType(v.type, types);
    7.82          }
    7.83 -        public boolean equals(Object other) {
    7.84 -            if (!(other instanceof Variable)) return false;
    7.85 -            VarSymbol o = ((Variable)other).v;
    7.86 +        public boolean equals(Object any) {
    7.87 +            if (!(any instanceof Variable)) return false;
    7.88 +            VarSymbol o = ((Variable)any).other;
    7.89 +            VarSymbol v = other;
    7.90              return
    7.91                  o.name == v.name &&
    7.92                  o.owner == v.owner &&
    7.93 -                ((Variable)other).uniqueType.equals(uniqueType);
    7.94 +                ((Variable)any).uniqueType.equals(uniqueType);
    7.95          }
    7.96          public int hashCode() {
    7.97 +            VarSymbol v = other;
    7.98              return
    7.99                  v.name.hashCode() * 33 +
   7.100                  v.owner.hashCode() * 9 +
     8.1 --- a/src/share/classes/com/sun/tools/javac/main/JavaCompiler.java	Thu Feb 07 12:33:21 2013 -0800
     8.2 +++ b/src/share/classes/com/sun/tools/javac/main/JavaCompiler.java	Mon Feb 11 16:15:09 2013 -0800
     8.3 @@ -629,6 +629,8 @@
     8.4              if (!taskListener.isEmpty()) {
     8.5                  TaskEvent e = new TaskEvent(TaskEvent.Kind.PARSE, filename);
     8.6                  taskListener.started(e);
     8.7 +                keepComments = true;
     8.8 +                genEndPos = true;
     8.9              }
    8.10              Parser parser = parserFactory.newParser(content, keepComments(), genEndPos, lineDebugInfo);
    8.11              tree = parser.parseCompilationUnit();
     9.1 --- a/src/share/classes/com/sun/tools/javac/parser/DocCommentParser.java	Thu Feb 07 12:33:21 2013 -0800
     9.2 +++ b/src/share/classes/com/sun/tools/javac/parser/DocCommentParser.java	Mon Feb 11 16:15:09 2013 -0800
     9.3 @@ -1,5 +1,5 @@
     9.4  /*
     9.5 - * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
     9.6 + * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
     9.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     9.8   *
     9.9   * This code is free software; you can redistribute it and/or modify it
    9.10 @@ -279,13 +279,7 @@
    9.11          try {
    9.12              nextChar();
    9.13              if (isIdentifierStart(ch)) {
    9.14 -                int namePos = bp;
    9.15 -                nextChar();
    9.16 -                while (isIdentifierPart(ch))
    9.17 -                    nextChar();
    9.18 -                int nameLen = bp - namePos;
    9.19 -
    9.20 -                Name name = names.fromChars(buf, namePos, nameLen);
    9.21 +                Name name = readIdentifier();
    9.22                  TagParser tp = tagParsers.get(name);
    9.23                  if (tp == null) {
    9.24                      List<DCTree> content = blockContent();
    9.25 @@ -334,14 +328,9 @@
    9.26          try {
    9.27              nextChar();
    9.28              if (isIdentifierStart(ch)) {
    9.29 -                int namePos = bp;
    9.30 -                nextChar();
    9.31 -                while (isIdentifierPart(ch))
    9.32 -                    nextChar();
    9.33 -                int nameLen = bp - namePos;
    9.34 +                Name name = readIdentifier();
    9.35                  skipWhitespace();
    9.36  
    9.37 -                Name name = names.fromChars(buf, namePos, nameLen);
    9.38                  TagParser tp = tagParsers.get(name);
    9.39                  if (tp == null) {
    9.40                      DCTree text = inlineText();
    9.41 @@ -575,10 +564,8 @@
    9.42          int pos = bp;
    9.43  
    9.44          if (isJavaIdentifierStart(ch)) {
    9.45 -            nextChar();
    9.46 -            while (isJavaIdentifierPart(ch))
    9.47 -                nextChar();
    9.48 -            return m.at(pos).Identifier(names.fromChars(buf, pos, bp - pos));
    9.49 +            Name name = readJavaIdentifier();
    9.50 +            return m.at(pos).Identifier(name);
    9.51          }
    9.52  
    9.53          throw new ParseException("dc.identifier.expected");
    9.54 @@ -703,39 +690,36 @@
    9.55      protected DCTree entity() {
    9.56          int p = bp;
    9.57          nextChar();
    9.58 -        int namep = bp;
    9.59 +        Name name = null;
    9.60          boolean checkSemi = false;
    9.61          if (ch == '#') {
    9.62 +            int namep = bp;
    9.63              nextChar();
    9.64              if (isDecimalDigit(ch)) {
    9.65                  nextChar();
    9.66                  while (isDecimalDigit(ch))
    9.67                      nextChar();
    9.68 -                checkSemi = true;
    9.69 +                name = names.fromChars(buf, namep, bp - namep);
    9.70              } else if (ch == 'x' || ch == 'X') {
    9.71                  nextChar();
    9.72                  if (isHexDigit(ch)) {
    9.73                      nextChar();
    9.74                      while (isHexDigit(ch))
    9.75                          nextChar();
    9.76 -                    checkSemi = true;
    9.77 +                    name = names.fromChars(buf, namep, bp - namep);
    9.78                  }
    9.79              }
    9.80          } else if (isIdentifierStart(ch)) {
    9.81 -            nextChar();
    9.82 -            while (isIdentifierPart(ch))
    9.83 -                nextChar();
    9.84 -            checkSemi = true;
    9.85 +            name = readIdentifier();
    9.86          }
    9.87  
    9.88 -        if (checkSemi && ch == ';') {
    9.89 +        if (name == null)
    9.90 +            return erroneous("dc.bad.entity", p);
    9.91 +        else {
    9.92 +            if (ch != ';')
    9.93 +                return erroneous("dc.missing.semicolon", p);
    9.94              nextChar();
    9.95 -            return m.at(p).Entity(names.fromChars(buf, namep, bp - namep - 1));
    9.96 -        } else {
    9.97 -            String code = checkSemi
    9.98 -                    ? "dc.missing.semicolon"
    9.99 -                    : "dc.bad.entity";
   9.100 -            return erroneous(code, p);
   9.101 +            return m.at(p).Entity(name);
   9.102          }
   9.103      }
   9.104  
   9.105 @@ -747,11 +731,7 @@
   9.106          int p = bp;
   9.107          nextChar();
   9.108          if (isIdentifierStart(ch)) {
   9.109 -            int namePos = bp;
   9.110 -            nextChar();
   9.111 -            while (isIdentifierPart(ch))
   9.112 -                nextChar();
   9.113 -            int nameLen = bp - namePos;
   9.114 +            Name name = readIdentifier();
   9.115              List<DCTree> attrs = htmlAttrs();
   9.116              if (attrs != null) {
   9.117                  boolean selfClosing = false;
   9.118 @@ -761,22 +741,16 @@
   9.119                  }
   9.120                  if (ch == '>') {
   9.121                      nextChar();
   9.122 -                    Name name = names.fromChars(buf, namePos, nameLen);
   9.123                      return m.at(p).StartElement(name, attrs, selfClosing);
   9.124                  }
   9.125              }
   9.126          } else if (ch == '/') {
   9.127              nextChar();
   9.128              if (isIdentifierStart(ch)) {
   9.129 -                int namePos = bp;
   9.130 -                nextChar();
   9.131 -                while (isIdentifierPart(ch))
   9.132 -                    nextChar();
   9.133 -                int nameLen = bp - namePos;
   9.134 +                Name name = readIdentifier();
   9.135                  skipWhitespace();
   9.136                  if (ch == '>') {
   9.137                      nextChar();
   9.138 -                    Name name = names.fromChars(buf, namePos, nameLen);
   9.139                      return m.at(p).EndElement(name);
   9.140                  }
   9.141              }
   9.142 @@ -822,10 +796,7 @@
   9.143          loop:
   9.144          while (isIdentifierStart(ch)) {
   9.145              int namePos = bp;
   9.146 -            nextChar();
   9.147 -            while (isIdentifierPart(ch))
   9.148 -                nextChar();
   9.149 -            int nameLen = bp - namePos;
   9.150 +            Name name = readIdentifier();
   9.151              skipWhitespace();
   9.152              List<DCTree> value = null;
   9.153              ValueKind vkind = ValueKind.EMPTY;
   9.154 @@ -862,7 +833,6 @@
   9.155                  skipWhitespace();
   9.156                  value = v.toList();
   9.157              }
   9.158 -            Name name = names.fromChars(buf, namePos, nameLen);
   9.159              DCAttribute attr = m.at(namePos).Attribute(name, vkind, value);
   9.160              attrs.add(attr);
   9.161          }
   9.162 @@ -897,7 +867,7 @@
   9.163      protected DCErroneous erroneous(String code, int pos) {
   9.164          int i = bp - 1;
   9.165          loop:
   9.166 -        while (i > 0) {
   9.167 +        while (i > pos) {
   9.168              switch (buf[i]) {
   9.169                  case '\f': case '\n': case '\r':
   9.170                      newline = true;
   9.171 @@ -926,16 +896,24 @@
   9.172          return Character.isUnicodeIdentifierStart(ch);
   9.173      }
   9.174  
   9.175 -    protected boolean isIdentifierPart(char ch) {
   9.176 -        return Character.isUnicodeIdentifierPart(ch);
   9.177 +    protected Name readIdentifier() {
   9.178 +        int start = bp;
   9.179 +        nextChar();
   9.180 +        while (bp < buflen && Character.isUnicodeIdentifierPart(ch))
   9.181 +            nextChar();
   9.182 +        return names.fromChars(buf, start, bp - start);
   9.183      }
   9.184  
   9.185      protected boolean isJavaIdentifierStart(char ch) {
   9.186          return Character.isJavaIdentifierStart(ch);
   9.187      }
   9.188  
   9.189 -    protected boolean isJavaIdentifierPart(char ch) {
   9.190 -        return Character.isJavaIdentifierPart(ch);
   9.191 +    protected Name readJavaIdentifier() {
   9.192 +        int start = bp;
   9.193 +        nextChar();
   9.194 +        while (bp < buflen && Character.isJavaIdentifierPart(ch))
   9.195 +            nextChar();
   9.196 +        return names.fromChars(buf, start, bp - start);
   9.197      }
   9.198  
   9.199      protected boolean isDecimalDigit(char ch) {
    10.1 --- a/src/share/classes/com/sun/tools/javac/parser/JavadocTokenizer.java	Thu Feb 07 12:33:21 2013 -0800
    10.2 +++ b/src/share/classes/com/sun/tools/javac/parser/JavadocTokenizer.java	Mon Feb 11 16:15:09 2013 -0800
    10.3 @@ -1,5 +1,5 @@
    10.4  /*
    10.5 - * Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved.
    10.6 + * Copyright (c) 2004, 2013, Oracle and/or its affiliates. All rights reserved.
    10.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    10.8   *
    10.9   * This code is free software; you can redistribute it and/or modify it
   10.10 @@ -236,7 +236,7 @@
   10.11              // relative to the best match found in the array.
   10.12              if (pos == Position.NOPOS)
   10.13                  return Position.NOPOS;
   10.14 -            if (pos < 0 || pos >= docComment.length())
   10.15 +            if (pos < 0 || pos > docComment.length())
   10.16                  throw new StringIndexOutOfBoundsException(String.valueOf(pos));
   10.17              if (docPosns == null)
   10.18                  return Position.NOPOS;
    11.1 --- a/src/share/classes/com/sun/tools/javac/tree/DCTree.java	Thu Feb 07 12:33:21 2013 -0800
    11.2 +++ b/src/share/classes/com/sun/tools/javac/tree/DCTree.java	Mon Feb 11 16:15:09 2013 -0800
    11.3 @@ -1,5 +1,5 @@
    11.4  /*
    11.5 - * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
    11.6 + * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
    11.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    11.8   *
    11.9   * This code is free software; you can redistribute it and/or modify it
   11.10 @@ -119,7 +119,7 @@
   11.11  
   11.12      }
   11.13  
   11.14 -    public static abstract class DCBlockTag extends DCTree implements InlineTagTree {
   11.15 +    public static abstract class DCBlockTag extends DCTree implements BlockTagTree {
   11.16          public String getTagName() {
   11.17              return getKind().tagName;
   11.18          }
   11.19 @@ -169,7 +169,7 @@
   11.20          }
   11.21      }
   11.22  
   11.23 -    public static class DCAuthor extends DCInlineTag implements AuthorTree {
   11.24 +    public static class DCAuthor extends DCBlockTag implements AuthorTree {
   11.25          public final List<DCTree> name;
   11.26  
   11.27          DCAuthor(List<DCTree> name) {
   11.28 @@ -640,7 +640,7 @@
   11.29          }
   11.30      }
   11.31  
   11.32 -    public static class DCSince extends DCInlineTag implements SinceTree {
   11.33 +    public static class DCSince extends DCBlockTag implements SinceTree {
   11.34          public final List<DCTree> body;
   11.35  
   11.36          DCSince(List<DCTree> body) {
    12.1 --- a/src/share/classes/com/sun/tools/javadoc/api/JavadocTool.java	Thu Feb 07 12:33:21 2013 -0800
    12.2 +++ b/src/share/classes/com/sun/tools/javadoc/api/JavadocTool.java	Mon Feb 11 16:15:09 2013 -0800
    12.3 @@ -1,5 +1,5 @@
    12.4  /*
    12.5 - * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
    12.6 + * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
    12.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    12.8   *
    12.9   * This code is free software; you can redistribute it and/or modify it
   12.10 @@ -139,12 +139,13 @@
   12.11  
   12.12      @Override
   12.13      public int run(InputStream in, OutputStream out, OutputStream err, String... arguments) {
   12.14 -        PrintWriter err_pw = new PrintWriter(err, true);
   12.15 -        PrintWriter out_pw = new PrintWriter(out);
   12.16 +        PrintWriter err_pw = new PrintWriter(err == null ? System.err : err, true);
   12.17 +        PrintWriter out_pw = new PrintWriter(out == null ? System.out : out);
   12.18          try {
   12.19              String standardDocletName = "com.sun.tools.doclets.standard.Standard";
   12.20 +            ClassLoader cl = getClass().getClassLoader();
   12.21              return com.sun.tools.javadoc.Main.execute(
   12.22 -                    "javadoc", err_pw, err_pw, out_pw, standardDocletName, arguments);
   12.23 +                    "javadoc", err_pw, err_pw, out_pw, standardDocletName, cl, arguments);
   12.24          } finally {
   12.25              err_pw.flush();
   12.26              out_pw.flush();
    13.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    13.2 +++ b/src/share/classes/jdk/Supported.java	Mon Feb 11 16:15:09 2013 -0800
    13.3 @@ -0,0 +1,53 @@
    13.4 +/*
    13.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
    13.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    13.7 + *
    13.8 + * This code is free software; you can redistribute it and/or modify it
    13.9 + * under the terms of the GNU General Public License version 2 only, as
   13.10 + * published by the Free Software Foundation.  Oracle designates this
   13.11 + * particular file as subject to the "Classpath" exception as provided
   13.12 + * by Oracle in the LICENSE file that accompanied this code.
   13.13 + *
   13.14 + * This code is distributed in the hope that it will be useful, but WITHOUT
   13.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   13.16 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   13.17 + * version 2 for more details (a copy is included in the LICENSE file that
   13.18 + * accompanied this code).
   13.19 + *
   13.20 + * You should have received a copy of the GNU General Public License version
   13.21 + * 2 along with this work; if not, write to the Free Software Foundation,
   13.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   13.23 + *
   13.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   13.25 + * or visit www.oracle.com if you need additional information or have any
   13.26 + * questions.
   13.27 + */
   13.28 +
   13.29 +package jdk;
   13.30 +
   13.31 +import java.lang.annotation.*;
   13.32 +
   13.33 +/**
   13.34 +  * Indicates whether or not a JDK specific type or package is a
   13.35 +  * supported part of the JDK.
   13.36 +  *
   13.37 +  * This annotation should only be applied to types and packages
   13.38 +  * <em>outside</em> of the Java SE namespaces of {@code java.*} and
   13.39 +  * {@code javax.*} packages.  For example, certain portions of {@code
   13.40 +  * com.sun.*} are official parts of the JDK meant to be generally
   13.41 +  * usable while other portions of {@code com.sun.*} are not.  This
   13.42 +  * annotation type allows those portions to be easily and
   13.43 +  * programmaticly distinguished.
   13.44 +  *
   13.45 +  * @since 1.8
   13.46 +  */
   13.47 +@Documented
   13.48 +@Retention(RetentionPolicy.RUNTIME)
   13.49 +@Target({ElementType.TYPE, ElementType.PACKAGE})
   13.50 +@Supported
   13.51 +public @interface Supported {
   13.52 +    /**
   13.53 +     * Whether or not this package or type is a supported part of the JDK.
   13.54 +     */
   13.55 +    boolean value() default true;
   13.56 +}
    14.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    14.2 +++ b/test/tools/doclint/EndWithIdentifierTest.java	Mon Feb 11 16:15:09 2013 -0800
    14.3 @@ -0,0 +1,32 @@
    14.4 +/*
    14.5 + * @test /nodynamiccopyright/
    14.6 + * @bug 8007096
    14.7 + * @summary DocLint parsing problems with some comments
    14.8 + * @build DocLintTester
    14.9 + * @run main DocLintTester -Xmsgs:-html EndWithIdentifierTest.java
   14.10 + * @run main DocLintTester -Xmsgs -ref EndWithIdentifierTest.out EndWithIdentifierTest.java
   14.11 + * @author jlahoda
   14.12 + */
   14.13 +
   14.14 +/**@deprecated*/
   14.15 +public class EndWithIdentifierTest {
   14.16 +
   14.17 +    /**{@link*/
   14.18 +    private void unfinishedInlineTagName() {}
   14.19 +
   14.20 +    /**@see List*/
   14.21 +    private void endsWithIdentifier() {}
   14.22 +
   14.23 +    /**&amp*/
   14.24 +    private void entityName() {}
   14.25 +
   14.26 +    /**<a*/
   14.27 +    private void tag() {}
   14.28 +
   14.29 +    /**</a*/
   14.30 +    private void tagEnd() {}
   14.31 +
   14.32 +    /**<a name*/
   14.33 +    private void attribute() {}
   14.34 +}
   14.35 +
    15.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    15.2 +++ b/test/tools/doclint/EndWithIdentifierTest.out	Mon Feb 11 16:15:09 2013 -0800
    15.3 @@ -0,0 +1,20 @@
    15.4 +EndWithIdentifierTest.java:14: error: syntax error in reference
    15.5 +    /**{@link*/
    15.6 +       ^
    15.7 +EndWithIdentifierTest.java:17: error: reference not found
    15.8 +    /**@see List*/
    15.9 +            ^
   15.10 +EndWithIdentifierTest.java:20: error: semicolon missing
   15.11 +    /**&amp*/
   15.12 +       ^
   15.13 +EndWithIdentifierTest.java:23: error: malformed HTML
   15.14 +    /**<a*/
   15.15 +       ^
   15.16 +EndWithIdentifierTest.java:26: error: malformed HTML
   15.17 +    /**</a*/
   15.18 +       ^
   15.19 +EndWithIdentifierTest.java:29: error: malformed HTML
   15.20 +    /**<a name*/
   15.21 +       ^
   15.22 +6 errors
   15.23 +
    16.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    16.2 +++ b/test/tools/doclint/UnfinishedInlineTagTest.java	Mon Feb 11 16:15:09 2013 -0800
    16.3 @@ -0,0 +1,17 @@
    16.4 +/*
    16.5 + * @test /nodynamiccopyright/
    16.6 + * @bug 8007096
    16.7 + * @summary DocLint parsing problems with some comments
    16.8 + * @build DocLintTester
    16.9 + * @run main DocLintTester -Xmsgs:-html UnfinishedInlineTagTest.java
   16.10 + * @run main DocLintTester -Xmsgs -ref UnfinishedInlineTagTest.out UnfinishedInlineTagTest.java
   16.11 + * @author jlahoda
   16.12 + */
   16.13 +
   16.14 +import java.util.List;
   16.15 +
   16.16 +/**{@link List
   16.17 + */
   16.18 +public class UnfinishedInlineTagTest {
   16.19 +}
   16.20 +
    17.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    17.2 +++ b/test/tools/doclint/UnfinishedInlineTagTest.out	Mon Feb 11 16:15:09 2013 -0800
    17.3 @@ -0,0 +1,5 @@
    17.4 +UnfinishedInlineTagTest.java:14: error: unterminated inline tag
    17.5 + */
    17.6 +^
    17.7 +1 error
    17.8 +
    18.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    18.2 +++ b/test/tools/javac/7199823/InnerClassCannotBeVerified.java	Mon Feb 11 16:15:09 2013 -0800
    18.3 @@ -0,0 +1,110 @@
    18.4 +/*
    18.5 + * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
    18.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    18.7 + *
    18.8 + * This code is free software; you can redistribute it and/or modify it
    18.9 + * under the terms of the GNU General Public License version 2 only, as
   18.10 + * published by the Free Software Foundation.
   18.11 + *
   18.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   18.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   18.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   18.15 + * version 2 for more details (a copy is included in the LICENSE file that
   18.16 + * accompanied this code).
   18.17 + *
   18.18 + * You should have received a copy of the GNU General Public License version
   18.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   18.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   18.21 + *
   18.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   18.23 + * or visit www.oracle.com if you need additional information or have any
   18.24 + * questions.
   18.25 + */
   18.26 +
   18.27 +/*
   18.28 + * @test
   18.29 + * @bug 7199823
   18.30 + * @summary javac generates inner class that can't be verified
   18.31 + * @run main InnerClassCannotBeVerified
   18.32 + */
   18.33 +
   18.34 +import java.util.Arrays;
   18.35 +import javax.tools.JavaFileObject;
   18.36 +import java.net.URI;
   18.37 +import javax.tools.SimpleJavaFileObject;
   18.38 +import javax.tools.ToolProvider;
   18.39 +import javax.tools.JavaCompiler;
   18.40 +import com.sun.source.util.JavacTask;
   18.41 +import com.sun.tools.classfile.ClassFile;
   18.42 +import com.sun.tools.classfile.ConstantPoolException;
   18.43 +import java.io.File;
   18.44 +import java.io.IOException;
   18.45 +
   18.46 +public class InnerClassCannotBeVerified {
   18.47 +
   18.48 +    private static final String errorMessage =
   18.49 +            "Compile error while compiling the following source:\n";
   18.50 +
   18.51 +    public static void main(String... args) throws Exception {
   18.52 +        new InnerClassCannotBeVerified().run();
   18.53 +    }
   18.54 +
   18.55 +    void run() throws Exception {
   18.56 +        JavaCompiler comp = ToolProvider.getSystemJavaCompiler();
   18.57 +        JavaSource source = new JavaSource();
   18.58 +        JavacTask ct = (JavacTask)comp.getTask(null, null, null,
   18.59 +                null, null, Arrays.asList(source));
   18.60 +        try {
   18.61 +            if (!ct.call()) {
   18.62 +                throw new AssertionError(errorMessage +
   18.63 +                        source.getCharContent(true));
   18.64 +            }
   18.65 +        } catch (Throwable ex) {
   18.66 +            throw new AssertionError(errorMessage +
   18.67 +                    source.getCharContent(true));
   18.68 +        }
   18.69 +        check();
   18.70 +    }
   18.71 +
   18.72 +    private void check() throws IOException, ConstantPoolException {
   18.73 +        File file = new File("Test$1.class");
   18.74 +        ClassFile classFile = ClassFile.read(file);
   18.75 +        boolean inheritsFromObject =
   18.76 +                classFile.getSuperclassName().equals("java/lang/Object");
   18.77 +        boolean implementsNoInterface = classFile.interfaces.length == 0;
   18.78 +        boolean noMethods = classFile.methods.length == 0;
   18.79 +        if (!(inheritsFromObject &&
   18.80 +              implementsNoInterface &&
   18.81 +              noMethods)) {
   18.82 +            throw new AssertionError("The inner classes reused as " +
   18.83 +                    "access constructor tag for this code must be empty");
   18.84 +        }
   18.85 +    }
   18.86 +
   18.87 +    class JavaSource extends SimpleJavaFileObject {
   18.88 +
   18.89 +        String internalSource =
   18.90 +                              "public class Test {\n" +
   18.91 +                              "    private static class Foo {}\n" +
   18.92 +                              "    public static void main(String[] args){ \n" +
   18.93 +                              "        new Foo();\n" +
   18.94 +                              "        if(false) {\n" +
   18.95 +                              "            new Runnable() {\n" +
   18.96 +                              "                @Override\n" +
   18.97 +                              "                public void run() {\n" +
   18.98 +                              "                    System.out.println();\n" +
   18.99 +                              "                }\n" +
  18.100 +                              "            }.run();\n" +
  18.101 +                              "        }\n" +
  18.102 +                              "   }\n" +
  18.103 +                              "}";
  18.104 +        public JavaSource() {
  18.105 +            super(URI.create("Test.java"), JavaFileObject.Kind.SOURCE);
  18.106 +        }
  18.107 +
  18.108 +        @Override
  18.109 +        public CharSequence getCharContent(boolean ignoreEncodingErrors) {
  18.110 +            return internalSource;
  18.111 +        }
  18.112 +    }
  18.113 +}
    19.1 --- a/test/tools/javac/annotations/typeAnnotations/TargetTypes.java	Thu Feb 07 12:33:21 2013 -0800
    19.2 +++ b/test/tools/javac/annotations/typeAnnotations/TargetTypes.java	Mon Feb 11 16:15:09 2013 -0800
    19.3 @@ -1,5 +1,5 @@
    19.4  /*
    19.5 - * Copyright (c) 2009 Oracle and/or its affiliates. All rights reserved.
    19.6 + * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
    19.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    19.8   *
    19.9   * This code is free software; you can redistribute it and/or modify it
    20.1 --- a/test/tools/javac/annotations/typeAnnotations/TypeProcOnly.java	Thu Feb 07 12:33:21 2013 -0800
    20.2 +++ b/test/tools/javac/annotations/typeAnnotations/TypeProcOnly.java	Mon Feb 11 16:15:09 2013 -0800
    20.3 @@ -1,5 +1,5 @@
    20.4  /*
    20.5 - * Copyright (c) 2009 Oracle and/or its affiliates. All rights reserved.
    20.6 + * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
    20.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    20.8   *
    20.9   * This code is free software; you can redistribute it and/or modify it
    21.1 --- a/test/tools/javac/annotations/typeAnnotations/api/AnnotatedArrayOrder.java	Thu Feb 07 12:33:21 2013 -0800
    21.2 +++ b/test/tools/javac/annotations/typeAnnotations/api/AnnotatedArrayOrder.java	Mon Feb 11 16:15:09 2013 -0800
    21.3 @@ -1,5 +1,5 @@
    21.4  /*
    21.5 - * Copyright (c) 2010 Oracle and/or its affiliates. All rights reserved.
    21.6 + * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
    21.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    21.8   *
    21.9   * This code is free software; you can redistribute it and/or modify it
    22.1 --- a/test/tools/javac/annotations/typeAnnotations/api/ArrayCreationTree.java	Thu Feb 07 12:33:21 2013 -0800
    22.2 +++ b/test/tools/javac/annotations/typeAnnotations/api/ArrayCreationTree.java	Mon Feb 11 16:15:09 2013 -0800
    22.3 @@ -1,5 +1,5 @@
    22.4  /*
    22.5 - * Copyright (c) 2010 Oracle and/or its affiliates. All rights reserved.
    22.6 + * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
    22.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    22.8   *
    22.9   * This code is free software; you can redistribute it and/or modify it
    23.1 --- a/test/tools/javac/annotations/typeAnnotations/api/ArrayPositionConsistency.java	Thu Feb 07 12:33:21 2013 -0800
    23.2 +++ b/test/tools/javac/annotations/typeAnnotations/api/ArrayPositionConsistency.java	Mon Feb 11 16:15:09 2013 -0800
    23.3 @@ -1,5 +1,5 @@
    23.4  /*
    23.5 - * Copyright (c) 2010 Oracle and/or its affiliates. All rights reserved.
    23.6 + * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
    23.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    23.8   *
    23.9   * This code is free software; you can redistribute it and/or modify it
    24.1 --- a/test/tools/javac/annotations/typeAnnotations/classfile/ClassfileTestHelper.java	Thu Feb 07 12:33:21 2013 -0800
    24.2 +++ b/test/tools/javac/annotations/typeAnnotations/classfile/ClassfileTestHelper.java	Mon Feb 11 16:15:09 2013 -0800
    24.3 @@ -1,5 +1,5 @@
    24.4  /*
    24.5 - * Copyright (c) 2012, 2013 Oracle and/or its affiliates. All rights reserved.
    24.6 + * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
    24.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    24.8   *
    24.9   * This code is free software; you can redistribute it and/or modify it
    25.1 --- a/test/tools/javac/annotations/typeAnnotations/classfile/CombinationsTargetTest1.java	Thu Feb 07 12:33:21 2013 -0800
    25.2 +++ b/test/tools/javac/annotations/typeAnnotations/classfile/CombinationsTargetTest1.java	Mon Feb 11 16:15:09 2013 -0800
    25.3 @@ -1,5 +1,5 @@
    25.4  /*
    25.5 - * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved.
    25.6 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
    25.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    25.8   *
    25.9   * This code is free software; you can redistribute it and/or modify it
   25.10 @@ -174,22 +174,20 @@
   25.11  
   25.12              String sourceBase = new String("@Retention("+retentn+")\n" +
   25.13              "@Target({TYPE_USE,_OTHER_})\n" +
   25.14 -            "@ContainedBy( AC.class )\n" +
   25.15 +            "@Repeatable( AC.class )\n" +
   25.16              "@interface A { }\n\n" +
   25.17  
   25.18              "@Retention("+retentn+")\n" +
   25.19              "@Target({TYPE_USE,_OTHER_})\n" +
   25.20 -            "@ContainerFor(A.class)\n" +
   25.21              "@interface AC { A[] value(); }\n\n" +
   25.22  
   25.23              "@Retention("+retentn+")\n" +
   25.24              "@Target({TYPE_USE,_OTHER_})\n" +
   25.25 -            "@ContainedBy( BC.class )\n" +
   25.26 +            "@Repeatable( BC.class )\n" +
   25.27              "@interface B { }\n\n" +
   25.28  
   25.29              "@Retention("+retentn+")\n" +
   25.30              "@Target({TYPE_USE,_OTHER_})\n" +
   25.31 -            "@ContainerFor(B.class)\n" +
   25.32              "@interface BC { B[] value(); } \n\n" +
   25.33  
   25.34              "@Retention("+retentn+")\n" +
   25.35 @@ -198,12 +196,11 @@
   25.36  
   25.37              "@Retention("+retentn+")\n" +
   25.38              "@Target({TYPE_USE,TYPE_PARAMETER,_OTHER_})\n" +
   25.39 -            "@ContainedBy(DC.class)\n" +
   25.40 +            "@Repeatable(DC.class)\n" +
   25.41              "@interface D { }\n\n" +
   25.42  
   25.43              "@Retention("+retentn+")\n" +
   25.44              "@Target({TYPE_USE,TYPE_PARAMETER,_OTHER_})\n" +
   25.45 -            "@ContainerFor(D.class) \n" +
   25.46              "@interface DC { D[] value(); }\n\n");
   25.47  
   25.48          // Test case sources with sample generated source.
    26.1 --- a/test/tools/javac/annotations/typeAnnotations/classfile/CombinationsTargetTest2.java	Thu Feb 07 12:33:21 2013 -0800
    26.2 +++ b/test/tools/javac/annotations/typeAnnotations/classfile/CombinationsTargetTest2.java	Mon Feb 11 16:15:09 2013 -0800
    26.3 @@ -1,5 +1,5 @@
    26.4  /*
    26.5 - * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved.
    26.6 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
    26.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    26.8   *
    26.9   * This code is free software; you can redistribute it and/or modify it
   26.10 @@ -171,32 +171,29 @@
   26.11  
   26.12              String sourceBase = new String("@Retention("+retentn+")\n" +
   26.13              "@Target({TYPE_USE,_OTHER_})\n" +
   26.14 -            "@ContainedBy( AC.class )\n" +
   26.15 +            "@Repeatable( AC.class )\n" +
   26.16              "@interface A { }\n\n" +
   26.17  
   26.18              "@Retention("+retentn+")\n" +
   26.19              "@Target({TYPE_USE,_OTHER_})\n" +
   26.20 -            "@ContainerFor(A.class)\n" +
   26.21              "@interface AC { A[] value(); }\n\n" +
   26.22  
   26.23              "@Retention("+retentn+")\n" +
   26.24              "@Target({TYPE_USE,_OTHER_})\n" +
   26.25 -            "@ContainedBy( BC.class )\n" +
   26.26 +            "@Repeatable( BC.class )\n" +
   26.27              "@interface B { }\n\n" +
   26.28  
   26.29              "@Retention("+retentn+")\n" +
   26.30              "@Target({TYPE_USE,_OTHER_})\n" +
   26.31 -            "@ContainerFor(B.class)\n" +
   26.32              "@interface BC { B[] value(); } \n\n" +
   26.33  
   26.34              "@Retention("+retentn+")\n" +
   26.35              "@Target({TYPE_USE,TYPE_PARAMETER,_OTHER_})\n" +
   26.36 -            "@ContainedBy(DC.class)\n" +
   26.37 +            "@Repeatable(DC.class)\n" +
   26.38              "@interface D { }\n\n" +
   26.39  
   26.40              "@Retention("+retentn+")\n" +
   26.41              "@Target({TYPE_USE,TYPE_PARAMETER,_OTHER_})\n" +
   26.42 -            "@ContainerFor(D.class) \n" +
   26.43              "@interface DC { D[] value(); }\n\n");
   26.44  
   26.45          // Test case sources with sample generated source
    27.1 --- a/test/tools/javac/annotations/typeAnnotations/classfile/NewTypeArguments.java	Thu Feb 07 12:33:21 2013 -0800
    27.2 +++ b/test/tools/javac/annotations/typeAnnotations/classfile/NewTypeArguments.java	Mon Feb 11 16:15:09 2013 -0800
    27.3 @@ -1,5 +1,5 @@
    27.4  /*
    27.5 - * Copyright (c) 2009 Oracle and/or its affiliates. All rights reserved.
    27.6 + * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
    27.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    27.8   *
    27.9   * This code is free software; you can redistribute it and/or modify it
    28.1 --- a/test/tools/javac/annotations/typeAnnotations/classfile/NoTargetAnnotations.java	Thu Feb 07 12:33:21 2013 -0800
    28.2 +++ b/test/tools/javac/annotations/typeAnnotations/classfile/NoTargetAnnotations.java	Mon Feb 11 16:15:09 2013 -0800
    28.3 @@ -1,5 +1,5 @@
    28.4  /*
    28.5 - * Copyright (c) 2008 Oracle and/or its affiliates. All rights reserved.
    28.6 + * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved.
    28.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    28.8   *
    28.9   * This code is free software; you can redistribute it and/or modify it
    29.1 --- a/test/tools/javac/annotations/typeAnnotations/classfile/TypeCasts.java	Thu Feb 07 12:33:21 2013 -0800
    29.2 +++ b/test/tools/javac/annotations/typeAnnotations/classfile/TypeCasts.java	Mon Feb 11 16:15:09 2013 -0800
    29.3 @@ -1,5 +1,5 @@
    29.4  /*
    29.5 - * Copyright (c) 2009 Oracle and/or its affiliates. All rights reserved.
    29.6 + * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
    29.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    29.8   *
    29.9   * This code is free software; you can redistribute it and/or modify it
    30.1 --- a/test/tools/javac/annotations/typeAnnotations/classfile/Wildcards.java	Thu Feb 07 12:33:21 2013 -0800
    30.2 +++ b/test/tools/javac/annotations/typeAnnotations/classfile/Wildcards.java	Mon Feb 11 16:15:09 2013 -0800
    30.3 @@ -1,5 +1,5 @@
    30.4  /*
    30.5 - * Copyright (c) 2009 Oracle and/or its affiliates. All rights reserved.
    30.6 + * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
    30.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    30.8   *
    30.9   * This code is free software; you can redistribute it and/or modify it
    31.1 --- a/test/tools/javac/annotations/typeAnnotations/failures/target/DotClass.java	Thu Feb 07 12:33:21 2013 -0800
    31.2 +++ b/test/tools/javac/annotations/typeAnnotations/failures/target/DotClass.java	Mon Feb 11 16:15:09 2013 -0800
    31.3 @@ -1,13 +1,5 @@
    31.4 -import static java.lang.annotation.ElementType.TYPE;
    31.5 -import static java.lang.annotation.ElementType.TYPE_PARAMETER;
    31.6 -import static java.lang.annotation.ElementType.TYPE_USE;
    31.7 -
    31.8 -import java.lang.annotation.Retention;
    31.9 -import java.lang.annotation.RetentionPolicy;
   31.10 -import java.lang.annotation.Target;
   31.11 -
   31.12  /*
   31.13 - * Copyright (c) 2009 Oracle and/or its affiliates. All rights reserved.
   31.14 + * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
   31.15   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   31.16   *
   31.17   * This code is free software; you can redistribute it and/or modify it
   31.18 @@ -36,6 +28,14 @@
   31.19   * @compile/fail/ref=DotClass.out -XDrawDiagnostics DotClass.java
   31.20   */
   31.21  
   31.22 +import java.lang.annotation.Retention;
   31.23 +import java.lang.annotation.RetentionPolicy;
   31.24 +import java.lang.annotation.Target;
   31.25 +
   31.26 +import static java.lang.annotation.ElementType.TYPE;
   31.27 +import static java.lang.annotation.ElementType.TYPE_PARAMETER;
   31.28 +import static java.lang.annotation.ElementType.TYPE_USE;
   31.29 +
   31.30  @Target({TYPE_USE, TYPE_PARAMETER, TYPE})
   31.31  @Retention(RetentionPolicy.RUNTIME)
   31.32  @interface A {}
    32.1 --- a/test/tools/javac/annotations/typeAnnotations/newlocations/RepeatingTypeAnnotations.java	Thu Feb 07 12:33:21 2013 -0800
    32.2 +++ b/test/tools/javac/annotations/typeAnnotations/newlocations/RepeatingTypeAnnotations.java	Mon Feb 11 16:15:09 2013 -0800
    32.3 @@ -120,7 +120,6 @@
    32.4  @Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
    32.5  @interface RTA { }
    32.6  
    32.7 -@ContainerFor(RTA.class)
    32.8  @Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
    32.9  @interface RTAs {
   32.10      RTA[] value();
    33.1 --- a/test/tools/javac/annotations/typeAnnotations/newlocations/Varargs.java	Thu Feb 07 12:33:21 2013 -0800
    33.2 +++ b/test/tools/javac/annotations/typeAnnotations/newlocations/Varargs.java	Mon Feb 11 16:15:09 2013 -0800
    33.3 @@ -1,6 +1,5 @@
    33.4 -
    33.5  /*
    33.6 - * Copyright (c) 2008 Oracle and/or its affiliates. All rights reserved.
    33.7 + * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved.
    33.8   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    33.9   *
   33.10   * This code is free software; you can redistribute it and/or modify it
   33.11 @@ -22,8 +21,6 @@
   33.12   * questions.
   33.13   */
   33.14  
   33.15 -import java.lang.annotation.*;
   33.16 -
   33.17  /*
   33.18   * @test
   33.19   * @summary test acceptance of varargs annotations
   33.20 @@ -31,6 +28,8 @@
   33.21   * @compile Varargs.java
   33.22   */
   33.23  
   33.24 +import java.lang.annotation.*;
   33.25 +
   33.26  @Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
   33.27  @interface A {}
   33.28  
    34.1 --- a/test/tools/javac/annotations/typeAnnotations/packageanno/PackageProcessor.java	Thu Feb 07 12:33:21 2013 -0800
    34.2 +++ b/test/tools/javac/annotations/typeAnnotations/packageanno/PackageProcessor.java	Mon Feb 11 16:15:09 2013 -0800
    34.3 @@ -1,5 +1,5 @@
    34.4  /*
    34.5 - * Copyright (c) 2009 Oracle and/or its affiliates. All rights reserved.
    34.6 + * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
    34.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    34.8   *
    34.9   * This code is free software; you can redistribute it and/or modify it
    35.1 --- a/test/tools/javac/annotations/typeAnnotations/packageanno/mypackage/Anno.java	Thu Feb 07 12:33:21 2013 -0800
    35.2 +++ b/test/tools/javac/annotations/typeAnnotations/packageanno/mypackage/Anno.java	Mon Feb 11 16:15:09 2013 -0800
    35.3 @@ -1,5 +1,5 @@
    35.4  /*
    35.5 - * Copyright (c) 2009 Oracle and/or its affiliates. All rights reserved.
    35.6 + * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
    35.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    35.8   *
    35.9   * This code is free software; you can redistribute it and/or modify it
    36.1 --- a/test/tools/javac/annotations/typeAnnotations/packageanno/mypackage/MyClass.java	Thu Feb 07 12:33:21 2013 -0800
    36.2 +++ b/test/tools/javac/annotations/typeAnnotations/packageanno/mypackage/MyClass.java	Mon Feb 11 16:15:09 2013 -0800
    36.3 @@ -1,5 +1,5 @@
    36.4  /*
    36.5 - * Copyright (c) 2009 Oracle and/or its affiliates. All rights reserved.
    36.6 + * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
    36.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    36.8   *
    36.9   * This code is free software; you can redistribute it and/or modify it
    37.1 --- a/test/tools/javac/annotations/typeAnnotations/packageanno/mypackage/package-info.java	Thu Feb 07 12:33:21 2013 -0800
    37.2 +++ b/test/tools/javac/annotations/typeAnnotations/packageanno/mypackage/package-info.java	Mon Feb 11 16:15:09 2013 -0800
    37.3 @@ -1,5 +1,5 @@
    37.4  /*
    37.5 - * Copyright (c) 2009 Oracle and/or its affiliates. All rights reserved.
    37.6 + * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
    37.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    37.8   *
    37.9   * This code is free software; you can redistribute it and/or modify it
    38.1 --- a/test/tools/javac/annotations/typeAnnotations/referenceinfos/ClassExtends.java	Thu Feb 07 12:33:21 2013 -0800
    38.2 +++ b/test/tools/javac/annotations/typeAnnotations/referenceinfos/ClassExtends.java	Mon Feb 11 16:15:09 2013 -0800
    38.3 @@ -1,5 +1,5 @@
    38.4  /*
    38.5 - * Copyright (c) 2009 Oracle and/or its affiliates. All rights reserved.
    38.6 + * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
    38.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    38.8   *
    38.9   * This code is free software; you can redistribute it and/or modify it
    39.1 --- a/test/tools/javac/annotations/typeAnnotations/referenceinfos/ClassTypeParam.java	Thu Feb 07 12:33:21 2013 -0800
    39.2 +++ b/test/tools/javac/annotations/typeAnnotations/referenceinfos/ClassTypeParam.java	Mon Feb 11 16:15:09 2013 -0800
    39.3 @@ -1,5 +1,5 @@
    39.4  /*
    39.5 - * Copyright (c) 2009 Oracle and/or its affiliates. All rights reserved.
    39.6 + * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
    39.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    39.8   *
    39.9   * This code is free software; you can redistribute it and/or modify it
    40.1 --- a/test/tools/javac/annotations/typeAnnotations/referenceinfos/Constructors.java	Thu Feb 07 12:33:21 2013 -0800
    40.2 +++ b/test/tools/javac/annotations/typeAnnotations/referenceinfos/Constructors.java	Mon Feb 11 16:15:09 2013 -0800
    40.3 @@ -1,5 +1,5 @@
    40.4  /*
    40.5 - * Copyright (c) 2012 Oracle and/or its affiliates. All rights reserved.
    40.6 + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
    40.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    40.8   *
    40.9   * This code is free software; you can redistribute it and/or modify it
    41.1 --- a/test/tools/javac/annotations/typeAnnotations/referenceinfos/Driver.java	Thu Feb 07 12:33:21 2013 -0800
    41.2 +++ b/test/tools/javac/annotations/typeAnnotations/referenceinfos/Driver.java	Mon Feb 11 16:15:09 2013 -0800
    41.3 @@ -1,5 +1,5 @@
    41.4  /*
    41.5 - * Copyright (c) 2009 Oracle and/or its affiliates. All rights reserved.
    41.6 + * Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved.
    41.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    41.8   *
    41.9   * This code is free software; you can redistribute it and/or modify it
   41.10 @@ -241,8 +241,8 @@
   41.11          sb.append("\n@Repeatable(RTAs.class) @Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER}) @interface RTA {}");
   41.12          sb.append("\n@Repeatable(RTBs.class) @Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER}) @interface RTB {}");
   41.13  
   41.14 -        sb.append("\n@ContainerFor(RTA.class) @Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER}) @interface RTAs { RTA[] value(); }");
   41.15 -        sb.append("\n@ContainerFor(RTB.class) @Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER}) @interface RTBs { RTB[] value(); }");
   41.16 +        sb.append("\n@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER}) @interface RTAs { RTA[] value(); }");
   41.17 +        sb.append("\n@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER}) @interface RTBs { RTB[] value(); }");
   41.18  
   41.19          sb.append("\n@Target(value={ElementType.TYPE,ElementType.FIELD,ElementType.METHOD,ElementType.PARAMETER,ElementType.CONSTRUCTOR,ElementType.LOCAL_VARIABLE})");
   41.20          sb.append("\n@interface Decl {}");
    42.1 --- a/test/tools/javac/annotations/typeAnnotations/referenceinfos/ExceptionParameters.java	Thu Feb 07 12:33:21 2013 -0800
    42.2 +++ b/test/tools/javac/annotations/typeAnnotations/referenceinfos/ExceptionParameters.java	Mon Feb 11 16:15:09 2013 -0800
    42.3 @@ -1,5 +1,5 @@
    42.4  /*
    42.5 - * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved.
    42.6 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
    42.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    42.8   *
    42.9   * This code is free software; you can redistribute it and/or modify it
    43.1 --- a/test/tools/javac/annotations/typeAnnotations/referenceinfos/Fields.java	Thu Feb 07 12:33:21 2013 -0800
    43.2 +++ b/test/tools/javac/annotations/typeAnnotations/referenceinfos/Fields.java	Mon Feb 11 16:15:09 2013 -0800
    43.3 @@ -1,5 +1,5 @@
    43.4  /*
    43.5 - * Copyright (c) 2009 Oracle and/or its affiliates. All rights reserved.
    43.6 + * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
    43.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    43.8   *
    43.9   * This code is free software; you can redistribute it and/or modify it
    44.1 --- a/test/tools/javac/annotations/typeAnnotations/referenceinfos/FromSpecification.java	Thu Feb 07 12:33:21 2013 -0800
    44.2 +++ b/test/tools/javac/annotations/typeAnnotations/referenceinfos/FromSpecification.java	Mon Feb 11 16:15:09 2013 -0800
    44.3 @@ -1,5 +1,5 @@
    44.4  /*
    44.5 - * Copyright (c) 2012 Oracle and/or its affiliates. All rights reserved.
    44.6 + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
    44.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    44.8   *
    44.9   * This code is free software; you can redistribute it and/or modify it
    45.1 --- a/test/tools/javac/annotations/typeAnnotations/referenceinfos/MethodParameters.java	Thu Feb 07 12:33:21 2013 -0800
    45.2 +++ b/test/tools/javac/annotations/typeAnnotations/referenceinfos/MethodParameters.java	Mon Feb 11 16:15:09 2013 -0800
    45.3 @@ -1,5 +1,5 @@
    45.4  /*
    45.5 - * Copyright (c) 2009 Oracle and/or its affiliates. All rights reserved.
    45.6 + * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
    45.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    45.8   *
    45.9   * This code is free software; you can redistribute it and/or modify it
    46.1 --- a/test/tools/javac/annotations/typeAnnotations/referenceinfos/MethodReceivers.java	Thu Feb 07 12:33:21 2013 -0800
    46.2 +++ b/test/tools/javac/annotations/typeAnnotations/referenceinfos/MethodReceivers.java	Mon Feb 11 16:15:09 2013 -0800
    46.3 @@ -1,5 +1,5 @@
    46.4  /*
    46.5 - * Copyright (c) 2009 Oracle and/or its affiliates. All rights reserved.
    46.6 + * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
    46.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    46.8   *
    46.9   * This code is free software; you can redistribute it and/or modify it
    47.1 --- a/test/tools/javac/annotations/typeAnnotations/referenceinfos/MethodReturns.java	Thu Feb 07 12:33:21 2013 -0800
    47.2 +++ b/test/tools/javac/annotations/typeAnnotations/referenceinfos/MethodReturns.java	Mon Feb 11 16:15:09 2013 -0800
    47.3 @@ -1,5 +1,5 @@
    47.4  /*
    47.5 - * Copyright (c) 2009 Oracle and/or its affiliates. All rights reserved.
    47.6 + * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
    47.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    47.8   *
    47.9   * This code is free software; you can redistribute it and/or modify it
    48.1 --- a/test/tools/javac/annotations/typeAnnotations/referenceinfos/MethodThrows.java	Thu Feb 07 12:33:21 2013 -0800
    48.2 +++ b/test/tools/javac/annotations/typeAnnotations/referenceinfos/MethodThrows.java	Mon Feb 11 16:15:09 2013 -0800
    48.3 @@ -1,5 +1,5 @@
    48.4  /*
    48.5 - * Copyright (c) 2009 Oracle and/or its affiliates. All rights reserved.
    48.6 + * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
    48.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    48.8   *
    48.9   * This code is free software; you can redistribute it and/or modify it
    49.1 --- a/test/tools/javac/annotations/typeAnnotations/referenceinfos/MethodTypeParam.java	Thu Feb 07 12:33:21 2013 -0800
    49.2 +++ b/test/tools/javac/annotations/typeAnnotations/referenceinfos/MethodTypeParam.java	Mon Feb 11 16:15:09 2013 -0800
    49.3 @@ -1,5 +1,5 @@
    49.4  /*
    49.5 - * Copyright (c) 2009 Oracle and/or its affiliates. All rights reserved.
    49.6 + * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
    49.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    49.8   *
    49.9   * This code is free software; you can redistribute it and/or modify it
    50.1 --- a/test/tools/javac/annotations/typeAnnotations/referenceinfos/MultiCatch.java	Thu Feb 07 12:33:21 2013 -0800
    50.2 +++ b/test/tools/javac/annotations/typeAnnotations/referenceinfos/MultiCatch.java	Mon Feb 11 16:15:09 2013 -0800
    50.3 @@ -1,5 +1,5 @@
    50.4  /*
    50.5 - * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved.
    50.6 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
    50.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    50.8   *
    50.9   * This code is free software; you can redistribute it and/or modify it
    51.1 --- a/test/tools/javac/annotations/typeAnnotations/referenceinfos/NestedTypes.java	Thu Feb 07 12:33:21 2013 -0800
    51.2 +++ b/test/tools/javac/annotations/typeAnnotations/referenceinfos/NestedTypes.java	Mon Feb 11 16:15:09 2013 -0800
    51.3 @@ -1,5 +1,5 @@
    51.4  /*
    51.5 - * Copyright (c) 2012 Oracle and/or its affiliates. All rights reserved.
    51.6 + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
    51.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    51.8   *
    51.9   * This code is free software; you can redistribute it and/or modify it
    52.1 --- a/test/tools/javac/annotations/typeAnnotations/referenceinfos/NewObjects.java	Thu Feb 07 12:33:21 2013 -0800
    52.2 +++ b/test/tools/javac/annotations/typeAnnotations/referenceinfos/NewObjects.java	Mon Feb 11 16:15:09 2013 -0800
    52.3 @@ -1,5 +1,5 @@
    52.4  /*
    52.5 - * Copyright (c) 2009 Oracle and/or its affiliates. All rights reserved.
    52.6 + * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
    52.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    52.8   *
    52.9   * This code is free software; you can redistribute it and/or modify it
    53.1 --- a/test/tools/javac/annotations/typeAnnotations/referenceinfos/ReferenceInfoUtil.java	Thu Feb 07 12:33:21 2013 -0800
    53.2 +++ b/test/tools/javac/annotations/typeAnnotations/referenceinfos/ReferenceInfoUtil.java	Mon Feb 11 16:15:09 2013 -0800
    53.3 @@ -1,5 +1,5 @@
    53.4  /*
    53.5 - * Copyright (c) 2009 Oracle and/or its affiliates. All rights reserved.
    53.6 + * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
    53.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    53.8   *
    53.9   * This code is free software; you can redistribute it and/or modify it
    54.1 --- a/test/tools/javac/annotations/typeAnnotations/referenceinfos/RepeatingTypeAnnotations.java	Thu Feb 07 12:33:21 2013 -0800
    54.2 +++ b/test/tools/javac/annotations/typeAnnotations/referenceinfos/RepeatingTypeAnnotations.java	Mon Feb 11 16:15:09 2013 -0800
    54.3 @@ -1,5 +1,5 @@
    54.4  /*
    54.5 - * Copyright (c) 2012 Oracle and/or its affiliates. All rights reserved.
    54.6 + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
    54.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    54.8   *
    54.9   * This code is free software; you can redistribute it and/or modify it
    55.1 --- a/test/tools/javac/annotations/typeAnnotations/referenceinfos/TypeCasts.java	Thu Feb 07 12:33:21 2013 -0800
    55.2 +++ b/test/tools/javac/annotations/typeAnnotations/referenceinfos/TypeCasts.java	Mon Feb 11 16:15:09 2013 -0800
    55.3 @@ -1,5 +1,5 @@
    55.4  /*
    55.5 - * Copyright (c) 2009 Oracle and/or its affiliates. All rights reserved.
    55.6 + * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
    55.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    55.8   *
    55.9   * This code is free software; you can redistribute it and/or modify it
    56.1 --- a/test/tools/javac/annotations/typeAnnotations/referenceinfos/TypeTests.java	Thu Feb 07 12:33:21 2013 -0800
    56.2 +++ b/test/tools/javac/annotations/typeAnnotations/referenceinfos/TypeTests.java	Mon Feb 11 16:15:09 2013 -0800
    56.3 @@ -1,5 +1,5 @@
    56.4  /*
    56.5 - * Copyright (c) 2009 Oracle and/or its affiliates. All rights reserved.
    56.6 + * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
    56.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    56.8   *
    56.9   * This code is free software; you can redistribute it and/or modify it
    57.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    57.2 +++ b/test/tools/javac/api/8007344/Test.java	Mon Feb 11 16:15:09 2013 -0800
    57.3 @@ -0,0 +1,227 @@
    57.4 +/*
    57.5 + * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
    57.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    57.7 + *
    57.8 + * This code is free software; you can redistribute it and/or modify it
    57.9 + * under the terms of the GNU General Public License version 2 only, as
   57.10 + * published by the Free Software Foundation.
   57.11 + *
   57.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   57.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   57.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   57.15 + * version 2 for more details (a copy is included in the LICENSE file that
   57.16 + * accompanied this code).
   57.17 + *
   57.18 + * You should have received a copy of the GNU General Public License version
   57.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   57.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   57.21 + *
   57.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   57.23 + * or visit www.oracle.com if you need additional information or have any
   57.24 + * questions.
   57.25 + */
   57.26 +
   57.27 +/*
   57.28 + * @test
   57.29 + * @bug 8007344
   57.30 + * @summary javac may not make tree end positions and/or doc comments
   57.31 + *          available to processors and listeners
   57.32 + * @library /tools/javac/lib
   57.33 + * @build JavacTestingAbstractProcessor
   57.34 + * @run main Test
   57.35 + */
   57.36 +
   57.37 +import java.io.File;
   57.38 +import java.io.PrintWriter;
   57.39 +import java.util.Arrays;
   57.40 +import java.util.Set;
   57.41 +
   57.42 +import javax.annotation.processing.RoundEnvironment;
   57.43 +import javax.lang.model.element.Element;
   57.44 +import javax.lang.model.element.TypeElement;
   57.45 +import javax.tools.JavaFileObject;
   57.46 +import javax.tools.StandardJavaFileManager;
   57.47 +
   57.48 +import com.sun.source.doctree.DocCommentTree;
   57.49 +import com.sun.source.tree.*;
   57.50 +import com.sun.source.util.DocTrees;
   57.51 +import com.sun.source.util.JavacTask;
   57.52 +import com.sun.source.util.SourcePositions;
   57.53 +import com.sun.source.util.TaskEvent;
   57.54 +import com.sun.source.util.TaskListener;
   57.55 +import com.sun.source.util.TreePath;
   57.56 +import com.sun.source.util.TreePathScanner;
   57.57 +import com.sun.tools.javac.api.JavacTool;
   57.58 +import com.sun.tools.javac.tree.JCTree;
   57.59 +import com.sun.tools.javac.tree.Pretty;
   57.60 +import com.sun.tools.javac.util.Position;
   57.61 +
   57.62 +/** Doc comment: Test */
   57.63 +public class Test {
   57.64 +    public static final int EXPECT_DOC_COMMENTS = 3;
   57.65 +
   57.66 +    /** Doc comment: main */
   57.67 +    public static void main(String... args) throws Exception {
   57.68 +        PrintWriter out = new PrintWriter(System.err);
   57.69 +        try {
   57.70 +            new Test(out).run();
   57.71 +        } finally {
   57.72 +            out.flush();
   57.73 +        }
   57.74 +    }
   57.75 +
   57.76 +    PrintWriter out;
   57.77 +    int errors;
   57.78 +
   57.79 +    Test(PrintWriter out) {
   57.80 +        this.out = out;
   57.81 +    }
   57.82 +
   57.83 +    /** Doc comment: run */
   57.84 +    void run() throws Exception {
   57.85 +        File testSrc = new File(System.getProperty("test.src"));
   57.86 +        File thisFile = new File(testSrc, getClass().getName() + ".java");
   57.87 +        JavacTool javac = JavacTool.create();
   57.88 +        StandardJavaFileManager fm = javac.getStandardFileManager(null, null, null);
   57.89 +        Iterable<? extends JavaFileObject> fos = fm.getJavaFileObjects(thisFile);
   57.90 +        testAnnoProcessor(javac, fm, fos, out, EXPECT_DOC_COMMENTS);
   57.91 +        testTaskListener(javac, fm, fos, out, EXPECT_DOC_COMMENTS);
   57.92 +
   57.93 +        if (errors > 0)
   57.94 +            throw new Exception(errors + " errors occurred");
   57.95 +    }
   57.96 +
   57.97 +    void testAnnoProcessor(JavacTool javac, StandardJavaFileManager fm,
   57.98 +            Iterable<? extends JavaFileObject> files, PrintWriter out,
   57.99 +            int expectedDocComments) {
  57.100 +        out.println("Test annotation processor");
  57.101 +        JavacTask task = javac.getTask(out, fm, null, null, null, files);
  57.102 +        AnnoProc ap = new AnnoProc(DocTrees.instance(task));
  57.103 +        task.setProcessors(Arrays.asList(ap));
  57.104 +        task.call();
  57.105 +        ap.checker.checkDocComments(expectedDocComments);
  57.106 +    }
  57.107 +
  57.108 +    void testTaskListener(JavacTool javac, StandardJavaFileManager fm,
  57.109 +            Iterable<? extends JavaFileObject> files, PrintWriter out,
  57.110 +            int expectedDocComments) {
  57.111 +        out.println("Test task listener");
  57.112 +        JavacTask task = javac.getTask(out, fm, null, null, null, files);
  57.113 +        TaskListnr tl = new TaskListnr(DocTrees.instance(task));
  57.114 +        task.addTaskListener(tl);
  57.115 +        task.call();
  57.116 +        tl.checker.checkDocComments(expectedDocComments);
  57.117 +    }
  57.118 +
  57.119 +    void error(String msg) {
  57.120 +        out.println("Error: " + msg);
  57.121 +        errors++;
  57.122 +    }
  57.123 +
  57.124 +    class AnnoProc extends JavacTestingAbstractProcessor {
  57.125 +        Checker checker;
  57.126 +
  57.127 +        AnnoProc(DocTrees trees) {
  57.128 +            checker = new Checker(trees);
  57.129 +        }
  57.130 +
  57.131 +        @Override
  57.132 +        public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
  57.133 +            for (Element e : roundEnv.getRootElements()) {
  57.134 +                checker.scan(checker.trees.getPath(e), null);
  57.135 +            }
  57.136 +            return true;
  57.137 +        }
  57.138 +    }
  57.139 +
  57.140 +    class TaskListnr implements TaskListener {
  57.141 +        Checker checker;
  57.142 +
  57.143 +        TaskListnr(DocTrees trees) {
  57.144 +            checker = new Checker(trees);
  57.145 +        }
  57.146 +
  57.147 +        public void started(TaskEvent e) {
  57.148 +            if (e.getKind() == TaskEvent.Kind.ANALYZE)
  57.149 +                checker.scan(new TreePath(e.getCompilationUnit()), null);
  57.150 +        }
  57.151 +
  57.152 +        public void finished(TaskEvent e) {
  57.153 +        }
  57.154 +    }
  57.155 +
  57.156 +    class Checker extends TreePathScanner<Void,Void> {
  57.157 +        DocTrees trees;
  57.158 +        SourcePositions srcPosns;
  57.159 +
  57.160 +        int docComments = 0;
  57.161 +
  57.162 +        Checker(DocTrees trees) {
  57.163 +            this.trees = trees;
  57.164 +            srcPosns = trees.getSourcePositions();
  57.165 +        }
  57.166 +
  57.167 +        @Override
  57.168 +        public Void scan(Tree tree, Void ignore) {
  57.169 +            if (tree != null) {
  57.170 +                switch (tree.getKind()) {
  57.171 +                    // HACK: Workaround 8007350
  57.172 +                    // Some tree nodes do not have endpos set
  57.173 +                    case ASSIGNMENT:
  57.174 +                    case BLOCK:
  57.175 +                    case IDENTIFIER:
  57.176 +                    case METHOD_INVOCATION:
  57.177 +                        break;
  57.178 +
  57.179 +                    default:
  57.180 +                        checkEndPos(getCurrentPath().getCompilationUnit(), tree);
  57.181 +                }
  57.182 +            }
  57.183 +            return super.scan(tree, ignore);
  57.184 +        }
  57.185 +
  57.186 +        @Override
  57.187 +        public Void visitClass(ClassTree tree, Void ignore) {
  57.188 +            checkComment();
  57.189 +            return super.visitClass(tree, ignore);
  57.190 +        }
  57.191 +
  57.192 +        @Override
  57.193 +        public Void visitMethod(MethodTree tree, Void ignore) {
  57.194 +            checkComment();
  57.195 +            return super.visitMethod(tree, ignore);
  57.196 +        }
  57.197 +
  57.198 +        @Override
  57.199 +        public Void visitVariable(VariableTree tree, Void ignore) {
  57.200 +            checkComment();
  57.201 +            return super.visitVariable(tree, ignore);
  57.202 +        }
  57.203 +
  57.204 +        void checkComment() {
  57.205 +            DocCommentTree dc = trees.getDocCommentTree(getCurrentPath());
  57.206 +            if (dc != null) {
  57.207 +                out.println("comment: " + dc.toString().replaceAll("\\s+", " "));
  57.208 +                docComments++;
  57.209 +            }
  57.210 +        }
  57.211 +
  57.212 +        void checkEndPos(CompilationUnitTree unit, Tree tree) {
  57.213 +            long sp = srcPosns.getStartPosition(unit, tree);
  57.214 +            long ep = srcPosns.getEndPosition(unit, tree);
  57.215 +            if (sp >= 0 && ep == Position.NOPOS) {
  57.216 +                error("endpos not set for " + tree.getKind()
  57.217 +                        + " " + Pretty.toSimpleString(((JCTree) tree))
  57.218 +                        +", start:" + sp);
  57.219 +            }
  57.220 +        }
  57.221 +
  57.222 +        void checkDocComments(int expected) {
  57.223 +            if (docComments != expected) {
  57.224 +                error("Unexpected number of doc comments received: "
  57.225 +                        + docComments + ", expected: " + expected);
  57.226 +            }
  57.227 +        }
  57.228 +
  57.229 +    }
  57.230 +}
    58.1 --- a/test/tools/javac/api/T6306137.java	Thu Feb 07 12:33:21 2013 -0800
    58.2 +++ b/test/tools/javac/api/T6306137.java	Mon Feb 11 16:15:09 2013 -0800
    58.3 @@ -26,9 +26,6 @@
    58.4   * @bug     6306137
    58.5   * @summary JSR 199: encoding option doesn't affect standard file manager
    58.6   * @author  Peter von der Ahé
    58.7 - * @ignore
    58.8 - *    Need to make the contentCache in JavacFileManager be aware of changes to the encoding.
    58.9 - *    Need to propogate -source (and -encoding?) down to the JavacFileManager
   58.10   */
   58.11  
   58.12  import java.io.File;
    59.1 --- a/test/tools/javac/defaultMethods/TestNoBridgeOnDefaults.java	Thu Feb 07 12:33:21 2013 -0800
    59.2 +++ b/test/tools/javac/defaultMethods/TestNoBridgeOnDefaults.java	Mon Feb 11 16:15:09 2013 -0800
    59.3 @@ -23,7 +23,6 @@
    59.4  
    59.5  /*
    59.6   * @test
    59.7 - * @ignore awaits for VM support
    59.8   * @summary  check that javac does not generate bridge methods for defaults
    59.9   */
   59.10  
    60.1 --- a/test/tools/javac/lambda/LambdaCapture06.java	Thu Feb 07 12:33:21 2013 -0800
    60.2 +++ b/test/tools/javac/lambda/LambdaCapture06.java	Mon Feb 11 16:15:09 2013 -0800
    60.3 @@ -23,7 +23,6 @@
    60.4  
    60.5  /*
    60.6   * @test
    60.7 - * @ignore investigate as to whether code generation fails
    60.8   * @bug 8003280
    60.9   * @summary Add lambda tests
   60.10   *  Compiler crash when local inner class nested inside lambda captures local variables from enclosing scope
    61.1 --- a/test/tools/javac/lambda/LambdaExpr15.java	Thu Feb 07 12:33:21 2013 -0800
    61.2 +++ b/test/tools/javac/lambda/LambdaExpr15.java	Mon Feb 11 16:15:09 2013 -0800
    61.3 @@ -23,7 +23,6 @@
    61.4  
    61.5  /*
    61.6   * @test
    61.7 - * @ignore investigate as to whether code generation fails
    61.8   * @bug 8003280
    61.9   * @summary Add lambda tests
   61.10   *  check that nested inner class in statement lambdas don't get corrupted return statements
    62.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    62.2 +++ b/test/tools/javac/lib/DPrinter.java	Mon Feb 11 16:15:09 2013 -0800
    62.3 @@ -0,0 +1,1331 @@
    62.4 +/*
    62.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
    62.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    62.7 + *
    62.8 + * This code is free software; you can redistribute it and/or modify it
    62.9 + * under the terms of the GNU General Public License version 2 only, as
   62.10 + * published by the Free Software Foundation.
   62.11 + *
   62.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   62.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   62.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   62.15 + * version 2 for more details (a copy is included in the LICENSE file that
   62.16 + * accompanied this code).
   62.17 + *
   62.18 + * You should have received a copy of the GNU General Public License version
   62.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   62.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   62.21 + *
   62.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   62.23 + * or visit www.oracle.com if you need additional information or have any
   62.24 + * questions.
   62.25 + */
   62.26 +
   62.27 +import java.io.File;
   62.28 +import java.io.IOException;
   62.29 +import java.io.PrintWriter;
   62.30 +import java.lang.reflect.Field;
   62.31 +import java.util.ArrayList;
   62.32 +import java.util.Arrays;
   62.33 +import java.util.Collection;
   62.34 +import java.util.EnumSet;
   62.35 +import java.util.HashMap;
   62.36 +import java.util.List;
   62.37 +import java.util.Locale;
   62.38 +import java.util.Map;
   62.39 +import java.util.Set;
   62.40 +
   62.41 +import javax.lang.model.element.Name;
   62.42 +import javax.lang.model.element.TypeElement;
   62.43 +import javax.tools.FileObject;
   62.44 +import javax.tools.JavaCompiler;
   62.45 +import javax.tools.JavaFileObject;
   62.46 +import javax.tools.StandardJavaFileManager;
   62.47 +import javax.tools.StandardLocation;
   62.48 +import javax.tools.ToolProvider;
   62.49 +
   62.50 +import com.sun.source.util.JavacTask;
   62.51 +import com.sun.source.util.TaskEvent;
   62.52 +import com.sun.source.util.TaskListener;
   62.53 +import com.sun.source.util.Trees;
   62.54 +import com.sun.tools.javac.api.JavacTrees;
   62.55 +import com.sun.tools.javac.code.Annotations;
   62.56 +import com.sun.tools.javac.code.Attribute;
   62.57 +import com.sun.tools.javac.code.Flags;
   62.58 +import com.sun.tools.javac.code.Kinds;
   62.59 +import com.sun.tools.javac.code.Printer;
   62.60 +import com.sun.tools.javac.code.Scope;
   62.61 +import com.sun.tools.javac.code.Scope.CompoundScope;
   62.62 +import com.sun.tools.javac.code.Symbol;
   62.63 +import com.sun.tools.javac.code.Symbol.*;
   62.64 +import com.sun.tools.javac.code.Type;
   62.65 +import com.sun.tools.javac.code.Type.*;
   62.66 +import com.sun.tools.javac.code.TypeTag;
   62.67 +import com.sun.tools.javac.tree.JCTree;
   62.68 +import com.sun.tools.javac.tree.JCTree.*;
   62.69 +import com.sun.tools.javac.tree.Pretty;
   62.70 +import com.sun.tools.javac.tree.TreeInfo;
   62.71 +import com.sun.tools.javac.tree.TreeScanner;
   62.72 +import com.sun.tools.javac.util.Assert;
   62.73 +import com.sun.tools.javac.util.Context;
   62.74 +import com.sun.tools.javac.util.Log;
   62.75 +
   62.76 +
   62.77 +/**
   62.78 + * Debug printer for javac internals, for when toString() just isn't enough.
   62.79 + *
   62.80 + * <p>
   62.81 + * The printer provides an API to generate structured views of javac objects,
   62.82 + * such as AST nodes, symbol, types and annotations. Various aspects of the
   62.83 + * output can be configured, such as whether to show nulls, empty lists, or
   62.84 + * a compressed representation of the source code. Visitors are used to walk
   62.85 + * object hierarchies, and can be replaced with custom visitors if the default
   62.86 + * visitors are not flexible enough.
   62.87 + *
   62.88 + * <p>
   62.89 + * In general, nodes are printed with an initial line identifying the node
   62.90 + * followed by indented lines for the child nodes. Currently, graphs are
   62.91 + * represented by printing a spanning subtree.
   62.92 + *
   62.93 + * <p>
   62.94 + * The printer can be accessed via a simple command-line utility,
   62.95 + * which makes it easy to see the internal representation of source code,
   62.96 + * such as simple test programs, during the compilation pipeline.
   62.97 + *
   62.98 + *  <p><b>This is NOT part of any supported API.
   62.99 + *  If you write code that depends on this, you do so at your own risk.
  62.100 + *  This code and its internal interfaces are subject to change or
  62.101 + *  deletion without notice.</b>
  62.102 + */
  62.103 +
  62.104 +public class DPrinter {
  62.105 +    protected final PrintWriter out;
  62.106 +    protected final Trees trees;
  62.107 +    protected Printer printer;
  62.108 +    protected boolean showEmptyItems = true;
  62.109 +    protected boolean showNulls = true;
  62.110 +    protected boolean showPositions = false;
  62.111 +    protected boolean showSrc;
  62.112 +    protected boolean showTreeSymbols;
  62.113 +    protected boolean showTreeTypes;
  62.114 +    protected int maxSrcLength = 32;
  62.115 +    protected Locale locale = Locale.getDefault();
  62.116 +    protected static final String NULL = "#null";
  62.117 +
  62.118 +    // <editor-fold defaultstate="collapsed" desc="Configuration">
  62.119 +
  62.120 +    public static DPrinter instance(Context context) {
  62.121 +        DPrinter dp = context.get(DPrinter.class);
  62.122 +        if (dp == null) {
  62.123 +            dp = new DPrinter(context);
  62.124 +        }
  62.125 +        return dp;
  62.126 +
  62.127 +    }
  62.128 +
  62.129 +    protected DPrinter(Context context) {
  62.130 +        context.put(DPrinter.class, this);
  62.131 +        out = context.get(Log.outKey);
  62.132 +        trees = JavacTrees.instance(context);
  62.133 +    }
  62.134 +
  62.135 +    public DPrinter(PrintWriter out, Trees trees) {
  62.136 +        this.out = out;
  62.137 +        this.trees = trees;
  62.138 +    }
  62.139 +
  62.140 +    public DPrinter emptyItems(boolean showEmptyItems) {
  62.141 +        this.showEmptyItems = showEmptyItems;
  62.142 +        return this;
  62.143 +    }
  62.144 +
  62.145 +    public DPrinter nulls(boolean showNulls) {
  62.146 +        this.showNulls = showNulls;
  62.147 +        return this;
  62.148 +    }
  62.149 +
  62.150 +    public DPrinter positions(boolean showPositions) {
  62.151 +        this.showPositions = showPositions;
  62.152 +        return this;
  62.153 +    }
  62.154 +
  62.155 +    public DPrinter source(boolean showSrc) {
  62.156 +        this.showSrc = showSrc;
  62.157 +        return this;
  62.158 +    }
  62.159 +
  62.160 +    public DPrinter source(int maxSrcLength) {
  62.161 +        this.showSrc = true;
  62.162 +        this.maxSrcLength = maxSrcLength;
  62.163 +        return this;
  62.164 +    }
  62.165 +
  62.166 +    public DPrinter treeSymbols(boolean showTreeSymbols) {
  62.167 +        this.showTreeSymbols = showTreeSymbols;
  62.168 +        return this;
  62.169 +    }
  62.170 +
  62.171 +    public DPrinter treeTypes(boolean showTreeTypes) {
  62.172 +        this.showTreeTypes = showTreeTypes;
  62.173 +        return this;
  62.174 +    }
  62.175 +
  62.176 +    public DPrinter typeSymbolPrinter(Printer p) {
  62.177 +        printer = p;
  62.178 +        return this;
  62.179 +    }
  62.180 +
  62.181 +    // </editor-fold>
  62.182 +
  62.183 +    // <editor-fold defaultstate="collapsed" desc="Printing">
  62.184 +
  62.185 +    protected enum Details {
  62.186 +        /** A one-line non-recursive summary */
  62.187 +        SUMMARY,
  62.188 +        /** Multi-line, possibly recursive. */
  62.189 +        FULL
  62.190 +    };
  62.191 +
  62.192 +    public void printAnnotations(String label, Annotations annotations) {
  62.193 +        printAnnotations(label, annotations, Details.FULL);
  62.194 +    }
  62.195 +
  62.196 +    protected void printAnnotations(String label, Annotations annotations, Details details) {
  62.197 +        if (annotations == null) {
  62.198 +            printNull(label);
  62.199 +        } else {
  62.200 +            // no SUMMARY format currently available to use
  62.201 +
  62.202 +            // use reflection to get at private fields
  62.203 +            Object DECL_NOT_STARTED = getField(null, Annotations.class, "DECL_NOT_STARTED");
  62.204 +            Object DECL_IN_PROGRESS = getField(null, Annotations.class, "DECL_IN_PROGRESS");
  62.205 +            Object attributes = getField(annotations, Annotations.class, "attributes");
  62.206 +            Object type_attributes = getField(annotations, Annotations.class, "type_attributes");
  62.207 +
  62.208 +            if (!showEmptyItems) {
  62.209 +                if (attributes instanceof List && ((List) attributes).isEmpty()
  62.210 +                        && attributes != DECL_NOT_STARTED
  62.211 +                        && attributes != DECL_IN_PROGRESS
  62.212 +                        && type_attributes instanceof List && ((List) type_attributes).isEmpty())
  62.213 +                    return;
  62.214 +            }
  62.215 +
  62.216 +            printString(label, hashString(annotations));
  62.217 +
  62.218 +            indent(+1);
  62.219 +            if (attributes == DECL_NOT_STARTED)
  62.220 +                printString("attributes", "DECL_NOT_STARTED");
  62.221 +            else if (attributes == DECL_IN_PROGRESS)
  62.222 +                printString("attributes", "DECL_IN_PROGRESS");
  62.223 +            else if (attributes instanceof List)
  62.224 +                printList("attributes", (List) attributes);
  62.225 +            else
  62.226 +                printObject("attributes", attributes, Details.SUMMARY);
  62.227 +
  62.228 +            if (attributes instanceof List)
  62.229 +                printList("type_attributes", (List) type_attributes);
  62.230 +            else
  62.231 +                printObject("type_attributes", type_attributes, Details.SUMMARY);
  62.232 +            indent(-1);
  62.233 +        }
  62.234 +    }
  62.235 +
  62.236 +    public void printAttribute(String label, Attribute attr) {
  62.237 +        if (attr == null) {
  62.238 +            printNull(label);
  62.239 +        } else {
  62.240 +            printString(label, attr.getClass().getSimpleName());
  62.241 +
  62.242 +            indent(+1);
  62.243 +            attr.accept(attrVisitor);
  62.244 +            indent(-1);
  62.245 +        }
  62.246 +    }
  62.247 +
  62.248 +    public void printFileObject(String label, FileObject fo) {
  62.249 +        if (fo == null) {
  62.250 +            printNull(label);
  62.251 +        } else {
  62.252 +            printString(label, fo.getName());
  62.253 +        }
  62.254 +    }
  62.255 +
  62.256 +    protected <T> void printImplClass(T item, Class<? extends T> stdImplClass) {
  62.257 +        if (item.getClass() != stdImplClass)
  62.258 +            printString("impl", item.getClass().getName());
  62.259 +    }
  62.260 +
  62.261 +    public void printInt(String label, int i) {
  62.262 +        printString(label, String.valueOf(i));
  62.263 +    }
  62.264 +
  62.265 +    public void printList(String label, List<?> list) {
  62.266 +        if (list == null) {
  62.267 +             printNull(label);
  62.268 +        } else if (!list.isEmpty() || showEmptyItems) {
  62.269 +            printString(label, "[" + list.size() + "]");
  62.270 +
  62.271 +            indent(+1);
  62.272 +            int i = 0;
  62.273 +            for (Object item: list) {
  62.274 +                printObject(String.valueOf(i++), item, Details.FULL);
  62.275 +            }
  62.276 +            indent(-1);
  62.277 +        }
  62.278 +    }
  62.279 +
  62.280 +    public void printName(String label, Name name) {
  62.281 +        if (name == null) {
  62.282 +            printNull(label);
  62.283 +        } else {
  62.284 +            printString(label, name.toString());
  62.285 +        }
  62.286 +    }
  62.287 +
  62.288 +    public void printNull(String label) {
  62.289 +        if (showNulls)
  62.290 +            printString(label, NULL);
  62.291 +    }
  62.292 +
  62.293 +    protected void printObject(String label, Object item, Details details) {
  62.294 +        if (item == null) {
  62.295 +            printNull(label);
  62.296 +        } else if (item instanceof Attribute) {
  62.297 +            printAttribute(label, (Attribute) item);
  62.298 +        } else if (item instanceof Symbol) {
  62.299 +            printSymbol(label, (Symbol) item, details);
  62.300 +        } else if (item instanceof Type) {
  62.301 +            printType(label, (Type) item, details);
  62.302 +        } else if (item instanceof JCTree) {
  62.303 +            printTree(label, (JCTree) item);
  62.304 +        } else if (item instanceof List) {
  62.305 +            printList(label, (List) item);
  62.306 +        } else if (item instanceof Name) {
  62.307 +            printName(label, (Name) item);
  62.308 +        } else {
  62.309 +            printString(label, String.valueOf(item));
  62.310 +        }
  62.311 +    }
  62.312 +
  62.313 +    public void printScope(String label, Scope scope) {
  62.314 +        printScope(label, scope, Details.FULL);
  62.315 +    }
  62.316 +
  62.317 +    public void printScope(String label, Scope scope, Details details) {
  62.318 +        if (scope == null) {
  62.319 +            printNull(label);
  62.320 +        } else {
  62.321 +            switch (details) {
  62.322 +                case SUMMARY: {
  62.323 +                    indent();
  62.324 +                    out.print(label);
  62.325 +                    out.print(": [");
  62.326 +                    String sep = "";
  62.327 +                    for (Symbol sym: scope.getElements()) {
  62.328 +                        out.print(sep);
  62.329 +                        out.print(sym.name);
  62.330 +                        sep = ",";
  62.331 +                    }
  62.332 +                    out.println("]");
  62.333 +                    break;
  62.334 +                }
  62.335 +
  62.336 +                case FULL: {
  62.337 +                    indent();
  62.338 +                    out.println(label);
  62.339 +
  62.340 +                    indent(+1);
  62.341 +                    printImplClass(scope, Scope.class);
  62.342 +                    printSymbol("owner", scope.owner, Details.SUMMARY);
  62.343 +                    printScope("next", scope.next, Details.SUMMARY);
  62.344 +                    printObject("shared", getField(scope, Scope.class, "shared"), Details.SUMMARY);
  62.345 +                    if (scope instanceof CompoundScope) {
  62.346 +                        printObject("subScopes",
  62.347 +                                getField(scope, CompoundScope.class, "subScopes"),
  62.348 +                                Details.FULL);
  62.349 +                    } else {
  62.350 +                        for (Symbol sym : scope.getElements()) {
  62.351 +                            printSymbol(sym.name.toString(), sym, Details.SUMMARY);
  62.352 +                        }
  62.353 +                    }
  62.354 +                    indent(-1);
  62.355 +                    break;
  62.356 +                }
  62.357 +            }
  62.358 +        }
  62.359 +    }
  62.360 +
  62.361 +    public void printSource(String label, JCTree tree) {
  62.362 +        printString(label, Pretty.toSimpleString(tree, maxSrcLength));
  62.363 +    }
  62.364 +
  62.365 +    public void printString(String label, String text) {
  62.366 +        indent();
  62.367 +        out.print(label);
  62.368 +        out.print(": ");
  62.369 +        out.print(text);
  62.370 +        out.println();
  62.371 +    }
  62.372 +
  62.373 +    public void printSymbol(String label, Symbol symbol) {
  62.374 +        printSymbol(label, symbol, Details.FULL);
  62.375 +    }
  62.376 +
  62.377 +    protected void printSymbol(String label, Symbol sym, Details details) {
  62.378 +        if (sym == null) {
  62.379 +            printNull(label);
  62.380 +        } else {
  62.381 +            switch (details) {
  62.382 +            case SUMMARY:
  62.383 +                printString(label, toString(sym));
  62.384 +                break;
  62.385 +
  62.386 +            case FULL:
  62.387 +                indent();
  62.388 +                out.print(label);
  62.389 +                out.println(": " +
  62.390 +                        info(sym.getClass(),
  62.391 +                            String.format("0x%x--%s", sym.kind, Kinds.kindName(sym)),
  62.392 +                            sym.getKind())
  62.393 +                        + " " + sym.name
  62.394 +                        + " " + hashString(sym));
  62.395 +
  62.396 +                indent(+1);
  62.397 +                if (showSrc) {
  62.398 +                    JCTree tree = (JCTree) trees.getTree(sym);
  62.399 +                    if (tree != null)
  62.400 +                        printSource("src", tree);
  62.401 +                }
  62.402 +                printString("flags", String.format("0x%x--%s",
  62.403 +                        sym.flags_field, Flags.toString(sym.flags_field)));
  62.404 +                printObject("completer", sym.completer, Details.SUMMARY); // what if too long?
  62.405 +                printSymbol("owner", sym.owner, Details.SUMMARY);
  62.406 +                printType("type", sym.type, Details.SUMMARY);
  62.407 +                printType("erasure", sym.erasure_field, Details.SUMMARY);
  62.408 +                sym.accept(symVisitor, null);
  62.409 +                printAnnotations("annotations", sym.annotations, Details.SUMMARY);
  62.410 +                indent(-1);
  62.411 +            }
  62.412 +        }
  62.413 +    }
  62.414 +
  62.415 +    protected String toString(Symbol sym) {
  62.416 +        return (printer != null) ? printer.visit(sym, locale) : String.valueOf(sym);
  62.417 +    }
  62.418 +
  62.419 +    protected void printTree(String label, JCTree tree) {
  62.420 +        if (tree == null) {
  62.421 +            printNull(label);
  62.422 +        } else {
  62.423 +            indent();
  62.424 +            String ext;
  62.425 +            try {
  62.426 +                ext = tree.getKind().name();
  62.427 +            } catch (Throwable t) {
  62.428 +                ext = "n/a";
  62.429 +            }
  62.430 +            out.print(label + ": " + info(tree.getClass(), tree.getTag(), ext));
  62.431 +            if (showPositions) {
  62.432 +                // We can always get start position, but to get end position
  62.433 +                // and/or line+offset, we would need a JCCompilationUnit
  62.434 +                out.print(" pos:" + tree.pos);
  62.435 +            }
  62.436 +            if (showTreeTypes && tree.type != null)
  62.437 +                out.print(" type:" + toString(tree.type));
  62.438 +            Symbol sym;
  62.439 +            if (showTreeSymbols && (sym = TreeInfo.symbolFor(tree)) != null)
  62.440 +                out.print(" sym:" + toString(sym));
  62.441 +            out.println();
  62.442 +
  62.443 +            indent(+1);
  62.444 +            if (showSrc) {
  62.445 +                indent();
  62.446 +                out.println("src: " + Pretty.toSimpleString(tree, maxSrcLength));
  62.447 +            }
  62.448 +            tree.accept(treeVisitor);
  62.449 +            indent(-1);
  62.450 +        }
  62.451 +    }
  62.452 +
  62.453 +    public void printType(String label, Type type) {
  62.454 +        printType(label, type, Details.FULL);
  62.455 +    }
  62.456 +
  62.457 +    protected void printType(String label, Type type, Details details) {
  62.458 +        if (type == null)
  62.459 +            printNull(label);
  62.460 +        else {
  62.461 +            switch (details) {
  62.462 +                case SUMMARY:
  62.463 +                    printString(label, toString(type));
  62.464 +                    break;
  62.465 +
  62.466 +                case FULL:
  62.467 +                    indent();
  62.468 +                    out.print(label);
  62.469 +                    out.println(": " + info(type.getClass(), type.getTag(), type.getKind())
  62.470 +                            + " " + hashString(type));
  62.471 +
  62.472 +                    indent(+1);
  62.473 +                    printSymbol("tsym", type.tsym, Details.SUMMARY);
  62.474 +                    printObject("constValue", type.constValue(), Details.SUMMARY);
  62.475 +                    type.accept(typeVisitor, null);
  62.476 +                    indent(-1);
  62.477 +            }
  62.478 +        }
  62.479 +    }
  62.480 +
  62.481 +    protected String toString(Type type) {
  62.482 +        return (printer != null) ? printer.visit(type, locale) : String.valueOf(type);
  62.483 +    }
  62.484 +
  62.485 +    protected String hashString(Object obj) {
  62.486 +        return String.format("#%x", obj.hashCode());
  62.487 +    }
  62.488 +
  62.489 +    protected String info(Class<?> clazz, Object internal, Object external) {
  62.490 +        return String.format("%s,%s,%s", clazz.getSimpleName(), internal, external);
  62.491 +    }
  62.492 +
  62.493 +    private int indent = 0;
  62.494 +
  62.495 +    protected void indent() {
  62.496 +        for (int i = 0; i < indent; i++) {
  62.497 +            out.print("  ");
  62.498 +        }
  62.499 +    }
  62.500 +
  62.501 +    protected void indent(int n) {
  62.502 +        indent += n;
  62.503 +    }
  62.504 +
  62.505 +    protected Object getField(Object o, Class<?> clazz, String name) {
  62.506 +        try {
  62.507 +            Field f = clazz.getDeclaredField(name);
  62.508 +            boolean prev = f.isAccessible();
  62.509 +            f.setAccessible(true);
  62.510 +            try {
  62.511 +                return f.get(o);
  62.512 +            } finally {
  62.513 +                f.setAccessible(prev);
  62.514 +            }
  62.515 +        } catch (ReflectiveOperationException e) {
  62.516 +            return e;
  62.517 +        } catch (SecurityException e) {
  62.518 +            return e;
  62.519 +        }
  62.520 +    }
  62.521 +
  62.522 +    // </editor-fold>
  62.523 +
  62.524 +    // <editor-fold defaultstate="collapsed" desc="JCTree visitor methods">
  62.525 +
  62.526 +    protected JCTree.Visitor treeVisitor = new TreeVisitor();
  62.527 +
  62.528 +    /**
  62.529 +     * Default visitor class for JCTree (AST) objects.
  62.530 +     */
  62.531 +    public class TreeVisitor extends JCTree.Visitor {
  62.532 +        @Override
  62.533 +        public void visitTopLevel(JCCompilationUnit tree) {
  62.534 +            printList("packageAnnotations", tree.packageAnnotations);
  62.535 +            printTree("pid", tree.pid);
  62.536 +            printList("defs", tree.defs);
  62.537 +        }
  62.538 +
  62.539 +        @Override
  62.540 +        public void visitImport(JCImport tree) {
  62.541 +            printTree("qualid", tree.qualid);
  62.542 +        }
  62.543 +
  62.544 +        @Override
  62.545 +        public void visitClassDef(JCClassDecl tree) {
  62.546 +            printName("name", tree.name);
  62.547 +            printTree("mods", tree.mods);
  62.548 +            printList("typarams", tree.typarams);
  62.549 +            printTree("extending", tree.extending);
  62.550 +            printList("implementing", tree.implementing);
  62.551 +            printList("defs", tree.defs);
  62.552 +        }
  62.553 +
  62.554 +        @Override
  62.555 +        public void visitMethodDef(JCMethodDecl tree) {
  62.556 +            printName("name", tree.name);
  62.557 +            printTree("mods", tree.mods);
  62.558 +            printTree("restype", tree.restype);
  62.559 +            printList("typarams", tree.typarams);
  62.560 +            printTree("recvparam", tree.recvparam);
  62.561 +            printList("params", tree.params);
  62.562 +            printList("thrown", tree.thrown);
  62.563 +            printTree("defaultValue", tree.defaultValue);
  62.564 +            printTree("body", tree.body);
  62.565 +        }
  62.566 +
  62.567 +        @Override
  62.568 +        public void visitVarDef(JCVariableDecl tree) {
  62.569 +            printName("name", tree.name);
  62.570 +            printTree("mods", tree.mods);
  62.571 +            printTree("vartype", tree.vartype);
  62.572 +            printTree("init", tree.init);
  62.573 +        }
  62.574 +
  62.575 +        @Override
  62.576 +        public void visitSkip(JCSkip tree) {
  62.577 +        }
  62.578 +
  62.579 +        @Override
  62.580 +        public void visitBlock(JCBlock tree) {
  62.581 +            printList("stats", tree.stats);
  62.582 +        }
  62.583 +
  62.584 +        @Override
  62.585 +        public void visitDoLoop(JCDoWhileLoop tree) {
  62.586 +            printTree("body", tree.body);
  62.587 +            printTree("cond", tree.cond);
  62.588 +        }
  62.589 +
  62.590 +        @Override
  62.591 +        public void visitWhileLoop(JCWhileLoop tree) {
  62.592 +            printTree("cond", tree.cond);
  62.593 +            printTree("body", tree.body);
  62.594 +        }
  62.595 +
  62.596 +        @Override
  62.597 +        public void visitForLoop(JCForLoop tree) {
  62.598 +            printList("init", tree.init);
  62.599 +            printTree("cond", tree.cond);
  62.600 +            printList("step", tree.step);
  62.601 +            printTree("body", tree.body);
  62.602 +        }
  62.603 +
  62.604 +        @Override
  62.605 +        public void visitForeachLoop(JCEnhancedForLoop tree) {
  62.606 +            printTree("var", tree.var);
  62.607 +            printTree("expr", tree.expr);
  62.608 +            printTree("body", tree.body);
  62.609 +        }
  62.610 +
  62.611 +        @Override
  62.612 +        public void visitLabelled(JCLabeledStatement tree) {
  62.613 +            printTree("body", tree.body);
  62.614 +        }
  62.615 +
  62.616 +        @Override
  62.617 +        public void visitSwitch(JCSwitch tree) {
  62.618 +            printTree("selector", tree.selector);
  62.619 +            printList("cases", tree.cases);
  62.620 +        }
  62.621 +
  62.622 +        @Override
  62.623 +        public void visitCase(JCCase tree) {
  62.624 +            printTree("pat", tree.pat);
  62.625 +            printList("stats", tree.stats);
  62.626 +        }
  62.627 +
  62.628 +        @Override
  62.629 +        public void visitSynchronized(JCSynchronized tree) {
  62.630 +            printTree("lock", tree.lock);
  62.631 +            printTree("body", tree.body);
  62.632 +        }
  62.633 +
  62.634 +        @Override
  62.635 +        public void visitTry(JCTry tree) {
  62.636 +            printList("resources", tree.resources);
  62.637 +            printTree("body", tree.body);
  62.638 +            printList("catchers", tree.catchers);
  62.639 +            printTree("finalizer", tree.finalizer);
  62.640 +        }
  62.641 +
  62.642 +        @Override
  62.643 +        public void visitCatch(JCCatch tree) {
  62.644 +            printTree("param", tree.param);
  62.645 +            printTree("body", tree.body);
  62.646 +        }
  62.647 +
  62.648 +        @Override
  62.649 +        public void visitConditional(JCConditional tree) {
  62.650 +            printTree("cond", tree.cond);
  62.651 +            printTree("truepart", tree.truepart);
  62.652 +            printTree("falsepart", tree.falsepart);
  62.653 +        }
  62.654 +
  62.655 +        @Override
  62.656 +        public void visitIf(JCIf tree) {
  62.657 +            printTree("cond", tree.cond);
  62.658 +            printTree("thenpart", tree.thenpart);
  62.659 +            printTree("elsepart", tree.elsepart);
  62.660 +        }
  62.661 +
  62.662 +        @Override
  62.663 +        public void visitExec(JCExpressionStatement tree) {
  62.664 +            printTree("expr", tree.expr);
  62.665 +        }
  62.666 +
  62.667 +        @Override
  62.668 +        public void visitBreak(JCBreak tree) {
  62.669 +            printName("label", tree.label);
  62.670 +        }
  62.671 +
  62.672 +        @Override
  62.673 +        public void visitContinue(JCContinue tree) {
  62.674 +            printName("label", tree.label);
  62.675 +        }
  62.676 +
  62.677 +        @Override
  62.678 +        public void visitReturn(JCReturn tree) {
  62.679 +            printTree("expr", tree.expr);
  62.680 +        }
  62.681 +
  62.682 +        @Override
  62.683 +        public void visitThrow(JCThrow tree) {
  62.684 +            printTree("expr", tree.expr);
  62.685 +        }
  62.686 +
  62.687 +        @Override
  62.688 +        public void visitAssert(JCAssert tree) {
  62.689 +            printTree("cond", tree.cond);
  62.690 +            printTree("detail", tree.detail);
  62.691 +        }
  62.692 +
  62.693 +        @Override
  62.694 +        public void visitApply(JCMethodInvocation tree) {
  62.695 +            printList("typeargs", tree.typeargs);
  62.696 +            printTree("meth", tree.meth);
  62.697 +            printList("args", tree.args);
  62.698 +        }
  62.699 +
  62.700 +        @Override
  62.701 +        public void visitNewClass(JCNewClass tree) {
  62.702 +            printTree("encl", tree.encl);
  62.703 +            printList("typeargs", tree.typeargs);
  62.704 +            printTree("clazz", tree.clazz);
  62.705 +            printList("args", tree.args);
  62.706 +            printTree("def", tree.def);
  62.707 +        }
  62.708 +
  62.709 +        @Override
  62.710 +        public void visitNewArray(JCNewArray tree) {
  62.711 +            printList("annotations", tree.annotations);
  62.712 +            printTree("elemtype", tree.elemtype);
  62.713 +            printList("dims", tree.dims);
  62.714 +            printList("dimAnnotations", tree.dimAnnotations);
  62.715 +            printList("elems", tree.elems);
  62.716 +        }
  62.717 +
  62.718 +        @Override
  62.719 +        public void visitLambda(JCLambda tree) {
  62.720 +            printTree("body", tree.body);
  62.721 +            printList("params", tree.params);
  62.722 +        }
  62.723 +
  62.724 +        @Override
  62.725 +        public void visitParens(JCParens tree) {
  62.726 +            printTree("expr", tree.expr);
  62.727 +        }
  62.728 +
  62.729 +        @Override
  62.730 +        public void visitAssign(JCAssign tree) {
  62.731 +            printTree("lhs", tree.lhs);
  62.732 +            printTree("rhs", tree.rhs);
  62.733 +        }
  62.734 +
  62.735 +        @Override
  62.736 +        public void visitAssignop(JCAssignOp tree) {
  62.737 +            printTree("lhs", tree.lhs);
  62.738 +            printTree("rhs", tree.rhs);
  62.739 +        }
  62.740 +
  62.741 +        @Override
  62.742 +        public void visitUnary(JCUnary tree) {
  62.743 +            printTree("arg", tree.arg);
  62.744 +        }
  62.745 +
  62.746 +        @Override
  62.747 +        public void visitBinary(JCBinary tree) {
  62.748 +            printTree("lhs", tree.lhs);
  62.749 +            printTree("rhs", tree.rhs);
  62.750 +        }
  62.751 +
  62.752 +        @Override
  62.753 +        public void visitTypeCast(JCTypeCast tree) {
  62.754 +            printTree("clazz", tree.clazz);
  62.755 +            printTree("expr", tree.expr);
  62.756 +        }
  62.757 +
  62.758 +        @Override
  62.759 +        public void visitTypeTest(JCInstanceOf tree) {
  62.760 +            printTree("expr", tree.expr);
  62.761 +            printTree("clazz", tree.clazz);
  62.762 +        }
  62.763 +
  62.764 +        @Override
  62.765 +        public void visitIndexed(JCArrayAccess tree) {
  62.766 +            printTree("indexed", tree.indexed);
  62.767 +            printTree("index", tree.index);
  62.768 +        }
  62.769 +
  62.770 +        @Override
  62.771 +        public void visitSelect(JCFieldAccess tree) {
  62.772 +            printTree("selected", tree.selected);
  62.773 +        }
  62.774 +
  62.775 +        @Override
  62.776 +        public void visitReference(JCMemberReference tree) {
  62.777 +            printTree("expr", tree.expr);
  62.778 +            printList("typeargs", tree.typeargs);
  62.779 +        }
  62.780 +
  62.781 +        @Override
  62.782 +        public void visitIdent(JCIdent tree) {
  62.783 +            printName("name", tree.name);
  62.784 +        }
  62.785 +
  62.786 +        @Override
  62.787 +        public void visitLiteral(JCLiteral tree) {
  62.788 +            printString("value", Pretty.toSimpleString(tree, 32));
  62.789 +        }
  62.790 +
  62.791 +        @Override
  62.792 +        public void visitTypeIdent(JCPrimitiveTypeTree tree) {
  62.793 +            printString("typetag", tree.typetag.name());
  62.794 +        }
  62.795 +
  62.796 +        @Override
  62.797 +        public void visitTypeArray(JCArrayTypeTree tree) {
  62.798 +            printTree("elemtype", tree.elemtype);
  62.799 +        }
  62.800 +
  62.801 +        @Override
  62.802 +        public void visitTypeApply(JCTypeApply tree) {
  62.803 +            printTree("clazz", tree.clazz);
  62.804 +            printList("arguments", tree.arguments);
  62.805 +        }
  62.806 +
  62.807 +        @Override
  62.808 +        public void visitTypeUnion(JCTypeUnion tree) {
  62.809 +            printList("alternatives", tree.alternatives);
  62.810 +        }
  62.811 +
  62.812 +        @Override
  62.813 +        public void visitTypeIntersection(JCTypeIntersection tree) {
  62.814 +            printList("bounds", tree.bounds);
  62.815 +        }
  62.816 +
  62.817 +        @Override
  62.818 +        public void visitTypeParameter(JCTypeParameter tree) {
  62.819 +            printName("name", tree.name);
  62.820 +            printList("annotations", tree.annotations);
  62.821 +            printList("bounds", tree.bounds);
  62.822 +        }
  62.823 +
  62.824 +        @Override
  62.825 +        public void visitWildcard(JCWildcard tree) {
  62.826 +            printTree("kind", tree.kind);
  62.827 +            printTree("inner", tree.inner);
  62.828 +        }
  62.829 +
  62.830 +        @Override
  62.831 +        public void visitTypeBoundKind(TypeBoundKind tree) {
  62.832 +            printString("kind", tree.kind.name());
  62.833 +        }
  62.834 +
  62.835 +        @Override
  62.836 +        public void visitModifiers(JCModifiers tree) {
  62.837 +            printList("annotations", tree.annotations);
  62.838 +            printString("flags", String.valueOf(Flags.asFlagSet(tree.flags)));
  62.839 +        }
  62.840 +
  62.841 +        @Override
  62.842 +        public void visitAnnotation(JCAnnotation tree) {
  62.843 +            printTree("annotationType", tree.annotationType);
  62.844 +            printList("args", tree.args);
  62.845 +        }
  62.846 +
  62.847 +        @Override
  62.848 +        public void visitAnnotatedType(JCAnnotatedType tree) {
  62.849 +            printList("annotations", tree.annotations);
  62.850 +            printTree("underlyingType", tree.underlyingType);
  62.851 +        }
  62.852 +
  62.853 +        @Override
  62.854 +        public void visitErroneous(JCErroneous tree) {
  62.855 +            printList("errs", tree.errs);
  62.856 +        }
  62.857 +
  62.858 +        @Override
  62.859 +        public void visitLetExpr(LetExpr tree) {
  62.860 +            printList("defs", tree.defs);
  62.861 +            printTree("expr", tree.expr);
  62.862 +        }
  62.863 +
  62.864 +        @Override
  62.865 +        public void visitTree(JCTree tree) {
  62.866 +            Assert.error();
  62.867 +        }
  62.868 +    }
  62.869 +
  62.870 +    // </editor-fold>
  62.871 +
  62.872 +    // <editor-fold defaultstate="collapsed" desc="Symbol visitor">
  62.873 +
  62.874 +    protected Symbol.Visitor<Void,Void> symVisitor = new SymbolVisitor();
  62.875 +
  62.876 +    /**
  62.877 +     * Default visitor class for Symbol objects.
  62.878 +     * Note: each visitXYZ method ends by calling the corresponding
  62.879 +     * visit method for its superclass.
  62.880 +     */
  62.881 +    class SymbolVisitor implements Symbol.Visitor<Void,Void> {
  62.882 +        @Override
  62.883 +        public Void visitClassSymbol(ClassSymbol sym, Void ignore) {
  62.884 +            printName("fullname", sym.fullname);
  62.885 +            printName("flatname", sym.flatname);
  62.886 +            printScope("members", sym.members_field);
  62.887 +            printFileObject("sourcefile", sym.sourcefile);
  62.888 +            printFileObject("classfile", sym.classfile);
  62.889 +            // trans-local?
  62.890 +            // pool?
  62.891 +            return visitTypeSymbol(sym, null);
  62.892 +        }
  62.893 +
  62.894 +        @Override
  62.895 +        public Void visitMethodSymbol(MethodSymbol sym, Void ignore) {
  62.896 +            // code
  62.897 +            printList("params", sym.params);
  62.898 +            printList("savedParameterNames", sym.savedParameterNames);
  62.899 +            return visitSymbol(sym, null);
  62.900 +        }
  62.901 +
  62.902 +        @Override
  62.903 +        public Void visitPackageSymbol(PackageSymbol sym, Void ignore) {
  62.904 +            printName("fullname", sym.fullname);
  62.905 +            printScope("members", sym.members_field);
  62.906 +            printSymbol("package-info", sym.package_info, Details.SUMMARY);
  62.907 +            return visitTypeSymbol(sym, null);
  62.908 +        }
  62.909 +
  62.910 +        @Override
  62.911 +        public Void visitOperatorSymbol(OperatorSymbol sym, Void ignore) {
  62.912 +            printInt("opcode", sym.opcode);
  62.913 +            return visitMethodSymbol(sym, null);
  62.914 +        }
  62.915 +
  62.916 +        @Override
  62.917 +        public Void visitVarSymbol(VarSymbol sym, Void ignore) {
  62.918 +            printInt("pos", sym.pos);
  62.919 +            printInt("adm", sym.adr);
  62.920 +            // data is a private field, and the standard accessors may
  62.921 +            // mutate it as part of lazy evaluation. Therefore, use
  62.922 +            // reflection to get the raw data.
  62.923 +            printObject("data", getField(sym, VarSymbol.class, "data"), Details.SUMMARY);
  62.924 +            return visitSymbol(sym, null);
  62.925 +        }
  62.926 +
  62.927 +        @Override
  62.928 +        public Void visitTypeSymbol(TypeSymbol sym, Void ignore) {
  62.929 +            return visitSymbol(sym, null);
  62.930 +        }
  62.931 +
  62.932 +        @Override
  62.933 +        public Void visitSymbol(Symbol sym, Void ignore) {
  62.934 +            return null;
  62.935 +        }
  62.936 +    }
  62.937 +
  62.938 +    // </editor-fold>
  62.939 +
  62.940 +    // <editor-fold defaultstate="collapsed" desc="Type visitor">
  62.941 +
  62.942 +    protected Type.Visitor<Void,Void> typeVisitor = new TypeVisitor();
  62.943 +
  62.944 +    /**
  62.945 +     * Default visitor class for Type objects.
  62.946 +     * Note: each visitXYZ method ends by calling the corresponding
  62.947 +     * visit method for its superclass.
  62.948 +     */
  62.949 +    public class TypeVisitor implements Type.Visitor<Void,Void> {
  62.950 +        public Void visitAnnotatedType(AnnotatedType type, Void ignore) {
  62.951 +            printList("typeAnnotations", type.typeAnnotations);
  62.952 +            printType("underlyingType", type.underlyingType, Details.FULL);
  62.953 +            return visitType(type, null);
  62.954 +        }
  62.955 +
  62.956 +        public Void visitArrayType(ArrayType type, Void ignore) {
  62.957 +            printType("elemType", type.elemtype, Details.FULL);
  62.958 +            return visitType(type, null);
  62.959 +        }
  62.960 +
  62.961 +        public Void visitCapturedType(CapturedType type, Void ignore) {
  62.962 +            printType("wildcard", type.wildcard, Details.FULL);
  62.963 +            return visitTypeVar(type, null);
  62.964 +        }
  62.965 +
  62.966 +        public Void visitClassType(ClassType type, Void ignore) {
  62.967 +            printType("outer", type.getEnclosingType(), Details.SUMMARY);
  62.968 +            printList("typarams", type.typarams_field);
  62.969 +            printList("allparams", type.allparams_field);
  62.970 +            printType("supertype", type.supertype_field, Details.SUMMARY);
  62.971 +            printList("interfaces", type.interfaces_field);
  62.972 +            printList("allinterfaces", type.all_interfaces_field);
  62.973 +            return visitType(type, null);
  62.974 +        }
  62.975 +
  62.976 +        public Void visitErrorType(ErrorType type, Void ignore) {
  62.977 +            printType("originalType", type.getOriginalType(), Details.FULL);
  62.978 +            return visitClassType(type, null);
  62.979 +        }
  62.980 +
  62.981 +        public Void visitForAll(ForAll type, Void ignore) {
  62.982 +            printList("tvars", type.tvars);
  62.983 +            return visitDelegatedType(type);
  62.984 +        }
  62.985 +
  62.986 +        public Void visitMethodType(MethodType type, Void ignore) {
  62.987 +            printList("argtypes", type.argtypes);
  62.988 +            printType("restype", type.restype, Details.FULL);
  62.989 +            printList("thrown", type.thrown);
  62.990 +            return visitType(type, null);
  62.991 +        }
  62.992 +
  62.993 +        public Void visitPackageType(PackageType type, Void ignore) {
  62.994 +            return visitType(type, null);
  62.995 +        }
  62.996 +
  62.997 +        public Void visitTypeVar(TypeVar type, Void ignore) {
  62.998 +            // For TypeVars (and not subtypes), the bound should always be
  62.999 +            // null or bot. So, only print the bound for subtypes of TypeVar,
 62.1000 +            // or if the bound is (erroneously) not null or bot.
 62.1001 +            if (!type.hasTag(TypeTag.TYPEVAR)
 62.1002 +                    || !(type.bound == null || type.bound.hasTag(TypeTag.BOT))) {
 62.1003 +                printType("bound", type.bound, Details.FULL);
 62.1004 +            }
 62.1005 +            printType("lower", type.lower, Details.FULL);
 62.1006 +            return visitType(type, null);
 62.1007 +        }
 62.1008 +
 62.1009 +        public Void visitUndetVar(UndetVar type, Void ignore) {
 62.1010 +            for (UndetVar.InferenceBound ib: UndetVar.InferenceBound.values())
 62.1011 +                printList("bounds." + ib, type.getBounds(ib));
 62.1012 +            printType("inst", type.inst, Details.SUMMARY);
 62.1013 +            return visitDelegatedType(type);
 62.1014 +        }
 62.1015 +
 62.1016 +        public Void visitWildcardType(WildcardType type, Void ignore) {
 62.1017 +            printType("type", type.type, Details.SUMMARY);
 62.1018 +            printString("kind", type.kind.name());
 62.1019 +            printType("bound", type.bound, Details.SUMMARY);
 62.1020 +            return visitType(type, null);
 62.1021 +        }
 62.1022 +
 62.1023 +        protected Void visitDelegatedType(DelegatedType type) {
 62.1024 +            printType("qtype", type.qtype, Details.FULL);
 62.1025 +            return visitType(type, null);
 62.1026 +        }
 62.1027 +
 62.1028 +        public Void visitType(Type type, Void ignore) {
 62.1029 +            return null;
 62.1030 +        }
 62.1031 +    }
 62.1032 +
 62.1033 +    // </editor-fold>
 62.1034 +
 62.1035 +    // <editor-fold defaultstate="collapsed" desc="Attribute (annotations) visitor">
 62.1036 +
 62.1037 +    protected Attribute.Visitor attrVisitor = new AttributeVisitor();
 62.1038 +
 62.1039 +    /**
 62.1040 +     * Default visitor class for Attribute (annotation) objects.
 62.1041 +     */
 62.1042 +    public class AttributeVisitor implements Attribute.Visitor {
 62.1043 +
 62.1044 +        public void visitConstant(Attribute.Constant a) {
 62.1045 +            printObject("value", a.value, Details.SUMMARY);
 62.1046 +            visitAttribute(a);
 62.1047 +        }
 62.1048 +
 62.1049 +        public void visitClass(Attribute.Class a) {
 62.1050 +            printObject("classType", a.classType, Details.SUMMARY);
 62.1051 +            visitAttribute(a);
 62.1052 +        }
 62.1053 +
 62.1054 +        public void visitCompound(Attribute.Compound a) {
 62.1055 +            if (a instanceof Attribute.TypeCompound) {
 62.1056 +                Attribute.TypeCompound ta = (Attribute.TypeCompound) a;
 62.1057 +                // consider a custom printer?
 62.1058 +                printObject("position", ta.position, Details.SUMMARY);
 62.1059 +            }
 62.1060 +            printObject("synthesized", a.isSynthesized(), Details.SUMMARY);
 62.1061 +            printList("values", a.values);
 62.1062 +            visitAttribute(a);
 62.1063 +        }
 62.1064 +
 62.1065 +        public void visitArray(Attribute.Array a) {
 62.1066 +            printList("values", Arrays.asList(a.values));
 62.1067 +            visitAttribute(a);
 62.1068 +        }
 62.1069 +
 62.1070 +        public void visitEnum(Attribute.Enum a) {
 62.1071 +            printSymbol("value", a.value, Details.SUMMARY);
 62.1072 +            visitAttribute(a);
 62.1073 +        }
 62.1074 +
 62.1075 +        public void visitError(Attribute.Error a) {
 62.1076 +            visitAttribute(a);
 62.1077 +        }
 62.1078 +
 62.1079 +        public void visitAttribute(Attribute a) {
 62.1080 +            printType("type", a.type, Details.SUMMARY);
 62.1081 +        }
 62.1082 +
 62.1083 +    }
 62.1084 +    // </editor-fold>
 62.1085 +
 62.1086 +    // <editor-fold defaultstate="collapsed" desc="Utility front end">
 62.1087 +
 62.1088 +    /**
 62.1089 +     * Utility class to invoke DPrinter from the command line.
 62.1090 +     */
 62.1091 +    static class Main {
 62.1092 +        public static void main(String... args) throws IOException {
 62.1093 +            Main m = new Main();
 62.1094 +            PrintWriter out = new PrintWriter(System.out);
 62.1095 +            try {
 62.1096 +                if (args.length == 0)
 62.1097 +                    m.usage(out);
 62.1098 +                else
 62.1099 +                    m.run(out, args);
 62.1100 +            } finally {
 62.1101 +                out.flush();
 62.1102 +            }
 62.1103 +        }
 62.1104 +
 62.1105 +        void usage(PrintWriter out) {
 62.1106 +            out.println("Usage:");
 62.1107 +            out.println("  java " + Main.class.getName() + " mode [options] [javac-options]");
 62.1108 +            out.print("where mode is one of: ");
 62.1109 +            String sep = "";
 62.1110 +            for (Handler h: getHandlers().values()) {
 62.1111 +                out.print(sep);
 62.1112 +                out.print(h.name);
 62.1113 +                sep = ", ";
 62.1114 +            }
 62.1115 +            out.println();
 62.1116 +            out.println("and where options include:");
 62.1117 +            out.println("  -before PARSE|ENTER|ANALYZE|GENERATE|ANNOTATION_PROCESSING|ANNOTATION_PROCESSING_ROUND");
 62.1118 +            out.println("  -after PARSE|ENTER|ANALYZE|GENERATE|ANNOTATION_PROCESSING|ANNOTATION_PROCESSING_ROUND");
 62.1119 +            out.println("  -showPositions");
 62.1120 +            out.println("  -showSource");
 62.1121 +            out.println("  -showTreeSymbols");
 62.1122 +            out.println("  -showTreeTypes");
 62.1123 +            out.println("  -hideEmptyItems");
 62.1124 +            out.println("  -hideNulls");
 62.1125 +        }
 62.1126 +
 62.1127 +        void run(PrintWriter out, String... args) throws IOException {
 62.1128 +            JavaCompiler c = ToolProvider.getSystemJavaCompiler();
 62.1129 +            StandardJavaFileManager fm = c.getStandardFileManager(null, null, null);
 62.1130 +
 62.1131 +            // DPrinter options
 62.1132 +            final Set<TaskEvent.Kind> before = EnumSet.noneOf(TaskEvent.Kind.class);
 62.1133 +            final Set<TaskEvent.Kind> after = EnumSet.noneOf(TaskEvent.Kind.class);
 62.1134 +            boolean showPositions = false;
 62.1135 +            boolean showSource = false;
 62.1136 +            boolean showTreeSymbols = false;
 62.1137 +            boolean showTreeTypes = false;
 62.1138 +            boolean showEmptyItems = true;
 62.1139 +            boolean showNulls = true;
 62.1140 +
 62.1141 +            // javac options
 62.1142 +            Collection<String> options = new ArrayList<String>();
 62.1143 +            Collection<File> files = new ArrayList<File>();
 62.1144 +            String classpath = null;
 62.1145 +            String classoutdir = null;
 62.1146 +
 62.1147 +            final Handler h = getHandlers().get(args[0]);
 62.1148 +            if (h == null)
 62.1149 +                throw new IllegalArgumentException(args[0]);
 62.1150 +
 62.1151 +            for (int i = 1; i < args.length; i++) {
 62.1152 +                String arg = args[i];
 62.1153 +                if (arg.equals("-before") && i + 1 < args.length) {
 62.1154 +                    before.add(getKind(args[++i]));
 62.1155 +                } else if (arg.equals("-after") && i + 1 < args.length) {
 62.1156 +                    after.add(getKind(args[++i]));
 62.1157 +                } else if (arg.equals("-showPositions")) {
 62.1158 +                    showPositions = true;
 62.1159 +                } else if (arg.equals("-showSource")) {
 62.1160 +                    showSource = true;
 62.1161 +                } else if (arg.equals("-showTreeSymbols")) {
 62.1162 +                    showTreeSymbols = true;
 62.1163 +                } else if (arg.equals("-showTreeTypes")) {
 62.1164 +                    showTreeTypes = true;
 62.1165 +                } else if (arg.equals("-hideEmptyLists")) {
 62.1166 +                    showEmptyItems = false;
 62.1167 +                } else if (arg.equals("-hideNulls")) {
 62.1168 +                    showNulls = false;
 62.1169 +                } else if (arg.equals("-classpath") && i + 1 < args.length) {
 62.1170 +                    classpath = args[++i];
 62.1171 +                } else if (arg.equals("-d") && i + 1 < args.length) {
 62.1172 +                    classoutdir = args[++i];
 62.1173 +                } else if (arg.startsWith("-")) {
 62.1174 +                    int n = c.isSupportedOption(arg);
 62.1175 +                    if (n < 0) throw new IllegalArgumentException(arg);
 62.1176 +                    options.add(arg);
 62.1177 +                    while (n > 0) options.add(args[++i]);
 62.1178 +                } else if (arg.endsWith(".java")) {
 62.1179 +                    files.add(new File(arg));
 62.1180 +                }
 62.1181 +            }
 62.1182 +
 62.1183 +            if (classoutdir != null) {
 62.1184 +                fm.setLocation(StandardLocation.CLASS_OUTPUT, Arrays.asList(new File(classoutdir)));
 62.1185 +            }
 62.1186 +
 62.1187 +            if (classpath != null) {
 62.1188 +                Collection<File> path = new ArrayList<File>();
 62.1189 +                for (String p: classpath.split(File.pathSeparator)) {
 62.1190 +                    if (p.isEmpty()) continue;
 62.1191 +                    File f = new File(p);
 62.1192 +                    if (f.exists()) path.add(f);
 62.1193 +                }
 62.1194 +                fm.setLocation(StandardLocation.CLASS_PATH, path);
 62.1195 +            }
 62.1196 +            Iterable<? extends JavaFileObject> fos = fm.getJavaFileObjectsFromFiles(files);
 62.1197 +
 62.1198 +            JavacTask task = (JavacTask) c.getTask(out, fm, null, options, null, fos);
 62.1199 +            final Trees trees = Trees.instance(task);
 62.1200 +
 62.1201 +            final DPrinter dprinter = new DPrinter(out, trees);
 62.1202 +            dprinter.source(showSource)
 62.1203 +                    .emptyItems(showEmptyItems)
 62.1204 +                    .nulls(showNulls)
 62.1205 +                    .positions(showPositions)
 62.1206 +                    .treeSymbols(showTreeSymbols)
 62.1207 +                    .treeTypes(showTreeTypes);
 62.1208 +
 62.1209 +            if (before.isEmpty() && after.isEmpty()) {
 62.1210 +                if (h.name.equals("trees") && !showTreeSymbols && !showTreeTypes)
 62.1211 +                    after.add(TaskEvent.Kind.PARSE);
 62.1212 +                else
 62.1213 +                    after.add(TaskEvent.Kind.ANALYZE);
 62.1214 +            }
 62.1215 +
 62.1216 +            task.addTaskListener(new TaskListener() {
 62.1217 +                public void started(TaskEvent e) {
 62.1218 +                    if (before.contains(e.getKind()))
 62.1219 +                        handle(e);
 62.1220 +                }
 62.1221 +
 62.1222 +                public void finished(TaskEvent e) {
 62.1223 +                    if (after.contains(e.getKind()))
 62.1224 +                        handle(e);
 62.1225 +                }
 62.1226 +
 62.1227 +                private void handle(TaskEvent e) {
 62.1228 +                     switch (e.getKind()) {
 62.1229 +                         case PARSE:
 62.1230 +                         case ENTER:
 62.1231 +                             h.handle(e.getSourceFile().getName(),
 62.1232 +                                     (JCTree) e.getCompilationUnit(),
 62.1233 +                                     dprinter);
 62.1234 +                             break;
 62.1235 +
 62.1236 +                         default:
 62.1237 +                             TypeElement elem = e.getTypeElement();
 62.1238 +                             h.handle(elem.toString(),
 62.1239 +                                     (JCTree) trees.getTree(elem),
 62.1240 +                                     dprinter);
 62.1241 +                             break;
 62.1242 +                     }
 62.1243 +                }
 62.1244 +            });
 62.1245 +
 62.1246 +            task.call();
 62.1247 +        }
 62.1248 +
 62.1249 +        TaskEvent.Kind getKind(String s) {
 62.1250 +            return TaskEvent.Kind.valueOf(s.toUpperCase());
 62.1251 +        }
 62.1252 +
 62.1253 +        static protected abstract class Handler {
 62.1254 +            final String name;
 62.1255 +            Handler(String name) {
 62.1256 +                this.name = name;
 62.1257 +            }
 62.1258 +            abstract void handle(String label, JCTree tree, DPrinter dprinter);
 62.1259 +        }
 62.1260 +
 62.1261 +        Map<String,Handler> getHandlers() {
 62.1262 +            Map<String,Handler> map = new HashMap<String, Handler>();
 62.1263 +            for (Handler h: defaultHandlers) {
 62.1264 +                map.put(h.name, h);
 62.1265 +            }
 62.1266 +            return map;
 62.1267 +        }
 62.1268 +
 62.1269 +        protected final Handler[] defaultHandlers = {
 62.1270 +            new Handler("trees") {
 62.1271 +                @Override
 62.1272 +                void handle(String name, JCTree tree, DPrinter dprinter) {
 62.1273 +                    dprinter.printTree(name, tree);
 62.1274 +                    dprinter.out.println();
 62.1275 +                }
 62.1276 +            },
 62.1277 +
 62.1278 +            new Handler("symbols") {
 62.1279 +                @Override
 62.1280 +                void handle(String name, JCTree tree, final DPrinter dprinter) {
 62.1281 +                    TreeScanner ds = new TreeScanner() {
 62.1282 +                        @Override
 62.1283 +                        public void visitClassDef(JCClassDecl tree) {
 62.1284 +                            visitDecl(tree, tree.sym);
 62.1285 +                            super.visitClassDef(tree);
 62.1286 +                        }
 62.1287 +
 62.1288 +                        @Override
 62.1289 +                        public void visitMethodDef(JCMethodDecl tree) {
 62.1290 +                            visitDecl(tree, tree.sym);
 62.1291 +                            super.visitMethodDef(tree);
 62.1292 +                        }
 62.1293 +
 62.1294 +                        @Override
 62.1295 +                        public void visitVarDef(JCVariableDecl tree) {
 62.1296 +                            visitDecl(tree, tree.sym);
 62.1297 +                            super.visitVarDef(tree);
 62.1298 +                        }
 62.1299 +
 62.1300 +                        void visitDecl(JCTree tree, Symbol sym) {
 62.1301 +                            dprinter.printSymbol(sym.name.toString(), sym);
 62.1302 +                            dprinter.out.println();
 62.1303 +                        }
 62.1304 +                    };
 62.1305 +                    ds.scan(tree);
 62.1306 +                }
 62.1307 +            },
 62.1308 +
 62.1309 +            new Handler("types") {
 62.1310 +                @Override
 62.1311 +                void handle(String name, JCTree tree, final DPrinter dprinter) {
 62.1312 +                    TreeScanner ts = new TreeScanner() {
 62.1313 +                        @Override
 62.1314 +                        public void scan(JCTree tree) {
 62.1315 +                            if (tree == null) {
 62.1316 +                                return;
 62.1317 +                            }
 62.1318 +                            if (tree.type != null) {
 62.1319 +                                String label = Pretty.toSimpleString(tree);
 62.1320 +                                dprinter.printType(label, tree.type);
 62.1321 +                                dprinter.out.println();
 62.1322 +                            }
 62.1323 +                            super.scan(tree);
 62.1324 +                        }
 62.1325 +                    };
 62.1326 +                    ts.scan(tree);
 62.1327 +                }
 62.1328 +            }
 62.1329 +        };
 62.1330 +    }
 62.1331 +
 62.1332 +    // </editor-fold>
 62.1333 +
 62.1334 +}
    63.1 --- a/test/tools/javac/lib/JavacTestingAbstractThreadedTest.java	Thu Feb 07 12:33:21 2013 -0800
    63.2 +++ b/test/tools/javac/lib/JavacTestingAbstractThreadedTest.java	Mon Feb 11 16:15:09 2013 -0800
    63.3 @@ -41,14 +41,20 @@
    63.4   *
    63.5   * If the property is not set the class will use a heuristic to determine the
    63.6   * maximum number of threads that can be fired to execute a given test.
    63.7 + *
    63.8 + * This code will have to be revisited if jprt starts using concurrency for
    63.9 + * for running jtreg tests.
   63.10   */
   63.11  public abstract class JavacTestingAbstractThreadedTest {
   63.12  
   63.13 +    protected static AtomicInteger numberOfThreads = new AtomicInteger();
   63.14 +
   63.15      protected static int getThreadPoolSize() {
   63.16          Integer testConc = Integer.getInteger("test.concurrency");
   63.17          if (testConc != null) return testConc;
   63.18          int cores = Runtime.getRuntime().availableProcessors();
   63.19 -        return Math.max(2, Math.min(8, cores / 2));
   63.20 +        numberOfThreads.set(Math.max(2, Math.min(8, cores / 2)));
   63.21 +        return numberOfThreads.get();
   63.22      }
   63.23  
   63.24      protected static void checkAfterExec() throws InterruptedException {
   63.25 @@ -82,11 +88,18 @@
   63.26          } else if (printCheckCount) {
   63.27              outWriter.println("Total check executed: " + checkCount.get());
   63.28          }
   63.29 +        /*
   63.30 +         * This output is for supporting debugging. It does not mean that a given
   63.31 +         * test had executed that number of threads concurrently. The value printed
   63.32 +         * here is the maximum possible amount.
   63.33 +         */
   63.34          closePrinters();
   63.35          if (printAll) {
   63.36              System.out.println(errSWriter.toString());
   63.37              System.out.println(outSWriter.toString());
   63.38          }
   63.39 +        System.out.println("Total number of threads in thread pool: " +
   63.40 +                numberOfThreads.get());
   63.41      }
   63.42  
   63.43      protected static void closePrinters() {
    64.1 --- a/test/tools/javadoc/api/basic/RunTest.java	Thu Feb 07 12:33:21 2013 -0800
    64.2 +++ b/test/tools/javadoc/api/basic/RunTest.java	Mon Feb 11 16:15:09 2013 -0800
    64.3 @@ -1,5 +1,5 @@
    64.4  /*
    64.5 - * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
    64.6 + * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
    64.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    64.8   *
    64.9   * This code is free software; you can redistribute it and/or modify it
   64.10 @@ -23,7 +23,7 @@
   64.11  
   64.12  /*
   64.13   * @test
   64.14 - * @bug 6493690
   64.15 + * @bug 6493690 8007490
   64.16   * @summary javadoc should have a javax.tools.Tool service provider
   64.17   * @build APITest
   64.18   * @run main RunTest
   64.19 @@ -31,6 +31,7 @@
   64.20  
   64.21  import java.io.ByteArrayOutputStream;
   64.22  import java.io.File;
   64.23 +import java.io.PrintStream;
   64.24  import javax.tools.DocumentationTool;
   64.25  import javax.tools.ToolProvider;
   64.26  
   64.27 @@ -46,7 +47,7 @@
   64.28       * Verify that run method can be invoked.
   64.29       */
   64.30      @Test
   64.31 -    public void testRun() throws Exception {
   64.32 +    public void testRunOK() throws Exception {
   64.33          File testSrc = new File(System.getProperty("test.src"));
   64.34          File srcFile = new File(testSrc, "pkg/C.java");
   64.35          File outDir = getOutDir();
   64.36 @@ -77,7 +78,7 @@
   64.37       * Verify that run method can be invoked.
   64.38       */
   64.39      @Test
   64.40 -    public void testRun2() throws Exception {
   64.41 +    public void testRunFail() throws Exception {
   64.42          File outDir = getOutDir();
   64.43          String badfile = "badfile.java";
   64.44          String[] args = { "-d", outDir.getPath(), badfile };
   64.45 @@ -100,5 +101,48 @@
   64.46          }
   64.47      }
   64.48  
   64.49 +    /**
   64.50 +     * Verify that null args are accepted.
   64.51 +     */
   64.52 +    @Test
   64.53 +    public void testNullArgs() throws Exception {
   64.54 +        File testSrc = new File(System.getProperty("test.src"));
   64.55 +        File srcFile = new File(testSrc, "pkg/C.java");
   64.56 +        File outDir = getOutDir();
   64.57 +        String[] args = { "-d", outDir.getPath(), srcFile.getPath() };
   64.58 +
   64.59 +        ByteArrayOutputStream stdout = new ByteArrayOutputStream();
   64.60 +        PrintStream prevStdout = System.out;
   64.61 +        System.setOut(new PrintStream(stdout));
   64.62 +
   64.63 +        ByteArrayOutputStream stderr = new ByteArrayOutputStream();
   64.64 +        PrintStream prevStderr = System.err;
   64.65 +        System.setErr(new PrintStream(stderr));
   64.66 +
   64.67 +        int rc ;
   64.68 +        try {
   64.69 +            DocumentationTool tool = ToolProvider.getSystemDocumentationTool();
   64.70 +            rc = tool.run(null, null, null, args);
   64.71 +        } finally {
   64.72 +            System.setOut(prevStdout);
   64.73 +            System.setErr(prevStderr);
   64.74 +        }
   64.75 +
   64.76 +        System.err.println("stdout >>" + stdout.toString() + "<<");
   64.77 +        System.err.println("stderr >>" + stderr.toString() + "<<");
   64.78 +
   64.79 +        if (rc == 0) {
   64.80 +            System.err.println("call succeeded");
   64.81 +            checkFiles(outDir, standardExpectFiles);
   64.82 +            String out = stdout.toString();
   64.83 +            for (String f: standardExpectFiles) {
   64.84 +                String f1 = f.replace('/', File.separatorChar);
   64.85 +                if (f1.endsWith(".html") && !out.contains(f1))
   64.86 +                    error("expected string not found: " + f1);
   64.87 +            }
   64.88 +        } else {
   64.89 +            error("call failed");
   64.90 +        }
   64.91 +    }
   64.92  }
   64.93  

mercurial