7021614: extend com.sun.source API to support parsing javadoc comments

Wed, 14 Nov 2012 17:23:10 -0800

author
jjg
date
Wed, 14 Nov 2012 17:23:10 -0800
changeset 1409
33abf479f202
parent 1408
b486794d160d
child 1410
bfec2a1cc869

7021614: extend com.sun.source API to support parsing javadoc comments
Reviewed-by: ksrini, strarup

make/build.xml file | annotate | diff | comparison | revisions
src/share/classes/com/sun/source/doctree/AttributeTree.java file | annotate | diff | comparison | revisions
src/share/classes/com/sun/source/doctree/AuthorTree.java file | annotate | diff | comparison | revisions
src/share/classes/com/sun/source/doctree/BlockTagTree.java file | annotate | diff | comparison | revisions
src/share/classes/com/sun/source/doctree/CommentTree.java file | annotate | diff | comparison | revisions
src/share/classes/com/sun/source/doctree/DeprecatedTree.java file | annotate | diff | comparison | revisions
src/share/classes/com/sun/source/doctree/DocCommentTree.java file | annotate | diff | comparison | revisions
src/share/classes/com/sun/source/doctree/DocRootTree.java file | annotate | diff | comparison | revisions
src/share/classes/com/sun/source/doctree/DocTree.java file | annotate | diff | comparison | revisions
src/share/classes/com/sun/source/doctree/DocTreeVisitor.java file | annotate | diff | comparison | revisions
src/share/classes/com/sun/source/doctree/EndElementTree.java file | annotate | diff | comparison | revisions
src/share/classes/com/sun/source/doctree/EntityTree.java file | annotate | diff | comparison | revisions
src/share/classes/com/sun/source/doctree/ErroneousTree.java file | annotate | diff | comparison | revisions
src/share/classes/com/sun/source/doctree/IdentifierTree.java file | annotate | diff | comparison | revisions
src/share/classes/com/sun/source/doctree/InheritDocTree.java file | annotate | diff | comparison | revisions
src/share/classes/com/sun/source/doctree/InlineTagTree.java file | annotate | diff | comparison | revisions
src/share/classes/com/sun/source/doctree/LinkTree.java file | annotate | diff | comparison | revisions
src/share/classes/com/sun/source/doctree/LiteralTree.java file | annotate | diff | comparison | revisions
src/share/classes/com/sun/source/doctree/ParamTree.java file | annotate | diff | comparison | revisions
src/share/classes/com/sun/source/doctree/ReferenceTree.java file | annotate | diff | comparison | revisions
src/share/classes/com/sun/source/doctree/ReturnTree.java file | annotate | diff | comparison | revisions
src/share/classes/com/sun/source/doctree/SeeTree.java file | annotate | diff | comparison | revisions
src/share/classes/com/sun/source/doctree/SerialDataTree.java file | annotate | diff | comparison | revisions
src/share/classes/com/sun/source/doctree/SerialFieldTree.java file | annotate | diff | comparison | revisions
src/share/classes/com/sun/source/doctree/SerialTree.java file | annotate | diff | comparison | revisions
src/share/classes/com/sun/source/doctree/SinceTree.java file | annotate | diff | comparison | revisions
src/share/classes/com/sun/source/doctree/StartElementTree.java file | annotate | diff | comparison | revisions
src/share/classes/com/sun/source/doctree/TextTree.java file | annotate | diff | comparison | revisions
src/share/classes/com/sun/source/doctree/ThrowsTree.java file | annotate | diff | comparison | revisions
src/share/classes/com/sun/source/doctree/UnknownBlockTagTree.java file | annotate | diff | comparison | revisions
src/share/classes/com/sun/source/doctree/UnknownInlineTagTree.java file | annotate | diff | comparison | revisions
src/share/classes/com/sun/source/doctree/ValueTree.java file | annotate | diff | comparison | revisions
src/share/classes/com/sun/source/doctree/VersionTree.java file | annotate | diff | comparison | revisions
src/share/classes/com/sun/source/doctree/package-info.java file | annotate | diff | comparison | revisions
src/share/classes/com/sun/source/tree/Tree.java file | annotate | diff | comparison | revisions
src/share/classes/com/sun/source/util/DocTreeScanner.java file | annotate | diff | comparison | revisions
src/share/classes/com/sun/source/util/DocTrees.java file | annotate | diff | comparison | revisions
src/share/classes/com/sun/source/util/SimpleDocTreeVisitor.java file | annotate | diff | comparison | revisions
src/share/classes/com/sun/source/util/Trees.java file | annotate | diff | comparison | revisions
src/share/classes/com/sun/tools/javac/api/JavacTrees.java file | annotate | diff | comparison | revisions
src/share/classes/com/sun/tools/javac/comp/Attr.java file | annotate | diff | comparison | revisions
src/share/classes/com/sun/tools/javac/comp/AttrContext.java file | annotate | diff | comparison | revisions
src/share/classes/com/sun/tools/javac/comp/Env.java file | annotate | diff | comparison | revisions
src/share/classes/com/sun/tools/javac/comp/Resolve.java file | annotate | diff | comparison | revisions
src/share/classes/com/sun/tools/javac/parser/DocCommentParser.java file | annotate | diff | comparison | revisions
src/share/classes/com/sun/tools/javac/parser/JavacParser.java file | annotate | diff | comparison | revisions
src/share/classes/com/sun/tools/javac/parser/JavadocTokenizer.java file | annotate | diff | comparison | revisions
src/share/classes/com/sun/tools/javac/parser/LazyDocCommentTable.java file | annotate | diff | comparison | revisions
src/share/classes/com/sun/tools/javac/parser/ParserFactory.java file | annotate | diff | comparison | revisions
src/share/classes/com/sun/tools/javac/parser/SimpleDocCommentTable.java file | annotate | diff | comparison | revisions
src/share/classes/com/sun/tools/javac/resources/compiler.properties file | annotate | diff | comparison | revisions
src/share/classes/com/sun/tools/javac/tree/DCTree.java file | annotate | diff | comparison | revisions
src/share/classes/com/sun/tools/javac/tree/DocCommentTable.java file | annotate | diff | comparison | revisions
src/share/classes/com/sun/tools/javac/tree/DocPretty.java file | annotate | diff | comparison | revisions
src/share/classes/com/sun/tools/javac/tree/DocTreeMaker.java file | annotate | diff | comparison | revisions
src/share/classes/com/sun/tools/javadoc/DocEnv.java file | annotate | diff | comparison | revisions
src/share/classes/com/sun/tools/javadoc/SeeTagImpl.java file | annotate | diff | comparison | revisions
test/tools/javac/diags/CheckExamples.java file | annotate | diff | comparison | revisions
test/tools/javac/diags/DocCommentProcessor.java file | annotate | diff | comparison | revisions
test/tools/javac/diags/Example.java file | annotate | diff | comparison | revisions
test/tools/javac/diags/RunExamples.java file | annotate | diff | comparison | revisions
test/tools/javac/diags/examples.not-yet.txt file | annotate | diff | comparison | revisions
test/tools/javac/diags/examples/BadEntity.java file | annotate | diff | comparison | revisions
test/tools/javac/diags/examples/BadGreaterThan.java file | annotate | diff | comparison | revisions
test/tools/javac/diags/examples/BadInlineTag.java file | annotate | diff | comparison | revisions
test/tools/javac/diags/examples/GreaterThanExpected.java file | annotate | diff | comparison | revisions
test/tools/javac/diags/examples/MalformedHTML.java file | annotate | diff | comparison | revisions
test/tools/javac/diags/examples/MissingSemicolon.java file | annotate | diff | comparison | revisions
test/tools/javac/diags/examples/NoTagName.java file | annotate | diff | comparison | revisions
test/tools/javac/diags/examples/RefBadParens.java file | annotate | diff | comparison | revisions
test/tools/javac/diags/examples/RefIdentifierExpected.java file | annotate | diff | comparison | revisions
test/tools/javac/diags/examples/RefSyntaxError.java file | annotate | diff | comparison | revisions
test/tools/javac/diags/examples/RefUnexpectedInput.java file | annotate | diff | comparison | revisions
test/tools/javac/diags/examples/UnexpectedContent.java file | annotate | diff | comparison | revisions
test/tools/javac/diags/examples/UnterminatedInlineTag.java file | annotate | diff | comparison | revisions
test/tools/javac/diags/examples/UnterminatedSignature.java file | annotate | diff | comparison | revisions
test/tools/javac/doctree/AttrTest.java file | annotate | diff | comparison | revisions
test/tools/javac/doctree/AuthorTest.java file | annotate | diff | comparison | revisions
test/tools/javac/doctree/BadTest.java file | annotate | diff | comparison | revisions
test/tools/javac/doctree/CodeTest.java file | annotate | diff | comparison | revisions
test/tools/javac/doctree/DeprecatedTest.java file | annotate | diff | comparison | revisions
test/tools/javac/doctree/DocCommentTester.java file | annotate | diff | comparison | revisions
test/tools/javac/doctree/DocRootTest.java file | annotate | diff | comparison | revisions
test/tools/javac/doctree/ElementTest.java file | annotate | diff | comparison | revisions
test/tools/javac/doctree/EntityTest.java file | annotate | diff | comparison | revisions
test/tools/javac/doctree/ExceptionTest.java file | annotate | diff | comparison | revisions
test/tools/javac/doctree/FirstSentenceTest.java file | annotate | diff | comparison | revisions
test/tools/javac/doctree/InheritDocTest.java file | annotate | diff | comparison | revisions
test/tools/javac/doctree/LinkPlainTest.java file | annotate | diff | comparison | revisions
test/tools/javac/doctree/LinkTest.java file | annotate | diff | comparison | revisions
test/tools/javac/doctree/LiteralTest.java file | annotate | diff | comparison | revisions
test/tools/javac/doctree/ParamTest.java file | annotate | diff | comparison | revisions
test/tools/javac/doctree/ReferenceTest.java file | annotate | diff | comparison | revisions
test/tools/javac/doctree/ReturnTest.java file | annotate | diff | comparison | revisions
test/tools/javac/doctree/SeeTest.java file | annotate | diff | comparison | revisions
test/tools/javac/doctree/SerialDataTest.java file | annotate | diff | comparison | revisions
test/tools/javac/doctree/SerialFieldTest.java file | annotate | diff | comparison | revisions
test/tools/javac/doctree/SerialTest.java file | annotate | diff | comparison | revisions
test/tools/javac/doctree/SimpleDocTreeVisitorTest.java file | annotate | diff | comparison | revisions
test/tools/javac/doctree/SinceTest.java file | annotate | diff | comparison | revisions
test/tools/javac/doctree/TagTest.java file | annotate | diff | comparison | revisions
test/tools/javac/doctree/ThrowableTest.java file | annotate | diff | comparison | revisions
test/tools/javac/doctree/ValueTest.java file | annotate | diff | comparison | revisions
test/tools/javac/doctree/VersionTest.java file | annotate | diff | comparison | revisions
     1.1 --- a/make/build.xml	Wed Nov 14 16:41:51 2012 -0800
     1.2 +++ b/make/build.xml	Wed Nov 14 17:23:10 2012 -0800
     1.3 @@ -1,6 +1,6 @@
     1.4  <?xml version="1.0" encoding="UTF-8"?>
     1.5  <!--
     1.6 - Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
     1.7 + Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved.
     1.8   DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     1.9  
    1.10   This code is free software; you can redistribute it and/or modify it
    1.11 @@ -277,7 +277,7 @@
    1.12          <!-- transform the output to a simple html -->
    1.13          <xslt  in="${dist.checkstyle.dir}/checkstyle_report.xml"
    1.14                 out="${dist.checkstyle.dir}/checkstyle_report.html"
    1.15 -               style="${checkstyle.home}/contrib/checkstyle-simple.xsl"/>            
    1.16 +               style="${checkstyle.home}/contrib/checkstyle-simple.xsl"/>
    1.17          <!-- transform the output to a very simple emacs friendly text file -->
    1.18          <xslt  in="${dist.checkstyle.dir}/checkstyle_report.xml"
    1.19                 out="${dist.checkstyle.dir}/checkstyle_report.tmp"
    1.20 @@ -297,9 +297,9 @@
    1.21      <target name="checkstyle-ide" depends="checkstyle">
    1.22          <concat>
    1.23              <fileset file="${dist.checkstyle.dir}/checkstyle_report.emacs.txt"/>
    1.24 -        </concat>  
    1.25 +        </concat>
    1.26      </target>
    1.27 -    
    1.28 +
    1.29      <target name="findbugs" depends="-def-findbugs,build-all-tools">
    1.30          <property name="findbugs.reportLevel" value="medium"/>
    1.31          <mkdir dir="${dist.findbugs.dir}"/>
    1.32 @@ -368,7 +368,7 @@
    1.33              executable="${dist.bin.dir}/javac"
    1.34              srcdir="test/tools/javac/diags"
    1.35              destdir="${build.dir}/diag-examples/classes"
    1.36 -            includes="ArgTypeCompilerFactory.java,Example.java,FileManager.java,HTMLWriter.java,RunExamples.java"
    1.37 +            includes="ArgTypeCompilerFactory.java,Example.java,FileManager.java,HTMLWriter.java,RunExamples.java,DocCommentProcessor.java"
    1.38              sourcepath=""
    1.39              classpath="${dist.lib.dir}/javac.jar"
    1.40              includeAntRuntime="no"
    1.41 @@ -381,6 +381,7 @@
    1.42              dir="test/tools/javac/diags"
    1.43              classpath="${build.dir}/diag-examples/classes;${dist.lib.dir}/javac.jar"
    1.44              classname="RunExamples">
    1.45 +            <jvmarg value="-Dtest.classes=${build.dir}/diag-examples/classes"/>
    1.46              <arg value="-examples"/>
    1.47              <arg value="examples"/>
    1.48              <arg value="-o"/>
    1.49 @@ -695,7 +696,7 @@
    1.50      <target name="-check-checkstyle.home" depends="-def-check">
    1.51          <check name="checkstyle" property="checkstyle.home" marker="${checkstyle.name.version}.jar"/>
    1.52      </target>
    1.53 -    
    1.54 +
    1.55      <target name="-check-jtreg.home" depends="-def-check">
    1.56          <check name="jtreg" property="jtreg.home" marker="lib/jtreg.jar"/>
    1.57      </target>
    1.58 @@ -1005,7 +1006,7 @@
    1.59          </taskdef>
    1.60          <property name="checkstyle.defined" value="true"/>
    1.61      </target>
    1.62 -    
    1.63 +
    1.64      <target name="-def-findbugs" unless="findbugs.defined"
    1.65          depends="-check-findbugs.home,-check-target.java.home">
    1.66          <taskdef name="findbugs" classname="edu.umd.cs.findbugs.anttask.FindBugsTask">
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/src/share/classes/com/sun/source/doctree/AttributeTree.java	Wed Nov 14 17:23:10 2012 -0800
     2.3 @@ -0,0 +1,42 @@
     2.4 +/*
     2.5 + * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
     2.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     2.7 + *
     2.8 + * This code is free software; you can redistribute it and/or modify it
     2.9 + * under the terms of the GNU General Public License version 2 only, as
    2.10 + * published by the Free Software Foundation.  Oracle designates this
    2.11 + * particular file as subject to the "Classpath" exception as provided
    2.12 + * by Oracle in the LICENSE file that accompanied this code.
    2.13 + *
    2.14 + * This code is distributed in the hope that it will be useful, but WITHOUT
    2.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    2.16 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    2.17 + * version 2 for more details (a copy is included in the LICENSE file that
    2.18 + * accompanied this code).
    2.19 + *
    2.20 + * You should have received a copy of the GNU General Public License version
    2.21 + * 2 along with this work; if not, write to the Free Software Foundation,
    2.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    2.23 + *
    2.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    2.25 + * or visit www.oracle.com if you need additional information or have any
    2.26 + * questions.
    2.27 + */
    2.28 +
    2.29 +package com.sun.source.doctree;
    2.30 +
    2.31 +import java.util.List;
    2.32 +import javax.lang.model.element.Name;
    2.33 +
    2.34 +/**
    2.35 + * A tree node for an attribute in an HTML element.
    2.36 + *
    2.37 + * @since 1.8
    2.38 + */
    2.39 +public interface AttributeTree extends DocTree {
    2.40 +    enum ValueKind { EMPTY, UNQUOTED, SINGLE, DOUBLE };
    2.41 +
    2.42 +    Name getName();
    2.43 +    ValueKind getValueKind();
    2.44 +    List<? extends DocTree> getValue();
    2.45 +}
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/src/share/classes/com/sun/source/doctree/AuthorTree.java	Wed Nov 14 17:23:10 2012 -0800
     3.3 @@ -0,0 +1,40 @@
     3.4 +/*
     3.5 + * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
     3.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3.7 + *
     3.8 + * This code is free software; you can redistribute it and/or modify it
     3.9 + * under the terms of the GNU General Public License version 2 only, as
    3.10 + * published by the Free Software Foundation.  Oracle designates this
    3.11 + * particular file as subject to the "Classpath" exception as provided
    3.12 + * by Oracle in the LICENSE file that accompanied this code.
    3.13 + *
    3.14 + * This code is distributed in the hope that it will be useful, but WITHOUT
    3.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    3.16 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    3.17 + * version 2 for more details (a copy is included in the LICENSE file that
    3.18 + * accompanied this code).
    3.19 + *
    3.20 + * You should have received a copy of the GNU General Public License version
    3.21 + * 2 along with this work; if not, write to the Free Software Foundation,
    3.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    3.23 + *
    3.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    3.25 + * or visit www.oracle.com if you need additional information or have any
    3.26 + * questions.
    3.27 + */
    3.28 +
    3.29 +package com.sun.source.doctree;
    3.30 +
    3.31 +import java.util.List;
    3.32 +
    3.33 +/**
    3.34 + * A tree node for an @author block tag.
    3.35 + *
    3.36 + * <p>
    3.37 + * &#064;author name-text.
    3.38 + *
    3.39 + * @since 1.8
    3.40 + */
    3.41 +public interface AuthorTree extends BlockTagTree {
    3.42 +    List<? extends DocTree> getName();
    3.43 +}
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/src/share/classes/com/sun/source/doctree/BlockTagTree.java	Wed Nov 14 17:23:10 2012 -0800
     4.3 @@ -0,0 +1,36 @@
     4.4 +/*
     4.5 + * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
     4.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4.7 + *
     4.8 + * This code is free software; you can redistribute it and/or modify it
     4.9 + * under the terms of the GNU General Public License version 2 only, as
    4.10 + * published by the Free Software Foundation.  Oracle designates this
    4.11 + * particular file as subject to the "Classpath" exception as provided
    4.12 + * by Oracle in the LICENSE file that accompanied this code.
    4.13 + *
    4.14 + * This code is distributed in the hope that it will be useful, but WITHOUT
    4.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    4.16 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    4.17 + * version 2 for more details (a copy is included in the LICENSE file that
    4.18 + * accompanied this code).
    4.19 + *
    4.20 + * You should have received a copy of the GNU General Public License version
    4.21 + * 2 along with this work; if not, write to the Free Software Foundation,
    4.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    4.23 + *
    4.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    4.25 + * or visit www.oracle.com if you need additional information or have any
    4.26 + * questions.
    4.27 + */
    4.28 +
    4.29 +package com.sun.source.doctree;
    4.30 +
    4.31 +/**
    4.32 + * A tree node used as the base class for the different types of
    4.33 + * block tags.
    4.34 + *
    4.35 + * @since 1.8
    4.36 + */
    4.37 +public interface BlockTagTree extends DocTree {
    4.38 +    String getTagName();
    4.39 +}
     5.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.2 +++ b/src/share/classes/com/sun/source/doctree/CommentTree.java	Wed Nov 14 17:23:10 2012 -0800
     5.3 @@ -0,0 +1,39 @@
     5.4 +/*
     5.5 + * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
     5.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     5.7 + *
     5.8 + * This code is free software; you can redistribute it and/or modify it
     5.9 + * under the terms of the GNU General Public License version 2 only, as
    5.10 + * published by the Free Software Foundation.  Oracle designates this
    5.11 + * particular file as subject to the "Classpath" exception as provided
    5.12 + * by Oracle in the LICENSE file that accompanied this code.
    5.13 + *
    5.14 + * This code is distributed in the hope that it will be useful, but WITHOUT
    5.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    5.16 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    5.17 + * version 2 for more details (a copy is included in the LICENSE file that
    5.18 + * accompanied this code).
    5.19 + *
    5.20 + * You should have received a copy of the GNU General Public License version
    5.21 + * 2 along with this work; if not, write to the Free Software Foundation,
    5.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    5.23 + *
    5.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    5.25 + * or visit www.oracle.com if you need additional information or have any
    5.26 + * questions.
    5.27 + */
    5.28 +
    5.29 +package com.sun.source.doctree;
    5.30 +
    5.31 +/**
    5.32 + * An embedded HTML comment.
    5.33 + *
    5.34 + * <p>
    5.35 + * {@literal <!-- text --> }
    5.36 + *
    5.37 + * @since 1.8
    5.38 + */
    5.39 +public interface CommentTree extends DocTree {
    5.40 +    String getBody();
    5.41 +}
    5.42 +
     6.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.2 +++ b/src/share/classes/com/sun/source/doctree/DeprecatedTree.java	Wed Nov 14 17:23:10 2012 -0800
     6.3 @@ -0,0 +1,40 @@
     6.4 +/*
     6.5 + * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
     6.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     6.7 + *
     6.8 + * This code is free software; you can redistribute it and/or modify it
     6.9 + * under the terms of the GNU General Public License version 2 only, as
    6.10 + * published by the Free Software Foundation.  Oracle designates this
    6.11 + * particular file as subject to the "Classpath" exception as provided
    6.12 + * by Oracle in the LICENSE file that accompanied this code.
    6.13 + *
    6.14 + * This code is distributed in the hope that it will be useful, but WITHOUT
    6.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    6.16 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    6.17 + * version 2 for more details (a copy is included in the LICENSE file that
    6.18 + * accompanied this code).
    6.19 + *
    6.20 + * You should have received a copy of the GNU General Public License version
    6.21 + * 2 along with this work; if not, write to the Free Software Foundation,
    6.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    6.23 + *
    6.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    6.25 + * or visit www.oracle.com if you need additional information or have any
    6.26 + * questions.
    6.27 + */
    6.28 +
    6.29 +package com.sun.source.doctree;
    6.30 +
    6.31 +import java.util.List;
    6.32 +
    6.33 +/**
    6.34 + * A tree node for an @deprecated block tag.
    6.35 + *
    6.36 + * <p>
    6.37 + * &#064;deprecated deprecated text.
    6.38 + *
    6.39 + * @since 1.8
    6.40 + */
    6.41 +public interface DeprecatedTree extends BlockTagTree {
    6.42 +    List<? extends DocTree> getBody();
    6.43 +}
     7.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.2 +++ b/src/share/classes/com/sun/source/doctree/DocCommentTree.java	Wed Nov 14 17:23:10 2012 -0800
     7.3 @@ -0,0 +1,42 @@
     7.4 +/*
     7.5 + * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
     7.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     7.7 + *
     7.8 + * This code is free software; you can redistribute it and/or modify it
     7.9 + * under the terms of the GNU General Public License version 2 only, as
    7.10 + * published by the Free Software Foundation.  Oracle designates this
    7.11 + * particular file as subject to the "Classpath" exception as provided
    7.12 + * by Oracle in the LICENSE file that accompanied this code.
    7.13 + *
    7.14 + * This code is distributed in the hope that it will be useful, but WITHOUT
    7.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    7.16 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    7.17 + * version 2 for more details (a copy is included in the LICENSE file that
    7.18 + * accompanied this code).
    7.19 + *
    7.20 + * You should have received a copy of the GNU General Public License version
    7.21 + * 2 along with this work; if not, write to the Free Software Foundation,
    7.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    7.23 + *
    7.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    7.25 + * or visit www.oracle.com if you need additional information or have any
    7.26 + * questions.
    7.27 + */
    7.28 +
    7.29 +package com.sun.source.doctree;
    7.30 +
    7.31 +import java.util.List;
    7.32 +
    7.33 +/**
    7.34 + * The top level representation of a documentation comment.
    7.35 + *
    7.36 + * <p>
    7.37 + * first-sentence body block-tags
    7.38 + *
    7.39 + * @since 1.8
    7.40 + */
    7.41 +public interface DocCommentTree extends DocTree {
    7.42 +    List<? extends DocTree> getFirstSentence();
    7.43 +    List<? extends DocTree> getBody();
    7.44 +    List<? extends DocTree> getBlockTags();
    7.45 +}
     8.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     8.2 +++ b/src/share/classes/com/sun/source/doctree/DocRootTree.java	Wed Nov 14 17:23:10 2012 -0800
     8.3 @@ -0,0 +1,36 @@
     8.4 +/*
     8.5 + * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
     8.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     8.7 + *
     8.8 + * This code is free software; you can redistribute it and/or modify it
     8.9 + * under the terms of the GNU General Public License version 2 only, as
    8.10 + * published by the Free Software Foundation.  Oracle designates this
    8.11 + * particular file as subject to the "Classpath" exception as provided
    8.12 + * by Oracle in the LICENSE file that accompanied this code.
    8.13 + *
    8.14 + * This code is distributed in the hope that it will be useful, but WITHOUT
    8.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    8.16 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    8.17 + * version 2 for more details (a copy is included in the LICENSE file that
    8.18 + * accompanied this code).
    8.19 + *
    8.20 + * You should have received a copy of the GNU General Public License version
    8.21 + * 2 along with this work; if not, write to the Free Software Foundation,
    8.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    8.23 + *
    8.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    8.25 + * or visit www.oracle.com if you need additional information or have any
    8.26 + * questions.
    8.27 + */
    8.28 +
    8.29 +package com.sun.source.doctree;
    8.30 +
    8.31 +/**
    8.32 + * A tree node for an @docroot inline tag.
    8.33 + *
    8.34 + * <p>
    8.35 + * {&#064;docroot}
    8.36 + *
    8.37 + * @since 1.8
    8.38 + */
    8.39 +public interface DocRootTree extends InlineTagTree { }
     9.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     9.2 +++ b/src/share/classes/com/sun/source/doctree/DocTree.java	Wed Nov 14 17:23:10 2012 -0800
     9.3 @@ -0,0 +1,254 @@
     9.4 +/*
     9.5 + * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
     9.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     9.7 + *
     9.8 + * This code is free software; you can redistribute it and/or modify it
     9.9 + * under the terms of the GNU General Public License version 2 only, as
    9.10 + * published by the Free Software Foundation.  Oracle designates this
    9.11 + * particular file as subject to the "Classpath" exception as provided
    9.12 + * by Oracle in the LICENSE file that accompanied this code.
    9.13 + *
    9.14 + * This code is distributed in the hope that it will be useful, but WITHOUT
    9.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    9.16 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    9.17 + * version 2 for more details (a copy is included in the LICENSE file that
    9.18 + * accompanied this code).
    9.19 + *
    9.20 + * You should have received a copy of the GNU General Public License version
    9.21 + * 2 along with this work; if not, write to the Free Software Foundation,
    9.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    9.23 + *
    9.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    9.25 + * or visit www.oracle.com if you need additional information or have any
    9.26 + * questions.
    9.27 + */
    9.28 +
    9.29 +package com.sun.source.doctree;
    9.30 +
    9.31 +/**
    9.32 + * Common interface for all nodes in a documentation syntax tree.
    9.33 + *
    9.34 + * @since 1.8
    9.35 + */
    9.36 +public interface DocTree {
    9.37 +    enum Kind {
    9.38 +        /**
    9.39 +         * Used for instances of {@link AttributeTree}
    9.40 +         * representing an HTML attribute.
    9.41 +         */
    9.42 +        ATTRIBUTE,
    9.43 +
    9.44 +        /**
    9.45 +         * Used for instances of {@link AuthorTree}
    9.46 +         * representing an @author tag.
    9.47 +         */
    9.48 +        AUTHOR("author"),
    9.49 +
    9.50 +        /**
    9.51 +         * Used for instances of {@link LiteralTree}
    9.52 +         * representing an @code tag.
    9.53 +         */
    9.54 +        CODE("code"),
    9.55 +
    9.56 +        /**
    9.57 +         * Used for instances of {@link CommentTree}
    9.58 +         * representing an HTML comment.
    9.59 +         */
    9.60 +        COMMENT,
    9.61 +
    9.62 +        /**
    9.63 +         * Used for instances of {@link DeprecatedTree}
    9.64 +         * representing an @deprecated tag.
    9.65 +         */
    9.66 +        DEPRECATED("deprecated"),
    9.67 +
    9.68 +        /**
    9.69 +         * Used for instances of {@link DocCommentTree}
    9.70 +         * representing a complete doc comment.
    9.71 +         */
    9.72 +        DOC_COMMENT,
    9.73 +
    9.74 +        /**
    9.75 +         * Used for instances of {@link DocRootTree}
    9.76 +         * representing an @docRoot tag.
    9.77 +         */
    9.78 +        DOC_ROOT("docRoot"),
    9.79 +
    9.80 +        /**
    9.81 +         * Used for instances of {@link EndElementTree}
    9.82 +         * representing the end of an HTML element.
    9.83 +         */
    9.84 +        END_ELEMENT,
    9.85 +
    9.86 +        /**
    9.87 +         * Used for instances of {@link EntityTree}
    9.88 +         * representing an HTML entity.
    9.89 +         */
    9.90 +        ENTITY,
    9.91 +
    9.92 +        /**
    9.93 +         * Used for instances of {@link ErroneousTree}
    9.94 +         * representing some invalid text.
    9.95 +         */
    9.96 +        ERRONEOUS,
    9.97 +
    9.98 +        /**
    9.99 +         * Used for instances of {@link ThrowsTree}
   9.100 +         * representing an @exception tag.
   9.101 +         */
   9.102 +        EXCEPTION("exception"),
   9.103 +
   9.104 +        /**
   9.105 +         * Used for instances of {@link IdentifierTree}
   9.106 +         * representing an identifier.
   9.107 +         */
   9.108 +        IDENTIFIER,
   9.109 +
   9.110 +        /**
   9.111 +         * Used for instances of {@link InheritDocTree}
   9.112 +         * representing an @inheritDoc tag.
   9.113 +         */
   9.114 +        INHERIT_DOC("inheritDoc"),
   9.115 +
   9.116 +        /**
   9.117 +         * Used for instances of {@link LinkTree}
   9.118 +         * representing an @link tag.
   9.119 +         */
   9.120 +        LINK("link"),
   9.121 +
   9.122 +        /**
   9.123 +         * Used for instances of {@link LinkTree}
   9.124 +         * representing an @linkplain tag.
   9.125 +         */
   9.126 +        LINK_PLAIN("linkplain"),
   9.127 +
   9.128 +        /**
   9.129 +         * Used for instances of {@link LiteralTree}
   9.130 +         * representing an @literal tag.
   9.131 +         */
   9.132 +        LITERAL("literal"),
   9.133 +
   9.134 +        /**
   9.135 +         * Used for instances of {@link ParamTree}
   9.136 +         * representing an @param tag.
   9.137 +         */
   9.138 +        PARAM("param"),
   9.139 +
   9.140 +        /**
   9.141 +         * Used for instances of {@link ReferenceTree}
   9.142 +         * representing a reference to a element in the
   9.143 +         * Java programming language.
   9.144 +         */
   9.145 +        REFERENCE,
   9.146 +
   9.147 +        /**
   9.148 +         * Used for instances of {@link ReturnTree}
   9.149 +         * representing an @return tag.
   9.150 +         */
   9.151 +        RETURN("return"),
   9.152 +
   9.153 +        /**
   9.154 +         * Used for instances of {@link SeeTree}
   9.155 +         * representing an @see tag.
   9.156 +         */
   9.157 +        SEE("see"),
   9.158 +
   9.159 +        /**
   9.160 +         * Used for instances of {@link SerialTree}
   9.161 +         * representing an @serial tag.
   9.162 +         */
   9.163 +        SERIAL("serial"),
   9.164 +
   9.165 +        /**
   9.166 +         * Used for instances of {@link SerialDataTree}
   9.167 +         * representing an @serialData tag.
   9.168 +         */
   9.169 +        SERIAL_DATA("serialData"),
   9.170 +
   9.171 +        /**
   9.172 +         * Used for instances of {@link SerialFieldTree}
   9.173 +         * representing an @serialField tag.
   9.174 +         */
   9.175 +        SERIAL_FIELD("serialField"),
   9.176 +
   9.177 +        /**
   9.178 +         * Used for instances of {@link SinceTree}
   9.179 +         * representing an @since tag.
   9.180 +         */
   9.181 +        SINCE("since"),
   9.182 +
   9.183 +        /**
   9.184 +         * Used for instances of {@link EndElementTree}
   9.185 +         * representing the start of an HTML element.
   9.186 +         */
   9.187 +        START_ELEMENT,
   9.188 +
   9.189 +        /**
   9.190 +         * Used for instances of {@link TextTree}
   9.191 +         * representing some documentation text.
   9.192 +         */
   9.193 +        TEXT,
   9.194 +
   9.195 +        /**
   9.196 +         * Used for instances of {@link ThrowsTree}
   9.197 +         * representing an @throws tag.
   9.198 +         */
   9.199 +        THROWS("throws"),
   9.200 +
   9.201 +        /**
   9.202 +         * Used for instances of {@link UnknownBlockTagTree}
   9.203 +         * representing an unknown block tag.
   9.204 +         */
   9.205 +        UNKNOWN_BLOCK_TAG,
   9.206 +
   9.207 +        /**
   9.208 +         * Used for instances of {@link UnknownInlineTagTree}
   9.209 +         * representing an unknown inline tag.
   9.210 +         */
   9.211 +        UNKNOWN_INLINE_TAG,
   9.212 +
   9.213 +        /**
   9.214 +         * Used for instances of {@link ValueTree}
   9.215 +         * representing an @value tag.
   9.216 +         */
   9.217 +        VALUE("value"),
   9.218 +
   9.219 +        /**
   9.220 +         * Used for instances of {@link VersionTree}
   9.221 +         * representing an @version tag.
   9.222 +         */
   9.223 +        VERSION("version"),
   9.224 +
   9.225 +        /**
   9.226 +         * An implementation-reserved node. This is the not the node
   9.227 +         * you are looking for.
   9.228 +         */
   9.229 +        OTHER;
   9.230 +
   9.231 +        public final String tagName;
   9.232 +
   9.233 +        Kind() {
   9.234 +            tagName = null;
   9.235 +        }
   9.236 +
   9.237 +        Kind(String tagName) {
   9.238 +            this.tagName = tagName;
   9.239 +        }
   9.240 +    };
   9.241 +
   9.242 +    /**
   9.243 +     * Gets the kind of this tree.
   9.244 +     *
   9.245 +     * @return the kind of this tree.
   9.246 +     */
   9.247 +    Kind getKind();
   9.248 +
   9.249 +    /**
   9.250 +     * Accept method used to implement the visitor pattern.  The
   9.251 +     * visitor pattern is used to implement operations on trees.
   9.252 +     *
   9.253 +     * @param <R> result type of this operation.
   9.254 +     * @param <D> type of additional data.
   9.255 +     */
   9.256 +    <R, D> R accept(DocTreeVisitor<R,D> visitor, D data);
   9.257 +}
    10.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    10.2 +++ b/src/share/classes/com/sun/source/doctree/DocTreeVisitor.java	Wed Nov 14 17:23:10 2012 -0800
    10.3 @@ -0,0 +1,87 @@
    10.4 +/*
    10.5 + * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
    10.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    10.7 + *
    10.8 + * This code is free software; you can redistribute it and/or modify it
    10.9 + * under the terms of the GNU General Public License version 2 only, as
   10.10 + * published by the Free Software Foundation.  Oracle designates this
   10.11 + * particular file as subject to the "Classpath" exception as provided
   10.12 + * by Oracle in the LICENSE file that accompanied this code.
   10.13 + *
   10.14 + * This code is distributed in the hope that it will be useful, but WITHOUT
   10.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   10.16 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   10.17 + * version 2 for more details (a copy is included in the LICENSE file that
   10.18 + * accompanied this code).
   10.19 + *
   10.20 + * You should have received a copy of the GNU General Public License version
   10.21 + * 2 along with this work; if not, write to the Free Software Foundation,
   10.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   10.23 + *
   10.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   10.25 + * or visit www.oracle.com if you need additional information or have any
   10.26 + * questions.
   10.27 + */
   10.28 +
   10.29 +package com.sun.source.doctree;
   10.30 +
   10.31 +
   10.32 +/**
   10.33 + * A visitor of trees, in the style of the visitor design pattern.
   10.34 + * Classes implementing this interface are used to operate
   10.35 + * on a tree when the kind of tree is unknown at compile time.
   10.36 + * When a visitor is passed to an tree's {@link DocTree#accept
   10.37 + * accept} method, the <tt>visit<i>XYZ</i></tt> method most applicable
   10.38 + * to that tree is invoked.
   10.39 + *
   10.40 + * <p> Classes implementing this interface may or may not throw a
   10.41 + * {@code NullPointerException} if the additional parameter {@code p}
   10.42 + * is {@code null}; see documentation of the implementing class for
   10.43 + * details.
   10.44 + *
   10.45 + * <p> <b>WARNING:</b> It is possible that methods will be added to
   10.46 + * this interface to accommodate new, currently unknown, doc comment
   10.47 + * structures added to future versions of the Java&trade; programming
   10.48 + * language.  Therefore, visitor classes directly implementing this
   10.49 + * interface may be source incompatible with future versions of the
   10.50 + * platform.
   10.51 + *
   10.52 + * @param <R> the return type of this visitor's methods.  Use {@link
   10.53 + *            Void} for visitors that do not need to return results.
   10.54 + * @param <P> the type of the additional parameter to this visitor's
   10.55 + *            methods.  Use {@code Void} for visitors that do not need an
   10.56 + *            additional parameter.
   10.57 + *
   10.58 + * @since 1.8
   10.59 + */
   10.60 +public interface DocTreeVisitor<R,P> {
   10.61 +    R visitAttribute(AttributeTree node, P p);
   10.62 +    R visitAuthor(AuthorTree node, P p);
   10.63 +    R visitComment(CommentTree node, P p);
   10.64 +    R visitDeprecated(DeprecatedTree node, P p);
   10.65 +    R visitDocComment(DocCommentTree node, P p);
   10.66 +    R visitDocRoot(DocRootTree node, P p);
   10.67 +    R visitEndElement(EndElementTree node, P p);
   10.68 +    R visitEntity(EntityTree node, P p);
   10.69 +    R visitErroneous(ErroneousTree node, P p);
   10.70 +    R visitIdentifier(IdentifierTree node, P p);
   10.71 +    R visitInheritDoc(InheritDocTree node, P p);
   10.72 +    R visitLink(LinkTree node, P p);
   10.73 +    R visitLiteral(LiteralTree node, P p);
   10.74 +    R visitParam(ParamTree node, P p);
   10.75 +    R visitReference(ReferenceTree node, P p);
   10.76 +    R visitReturn(ReturnTree node, P p);
   10.77 +    R visitSee(SeeTree node, P p);
   10.78 +    R visitSerial(SerialTree node, P p);
   10.79 +    R visitSerialData(SerialDataTree node, P p);
   10.80 +    R visitSerialField(SerialFieldTree node, P p);
   10.81 +    R visitSince(SinceTree node, P p);
   10.82 +    R visitStartElement(StartElementTree node, P p);
   10.83 +    R visitText(TextTree node, P p);
   10.84 +    R visitThrows(ThrowsTree node, P p);
   10.85 +    R visitUnknownBlockTag(UnknownBlockTagTree node, P p);
   10.86 +    R visitUnknownInlineTag(UnknownInlineTagTree node, P p);
   10.87 +    R visitValue(ValueTree node, P p);
   10.88 +    R visitVersion(VersionTree node, P p);
   10.89 +    R visitOther(DocTree node, P p);
   10.90 +}
    11.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    11.2 +++ b/src/share/classes/com/sun/source/doctree/EndElementTree.java	Wed Nov 14 17:23:10 2012 -0800
    11.3 @@ -0,0 +1,40 @@
    11.4 +/*
    11.5 + * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
    11.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    11.7 + *
    11.8 + * This code is free software; you can redistribute it and/or modify it
    11.9 + * under the terms of the GNU General Public License version 2 only, as
   11.10 + * published by the Free Software Foundation.  Oracle designates this
   11.11 + * particular file as subject to the "Classpath" exception as provided
   11.12 + * by Oracle in the LICENSE file that accompanied this code.
   11.13 + *
   11.14 + * This code is distributed in the hope that it will be useful, but WITHOUT
   11.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   11.16 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   11.17 + * version 2 for more details (a copy is included in the LICENSE file that
   11.18 + * accompanied this code).
   11.19 + *
   11.20 + * You should have received a copy of the GNU General Public License version
   11.21 + * 2 along with this work; if not, write to the Free Software Foundation,
   11.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   11.23 + *
   11.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   11.25 + * or visit www.oracle.com if you need additional information or have any
   11.26 + * questions.
   11.27 + */
   11.28 +
   11.29 +package com.sun.source.doctree;
   11.30 +
   11.31 +import javax.lang.model.element.Name;
   11.32 +
   11.33 +/**
   11.34 + * A tree node for the end of an HTML element.
   11.35 + *
   11.36 + * <p>
   11.37 + * &lt;/ name &gt;
   11.38 + *
   11.39 + * @since 1.8
   11.40 + */
   11.41 +public interface EndElementTree extends DocTree {
   11.42 +    Name getName();
   11.43 +}
    12.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    12.2 +++ b/src/share/classes/com/sun/source/doctree/EntityTree.java	Wed Nov 14 17:23:10 2012 -0800
    12.3 @@ -0,0 +1,41 @@
    12.4 +/*
    12.5 + * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
    12.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    12.7 + *
    12.8 + * This code is free software; you can redistribute it and/or modify it
    12.9 + * under the terms of the GNU General Public License version 2 only, as
   12.10 + * published by the Free Software Foundation.  Oracle designates this
   12.11 + * particular file as subject to the "Classpath" exception as provided
   12.12 + * by Oracle in the LICENSE file that accompanied this code.
   12.13 + *
   12.14 + * This code is distributed in the hope that it will be useful, but WITHOUT
   12.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   12.16 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   12.17 + * version 2 for more details (a copy is included in the LICENSE file that
   12.18 + * accompanied this code).
   12.19 + *
   12.20 + * You should have received a copy of the GNU General Public License version
   12.21 + * 2 along with this work; if not, write to the Free Software Foundation,
   12.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   12.23 + *
   12.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   12.25 + * or visit www.oracle.com if you need additional information or have any
   12.26 + * questions.
   12.27 + */
   12.28 +
   12.29 +package com.sun.source.doctree;
   12.30 +
   12.31 +import javax.lang.model.element.Name;
   12.32 +
   12.33 +
   12.34 +/**
   12.35 + * A tree node for an HTML entity.
   12.36 + *
   12.37 + * <p>
   12.38 + * &amp; name ;
   12.39 + *
   12.40 + * @since 1.8
   12.41 + */
   12.42 +public interface EntityTree extends DocTree {
   12.43 +    Name getName();
   12.44 +}
    13.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    13.2 +++ b/src/share/classes/com/sun/source/doctree/ErroneousTree.java	Wed Nov 14 17:23:10 2012 -0800
    13.3 @@ -0,0 +1,43 @@
    13.4 +/*
    13.5 + * Copyright (c) 2011, 2012, 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 +package com.sun.source.doctree;
   13.29 +
   13.30 +import javax.tools.Diagnostic;
   13.31 +import javax.tools.JavaFileObject;
   13.32 +
   13.33 +/**
   13.34 + * A tree node to stand in for a malformed text
   13.35 + *
   13.36 + * @since 1.8
   13.37 + */
   13.38 +public interface ErroneousTree extends TextTree {
   13.39 +    /**
   13.40 +     * Gets a diagnostic object giving details about
   13.41 +     * the reason the body text is in error.
   13.42 +     *
   13.43 +     * @return a diagnostic
   13.44 +     */
   13.45 +    Diagnostic<JavaFileObject> getDiagnostic();
   13.46 +}
    14.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    14.2 +++ b/src/share/classes/com/sun/source/doctree/IdentifierTree.java	Wed Nov 14 17:23:10 2012 -0800
    14.3 @@ -0,0 +1,40 @@
    14.4 +/*
    14.5 + * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
    14.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    14.7 + *
    14.8 + * This code is free software; you can redistribute it and/or modify it
    14.9 + * under the terms of the GNU General Public License version 2 only, as
   14.10 + * published by the Free Software Foundation.  Oracle designates this
   14.11 + * particular file as subject to the "Classpath" exception as provided
   14.12 + * by Oracle in the LICENSE file that accompanied this code.
   14.13 + *
   14.14 + * This code is distributed in the hope that it will be useful, but WITHOUT
   14.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   14.16 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   14.17 + * version 2 for more details (a copy is included in the LICENSE file that
   14.18 + * accompanied this code).
   14.19 + *
   14.20 + * You should have received a copy of the GNU General Public License version
   14.21 + * 2 along with this work; if not, write to the Free Software Foundation,
   14.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   14.23 + *
   14.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   14.25 + * or visit www.oracle.com if you need additional information or have any
   14.26 + * questions.
   14.27 + */
   14.28 +
   14.29 +package com.sun.source.doctree;
   14.30 +
   14.31 +import javax.lang.model.element.Name;
   14.32 +
   14.33 +/**
   14.34 + * An identifier in a documentation comment.
   14.35 + *
   14.36 + * <p>
   14.37 + * name
   14.38 + *
   14.39 + * @since 1.8
   14.40 + */
   14.41 +public interface IdentifierTree extends DocTree {
   14.42 +    Name getName();
   14.43 +}
    15.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    15.2 +++ b/src/share/classes/com/sun/source/doctree/InheritDocTree.java	Wed Nov 14 17:23:10 2012 -0800
    15.3 @@ -0,0 +1,37 @@
    15.4 +/*
    15.5 + * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
    15.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    15.7 + *
    15.8 + * This code is free software; you can redistribute it and/or modify it
    15.9 + * under the terms of the GNU General Public License version 2 only, as
   15.10 + * published by the Free Software Foundation.  Oracle designates this
   15.11 + * particular file as subject to the "Classpath" exception as provided
   15.12 + * by Oracle in the LICENSE file that accompanied this code.
   15.13 + *
   15.14 + * This code is distributed in the hope that it will be useful, but WITHOUT
   15.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   15.16 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   15.17 + * version 2 for more details (a copy is included in the LICENSE file that
   15.18 + * accompanied this code).
   15.19 + *
   15.20 + * You should have received a copy of the GNU General Public License version
   15.21 + * 2 along with this work; if not, write to the Free Software Foundation,
   15.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   15.23 + *
   15.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   15.25 + * or visit www.oracle.com if you need additional information or have any
   15.26 + * questions.
   15.27 + */
   15.28 +
   15.29 +package com.sun.source.doctree;
   15.30 +
   15.31 +/**
   15.32 + *
   15.33 + * A tree node for an @inheritDoc inline tag.
   15.34 + *
   15.35 + * <p>
   15.36 + * {&#064;inheritDoc}
   15.37 + *
   15.38 + * @since 1.8
   15.39 + */
   15.40 +public interface InheritDocTree extends InlineTagTree { }
    16.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    16.2 +++ b/src/share/classes/com/sun/source/doctree/InlineTagTree.java	Wed Nov 14 17:23:10 2012 -0800
    16.3 @@ -0,0 +1,36 @@
    16.4 +/*
    16.5 + * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
    16.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    16.7 + *
    16.8 + * This code is free software; you can redistribute it and/or modify it
    16.9 + * under the terms of the GNU General Public License version 2 only, as
   16.10 + * published by the Free Software Foundation.  Oracle designates this
   16.11 + * particular file as subject to the "Classpath" exception as provided
   16.12 + * by Oracle in the LICENSE file that accompanied this code.
   16.13 + *
   16.14 + * This code is distributed in the hope that it will be useful, but WITHOUT
   16.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   16.16 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   16.17 + * version 2 for more details (a copy is included in the LICENSE file that
   16.18 + * accompanied this code).
   16.19 + *
   16.20 + * You should have received a copy of the GNU General Public License version
   16.21 + * 2 along with this work; if not, write to the Free Software Foundation,
   16.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   16.23 + *
   16.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   16.25 + * or visit www.oracle.com if you need additional information or have any
   16.26 + * questions.
   16.27 + */
   16.28 +
   16.29 +package com.sun.source.doctree;
   16.30 +
   16.31 +/**
   16.32 + * A tree node used as the base class for the different types of
   16.33 + * inline tags.
   16.34 + *
   16.35 + * @since 1.8
   16.36 + */
   16.37 +public interface InlineTagTree extends DocTree {
   16.38 +    String getTagName();
   16.39 +}
    17.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    17.2 +++ b/src/share/classes/com/sun/source/doctree/LinkTree.java	Wed Nov 14 17:23:10 2012 -0800
    17.3 @@ -0,0 +1,42 @@
    17.4 +/*
    17.5 + * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
    17.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    17.7 + *
    17.8 + * This code is free software; you can redistribute it and/or modify it
    17.9 + * under the terms of the GNU General Public License version 2 only, as
   17.10 + * published by the Free Software Foundation.  Oracle designates this
   17.11 + * particular file as subject to the "Classpath" exception as provided
   17.12 + * by Oracle in the LICENSE file that accompanied this code.
   17.13 + *
   17.14 + * This code is distributed in the hope that it will be useful, but WITHOUT
   17.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   17.16 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   17.17 + * version 2 for more details (a copy is included in the LICENSE file that
   17.18 + * accompanied this code).
   17.19 + *
   17.20 + * You should have received a copy of the GNU General Public License version
   17.21 + * 2 along with this work; if not, write to the Free Software Foundation,
   17.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   17.23 + *
   17.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   17.25 + * or visit www.oracle.com if you need additional information or have any
   17.26 + * questions.
   17.27 + */
   17.28 +
   17.29 +package com.sun.source.doctree;
   17.30 +
   17.31 +import java.util.List;
   17.32 +
   17.33 +/**
   17.34 + * A tree node for an @link or &#064;linkplain inline tag.
   17.35 + *
   17.36 + * <p>
   17.37 + * {&#064;link reference label} <br>
   17.38 + * {&#064;linkplain reference label }
   17.39 + *
   17.40 + * @since 1.8
   17.41 + */
   17.42 +public interface LinkTree extends InlineTagTree {
   17.43 +    ReferenceTree getReference();
   17.44 +    List<? extends DocTree> getLabel();
   17.45 +}
    18.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    18.2 +++ b/src/share/classes/com/sun/source/doctree/LiteralTree.java	Wed Nov 14 17:23:10 2012 -0800
    18.3 @@ -0,0 +1,39 @@
    18.4 +/*
    18.5 + * Copyright (c) 2011, 2012, 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.  Oracle designates this
   18.11 + * particular file as subject to the "Classpath" exception as provided
   18.12 + * by Oracle in the LICENSE file that accompanied this code.
   18.13 + *
   18.14 + * This code is distributed in the hope that it will be useful, but WITHOUT
   18.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   18.16 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   18.17 + * version 2 for more details (a copy is included in the LICENSE file that
   18.18 + * accompanied this code).
   18.19 + *
   18.20 + * You should have received a copy of the GNU General Public License version
   18.21 + * 2 along with this work; if not, write to the Free Software Foundation,
   18.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   18.23 + *
   18.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   18.25 + * or visit www.oracle.com if you need additional information or have any
   18.26 + * questions.
   18.27 + */
   18.28 +
   18.29 +package com.sun.source.doctree;
   18.30 +
   18.31 +/**
   18.32 + *
   18.33 + * A tree node for an @literal or @code inline tag.
   18.34 + *
   18.35 + * <p>
   18.36 + * {&#064;literal text}
   18.37 + *
   18.38 + * @since 1.8
   18.39 + */
   18.40 +public interface LiteralTree extends InlineTagTree {
   18.41 +    TextTree getBody();
   18.42 +}
    19.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    19.2 +++ b/src/share/classes/com/sun/source/doctree/ParamTree.java	Wed Nov 14 17:23:10 2012 -0800
    19.3 @@ -0,0 +1,42 @@
    19.4 +/*
    19.5 + * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
    19.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    19.7 + *
    19.8 + * This code is free software; you can redistribute it and/or modify it
    19.9 + * under the terms of the GNU General Public License version 2 only, as
   19.10 + * published by the Free Software Foundation.  Oracle designates this
   19.11 + * particular file as subject to the "Classpath" exception as provided
   19.12 + * by Oracle in the LICENSE file that accompanied this code.
   19.13 + *
   19.14 + * This code is distributed in the hope that it will be useful, but WITHOUT
   19.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   19.16 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   19.17 + * version 2 for more details (a copy is included in the LICENSE file that
   19.18 + * accompanied this code).
   19.19 + *
   19.20 + * You should have received a copy of the GNU General Public License version
   19.21 + * 2 along with this work; if not, write to the Free Software Foundation,
   19.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   19.23 + *
   19.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   19.25 + * or visit www.oracle.com if you need additional information or have any
   19.26 + * questions.
   19.27 + */
   19.28 +
   19.29 +package com.sun.source.doctree;
   19.30 +
   19.31 +import java.util.List;
   19.32 +
   19.33 +/**
   19.34 + * A tree node for an @param block tag.
   19.35 + *
   19.36 + * <p>
   19.37 + * &#064;param parameter-name description
   19.38 + *
   19.39 + * @since 1.8
   19.40 + */
   19.41 +public interface ParamTree extends BlockTagTree {
   19.42 +    boolean isTypeParameter();
   19.43 +    IdentifierTree getName();
   19.44 +    List<? extends DocTree> getDescription();
   19.45 +}
    20.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    20.2 +++ b/src/share/classes/com/sun/source/doctree/ReferenceTree.java	Wed Nov 14 17:23:10 2012 -0800
    20.3 @@ -0,0 +1,38 @@
    20.4 +/*
    20.5 + * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
    20.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    20.7 + *
    20.8 + * This code is free software; you can redistribute it and/or modify it
    20.9 + * under the terms of the GNU General Public License version 2 only, as
   20.10 + * published by the Free Software Foundation.  Oracle designates this
   20.11 + * particular file as subject to the "Classpath" exception as provided
   20.12 + * by Oracle in the LICENSE file that accompanied this code.
   20.13 + *
   20.14 + * This code is distributed in the hope that it will be useful, but WITHOUT
   20.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   20.16 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   20.17 + * version 2 for more details (a copy is included in the LICENSE file that
   20.18 + * accompanied this code).
   20.19 + *
   20.20 + * You should have received a copy of the GNU General Public License version
   20.21 + * 2 along with this work; if not, write to the Free Software Foundation,
   20.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   20.23 + *
   20.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   20.25 + * or visit www.oracle.com if you need additional information or have any
   20.26 + * questions.
   20.27 + */
   20.28 +
   20.29 +package com.sun.source.doctree;
   20.30 +
   20.31 +/**
   20.32 + * A tree node to a reference to a Java language element.
   20.33 + *
   20.34 + * <p>
   20.35 + * package.class#field
   20.36 + *
   20.37 + * @since 1.8
   20.38 + */
   20.39 +public interface ReferenceTree extends DocTree {
   20.40 +    String getSignature();
   20.41 +}
    21.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    21.2 +++ b/src/share/classes/com/sun/source/doctree/ReturnTree.java	Wed Nov 14 17:23:10 2012 -0800
    21.3 @@ -0,0 +1,40 @@
    21.4 +/*
    21.5 + * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
    21.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    21.7 + *
    21.8 + * This code is free software; you can redistribute it and/or modify it
    21.9 + * under the terms of the GNU General Public License version 2 only, as
   21.10 + * published by the Free Software Foundation.  Oracle designates this
   21.11 + * particular file as subject to the "Classpath" exception as provided
   21.12 + * by Oracle in the LICENSE file that accompanied this code.
   21.13 + *
   21.14 + * This code is distributed in the hope that it will be useful, but WITHOUT
   21.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   21.16 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   21.17 + * version 2 for more details (a copy is included in the LICENSE file that
   21.18 + * accompanied this code).
   21.19 + *
   21.20 + * You should have received a copy of the GNU General Public License version
   21.21 + * 2 along with this work; if not, write to the Free Software Foundation,
   21.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   21.23 + *
   21.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   21.25 + * or visit www.oracle.com if you need additional information or have any
   21.26 + * questions.
   21.27 + */
   21.28 +
   21.29 +package com.sun.source.doctree;
   21.30 +
   21.31 +import java.util.List;
   21.32 +
   21.33 +/**
   21.34 + * A tree node for an @return block tag.
   21.35 + *
   21.36 + * <p>
   21.37 + * &#064;return description
   21.38 + *
   21.39 + * @since 1.8
   21.40 + */
   21.41 +public interface ReturnTree extends BlockTagTree {
   21.42 +    List<? extends DocTree> getDescription();
   21.43 +}
    22.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    22.2 +++ b/src/share/classes/com/sun/source/doctree/SeeTree.java	Wed Nov 14 17:23:10 2012 -0800
    22.3 @@ -0,0 +1,43 @@
    22.4 +/*
    22.5 + * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
    22.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    22.7 + *
    22.8 + * This code is free software; you can redistribute it and/or modify it
    22.9 + * under the terms of the GNU General Public License version 2 only, as
   22.10 + * published by the Free Software Foundation.  Oracle designates this
   22.11 + * particular file as subject to the "Classpath" exception as provided
   22.12 + * by Oracle in the LICENSE file that accompanied this code.
   22.13 + *
   22.14 + * This code is distributed in the hope that it will be useful, but WITHOUT
   22.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   22.16 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   22.17 + * version 2 for more details (a copy is included in the LICENSE file that
   22.18 + * accompanied this code).
   22.19 + *
   22.20 + * You should have received a copy of the GNU General Public License version
   22.21 + * 2 along with this work; if not, write to the Free Software Foundation,
   22.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   22.23 + *
   22.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   22.25 + * or visit www.oracle.com if you need additional information or have any
   22.26 + * questions.
   22.27 + */
   22.28 +
   22.29 +package com.sun.source.doctree;
   22.30 +
   22.31 +import java.util.List;
   22.32 +
   22.33 +/**
   22.34 + *
   22.35 + * A tree node for an @see block tag.
   22.36 + *
   22.37 + * <p>
   22.38 + * &#064;see "string" <br>
   22.39 + * &#064;see &lt;a href="URL#value"&gt; label &lt;/a&gt; <br>
   22.40 + * &#064;see reference
   22.41 + *
   22.42 + * @since 1.8
   22.43 + */
   22.44 +public interface SeeTree extends BlockTagTree {
   22.45 +    List<? extends DocTree> getReference();
   22.46 +}
    23.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    23.2 +++ b/src/share/classes/com/sun/source/doctree/SerialDataTree.java	Wed Nov 14 17:23:10 2012 -0800
    23.3 @@ -0,0 +1,40 @@
    23.4 +/*
    23.5 + * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
    23.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    23.7 + *
    23.8 + * This code is free software; you can redistribute it and/or modify it
    23.9 + * under the terms of the GNU General Public License version 2 only, as
   23.10 + * published by the Free Software Foundation.  Oracle designates this
   23.11 + * particular file as subject to the "Classpath" exception as provided
   23.12 + * by Oracle in the LICENSE file that accompanied this code.
   23.13 + *
   23.14 + * This code is distributed in the hope that it will be useful, but WITHOUT
   23.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   23.16 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   23.17 + * version 2 for more details (a copy is included in the LICENSE file that
   23.18 + * accompanied this code).
   23.19 + *
   23.20 + * You should have received a copy of the GNU General Public License version
   23.21 + * 2 along with this work; if not, write to the Free Software Foundation,
   23.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   23.23 + *
   23.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   23.25 + * or visit www.oracle.com if you need additional information or have any
   23.26 + * questions.
   23.27 + */
   23.28 +
   23.29 +package com.sun.source.doctree;
   23.30 +
   23.31 +import java.util.List;
   23.32 +
   23.33 +/**
   23.34 + * A tree node for an @serialData block tag.
   23.35 + *
   23.36 + * <p>
   23.37 + * &#064;serialData data-description
   23.38 + *
   23.39 + * @since 1.8
   23.40 + */
   23.41 +public interface SerialDataTree extends BlockTagTree {
   23.42 +    List<? extends DocTree> getDescription();
   23.43 +}
    24.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    24.2 +++ b/src/share/classes/com/sun/source/doctree/SerialFieldTree.java	Wed Nov 14 17:23:10 2012 -0800
    24.3 @@ -0,0 +1,42 @@
    24.4 +/*
    24.5 + * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
    24.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    24.7 + *
    24.8 + * This code is free software; you can redistribute it and/or modify it
    24.9 + * under the terms of the GNU General Public License version 2 only, as
   24.10 + * published by the Free Software Foundation.  Oracle designates this
   24.11 + * particular file as subject to the "Classpath" exception as provided
   24.12 + * by Oracle in the LICENSE file that accompanied this code.
   24.13 + *
   24.14 + * This code is distributed in the hope that it will be useful, but WITHOUT
   24.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   24.16 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   24.17 + * version 2 for more details (a copy is included in the LICENSE file that
   24.18 + * accompanied this code).
   24.19 + *
   24.20 + * You should have received a copy of the GNU General Public License version
   24.21 + * 2 along with this work; if not, write to the Free Software Foundation,
   24.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   24.23 + *
   24.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   24.25 + * or visit www.oracle.com if you need additional information or have any
   24.26 + * questions.
   24.27 + */
   24.28 +
   24.29 +package com.sun.source.doctree;
   24.30 +
   24.31 +import java.util.List;
   24.32 +
   24.33 +/**
   24.34 + * A tree node for an @serialData block tag.
   24.35 + *
   24.36 + * <p>
   24.37 + * &#064;serialField field-name field-type field-description
   24.38 + *
   24.39 + * @since 1.8
   24.40 + */
   24.41 +public interface SerialFieldTree extends BlockTagTree {
   24.42 +    IdentifierTree getName();
   24.43 +    ReferenceTree getType();
   24.44 +    List<? extends DocTree> getDescription();
   24.45 +}
    25.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    25.2 +++ b/src/share/classes/com/sun/source/doctree/SerialTree.java	Wed Nov 14 17:23:10 2012 -0800
    25.3 @@ -0,0 +1,40 @@
    25.4 +/*
    25.5 + * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
    25.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    25.7 + *
    25.8 + * This code is free software; you can redistribute it and/or modify it
    25.9 + * under the terms of the GNU General Public License version 2 only, as
   25.10 + * published by the Free Software Foundation.  Oracle designates this
   25.11 + * particular file as subject to the "Classpath" exception as provided
   25.12 + * by Oracle in the LICENSE file that accompanied this code.
   25.13 + *
   25.14 + * This code is distributed in the hope that it will be useful, but WITHOUT
   25.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   25.16 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   25.17 + * version 2 for more details (a copy is included in the LICENSE file that
   25.18 + * accompanied this code).
   25.19 + *
   25.20 + * You should have received a copy of the GNU General Public License version
   25.21 + * 2 along with this work; if not, write to the Free Software Foundation,
   25.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   25.23 + *
   25.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   25.25 + * or visit www.oracle.com if you need additional information or have any
   25.26 + * questions.
   25.27 + */
   25.28 +
   25.29 +package com.sun.source.doctree;
   25.30 +
   25.31 +import java.util.List;
   25.32 +
   25.33 +/**
   25.34 + * A tree node for an @serial block tag.
   25.35 + *
   25.36 + * <p>
   25.37 + * &#064;serial field-description | include | exclude
   25.38 + *
   25.39 + * @since 1.8
   25.40 + */
   25.41 +public interface SerialTree extends BlockTagTree {
   25.42 +    List<? extends DocTree> getDescription();
   25.43 +}
    26.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    26.2 +++ b/src/share/classes/com/sun/source/doctree/SinceTree.java	Wed Nov 14 17:23:10 2012 -0800
    26.3 @@ -0,0 +1,40 @@
    26.4 +/*
    26.5 + * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
    26.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    26.7 + *
    26.8 + * This code is free software; you can redistribute it and/or modify it
    26.9 + * under the terms of the GNU General Public License version 2 only, as
   26.10 + * published by the Free Software Foundation.  Oracle designates this
   26.11 + * particular file as subject to the "Classpath" exception as provided
   26.12 + * by Oracle in the LICENSE file that accompanied this code.
   26.13 + *
   26.14 + * This code is distributed in the hope that it will be useful, but WITHOUT
   26.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   26.16 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   26.17 + * version 2 for more details (a copy is included in the LICENSE file that
   26.18 + * accompanied this code).
   26.19 + *
   26.20 + * You should have received a copy of the GNU General Public License version
   26.21 + * 2 along with this work; if not, write to the Free Software Foundation,
   26.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   26.23 + *
   26.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   26.25 + * or visit www.oracle.com if you need additional information or have any
   26.26 + * questions.
   26.27 + */
   26.28 +
   26.29 +package com.sun.source.doctree;
   26.30 +
   26.31 +import java.util.List;
   26.32 +
   26.33 +/**
   26.34 + * A tree node for an @since block tag.
   26.35 + *
   26.36 + * <p>
   26.37 + * &#064;since since-text
   26.38 + *
   26.39 + * @since 1.8
   26.40 + */
   26.41 +public interface SinceTree extends BlockTagTree {
   26.42 +    List<? extends DocTree> getBody();
   26.43 +}
    27.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    27.2 +++ b/src/share/classes/com/sun/source/doctree/StartElementTree.java	Wed Nov 14 17:23:10 2012 -0800
    27.3 @@ -0,0 +1,43 @@
    27.4 +/*
    27.5 + * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
    27.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    27.7 + *
    27.8 + * This code is free software; you can redistribute it and/or modify it
    27.9 + * under the terms of the GNU General Public License version 2 only, as
   27.10 + * published by the Free Software Foundation.  Oracle designates this
   27.11 + * particular file as subject to the "Classpath" exception as provided
   27.12 + * by Oracle in the LICENSE file that accompanied this code.
   27.13 + *
   27.14 + * This code is distributed in the hope that it will be useful, but WITHOUT
   27.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   27.16 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   27.17 + * version 2 for more details (a copy is included in the LICENSE file that
   27.18 + * accompanied this code).
   27.19 + *
   27.20 + * You should have received a copy of the GNU General Public License version
   27.21 + * 2 along with this work; if not, write to the Free Software Foundation,
   27.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   27.23 + *
   27.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   27.25 + * or visit www.oracle.com if you need additional information or have any
   27.26 + * questions.
   27.27 + */
   27.28 +
   27.29 +package com.sun.source.doctree;
   27.30 +
   27.31 +import java.util.List;
   27.32 +import javax.lang.model.element.Name;
   27.33 +
   27.34 +/**
   27.35 + * A tree node for the start of an HTML element.
   27.36 + *
   27.37 + * <p>
   27.38 + * &lt; name [attributes] [/]&gt;
   27.39 + *
   27.40 + * @since 1.8
   27.41 + */
   27.42 +public interface StartElementTree extends DocTree {
   27.43 +    Name getName();
   27.44 +    List<? extends DocTree> getAttributes();
   27.45 +    boolean isSelfClosing();
   27.46 +}
    28.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    28.2 +++ b/src/share/classes/com/sun/source/doctree/TextTree.java	Wed Nov 14 17:23:10 2012 -0800
    28.3 @@ -0,0 +1,35 @@
    28.4 +/*
    28.5 + * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
    28.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    28.7 + *
    28.8 + * This code is free software; you can redistribute it and/or modify it
    28.9 + * under the terms of the GNU General Public License version 2 only, as
   28.10 + * published by the Free Software Foundation.  Oracle designates this
   28.11 + * particular file as subject to the "Classpath" exception as provided
   28.12 + * by Oracle in the LICENSE file that accompanied this code.
   28.13 + *
   28.14 + * This code is distributed in the hope that it will be useful, but WITHOUT
   28.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   28.16 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   28.17 + * version 2 for more details (a copy is included in the LICENSE file that
   28.18 + * accompanied this code).
   28.19 + *
   28.20 + * You should have received a copy of the GNU General Public License version
   28.21 + * 2 along with this work; if not, write to the Free Software Foundation,
   28.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   28.23 + *
   28.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   28.25 + * or visit www.oracle.com if you need additional information or have any
   28.26 + * questions.
   28.27 + */
   28.28 +
   28.29 +package com.sun.source.doctree;
   28.30 +
   28.31 +/**
   28.32 + * A tree node for plain text.
   28.33 + *
   28.34 + * @since 1.8
   28.35 + */
   28.36 +public interface TextTree extends DocTree {
   28.37 +    String getBody();
   28.38 +}
    29.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    29.2 +++ b/src/share/classes/com/sun/source/doctree/ThrowsTree.java	Wed Nov 14 17:23:10 2012 -0800
    29.3 @@ -0,0 +1,44 @@
    29.4 +/*
    29.5 + * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
    29.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    29.7 + *
    29.8 + * This code is free software; you can redistribute it and/or modify it
    29.9 + * under the terms of the GNU General Public License version 2 only, as
   29.10 + * published by the Free Software Foundation.  Oracle designates this
   29.11 + * particular file as subject to the "Classpath" exception as provided
   29.12 + * by Oracle in the LICENSE file that accompanied this code.
   29.13 + *
   29.14 + * This code is distributed in the hope that it will be useful, but WITHOUT
   29.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   29.16 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   29.17 + * version 2 for more details (a copy is included in the LICENSE file that
   29.18 + * accompanied this code).
   29.19 + *
   29.20 + * You should have received a copy of the GNU General Public License version
   29.21 + * 2 along with this work; if not, write to the Free Software Foundation,
   29.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   29.23 + *
   29.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   29.25 + * or visit www.oracle.com if you need additional information or have any
   29.26 + * questions.
   29.27 + */
   29.28 +
   29.29 +package com.sun.source.doctree;
   29.30 +
   29.31 +import java.util.List;
   29.32 +
   29.33 +/**
   29.34 + *
   29.35 + * A tree node for an @exception or &#064;throws block tag.
   29.36 + * &#064;exception is a synonym for &#064;throws.
   29.37 + *
   29.38 + * <p>
   29.39 + * &#064;exception class-name description <br>
   29.40 + * &#064;throws class-name description
   29.41 + *
   29.42 + * @since 1.8
   29.43 + */
   29.44 +public interface ThrowsTree extends BlockTagTree {
   29.45 +    ReferenceTree getExceptionName();
   29.46 +    List<? extends DocTree> getDescription();
   29.47 +}
    30.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    30.2 +++ b/src/share/classes/com/sun/source/doctree/UnknownBlockTagTree.java	Wed Nov 14 17:23:10 2012 -0800
    30.3 @@ -0,0 +1,40 @@
    30.4 +/*
    30.5 + * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
    30.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    30.7 + *
    30.8 + * This code is free software; you can redistribute it and/or modify it
    30.9 + * under the terms of the GNU General Public License version 2 only, as
   30.10 + * published by the Free Software Foundation.  Oracle designates this
   30.11 + * particular file as subject to the "Classpath" exception as provided
   30.12 + * by Oracle in the LICENSE file that accompanied this code.
   30.13 + *
   30.14 + * This code is distributed in the hope that it will be useful, but WITHOUT
   30.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   30.16 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   30.17 + * version 2 for more details (a copy is included in the LICENSE file that
   30.18 + * accompanied this code).
   30.19 + *
   30.20 + * You should have received a copy of the GNU General Public License version
   30.21 + * 2 along with this work; if not, write to the Free Software Foundation,
   30.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   30.23 + *
   30.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   30.25 + * or visit www.oracle.com if you need additional information or have any
   30.26 + * questions.
   30.27 + */
   30.28 +package com.sun.source.doctree;
   30.29 +
   30.30 +import java.util.List;
   30.31 +
   30.32 +/**
   30.33 + * A tree node for an unrecognized inline tag.
   30.34 + *
   30.35 + * <p>
   30.36 + * &#064;name content
   30.37 + *
   30.38 + * @since 1.8
   30.39 + *
   30.40 + */
   30.41 +public interface UnknownBlockTagTree extends BlockTagTree {
   30.42 +    List<? extends DocTree> getContent();
   30.43 +}
    31.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    31.2 +++ b/src/share/classes/com/sun/source/doctree/UnknownInlineTagTree.java	Wed Nov 14 17:23:10 2012 -0800
    31.3 @@ -0,0 +1,40 @@
    31.4 +/*
    31.5 + * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
    31.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    31.7 + *
    31.8 + * This code is free software; you can redistribute it and/or modify it
    31.9 + * under the terms of the GNU General Public License version 2 only, as
   31.10 + * published by the Free Software Foundation.  Oracle designates this
   31.11 + * particular file as subject to the "Classpath" exception as provided
   31.12 + * by Oracle in the LICENSE file that accompanied this code.
   31.13 + *
   31.14 + * This code is distributed in the hope that it will be useful, but WITHOUT
   31.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   31.16 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   31.17 + * version 2 for more details (a copy is included in the LICENSE file that
   31.18 + * accompanied this code).
   31.19 + *
   31.20 + * You should have received a copy of the GNU General Public License version
   31.21 + * 2 along with this work; if not, write to the Free Software Foundation,
   31.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   31.23 + *
   31.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   31.25 + * or visit www.oracle.com if you need additional information or have any
   31.26 + * questions.
   31.27 + */
   31.28 +package com.sun.source.doctree;
   31.29 +
   31.30 +import java.util.List;
   31.31 +
   31.32 +/**
   31.33 + * A tree node for an unrecognized inline tag.
   31.34 + *
   31.35 + * <p>
   31.36 + * {&#064;name content}
   31.37 + *
   31.38 + * @since 1.8
   31.39 + *
   31.40 + */
   31.41 +public interface UnknownInlineTagTree extends InlineTagTree {
   31.42 +    List<? extends DocTree> getContent();
   31.43 +}
    32.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    32.2 +++ b/src/share/classes/com/sun/source/doctree/ValueTree.java	Wed Nov 14 17:23:10 2012 -0800
    32.3 @@ -0,0 +1,38 @@
    32.4 +/*
    32.5 + * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
    32.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    32.7 + *
    32.8 + * This code is free software; you can redistribute it and/or modify it
    32.9 + * under the terms of the GNU General Public License version 2 only, as
   32.10 + * published by the Free Software Foundation.  Oracle designates this
   32.11 + * particular file as subject to the "Classpath" exception as provided
   32.12 + * by Oracle in the LICENSE file that accompanied this code.
   32.13 + *
   32.14 + * This code is distributed in the hope that it will be useful, but WITHOUT
   32.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   32.16 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   32.17 + * version 2 for more details (a copy is included in the LICENSE file that
   32.18 + * accompanied this code).
   32.19 + *
   32.20 + * You should have received a copy of the GNU General Public License version
   32.21 + * 2 along with this work; if not, write to the Free Software Foundation,
   32.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   32.23 + *
   32.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   32.25 + * or visit www.oracle.com if you need additional information or have any
   32.26 + * questions.
   32.27 + */
   32.28 +
   32.29 +package com.sun.source.doctree;
   32.30 +
   32.31 +/**
   32.32 + * A tree node for an @value inline tag.
   32.33 + *
   32.34 + * <p>
   32.35 + * { &#064;value reference }
   32.36 + *
   32.37 + * @since 1.8
   32.38 + */
   32.39 +public interface ValueTree extends InlineTagTree {
   32.40 +    ReferenceTree getReference();
   32.41 +}
    33.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    33.2 +++ b/src/share/classes/com/sun/source/doctree/VersionTree.java	Wed Nov 14 17:23:10 2012 -0800
    33.3 @@ -0,0 +1,41 @@
    33.4 +/*
    33.5 + * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
    33.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    33.7 + *
    33.8 + * This code is free software; you can redistribute it and/or modify it
    33.9 + * under the terms of the GNU General Public License version 2 only, as
   33.10 + * published by the Free Software Foundation.  Oracle designates this
   33.11 + * particular file as subject to the "Classpath" exception as provided
   33.12 + * by Oracle in the LICENSE file that accompanied this code.
   33.13 + *
   33.14 + * This code is distributed in the hope that it will be useful, but WITHOUT
   33.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   33.16 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   33.17 + * version 2 for more details (a copy is included in the LICENSE file that
   33.18 + * accompanied this code).
   33.19 + *
   33.20 + * You should have received a copy of the GNU General Public License version
   33.21 + * 2 along with this work; if not, write to the Free Software Foundation,
   33.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   33.23 + *
   33.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   33.25 + * or visit www.oracle.com if you need additional information or have any
   33.26 + * questions.
   33.27 + */
   33.28 +
   33.29 +package com.sun.source.doctree;
   33.30 +
   33.31 +import java.util.List;
   33.32 +
   33.33 +/**
   33.34 + *
   33.35 + * A tree node for an @version block tag.
   33.36 + *
   33.37 + * <p>
   33.38 + * &#064;version version-text
   33.39 + *
   33.40 + * @since 1.8
   33.41 + */
   33.42 +public interface VersionTree extends BlockTagTree {
   33.43 +    List<? extends DocTree> getBody();
   33.44 +}
    34.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    34.2 +++ b/src/share/classes/com/sun/source/doctree/package-info.java	Wed Nov 14 17:23:10 2012 -0800
    34.3 @@ -0,0 +1,34 @@
    34.4 +/*
    34.5 + * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
    34.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    34.7 + *
    34.8 + * This code is free software; you can redistribute it and/or modify it
    34.9 + * under the terms of the GNU General Public License version 2 only, as
   34.10 + * published by the Free Software Foundation.  Oracle designates this
   34.11 + * particular file as subject to the "Classpath" exception as provided
   34.12 + * by Oracle in the LICENSE file that accompanied this code.
   34.13 + *
   34.14 + * This code is distributed in the hope that it will be useful, but WITHOUT
   34.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   34.16 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   34.17 + * version 2 for more details (a copy is included in the LICENSE file that
   34.18 + * accompanied this code).
   34.19 + *
   34.20 + * You should have received a copy of the GNU General Public License version
   34.21 + * 2 along with this work; if not, write to the Free Software Foundation,
   34.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   34.23 + *
   34.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   34.25 + * or visit www.oracle.com if you need additional information or have any
   34.26 + * questions.
   34.27 + */
   34.28 +
   34.29 +/**
   34.30 + * Provides interfaces to represent documentation comments as abstract syntax
   34.31 + * trees (AST).
   34.32 + *
   34.33 + * @author Jonathan Gibbons
   34.34 + * @since 1.8
   34.35 + * @see <a href="http://download.oracle.com/javase/6/docs/technotes/tools/solaris/javadoc.html#javadoctags">http://download.oracle.com/javase/6/docs/technotes/tools/solaris/javadoc.html#javadoctags</a>
   34.36 + */
   34.37 +package com.sun.source.doctree;
    35.1 --- a/src/share/classes/com/sun/source/tree/Tree.java	Wed Nov 14 16:41:51 2012 -0800
    35.2 +++ b/src/share/classes/com/sun/source/tree/Tree.java	Wed Nov 14 17:23:10 2012 -0800
    35.3 @@ -1,5 +1,5 @@
    35.4  /*
    35.5 - * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
    35.6 + * Copyright (c) 2005, 2012, 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
   35.10 @@ -610,7 +610,7 @@
   35.11       * visitor pattern is used to implement operations on trees.
   35.12       *
   35.13       * @param <R> result type of this operation.
   35.14 -     * @param <D> type of additonal data.
   35.15 +     * @param <D> type of additional data.
   35.16       */
   35.17      <R,D> R accept(TreeVisitor<R,D> visitor, D data);
   35.18  }
    36.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    36.2 +++ b/src/share/classes/com/sun/source/util/DocTreeScanner.java	Wed Nov 14 17:23:10 2012 -0800
    36.3 @@ -0,0 +1,273 @@
    36.4 +/*
    36.5 + * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
    36.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    36.7 + *
    36.8 + * This code is free software; you can redistribute it and/or modify it
    36.9 + * under the terms of the GNU General Public License version 2 only, as
   36.10 + * published by the Free Software Foundation.  Oracle designates this
   36.11 + * particular file as subject to the "Classpath" exception as provided
   36.12 + * by Oracle in the LICENSE file that accompanied this code.
   36.13 + *
   36.14 + * This code is distributed in the hope that it will be useful, but WITHOUT
   36.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   36.16 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   36.17 + * version 2 for more details (a copy is included in the LICENSE file that
   36.18 + * accompanied this code).
   36.19 + *
   36.20 + * You should have received a copy of the GNU General Public License version
   36.21 + * 2 along with this work; if not, write to the Free Software Foundation,
   36.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   36.23 + *
   36.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   36.25 + * or visit www.oracle.com if you need additional information or have any
   36.26 + * questions.
   36.27 + */
   36.28 +
   36.29 +package com.sun.source.util;
   36.30 +
   36.31 +import com.sun.source.doctree.*;
   36.32 +
   36.33 +
   36.34 +/**
   36.35 + * A TreeVisitor that visits all the child tree nodes.
   36.36 + * To visit nodes of a particular type, just override the
   36.37 + * corresponding visitXYZ method.
   36.38 + * Inside your method, call super.visitXYZ to visit descendant
   36.39 + * nodes.
   36.40 + *
   36.41 + * <p>The default implementation of the visitXYZ methods will determine
   36.42 + * a result as follows:
   36.43 + * <ul>
   36.44 + * <li>If the node being visited has no children, the result will be null.
   36.45 + * <li>If the node being visited has one child, the result will be the
   36.46 + * result of calling {@code scan} on that child. The child may be a simple node
   36.47 + * or itself a list of nodes.
   36.48 + * <li> If the node being visited has more than one child, the result will
   36.49 + * be determined by calling {@code scan} each child in turn, and then combining the
   36.50 + * result of each scan after the first with the cumulative result
   36.51 + * so far, as determined by the {@link #reduce} method. Each child may be either
   36.52 + * a simple node of a list of nodes. The default behavior of the {@code reduce}
   36.53 + * method is such that the result of the visitXYZ method will be the result of
   36.54 + * the last child scanned.
   36.55 + * </ul>
   36.56 + *
   36.57 + * <p>Here is an example to count the number of erroneous nodes in a tree:
   36.58 + * <pre>
   36.59 + *   class CountErrors extends DocTreeScanner<Integer,Void> {
   36.60 + *      {@literal @}Override
   36.61 + *      public Integer visitErroneous(ErroneousTree node, Void p) {
   36.62 + *          return 1;
   36.63 + *      }
   36.64 + *      {@literal @}Override
   36.65 + *      public Integer reduce(Integer r1, Integer r2) {
   36.66 + *          return (r1 == null ? 0 : r1) + (r2 == null ? 0 : r2);
   36.67 + *      }
   36.68 + *   }
   36.69 + * </pre>
   36.70 + *
   36.71 + * @since 1.8
   36.72 + */
   36.73 +public class DocTreeScanner<R,P> implements DocTreeVisitor<R,P> {
   36.74 +
   36.75 +    /**
   36.76 +     * Scan a single node.
   36.77 +     */
   36.78 +    public R scan(DocTree node, P p) {
   36.79 +        return (node == null) ? null : node.accept(this, p);
   36.80 +    }
   36.81 +
   36.82 +    private R scanAndReduce(DocTree node, P p, R r) {
   36.83 +        return reduce(scan(node, p), r);
   36.84 +    }
   36.85 +
   36.86 +    /**
   36.87 +     * Scan a list of nodes.
   36.88 +     */
   36.89 +    public R scan(Iterable<? extends DocTree> nodes, P p) {
   36.90 +        R r = null;
   36.91 +        if (nodes != null) {
   36.92 +            boolean first = true;
   36.93 +            for (DocTree node : nodes) {
   36.94 +                r = (first ? scan(node, p) : scanAndReduce(node, p, r));
   36.95 +                first = false;
   36.96 +            }
   36.97 +        }
   36.98 +        return r;
   36.99 +    }
  36.100 +
  36.101 +    private R scanAndReduce(Iterable<? extends DocTree> nodes, P p, R r) {
  36.102 +        return reduce(scan(nodes, p), r);
  36.103 +    }
  36.104 +
  36.105 +    /**
  36.106 +     * Reduces two results into a combined result.
  36.107 +     * The default implementation is to return the first parameter.
  36.108 +     * The general contract of the method is that it may take any action whatsoever.
  36.109 +     */
  36.110 +    public R reduce(R r1, R r2) {
  36.111 +        return r1;
  36.112 +    }
  36.113 +
  36.114 +
  36.115 +/* ***************************************************************************
  36.116 + * Visitor methods
  36.117 + ****************************************************************************/
  36.118 +
  36.119 +    @Override
  36.120 +    public R visitAttribute(AttributeTree node, P p) {
  36.121 +        return null;
  36.122 +    }
  36.123 +
  36.124 +    @Override
  36.125 +    public R visitAuthor(AuthorTree node, P p) {
  36.126 +        return scan(node.getName(), p);
  36.127 +    }
  36.128 +
  36.129 +    @Override
  36.130 +    public R visitComment(CommentTree node, P p) {
  36.131 +        return null;
  36.132 +    }
  36.133 +
  36.134 +    @Override
  36.135 +    public R visitDeprecated(DeprecatedTree node, P p) {
  36.136 +        return scan(node.getBody(), p);
  36.137 +    }
  36.138 +
  36.139 +    @Override
  36.140 +    public R visitDocComment(DocCommentTree node, P p) {
  36.141 +        R r = scan(node.getFirstSentence(), p);
  36.142 +        r = scanAndReduce(node.getBody(), p, r);
  36.143 +        r = scanAndReduce(node.getBlockTags(), p, r);
  36.144 +        return r;
  36.145 +    }
  36.146 +
  36.147 +    @Override
  36.148 +    public R visitDocRoot(DocRootTree node, P p) {
  36.149 +        return null;
  36.150 +    }
  36.151 +
  36.152 +    @Override
  36.153 +    public R visitEndElement(EndElementTree node, P p) {
  36.154 +        return null;
  36.155 +    }
  36.156 +
  36.157 +    @Override
  36.158 +    public R visitEntity(EntityTree node, P p) {
  36.159 +        return null;
  36.160 +    }
  36.161 +
  36.162 +    @Override
  36.163 +    public R visitErroneous(ErroneousTree node, P p) {
  36.164 +        return null;
  36.165 +    }
  36.166 +
  36.167 +    @Override
  36.168 +    public R visitIdentifier(IdentifierTree node, P p) {
  36.169 +        return null;
  36.170 +    }
  36.171 +
  36.172 +    @Override
  36.173 +    public R visitInheritDoc(InheritDocTree node, P p) {
  36.174 +        return null;
  36.175 +    }
  36.176 +
  36.177 +    @Override
  36.178 +    public R visitLink(LinkTree node, P p) {
  36.179 +        R r = scan(node.getReference(), p);
  36.180 +        r = scanAndReduce(node.getLabel(), p, r);
  36.181 +        return r;
  36.182 +    }
  36.183 +
  36.184 +    @Override
  36.185 +    public R visitLiteral(LiteralTree node, P p) {
  36.186 +        return null;
  36.187 +    }
  36.188 +
  36.189 +    @Override
  36.190 +    public R visitParam(ParamTree node, P p) {
  36.191 +        R r = scan(node.getName(), p);
  36.192 +        r = scanAndReduce(node.getDescription(), p, r);
  36.193 +        return r;
  36.194 +    }
  36.195 +
  36.196 +    @Override
  36.197 +    public R visitReference(ReferenceTree node, P p) {
  36.198 +        return null;
  36.199 +    }
  36.200 +
  36.201 +    @Override
  36.202 +    public R visitReturn(ReturnTree node, P p) {
  36.203 +        return scan(node.getDescription(), p);
  36.204 +    }
  36.205 +
  36.206 +    @Override
  36.207 +    public R visitSee(SeeTree node, P p) {
  36.208 +        return scan(node.getReference(), p);
  36.209 +    }
  36.210 +
  36.211 +    @Override
  36.212 +    public R visitSerial(SerialTree node, P p) {
  36.213 +        return scan(node.getDescription(), p);
  36.214 +    }
  36.215 +
  36.216 +    @Override
  36.217 +    public R visitSerialData(SerialDataTree node, P p) {
  36.218 +        return scan(node.getDescription(), p);
  36.219 +    }
  36.220 +
  36.221 +    @Override
  36.222 +    public R visitSerialField(SerialFieldTree node, P p) {
  36.223 +        R r = scan(node.getName(), p);
  36.224 +        r = scanAndReduce(node.getType(), p, r);
  36.225 +        r = scanAndReduce(node.getDescription(), p, r);
  36.226 +        return r;
  36.227 +    }
  36.228 +
  36.229 +    @Override
  36.230 +    public R visitSince(SinceTree node, P p) {
  36.231 +        return scan(node.getBody(), p);
  36.232 +    }
  36.233 +
  36.234 +    @Override
  36.235 +    public R visitStartElement(StartElementTree node, P p) {
  36.236 +        return scan(node.getAttributes(), p);
  36.237 +    }
  36.238 +
  36.239 +    @Override
  36.240 +    public R visitText(TextTree node, P p) {
  36.241 +        return null;
  36.242 +    }
  36.243 +
  36.244 +    @Override
  36.245 +    public R visitThrows(ThrowsTree node, P p) {
  36.246 +        R r = scan(node.getExceptionName(), p);
  36.247 +        r = scanAndReduce(node.getDescription(), p, r);
  36.248 +        return r;
  36.249 +    }
  36.250 +
  36.251 +    @Override
  36.252 +    public R visitUnknownBlockTag(UnknownBlockTagTree node, P p) {
  36.253 +        return scan(node.getContent(), p);
  36.254 +    }
  36.255 +
  36.256 +    @Override
  36.257 +    public R visitUnknownInlineTag(UnknownInlineTagTree node, P p) {
  36.258 +        return scan(node.getContent(), p);
  36.259 +    }
  36.260 +
  36.261 +    @Override
  36.262 +    public R visitValue(ValueTree node, P p) {
  36.263 +        return scan(node.getReference(), p);
  36.264 +    }
  36.265 +
  36.266 +    @Override
  36.267 +    public R visitVersion(VersionTree node, P p) {
  36.268 +        return scan(node.getBody(), p);
  36.269 +    }
  36.270 +
  36.271 +    @Override
  36.272 +    public R visitOther(DocTree node, P p) {
  36.273 +        return null;
  36.274 +    }
  36.275 +
  36.276 +}
    37.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    37.2 +++ b/src/share/classes/com/sun/source/util/DocTrees.java	Wed Nov 14 17:23:10 2012 -0800
    37.3 @@ -0,0 +1,89 @@
    37.4 +/*
    37.5 + * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
    37.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    37.7 + *
    37.8 + * This code is free software; you can redistribute it and/or modify it
    37.9 + * under the terms of the GNU General Public License version 2 only, as
   37.10 + * published by the Free Software Foundation.  Oracle designates this
   37.11 + * particular file as subject to the "Classpath" exception as provided
   37.12 + * by Oracle in the LICENSE file that accompanied this code.
   37.13 + *
   37.14 + * This code is distributed in the hope that it will be useful, but WITHOUT
   37.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   37.16 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   37.17 + * version 2 for more details (a copy is included in the LICENSE file that
   37.18 + * accompanied this code).
   37.19 + *
   37.20 + * You should have received a copy of the GNU General Public License version
   37.21 + * 2 along with this work; if not, write to the Free Software Foundation,
   37.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   37.23 + *
   37.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   37.25 + * or visit www.oracle.com if you need additional information or have any
   37.26 + * questions.
   37.27 + */
   37.28 +
   37.29 +package com.sun.source.util;
   37.30 +
   37.31 +import javax.annotation.processing.ProcessingEnvironment;
   37.32 +import javax.lang.model.element.Element;
   37.33 +import javax.tools.JavaCompiler.CompilationTask;
   37.34 +
   37.35 +import com.sun.source.doctree.DocCommentTree;
   37.36 +import com.sun.source.doctree.ReferenceTree;
   37.37 +import javax.tools.Diagnostic;
   37.38 +
   37.39 +/**
   37.40 + * Provides access to syntax trees for doc comments.
   37.41 + *
   37.42 + * @since 1.8
   37.43 + */
   37.44 +public abstract class DocTrees extends Trees {
   37.45 +    /**
   37.46 +     * Gets a DocTrees object for a given CompilationTask.
   37.47 +     * @param task the compilation task for which to get the Trees object
   37.48 +     * @throws IllegalArgumentException if the task does not support the Trees API.
   37.49 +     */
   37.50 +    public static DocTrees instance(CompilationTask task) {
   37.51 +        if (!task.getClass().getName().equals("com.sun.tools.javac.api.JavacTaskImpl"))
   37.52 +            throw new IllegalArgumentException();
   37.53 +        return (DocTrees) getJavacTrees(CompilationTask.class, task);
   37.54 +    }
   37.55 +
   37.56 +    /**
   37.57 +     * Gets a DocTrees object for a given ProcessingEnvironment.
   37.58 +     * @param env the processing environment for which to get the Trees object
   37.59 +     * @throws IllegalArgumentException if the env does not support the Trees API.
   37.60 +     */
   37.61 +    public static DocTrees instance(ProcessingEnvironment env) {
   37.62 +        if (!env.getClass().getName().equals("com.sun.tools.javac.processing.JavacProcessingEnvironment"))
   37.63 +            throw new IllegalArgumentException();
   37.64 +        return (DocTrees) getJavacTrees(ProcessingEnvironment.class, env);
   37.65 +    }
   37.66 +
   37.67 +    /**
   37.68 +     * Gets the doc comment tree, if any, for the Tree node identified by a given TreePath.
   37.69 +     * Returns null if no doc comment was found.
   37.70 +     */
   37.71 +    public abstract DocCommentTree getDocCommentTree(TreePath path);
   37.72 +
   37.73 +    /**
   37.74 +     * Gets the language model element referred to by a ReferenceTree that
   37.75 +     * appears on the declaration identified by the given path.
   37.76 +     */
   37.77 +    public abstract Element getElement(TreePath path, ReferenceTree reference);
   37.78 +
   37.79 +    /**
   37.80 +     * Prints a message of the specified kind at the location of the
   37.81 +     * tree within the provided compilation unit
   37.82 +     *
   37.83 +     * @param kind the kind of message
   37.84 +     * @param msg  the message, or an empty string if none
   37.85 +     * @param t    the tree to use as a position hint
   37.86 +     * @param root the compilation unit that contains tree
   37.87 +     */
   37.88 +    public abstract void printMessage(Diagnostic.Kind kind, CharSequence msg,
   37.89 +            com.sun.source.doctree.DocTree t,
   37.90 +            com.sun.source.doctree.DocCommentTree c,
   37.91 +            com.sun.source.tree.CompilationUnitTree root);
   37.92 +}
    38.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    38.2 +++ b/src/share/classes/com/sun/source/util/SimpleDocTreeVisitor.java	Wed Nov 14 17:23:10 2012 -0800
    38.3 @@ -0,0 +1,179 @@
    38.4 +/*
    38.5 + * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
    38.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    38.7 + *
    38.8 + * This code is free software; you can redistribute it and/or modify it
    38.9 + * under the terms of the GNU General Public License version 2 only, as
   38.10 + * published by the Free Software Foundation.  Oracle designates this
   38.11 + * particular file as subject to the "Classpath" exception as provided
   38.12 + * by Oracle in the LICENSE file that accompanied this code.
   38.13 + *
   38.14 + * This code is distributed in the hope that it will be useful, but WITHOUT
   38.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   38.16 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   38.17 + * version 2 for more details (a copy is included in the LICENSE file that
   38.18 + * accompanied this code).
   38.19 + *
   38.20 + * You should have received a copy of the GNU General Public License version
   38.21 + * 2 along with this work; if not, write to the Free Software Foundation,
   38.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   38.23 + *
   38.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   38.25 + * or visit www.oracle.com if you need additional information or have any
   38.26 + * questions.
   38.27 + */
   38.28 +
   38.29 +package com.sun.source.util;
   38.30 +
   38.31 +import com.sun.source.doctree.*;
   38.32 +
   38.33 +/**
   38.34 + * A simple visitor for tree nodes.
   38.35 + *
   38.36 + * @since 1.8
   38.37 + */
   38.38 +public class SimpleDocTreeVisitor<R,P> implements DocTreeVisitor<R, P> {
   38.39 +    protected final R DEFAULT_VALUE;
   38.40 +
   38.41 +    protected SimpleDocTreeVisitor() {
   38.42 +        DEFAULT_VALUE = null;
   38.43 +    }
   38.44 +
   38.45 +    protected SimpleDocTreeVisitor(R defaultValue) {
   38.46 +        DEFAULT_VALUE = defaultValue;
   38.47 +    }
   38.48 +
   38.49 +    protected R defaultAction(DocTree node, P p) {
   38.50 +        return DEFAULT_VALUE;
   38.51 +    }
   38.52 +
   38.53 +    public final R visit(DocTree node, P p) {
   38.54 +        return (node == null) ? null : node.accept(this, p);
   38.55 +    }
   38.56 +
   38.57 +    public final R visit(Iterable<? extends DocTree> nodes, P p) {
   38.58 +        R r = null;
   38.59 +        if (nodes != null) {
   38.60 +            for (DocTree node : nodes)
   38.61 +                r = visit(node, p);
   38.62 +        }
   38.63 +        return r;
   38.64 +    }
   38.65 +
   38.66 +    public R visitAttribute(AttributeTree node, P p) {
   38.67 +        return defaultAction(node, p);
   38.68 +    }
   38.69 +
   38.70 +    public R visitAuthor(AuthorTree node, P p) {
   38.71 +        return defaultAction(node, p);
   38.72 +    }
   38.73 +
   38.74 +    public R visitComment(CommentTree node, P p) {
   38.75 +        return defaultAction(node, p);
   38.76 +    }
   38.77 +
   38.78 +    public R visitDeprecated(DeprecatedTree node, P p) {
   38.79 +        return defaultAction(node, p);
   38.80 +    }
   38.81 +
   38.82 +    public R visitDocComment(DocCommentTree node, P p) {
   38.83 +        return defaultAction(node, p);
   38.84 +    }
   38.85 +
   38.86 +    public R visitDocRoot(DocRootTree node, P p) {
   38.87 +        return defaultAction(node, p);
   38.88 +    }
   38.89 +
   38.90 +    public R visitEndElement(EndElementTree node, P p) {
   38.91 +        return defaultAction(node, p);
   38.92 +    }
   38.93 +
   38.94 +    public R visitEntity(EntityTree node, P p) {
   38.95 +        return defaultAction(node, p);
   38.96 +    }
   38.97 +
   38.98 +    public R visitErroneous(ErroneousTree node, P p) {
   38.99 +        return defaultAction(node, p);
  38.100 +    }
  38.101 +
  38.102 +    public R visitIdentifier(IdentifierTree node, P p) {
  38.103 +        return defaultAction(node, p);
  38.104 +    }
  38.105 +
  38.106 +    public R visitInheritDoc(InheritDocTree node, P p) {
  38.107 +        return defaultAction(node, p);
  38.108 +    }
  38.109 +
  38.110 +    public R visitLink(LinkTree node, P p) {
  38.111 +        return defaultAction(node, p);
  38.112 +    }
  38.113 +
  38.114 +    public R visitLiteral(LiteralTree node, P p) {
  38.115 +        return defaultAction(node, p);
  38.116 +    }
  38.117 +
  38.118 +    public R visitParam(ParamTree node, P p) {
  38.119 +        return defaultAction(node, p);
  38.120 +    }
  38.121 +
  38.122 +    public R visitReference(ReferenceTree node, P p) {
  38.123 +        return defaultAction(node, p);
  38.124 +    }
  38.125 +
  38.126 +    public R visitReturn(ReturnTree node, P p) {
  38.127 +        return defaultAction(node, p);
  38.128 +    }
  38.129 +
  38.130 +    public R visitSee(SeeTree node, P p) {
  38.131 +        return defaultAction(node, p);
  38.132 +    }
  38.133 +
  38.134 +    public R visitSerial(SerialTree node, P p) {
  38.135 +        return defaultAction(node, p);
  38.136 +    }
  38.137 +
  38.138 +    public R visitSerialData(SerialDataTree node, P p) {
  38.139 +        return defaultAction(node, p);
  38.140 +    }
  38.141 +
  38.142 +    public R visitSerialField(SerialFieldTree node, P p) {
  38.143 +        return defaultAction(node, p);
  38.144 +    }
  38.145 +
  38.146 +    public R visitSince(SinceTree node, P p) {
  38.147 +        return defaultAction(node, p);
  38.148 +    }
  38.149 +
  38.150 +    public R visitStartElement(StartElementTree node, P p) {
  38.151 +        return defaultAction(node, p);
  38.152 +    }
  38.153 +
  38.154 +    public R visitText(TextTree node, P p) {
  38.155 +        return defaultAction(node, p);
  38.156 +    }
  38.157 +
  38.158 +    public R visitThrows(ThrowsTree node, P p) {
  38.159 +        return defaultAction(node, p);
  38.160 +    }
  38.161 +
  38.162 +    public R visitUnknownBlockTag(UnknownBlockTagTree node, P p) {
  38.163 +        return defaultAction(node, p);
  38.164 +    }
  38.165 +
  38.166 +    public R visitUnknownInlineTag(UnknownInlineTagTree node, P p) {
  38.167 +        return defaultAction(node, p);
  38.168 +    }
  38.169 +
  38.170 +    public R visitValue(ValueTree node, P p) {
  38.171 +        return defaultAction(node, p);
  38.172 +    }
  38.173 +
  38.174 +    public R visitVersion(VersionTree node, P p) {
  38.175 +        return defaultAction(node, p);
  38.176 +    }
  38.177 +
  38.178 +    public R visitOther(DocTree node, P p) {
  38.179 +        return defaultAction(node, p);
  38.180 +    }
  38.181 +
  38.182 +}
    39.1 --- a/src/share/classes/com/sun/source/util/Trees.java	Wed Nov 14 16:41:51 2012 -0800
    39.2 +++ b/src/share/classes/com/sun/source/util/Trees.java	Wed Nov 14 17:23:10 2012 -0800
    39.3 @@ -1,5 +1,5 @@
    39.4  /*
    39.5 - * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
    39.6 + * Copyright (c) 2005, 2012, 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
   39.10 @@ -26,6 +26,7 @@
   39.11  package com.sun.source.util;
   39.12  
   39.13  import java.lang.reflect.Method;
   39.14 +
   39.15  import javax.annotation.processing.ProcessingEnvironment;
   39.16  import javax.lang.model.element.AnnotationMirror;
   39.17  import javax.lang.model.element.AnnotationValue;
   39.18 @@ -73,7 +74,7 @@
   39.19          return getJavacTrees(ProcessingEnvironment.class, env);
   39.20      }
   39.21  
   39.22 -    private static Trees getJavacTrees(Class<?> argType, Object arg) {
   39.23 +    static Trees getJavacTrees(Class<?> argType, Object arg) {
   39.24          try {
   39.25              ClassLoader cl = arg.getClass().getClassLoader();
   39.26              Class<?> c = Class.forName("com.sun.tools.javac.api.JavacTrees", false, cl);
   39.27 @@ -168,6 +169,7 @@
   39.28      /**
   39.29       * Gets the doc comment, if any, for the Tree node identified by a given TreePath.
   39.30       * Returns null if no doc comment was found.
   39.31 +     * @see DocTrees#getDocCommentTree(TreePath)
   39.32       */
   39.33      public abstract String getDocComment(TreePath path);
   39.34  
    40.1 --- a/src/share/classes/com/sun/tools/javac/api/JavacTrees.java	Wed Nov 14 16:41:51 2012 -0800
    40.2 +++ b/src/share/classes/com/sun/tools/javac/api/JavacTrees.java	Wed Nov 14 17:23:10 2012 -0800
    40.3 @@ -26,6 +26,8 @@
    40.4  package com.sun.tools.javac.api;
    40.5  
    40.6  import java.io.IOException;
    40.7 +import java.util.HashSet;
    40.8 +import java.util.Set;
    40.9  
   40.10  import javax.annotation.processing.ProcessingEnvironment;
   40.11  import javax.lang.model.element.AnnotationMirror;
   40.12 @@ -40,19 +42,31 @@
   40.13  import javax.tools.JavaCompiler;
   40.14  import javax.tools.JavaFileObject;
   40.15  
   40.16 +import com.sun.source.doctree.DocCommentTree;
   40.17 +import com.sun.source.doctree.ReferenceTree;
   40.18  import com.sun.source.tree.CatchTree;
   40.19  import com.sun.source.tree.CompilationUnitTree;
   40.20  import com.sun.source.tree.Scope;
   40.21  import com.sun.source.tree.Tree;
   40.22 +import com.sun.source.util.DocTrees;
   40.23  import com.sun.source.util.JavacTask;
   40.24  import com.sun.source.util.SourcePositions;
   40.25  import com.sun.source.util.TreePath;
   40.26 -import com.sun.source.util.Trees;
   40.27  import com.sun.tools.javac.code.Flags;
   40.28 +import com.sun.tools.javac.code.Kinds;
   40.29  import com.sun.tools.javac.code.Symbol;
   40.30  import com.sun.tools.javac.code.Symbol.ClassSymbol;
   40.31 +import com.sun.tools.javac.code.Symbol.MethodSymbol;
   40.32 +import com.sun.tools.javac.code.Symbol.PackageSymbol;
   40.33  import com.sun.tools.javac.code.Symbol.TypeSymbol;
   40.34 +import com.sun.tools.javac.code.Symbol.VarSymbol;
   40.35 +import com.sun.tools.javac.code.Type;
   40.36 +import com.sun.tools.javac.code.Type.ArrayType;
   40.37 +import com.sun.tools.javac.code.Type.ClassType;
   40.38 +import com.sun.tools.javac.code.Type.ErrorType;
   40.39  import com.sun.tools.javac.code.Type.UnionClassType;
   40.40 +import com.sun.tools.javac.code.Types;
   40.41 +import com.sun.tools.javac.code.Types.TypeRelation;
   40.42  import com.sun.tools.javac.comp.Attr;
   40.43  import com.sun.tools.javac.comp.AttrContext;
   40.44  import com.sun.tools.javac.comp.Enter;
   40.45 @@ -61,6 +75,9 @@
   40.46  import com.sun.tools.javac.comp.Resolve;
   40.47  import com.sun.tools.javac.model.JavacElements;
   40.48  import com.sun.tools.javac.processing.JavacProcessingEnvironment;
   40.49 +import com.sun.tools.javac.tree.DCTree;
   40.50 +import com.sun.tools.javac.tree.DCTree.DCDocComment;
   40.51 +import com.sun.tools.javac.tree.DCTree.DCReference;
   40.52  import com.sun.tools.javac.tree.EndPosTable;
   40.53  import com.sun.tools.javac.tree.JCTree;
   40.54  import com.sun.tools.javac.tree.JCTree.*;
   40.55 @@ -71,8 +88,12 @@
   40.56  import com.sun.tools.javac.util.Context;
   40.57  import com.sun.tools.javac.util.JCDiagnostic;
   40.58  import com.sun.tools.javac.util.List;
   40.59 +import com.sun.tools.javac.util.ListBuffer;
   40.60  import com.sun.tools.javac.util.Log;
   40.61 +import com.sun.tools.javac.util.Name;
   40.62 +import com.sun.tools.javac.util.Names;
   40.63  import com.sun.tools.javac.util.Pair;
   40.64 +import static com.sun.tools.javac.code.TypeTag.*;
   40.65  
   40.66  /**
   40.67   * Provides an implementation of Trees.
   40.68 @@ -84,7 +105,7 @@
   40.69   *
   40.70   * @author Peter von der Ah&eacute;
   40.71   */
   40.72 -public class JavacTrees extends Trees {
   40.73 +public class JavacTrees extends DocTrees {
   40.74  
   40.75      // in a world of a single context per compilation, these would all be final
   40.76      private Resolve resolve;
   40.77 @@ -95,6 +116,8 @@
   40.78      private TreeMaker treeMaker;
   40.79      private JavacElements elements;
   40.80      private JavacTaskImpl javacTaskImpl;
   40.81 +    private Names names;
   40.82 +    private Types types;
   40.83  
   40.84      // called reflectively from Trees.instance(CompilationTask task)
   40.85      public static JavacTrees instance(JavaCompiler.CompilationTask task) {
   40.86 @@ -134,6 +157,8 @@
   40.87          resolve = Resolve.instance(context);
   40.88          treeMaker = TreeMaker.instance(context);
   40.89          memberEnter = MemberEnter.instance(context);
   40.90 +        names = Names.instance(context);
   40.91 +        types = Types.instance(context);
   40.92  
   40.93          JavacTask t = context.get(JavacTask.class);
   40.94          if (t instanceof JavacTaskImpl)
   40.95 @@ -229,6 +254,324 @@
   40.96          return sym;
   40.97      }
   40.98  
   40.99 +    @Override
  40.100 +    public Element getElement(TreePath path, ReferenceTree reference) {
  40.101 +        if (!(reference instanceof DCReference))
  40.102 +            return null;
  40.103 +        DCReference ref = (DCReference) reference;
  40.104 +
  40.105 +        Env<AttrContext> env = getAttrContext(path);
  40.106 +
  40.107 +        Log.DeferredDiagnosticHandler deferredDiagnosticHandler =
  40.108 +                new Log.DeferredDiagnosticHandler(log);
  40.109 +        try {
  40.110 +            final ClassSymbol tsym;
  40.111 +            final Name memberName;
  40.112 +            if (ref.qualifierExpression == null) {
  40.113 +                tsym = env.enclClass.sym;
  40.114 +                memberName = ref.memberName;
  40.115 +            } else {
  40.116 +                // See if the qualifierExpression is a type or package name.
  40.117 +                // javac does not provide the exact method required, so
  40.118 +                // we first check if qualifierExpression identifies a type,
  40.119 +                // and if not, then we check to see if it identifies a package.
  40.120 +                Type t = attr.attribType(ref.qualifierExpression, env);
  40.121 +                if (t.isErroneous()) {
  40.122 +                    if (ref.memberName == null) {
  40.123 +                        // Attr/Resolve assume packages exist and create symbols as needed
  40.124 +                        // so use getPackageElement to restrict search to existing packages
  40.125 +                        PackageSymbol pck = elements.getPackageElement(ref.qualifierExpression.toString());
  40.126 +                        if (pck != null) {
  40.127 +                            return pck;
  40.128 +                        } else if (ref.qualifierExpression.hasTag(JCTree.Tag.IDENT)) {
  40.129 +                            // fixup:  allow "identifier" instead of "#identifier"
  40.130 +                            // for compatibility with javadoc
  40.131 +                            tsym = env.enclClass.sym;
  40.132 +                            memberName = ((JCIdent) ref.qualifierExpression).name;
  40.133 +                        } else
  40.134 +                            return null;
  40.135 +                    } else {
  40.136 +                        return null;
  40.137 +                    }
  40.138 +                } else {
  40.139 +                    tsym = (ClassSymbol) t.tsym;
  40.140 +                    memberName = ref.memberName;
  40.141 +                }
  40.142 +            }
  40.143 +
  40.144 +            if (memberName == null)
  40.145 +                return tsym;
  40.146 +
  40.147 +            final List<Type> paramTypes;
  40.148 +            if (ref.paramTypes == null)
  40.149 +                paramTypes = null;
  40.150 +            else {
  40.151 +                ListBuffer<Type> lb = new ListBuffer<Type>();
  40.152 +                for (List<JCTree> l = ref.paramTypes; l.nonEmpty(); l = l.tail) {
  40.153 +                    JCTree tree = l.head;
  40.154 +                    Type t = attr.attribType(tree, env);
  40.155 +                    lb.add(t);
  40.156 +                }
  40.157 +                paramTypes = lb.toList();
  40.158 +            }
  40.159 +
  40.160 +            Symbol msym = (memberName == tsym.name)
  40.161 +                    ? findConstructor(tsym, paramTypes)
  40.162 +                    : findMethod(tsym, memberName, paramTypes);
  40.163 +            if (paramTypes != null) {
  40.164 +                // explicit (possibly empty) arg list given, so cannot be a field
  40.165 +                return msym;
  40.166 +            }
  40.167 +
  40.168 +            VarSymbol vsym = (ref.paramTypes != null) ? null : findField(tsym, memberName);
  40.169 +            // prefer a field over a method with no parameters
  40.170 +            if (vsym != null &&
  40.171 +                    (msym == null ||
  40.172 +                        types.isSubtypeUnchecked(vsym.enclClass().asType(), msym.enclClass().asType()))) {
  40.173 +                return vsym;
  40.174 +            } else {
  40.175 +                return msym;
  40.176 +            }
  40.177 +        } finally {
  40.178 +            log.popDiagnosticHandler(deferredDiagnosticHandler);
  40.179 +        }
  40.180 +    }
  40.181 +
  40.182 +    /** @see com.sun.tools.javadoc.ClassDocImpl#findField */
  40.183 +    private VarSymbol findField(ClassSymbol tsym, Name fieldName) {
  40.184 +        return searchField(tsym, fieldName, new HashSet<ClassSymbol>());
  40.185 +    }
  40.186 +
  40.187 +    /** @see com.sun.tools.javadoc.ClassDocImpl#searchField */
  40.188 +    private VarSymbol searchField(ClassSymbol tsym, Name fieldName, Set<ClassSymbol> searched) {
  40.189 +        if (searched.contains(tsym)) {
  40.190 +            return null;
  40.191 +        }
  40.192 +        searched.add(tsym);
  40.193 +
  40.194 +        for (com.sun.tools.javac.code.Scope.Entry e = tsym.members().lookup(fieldName);
  40.195 +                e.scope != null; e = e.next()) {
  40.196 +            if (e.sym.kind == Kinds.VAR) {
  40.197 +                return (VarSymbol)e.sym;
  40.198 +            }
  40.199 +        }
  40.200 +
  40.201 +        //### If we found a VarSymbol above, but which did not pass
  40.202 +        //### the modifier filter, we should return failure here!
  40.203 +
  40.204 +        ClassSymbol encl = tsym.owner.enclClass();
  40.205 +        if (encl != null) {
  40.206 +            VarSymbol vsym = searchField(encl, fieldName, searched);
  40.207 +            if (vsym != null) {
  40.208 +                return vsym;
  40.209 +            }
  40.210 +        }
  40.211 +
  40.212 +        // search superclass
  40.213 +        Type superclass = tsym.getSuperclass();
  40.214 +        if (superclass.tsym != null) {
  40.215 +            VarSymbol vsym = searchField((ClassSymbol) superclass.tsym, fieldName, searched);
  40.216 +            if (vsym != null) {
  40.217 +                return vsym;
  40.218 +            }
  40.219 +        }
  40.220 +
  40.221 +        // search interfaces
  40.222 +        List<Type> intfs = tsym.getInterfaces();
  40.223 +        for (List<Type> l = intfs; l.nonEmpty(); l = l.tail) {
  40.224 +            Type intf = l.head;
  40.225 +            if (intf.isErroneous()) continue;
  40.226 +            VarSymbol vsym = searchField((ClassSymbol) intf.tsym, fieldName, searched);
  40.227 +            if (vsym != null) {
  40.228 +                return vsym;
  40.229 +            }
  40.230 +        }
  40.231 +
  40.232 +        return null;
  40.233 +    }
  40.234 +
  40.235 +    /** @see com.sun.tools.javadoc.ClassDocImpl#findConstructor */
  40.236 +    MethodSymbol findConstructor(ClassSymbol tsym, List<Type> paramTypes) {
  40.237 +        for (com.sun.tools.javac.code.Scope.Entry e = tsym.members().lookup(names.init);
  40.238 +                e.scope != null; e = e.next()) {
  40.239 +            if (e.sym.kind == Kinds.MTH) {
  40.240 +                if (hasParameterTypes((MethodSymbol) e.sym, paramTypes)) {
  40.241 +                    return (MethodSymbol) e.sym;
  40.242 +                }
  40.243 +            }
  40.244 +        }
  40.245 +        return null;
  40.246 +    }
  40.247 +
  40.248 +    /** @see com.sun.tools.javadoc.ClassDocImpl#findMethod */
  40.249 +    private MethodSymbol findMethod(ClassSymbol tsym, Name methodName, List<Type> paramTypes) {
  40.250 +        return searchMethod(tsym, methodName, paramTypes, new HashSet<ClassSymbol>());
  40.251 +    }
  40.252 +
  40.253 +    /** @see com.sun.tools.javadoc.ClassDocImpl#searchMethod */
  40.254 +    private MethodSymbol searchMethod(ClassSymbol tsym, Name methodName,
  40.255 +                                       List<Type> paramTypes, Set<ClassSymbol> searched) {
  40.256 +        //### Note that this search is not necessarily what the compiler would do!
  40.257 +
  40.258 +        // do not match constructors
  40.259 +        if (methodName == names.init)
  40.260 +            return null;
  40.261 +
  40.262 +        if (searched.contains(tsym))
  40.263 +            return null;
  40.264 +        searched.add(tsym);
  40.265 +
  40.266 +        // search current class
  40.267 +        com.sun.tools.javac.code.Scope.Entry e = tsym.members().lookup(methodName);
  40.268 +
  40.269 +        //### Using modifier filter here isn't really correct,
  40.270 +        //### but emulates the old behavior.  Instead, we should
  40.271 +        //### apply the normal rules of visibility and inheritance.
  40.272 +
  40.273 +        if (paramTypes == null) {
  40.274 +            // If no parameters specified, we are allowed to return
  40.275 +            // any method with a matching name.  In practice, the old
  40.276 +            // code returned the first method, which is now the last!
  40.277 +            // In order to provide textually identical results, we
  40.278 +            // attempt to emulate the old behavior.
  40.279 +            MethodSymbol lastFound = null;
  40.280 +            for (; e.scope != null; e = e.next()) {
  40.281 +                if (e.sym.kind == Kinds.MTH) {
  40.282 +                    if (e.sym.name == methodName) {
  40.283 +                        lastFound = (MethodSymbol)e.sym;
  40.284 +                    }
  40.285 +                }
  40.286 +            }
  40.287 +            if (lastFound != null) {
  40.288 +                return lastFound;
  40.289 +            }
  40.290 +        } else {
  40.291 +            for (; e.scope != null; e = e.next()) {
  40.292 +                if (e.sym != null &&
  40.293 +                    e.sym.kind == Kinds.MTH) {
  40.294 +                    if (hasParameterTypes((MethodSymbol) e.sym, paramTypes)) {
  40.295 +                        return (MethodSymbol) e.sym;
  40.296 +                    }
  40.297 +                }
  40.298 +            }
  40.299 +        }
  40.300 +
  40.301 +        //### If we found a MethodSymbol above, but which did not pass
  40.302 +        //### the modifier filter, we should return failure here!
  40.303 +
  40.304 +        // search superclass
  40.305 +        Type superclass = tsym.getSuperclass();
  40.306 +        if (superclass.tsym != null) {
  40.307 +            MethodSymbol msym = searchMethod((ClassSymbol) superclass.tsym, methodName, paramTypes, searched);
  40.308 +            if (msym != null) {
  40.309 +                return msym;
  40.310 +            }
  40.311 +        }
  40.312 +
  40.313 +        // search interfaces
  40.314 +        List<Type> intfs = tsym.getInterfaces();
  40.315 +        for (List<Type> l = intfs; l.nonEmpty(); l = l.tail) {
  40.316 +            Type intf = l.head;
  40.317 +            if (intf.isErroneous()) continue;
  40.318 +            MethodSymbol msym = searchMethod((ClassSymbol) intf.tsym, methodName, paramTypes, searched);
  40.319 +            if (msym != null) {
  40.320 +                return msym;
  40.321 +            }
  40.322 +        }
  40.323 +
  40.324 +        // search enclosing class
  40.325 +        ClassSymbol encl = tsym.owner.enclClass();
  40.326 +        if (encl != null) {
  40.327 +            MethodSymbol msym = searchMethod(encl, methodName, paramTypes, searched);
  40.328 +            if (msym != null) {
  40.329 +                return msym;
  40.330 +            }
  40.331 +        }
  40.332 +
  40.333 +        return null;
  40.334 +    }
  40.335 +
  40.336 +    /** @see com.sun.tools.javadoc.ClassDocImpl */
  40.337 +    private boolean hasParameterTypes(MethodSymbol method, List<Type> paramTypes) {
  40.338 +        if (paramTypes == null)
  40.339 +            return true;
  40.340 +
  40.341 +        if (method.params().size() != paramTypes.size())
  40.342 +            return false;
  40.343 +
  40.344 +        List<Type> methodParamTypes = types.erasureRecursive(method.asType()).getParameterTypes();
  40.345 +
  40.346 +        return (Type.isErroneous(paramTypes))
  40.347 +            ? fuzzyMatch(paramTypes, methodParamTypes)
  40.348 +            : types.isSameTypes(paramTypes, methodParamTypes);
  40.349 +    }
  40.350 +
  40.351 +    boolean fuzzyMatch(List<Type> paramTypes, List<Type> methodParamTypes) {
  40.352 +        List<Type> l1 = paramTypes;
  40.353 +        List<Type> l2 = methodParamTypes;
  40.354 +        while (l1.nonEmpty()) {
  40.355 +            if (!fuzzyMatch(l1.head, l2.head))
  40.356 +                return false;
  40.357 +            l1 = l1.tail;
  40.358 +            l2 = l2.tail;
  40.359 +        }
  40.360 +        return true;
  40.361 +    }
  40.362 +
  40.363 +    boolean fuzzyMatch(Type paramType, Type methodParamType) {
  40.364 +        Boolean b = fuzzyMatcher.visit(paramType, methodParamType);
  40.365 +        return (b == Boolean.TRUE);
  40.366 +    }
  40.367 +
  40.368 +    TypeRelation fuzzyMatcher = new TypeRelation() {
  40.369 +        @Override
  40.370 +        public Boolean visitType(Type t, Type s) {
  40.371 +            if (t == s)
  40.372 +                return true;
  40.373 +
  40.374 +            if (s.isPartial())
  40.375 +                return visit(s, t);
  40.376 +
  40.377 +            switch (t.getTag()) {
  40.378 +            case BYTE: case CHAR: case SHORT: case INT: case LONG: case FLOAT:
  40.379 +            case DOUBLE: case BOOLEAN: case VOID: case BOT: case NONE:
  40.380 +                return t.getTag() == s.getTag();
  40.381 +
  40.382 +            default:
  40.383 +                throw new AssertionError("fuzzyMatcher " + t.getTag());
  40.384 +            }
  40.385 +        }
  40.386 +
  40.387 +        @Override
  40.388 +        public Boolean visitArrayType(ArrayType t, Type s) {
  40.389 +            if (t == s)
  40.390 +                return true;
  40.391 +
  40.392 +            if (s.isPartial())
  40.393 +                return visit(s, t);
  40.394 +
  40.395 +            return s.getTag() == ARRAY
  40.396 +                && visit(t.elemtype, types.elemtype(s));
  40.397 +        }
  40.398 +
  40.399 +        @Override
  40.400 +        public Boolean visitClassType(ClassType t, Type s) {
  40.401 +            if (t == s)
  40.402 +                return true;
  40.403 +
  40.404 +            if (s.isPartial())
  40.405 +                return visit(s, t);
  40.406 +
  40.407 +            return t.tsym == s.tsym;
  40.408 +        }
  40.409 +
  40.410 +        @Override
  40.411 +        public Boolean visitErrorType(ErrorType t, Type s) {
  40.412 +            return s.getTag() == CLASS
  40.413 +                    && t.tsym.name == ((ClassType) s).tsym.name;
  40.414 +        }
  40.415 +    };
  40.416 +
  40.417      public TypeMirror getTypeMirror(TreePath path) {
  40.418          Tree t = path.getLeaf();
  40.419          return ((JCTree)t).type;
  40.420 @@ -250,6 +593,18 @@
  40.421          return null;
  40.422      }
  40.423  
  40.424 +    public DocCommentTree getDocCommentTree(TreePath path) {
  40.425 +        CompilationUnitTree t = path.getCompilationUnit();
  40.426 +        Tree leaf = path.getLeaf();
  40.427 +        if (t instanceof JCTree.JCCompilationUnit && leaf instanceof JCTree) {
  40.428 +            JCCompilationUnit cu = (JCCompilationUnit) t;
  40.429 +            if (cu.docComments != null) {
  40.430 +                return cu.docComments.getCommentTree((JCTree) leaf);
  40.431 +            }
  40.432 +        }
  40.433 +        return null;
  40.434 +    }
  40.435 +
  40.436      public boolean isAccessible(Scope scope, TypeElement type) {
  40.437          if (scope instanceof JavacScope && type instanceof ClassSymbol) {
  40.438              Env<AttrContext> env = ((JavacScope) scope).env;
  40.439 @@ -418,14 +773,27 @@
  40.440      public void printMessage(Diagnostic.Kind kind, CharSequence msg,
  40.441              com.sun.source.tree.Tree t,
  40.442              com.sun.source.tree.CompilationUnitTree root) {
  40.443 +        printMessage(kind, msg, ((JCTree) t).pos(), root);
  40.444 +    }
  40.445 +
  40.446 +    public void printMessage(Diagnostic.Kind kind, CharSequence msg,
  40.447 +            com.sun.source.doctree.DocTree t,
  40.448 +            com.sun.source.doctree.DocCommentTree c,
  40.449 +            com.sun.source.tree.CompilationUnitTree root) {
  40.450 +        printMessage(kind, msg, ((DCTree) t).pos((DCDocComment) c), root);
  40.451 +    }
  40.452 +
  40.453 +    private void printMessage(Diagnostic.Kind kind, CharSequence msg,
  40.454 +            JCDiagnostic.DiagnosticPosition pos,
  40.455 +            com.sun.source.tree.CompilationUnitTree root) {
  40.456          JavaFileObject oldSource = null;
  40.457          JavaFileObject newSource = null;
  40.458 -        JCDiagnostic.DiagnosticPosition pos = null;
  40.459  
  40.460          newSource = root.getSourceFile();
  40.461 -        if (newSource != null) {
  40.462 +        if (newSource == null) {
  40.463 +            pos = null;
  40.464 +        } else {
  40.465              oldSource = log.useSource(newSource);
  40.466 -            pos = ((JCTree) t).pos();
  40.467          }
  40.468  
  40.469          try {
    41.1 --- a/src/share/classes/com/sun/tools/javac/comp/Attr.java	Wed Nov 14 16:41:51 2012 -0800
    41.2 +++ b/src/share/classes/com/sun/tools/javac/comp/Attr.java	Wed Nov 14 17:23:10 2012 -0800
    41.3 @@ -616,13 +616,13 @@
    41.4      /** Derived visitor method: attribute an expression tree with
    41.5       *  no constraints on the computed type.
    41.6       */
    41.7 -    Type attribExpr(JCTree tree, Env<AttrContext> env) {
    41.8 +    public Type attribExpr(JCTree tree, Env<AttrContext> env) {
    41.9          return attribTree(tree, env, unknownExprInfo);
   41.10      }
   41.11  
   41.12      /** Derived visitor method: attribute a type tree.
   41.13       */
   41.14 -    Type attribType(JCTree tree, Env<AttrContext> env) {
   41.15 +    public Type attribType(JCTree tree, Env<AttrContext> env) {
   41.16          Type result = attribType(tree, env, Type.noType);
   41.17          return result;
   41.18      }
    42.1 --- a/src/share/classes/com/sun/tools/javac/comp/AttrContext.java	Wed Nov 14 16:41:51 2012 -0800
    42.2 +++ b/src/share/classes/com/sun/tools/javac/comp/AttrContext.java	Wed Nov 14 17:23:10 2012 -0800
    42.3 @@ -109,6 +109,7 @@
    42.4                  pendingResolutionPhase.isVarargsRequired();
    42.5      }
    42.6  
    42.7 +    @Override
    42.8      public String toString() {
    42.9          return "AttrContext[" + scope.toString() + "]";
   42.10      }
    43.1 --- a/src/share/classes/com/sun/tools/javac/comp/Env.java	Wed Nov 14 16:41:51 2012 -0800
    43.2 +++ b/src/share/classes/com/sun/tools/javac/comp/Env.java	Wed Nov 14 17:23:10 2012 -0800
    43.3 @@ -1,5 +1,5 @@
    43.4  /*
    43.5 - * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
    43.6 + * Copyright (c) 1999, 2012, 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
   43.10 @@ -122,6 +122,7 @@
   43.11          return env1;
   43.12      }
   43.13  
   43.14 +    @Override
   43.15      public String toString() {
   43.16          return "Env[" + info + (outer == null ? "" : ",outer=" + outer) + "]";
   43.17      }
    44.1 --- a/src/share/classes/com/sun/tools/javac/comp/Resolve.java	Wed Nov 14 16:41:51 2012 -0800
    44.2 +++ b/src/share/classes/com/sun/tools/javac/comp/Resolve.java	Wed Nov 14 17:23:10 2012 -0800
    44.3 @@ -1731,7 +1731,7 @@
    44.4  
    44.5      /** Find an unqualified identifier which matches a specified kind set.
    44.6       *  @param env       The current environment.
    44.7 -     *  @param name      The indentifier's name.
    44.8 +     *  @param name      The identifier's name.
    44.9       *  @param kind      Indicates the possible symbol kinds
   44.10       *                   (a subset of VAL, TYP, PCK).
   44.11       */
    45.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    45.2 +++ b/src/share/classes/com/sun/tools/javac/parser/DocCommentParser.java	Wed Nov 14 17:23:10 2012 -0800
    45.3 @@ -0,0 +1,1288 @@
    45.4 +/*
    45.5 + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
    45.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    45.7 + *
    45.8 + * This code is free software; you can redistribute it and/or modify it
    45.9 + * under the terms of the GNU General Public License version 2 only, as
   45.10 + * published by the Free Software Foundation.  Oracle designates this
   45.11 + * particular file as subject to the "Classpath" exception as provided
   45.12 + * by Oracle in the LICENSE file that accompanied this code.
   45.13 + *
   45.14 + * This code is distributed in the hope that it will be useful, but WITHOUT
   45.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   45.16 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   45.17 + * version 2 for more details (a copy is included in the LICENSE file that
   45.18 + * accompanied this code).
   45.19 + *
   45.20 + * You should have received a copy of the GNU General Public License version
   45.21 + * 2 along with this work; if not, write to the Free Software Foundation,
   45.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   45.23 + *
   45.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   45.25 + * or visit www.oracle.com if you need additional information or have any
   45.26 + * questions.
   45.27 + */
   45.28 +
   45.29 +package com.sun.tools.javac.parser;
   45.30 +
   45.31 +import com.sun.tools.javac.util.Filter;
   45.32 +import java.text.BreakIterator;
   45.33 +import java.util.Arrays;
   45.34 +import java.util.HashMap;
   45.35 +import java.util.HashSet;
   45.36 +import java.util.LinkedList;
   45.37 +import java.util.Locale;
   45.38 +import java.util.Map;
   45.39 +import java.util.Queue;
   45.40 +import java.util.Set;
   45.41 +
   45.42 +import com.sun.source.doctree.AttributeTree.ValueKind;
   45.43 +import com.sun.tools.javac.parser.DocCommentParser.TagParser.Kind;
   45.44 +import com.sun.tools.javac.parser.Tokens.Comment;
   45.45 +import com.sun.tools.javac.parser.Tokens.TokenKind;
   45.46 +import com.sun.tools.javac.tree.DCTree;
   45.47 +import com.sun.tools.javac.tree.DCTree.DCAttribute;
   45.48 +import com.sun.tools.javac.tree.DCTree.DCDocComment;
   45.49 +import com.sun.tools.javac.tree.DCTree.DCEndElement;
   45.50 +import com.sun.tools.javac.tree.DCTree.DCErroneous;
   45.51 +import com.sun.tools.javac.tree.DCTree.DCIdentifier;
   45.52 +import com.sun.tools.javac.tree.DCTree.DCReference;
   45.53 +import com.sun.tools.javac.tree.DCTree.DCStartElement;
   45.54 +import com.sun.tools.javac.tree.DCTree.DCText;
   45.55 +import com.sun.tools.javac.tree.DocTreeMaker;
   45.56 +import com.sun.tools.javac.tree.JCTree;
   45.57 +import com.sun.tools.javac.util.DiagnosticSource;
   45.58 +import com.sun.tools.javac.util.JCDiagnostic;
   45.59 +import com.sun.tools.javac.util.List;
   45.60 +import com.sun.tools.javac.util.ListBuffer;
   45.61 +import com.sun.tools.javac.util.Log;
   45.62 +import com.sun.tools.javac.util.Name;
   45.63 +import com.sun.tools.javac.util.Names;
   45.64 +import com.sun.tools.javac.util.Options;
   45.65 +import com.sun.tools.javac.util.Position;
   45.66 +import static com.sun.tools.javac.util.LayoutCharacters.*;
   45.67 +
   45.68 +/**
   45.69 + *
   45.70 + *  <p><b>This is NOT part of any supported API.
   45.71 + *  If you write code that depends on this, you do so at your own risk.
   45.72 + *  This code and its internal interfaces are subject to change or
   45.73 + *  deletion without notice.</b>
   45.74 + */
   45.75 +public class DocCommentParser {
   45.76 +    static class ParseException extends Exception {
   45.77 +        private static final long serialVersionUID = 0;
   45.78 +        ParseException(String key) {
   45.79 +            super(key);
   45.80 +        }
   45.81 +    }
   45.82 +
   45.83 +    final ParserFactory fac;
   45.84 +    final DiagnosticSource diagSource;
   45.85 +    final Comment comment;
   45.86 +    final DocTreeMaker m;
   45.87 +    final Names names;
   45.88 +
   45.89 +    BreakIterator sentenceBreaker;
   45.90 +
   45.91 +    /** The input buffer, index of most recent character read,
   45.92 +     *  index of one past last character in buffer.
   45.93 +     */
   45.94 +    protected char[] buf;
   45.95 +    protected int bp;
   45.96 +    protected int buflen;
   45.97 +
   45.98 +    /** The current character.
   45.99 +     */
  45.100 +    protected char ch;
  45.101 +
  45.102 +    int textStart = -1;
  45.103 +    int lastNonWhite = -1;
  45.104 +    boolean newline = true;
  45.105 +
  45.106 +    Map<Name, TagParser> tagParsers;
  45.107 +
  45.108 +    DocCommentParser(ParserFactory fac, DiagnosticSource diagSource, Comment comment) {
  45.109 +        this.fac = fac;
  45.110 +        this.diagSource = diagSource;
  45.111 +        this.comment = comment;
  45.112 +        names = fac.names;
  45.113 +        m = fac.docTreeMaker;
  45.114 +
  45.115 +        Locale locale = (fac.locale == null) ? Locale.getDefault() : fac.locale;
  45.116 +
  45.117 +        Options options = fac.options;
  45.118 +        boolean useBreakIterator = options.isSet("breakIterator");
  45.119 +        if (useBreakIterator || !locale.getLanguage().equals(Locale.ENGLISH.getLanguage()))
  45.120 +            sentenceBreaker = BreakIterator.getSentenceInstance(locale);
  45.121 +
  45.122 +        initTagParsers();
  45.123 +    }
  45.124 +
  45.125 +    DCDocComment parse() {
  45.126 +        String c = comment.getText();
  45.127 +        buf = new char[c.length() + 1];
  45.128 +        c.getChars(0, c.length(), buf, 0);
  45.129 +        buf[buf.length - 1] = EOI;
  45.130 +        buflen = buf.length - 1;
  45.131 +        bp = -1;
  45.132 +        nextChar();
  45.133 +
  45.134 +        List<DCTree> body = blockContent();
  45.135 +        List<DCTree> tags = blockTags();
  45.136 +
  45.137 +        // split body into first sentence and body
  45.138 +        ListBuffer<DCTree> fs = new ListBuffer<DCTree>();
  45.139 +        loop:
  45.140 +        for (; body.nonEmpty(); body = body.tail) {
  45.141 +            DCTree t = body.head;
  45.142 +            switch (t.getKind()) {
  45.143 +                case TEXT:
  45.144 +                    String s = ((DCText) t).getBody();
  45.145 +                    int i = getSentenceBreak(s);
  45.146 +                    if (i > 0) {
  45.147 +                        int i0 = i;
  45.148 +                        while (i0 > 0 && isWhitespace(s.charAt(i0 - 1)))
  45.149 +                            i0--;
  45.150 +                        fs.add(m.at(t.pos).Text(s.substring(0, i0)));
  45.151 +                        int i1 = i;
  45.152 +                        while (i1 < s.length() && isWhitespace(s.charAt(i1)))
  45.153 +                            i1++;
  45.154 +                        body = body.tail;
  45.155 +                        if (i1 < s.length())
  45.156 +                            body = body.prepend(m.at(t.pos + i1).Text(s.substring(i1)));
  45.157 +                        break loop;
  45.158 +                    } else if (body.tail.nonEmpty()) {
  45.159 +                        if (isSentenceBreak(body.tail.head)) {
  45.160 +                            int i0 = s.length() - 1;
  45.161 +                            while (i0 > 0 && isWhitespace(s.charAt(i0)))
  45.162 +                                i0--;
  45.163 +                            fs.add(m.at(t.pos).Text(s.substring(0, i0 + 1)));
  45.164 +                            body = body.tail;
  45.165 +                            break loop;
  45.166 +                        }
  45.167 +                    }
  45.168 +                    break;
  45.169 +
  45.170 +                case START_ELEMENT:
  45.171 +                case END_ELEMENT:
  45.172 +                    if (isSentenceBreak(t))
  45.173 +                        break loop;
  45.174 +                    break;
  45.175 +            }
  45.176 +            fs.add(t);
  45.177 +        }
  45.178 +
  45.179 +        @SuppressWarnings("unchecked")
  45.180 +        DCTree first = getFirst(fs.toList(), body, tags);
  45.181 +        int pos = (first == null) ? Position.NOPOS : first.pos;
  45.182 +
  45.183 +        DCDocComment dc = m.at(pos).DocComment(comment, fs.toList(), body, tags);
  45.184 +        return dc;
  45.185 +    }
  45.186 +
  45.187 +    void nextChar() {
  45.188 +        ch = buf[bp < buflen ? ++bp : buflen];
  45.189 +        switch (ch) {
  45.190 +            case '\f': case '\n': case '\r':
  45.191 +                newline = true;
  45.192 +        }
  45.193 +    }
  45.194 +
  45.195 +    /**
  45.196 +     * Read block content, consisting of text, html and inline tags.
  45.197 +     * Terminated by the end of input, or the beginning of the next block tag:
  45.198 +     * i.e. @ as the first non-whitespace character on a line.
  45.199 +     */
  45.200 +    @SuppressWarnings("fallthrough")
  45.201 +    protected List<DCTree> blockContent() {
  45.202 +        ListBuffer<DCTree> trees = new ListBuffer<DCTree>();
  45.203 +        textStart = -1;
  45.204 +
  45.205 +        loop:
  45.206 +        while (bp < buflen) {
  45.207 +            switch (ch) {
  45.208 +                case '\n': case '\r': case '\f':
  45.209 +                    newline = true;
  45.210 +                    // fallthrough
  45.211 +
  45.212 +                case ' ': case '\t':
  45.213 +                    nextChar();
  45.214 +                    break;
  45.215 +
  45.216 +                case '&':
  45.217 +                    entity(trees);
  45.218 +                    break;
  45.219 +
  45.220 +                case '<':
  45.221 +                    newline = false;
  45.222 +                    addPendingText(trees, bp - 1);
  45.223 +                    trees.add(html());
  45.224 +                    if (textStart == -1) {
  45.225 +                        textStart = bp;
  45.226 +                        lastNonWhite = -1;
  45.227 +                    }
  45.228 +                    break;
  45.229 +
  45.230 +                case '>':
  45.231 +                    newline = false;
  45.232 +                    addPendingText(trees, bp - 1);
  45.233 +                    trees.add(m.at(bp).Erroneous(newString(bp, bp+1), diagSource, "dc.bad.gt"));
  45.234 +                    nextChar();
  45.235 +                    if (textStart == -1) {
  45.236 +                        textStart = bp;
  45.237 +                        lastNonWhite = -1;
  45.238 +                    }
  45.239 +                    break;
  45.240 +
  45.241 +                case '{':
  45.242 +                    inlineTag(trees);
  45.243 +                    break;
  45.244 +
  45.245 +                case '@':
  45.246 +                    if (newline) {
  45.247 +                        addPendingText(trees, lastNonWhite);
  45.248 +                        break loop;
  45.249 +                    }
  45.250 +                    // fallthrough
  45.251 +
  45.252 +                default:
  45.253 +                    newline = false;
  45.254 +                    if (textStart == -1)
  45.255 +                        textStart = bp;
  45.256 +                    lastNonWhite = bp;
  45.257 +                    nextChar();
  45.258 +            }
  45.259 +        }
  45.260 +
  45.261 +        if (lastNonWhite != -1)
  45.262 +            addPendingText(trees, lastNonWhite);
  45.263 +
  45.264 +        return trees.toList();
  45.265 +    }
  45.266 +
  45.267 +    /**
  45.268 +     * Read a series of block tags, including their content.
  45.269 +     * Standard tags parse their content appropriately.
  45.270 +     * Non-standard tags are represented by {@link UnknownBlockTag}.
  45.271 +     */
  45.272 +    protected List<DCTree> blockTags() {
  45.273 +        ListBuffer<DCTree> tags = new ListBuffer<DCTree>();
  45.274 +        while (ch == '@')
  45.275 +            tags.add(blockTag());
  45.276 +        return tags.toList();
  45.277 +    }
  45.278 +
  45.279 +    /**
  45.280 +     * Read a single block tag, including its content.
  45.281 +     * Standard tags parse their content appropriately.
  45.282 +     * Non-standard tags are represented by {@link UnknownBlockTag}.
  45.283 +     */
  45.284 +    protected DCTree blockTag() {
  45.285 +        int p = bp;
  45.286 +        try {
  45.287 +            nextChar();
  45.288 +            if (isIdentifierStart(ch)) {
  45.289 +                int namePos = bp;
  45.290 +                nextChar();
  45.291 +                while (isIdentifierPart(ch))
  45.292 +                    nextChar();
  45.293 +                int nameLen = bp - namePos;
  45.294 +
  45.295 +                Name name = names.fromChars(buf, namePos, nameLen);
  45.296 +                TagParser tp = tagParsers.get(name);
  45.297 +                if (tp == null) {
  45.298 +                    List<DCTree> content = blockContent();
  45.299 +                    return m.at(p).UnknownBlockTag(name, content);
  45.300 +                } else {
  45.301 +                    switch (tp.getKind()) {
  45.302 +                        case BLOCK:
  45.303 +                            return tp.parse(p);
  45.304 +                        case INLINE:
  45.305 +                            return erroneous("dc.bad.inline.tag", p);
  45.306 +                    }
  45.307 +                }
  45.308 +            }
  45.309 +            blockContent();
  45.310 +
  45.311 +            return erroneous("dc.no.tag.name", p);
  45.312 +        } catch (ParseException e) {
  45.313 +            blockContent();
  45.314 +            return erroneous(e.getMessage(), p);
  45.315 +        }
  45.316 +    }
  45.317 +
  45.318 +    protected void inlineTag(ListBuffer<DCTree> list) {
  45.319 +        newline = false;
  45.320 +        nextChar();
  45.321 +        if (ch == '@') {
  45.322 +            addPendingText(list, bp - 2);
  45.323 +            list.add(inlineTag());
  45.324 +            textStart = bp;
  45.325 +            lastNonWhite = -1;
  45.326 +        } else {
  45.327 +            if (textStart == -1)
  45.328 +                textStart = bp - 1;
  45.329 +            lastNonWhite = bp;
  45.330 +        }
  45.331 +    }
  45.332 +
  45.333 +    /**
  45.334 +     * Read a single inline tag, including its content.
  45.335 +     * Standard tags parse their content appropriately.
  45.336 +     * Non-standard tags are represented by {@link UnknownBlockTag}.
  45.337 +     * Malformed tags may be returned as {@link Erroneous}.
  45.338 +     */
  45.339 +    protected DCTree inlineTag() {
  45.340 +        int p = bp - 1;
  45.341 +        try {
  45.342 +            nextChar();
  45.343 +            if (isIdentifierStart(ch)) {
  45.344 +                int namePos = bp;
  45.345 +                nextChar();
  45.346 +                while (isIdentifierPart(ch))
  45.347 +                    nextChar();
  45.348 +                int nameLen = bp - namePos;
  45.349 +                skipWhitespace();
  45.350 +
  45.351 +                Name name = names.fromChars(buf, namePos, nameLen);
  45.352 +                TagParser tp = tagParsers.get(name);
  45.353 +                if (tp == null) {
  45.354 +                    DCTree text = inlineText();
  45.355 +                    if (text != null) {
  45.356 +                        nextChar();
  45.357 +                        return m.at(p).UnknownInlineTag(name, List.of(text));
  45.358 +                    }
  45.359 +                } else if (tp.getKind() == TagParser.Kind.INLINE) {
  45.360 +                    DCTree tree =  tp.parse(p);
  45.361 +                    if (tree != null) {
  45.362 +                        return tree;
  45.363 +                    }
  45.364 +                } else {
  45.365 +                    inlineText(); // skip content
  45.366 +                    nextChar();
  45.367 +                }
  45.368 +            }
  45.369 +            return erroneous("dc.no.tag.name", p);
  45.370 +        } catch (ParseException e) {
  45.371 +            return erroneous(e.getMessage(), p);
  45.372 +        }
  45.373 +    }
  45.374 +
  45.375 +    /**
  45.376 +     * Read plain text content of an inline tag.
  45.377 +     * Matching pairs of { } are skipped; the text is terminated by the first
  45.378 +     * unmatched }. It is an error if the beginning of the next tag is detected.
  45.379 +     */
  45.380 +    protected DCTree inlineText() throws ParseException {
  45.381 +        skipWhitespace();
  45.382 +        int pos = bp;
  45.383 +        int depth = 1;
  45.384 +
  45.385 +        loop:
  45.386 +        while (bp < buflen) {
  45.387 +            switch (ch) {
  45.388 +                case '\n': case '\r': case '\f':
  45.389 +                    newline = true;
  45.390 +                    break;
  45.391 +
  45.392 +                case ' ': case '\t':
  45.393 +                    break;
  45.394 +
  45.395 +                case '{':
  45.396 +                    newline = false;
  45.397 +                    lastNonWhite = bp;
  45.398 +                    depth++;
  45.399 +                    break;
  45.400 +
  45.401 +                case '}':
  45.402 +                    if (--depth == 0) {
  45.403 +                        return m.at(pos).Text(newString(pos, bp));
  45.404 +                    }
  45.405 +                    newline = false;
  45.406 +                    lastNonWhite = bp;
  45.407 +                    break;
  45.408 +
  45.409 +                case '@':
  45.410 +                    if (newline)
  45.411 +                        break loop;
  45.412 +                    newline = false;
  45.413 +                    lastNonWhite = bp;
  45.414 +                    break;
  45.415 +
  45.416 +                default:
  45.417 +                    newline = false;
  45.418 +                    lastNonWhite = bp;
  45.419 +                    break;
  45.420 +            }
  45.421 +            nextChar();
  45.422 +        }
  45.423 +        throw new ParseException("dc.unterminated.inline.tag");
  45.424 +    }
  45.425 +
  45.426 +    /**
  45.427 +     * Read Java class name, possibly followed by member
  45.428 +     * Matching pairs of < > are skipped. The text is terminated by the first
  45.429 +     * unmatched }. It is an error if the beginning of the next tag is detected.
  45.430 +     */
  45.431 +    // TODO: boolean allowMember should be enum FORBID, ALLOW, REQUIRE
  45.432 +    // TODO: improve quality of parse to forbid bad constructions.
  45.433 +    @SuppressWarnings("fallthrough")
  45.434 +    protected DCReference reference(boolean allowMember) throws ParseException {
  45.435 +        int pos = bp;
  45.436 +        int depth = 0;
  45.437 +
  45.438 +        // scan to find the end of the signature, by looking for the first
  45.439 +        // whitespace not enclosed in () or <>, or the end of the tag
  45.440 +        loop:
  45.441 +        while (bp < buflen) {
  45.442 +            switch (ch) {
  45.443 +                case '\n': case '\r': case '\f':
  45.444 +                    newline = true;
  45.445 +                    // fallthrough
  45.446 +
  45.447 +                case ' ': case '\t':
  45.448 +                    if (depth == 0)
  45.449 +                        break loop;
  45.450 +                    break;
  45.451 +
  45.452 +                case '(':
  45.453 +                case '<':
  45.454 +                    newline = false;
  45.455 +                    depth++;
  45.456 +                    break;
  45.457 +
  45.458 +                case ')':
  45.459 +                case '>':
  45.460 +                    newline = false;
  45.461 +                    --depth;
  45.462 +                    break;
  45.463 +
  45.464 +                case '}':
  45.465 +                    if (bp == pos)
  45.466 +                        return null;
  45.467 +                    newline = false;
  45.468 +                    break loop;
  45.469 +
  45.470 +                case '@':
  45.471 +                    if (newline)
  45.472 +                        break loop;
  45.473 +                    // fallthrough
  45.474 +
  45.475 +                default:
  45.476 +                    newline = false;
  45.477 +
  45.478 +            }
  45.479 +            nextChar();
  45.480 +        }
  45.481 +
  45.482 +        if (depth != 0)
  45.483 +            throw new ParseException("dc.unterminated.signature");
  45.484 +
  45.485 +        String sig = newString(pos, bp);
  45.486 +
  45.487 +        // Break sig apart into qualifiedExpr member paramTypes.
  45.488 +        JCTree qualExpr;
  45.489 +        Name member;
  45.490 +        List<JCTree> paramTypes;
  45.491 +
  45.492 +        Log.DeferredDiagnosticHandler deferredDiagnosticHandler
  45.493 +                = new Log.DeferredDiagnosticHandler(fac.log);
  45.494 +
  45.495 +        try {
  45.496 +            int hash = sig.indexOf("#");
  45.497 +            int lparen = sig.indexOf("(", hash + 1);
  45.498 +            if (hash == -1) {
  45.499 +                if (lparen == -1) {
  45.500 +                    qualExpr = parseType(sig);
  45.501 +                    member = null;
  45.502 +                } else {
  45.503 +                    qualExpr = null;
  45.504 +                    member = parseMember(sig.substring(0, lparen));
  45.505 +                }
  45.506 +            } else {
  45.507 +                qualExpr = (hash == 0) ? null : parseType(sig.substring(0, hash));
  45.508 +                if (lparen == -1)
  45.509 +                    member = parseMember(sig.substring(hash + 1));
  45.510 +                else
  45.511 +                    member = parseMember(sig.substring(hash + 1, lparen));
  45.512 +            }
  45.513 +
  45.514 +            if (lparen < 0) {
  45.515 +                paramTypes = null;
  45.516 +            } else {
  45.517 +                int rparen = sig.indexOf(")", lparen);
  45.518 +                if (rparen != sig.length() - 1)
  45.519 +                    throw new ParseException("dc.ref.bad.parens");
  45.520 +                paramTypes = parseParams(sig.substring(lparen + 1, rparen));
  45.521 +            }
  45.522 +
  45.523 +            if (!deferredDiagnosticHandler.getDiagnostics().isEmpty())
  45.524 +                throw new ParseException("dc.ref.syntax.error");
  45.525 +
  45.526 +        } finally {
  45.527 +            fac.log.popDiagnosticHandler(deferredDiagnosticHandler);
  45.528 +        }
  45.529 +
  45.530 +        return m.at(pos).Reference(sig, qualExpr, member, paramTypes);
  45.531 +    }
  45.532 +
  45.533 +    JCTree parseType(String s) throws ParseException {
  45.534 +        JavacParser p = fac.newParser(s, false, false, false);
  45.535 +        JCTree tree = p.parseType();
  45.536 +        if (p.token().kind != TokenKind.EOF)
  45.537 +            throw new ParseException("dc.ref.unexpected.input");
  45.538 +        return tree;
  45.539 +    }
  45.540 +
  45.541 +    Name parseMember(String s) throws ParseException {
  45.542 +        JavacParser p = fac.newParser(s, false, false, false);
  45.543 +        Name name = p.ident();
  45.544 +        if (p.token().kind != TokenKind.EOF)
  45.545 +            throw new ParseException("dc.ref.unexpected.input");
  45.546 +        return name;
  45.547 +    }
  45.548 +
  45.549 +    List<JCTree> parseParams(String s) throws ParseException {
  45.550 +        if (s.trim().isEmpty())
  45.551 +            return List.nil();
  45.552 +
  45.553 +        JavacParser p = fac.newParser(s.replace("...", "[]"), false, false, false);
  45.554 +        ListBuffer<JCTree> paramTypes = new ListBuffer<JCTree>();
  45.555 +        paramTypes.add(p.parseType());
  45.556 +
  45.557 +        if (p.token().kind == TokenKind.IDENTIFIER)
  45.558 +            p.nextToken();
  45.559 +
  45.560 +        while (p.token().kind == TokenKind.COMMA) {
  45.561 +            p.nextToken();
  45.562 +            paramTypes.add(p.parseType());
  45.563 +
  45.564 +            if (p.token().kind == TokenKind.IDENTIFIER)
  45.565 +                p.nextToken();
  45.566 +        }
  45.567 +
  45.568 +        if (p.token().kind != TokenKind.EOF)
  45.569 +            throw new ParseException("dc.ref.unexpected.input");
  45.570 +
  45.571 +        return paramTypes.toList();
  45.572 +    }
  45.573 +
  45.574 +    /**
  45.575 +     * Read Java identifier
  45.576 +     * Matching pairs of { } are skipped; the text is terminated by the first
  45.577 +     * unmatched }. It is an error if the beginning of the next tag is detected.
  45.578 +     */
  45.579 +    @SuppressWarnings("fallthrough")
  45.580 +    protected DCIdentifier identifier() throws ParseException {
  45.581 +        skipWhitespace();
  45.582 +        int pos = bp;
  45.583 +
  45.584 +        if (isJavaIdentifierStart(ch)) {
  45.585 +            nextChar();
  45.586 +            while (isJavaIdentifierPart(ch))
  45.587 +                nextChar();
  45.588 +            return m.at(pos).Identifier(names.fromChars(buf, pos, bp - pos));
  45.589 +        }
  45.590 +
  45.591 +        throw new ParseException("dc.identifier.expected");
  45.592 +    }
  45.593 +
  45.594 +    /**
  45.595 +     * Read a quoted string.
  45.596 +     * It is an error if the beginning of the next tag is detected.
  45.597 +     */
  45.598 +    @SuppressWarnings("fallthrough")
  45.599 +    protected DCText quotedString() {
  45.600 +        int pos = bp;
  45.601 +        nextChar();
  45.602 +
  45.603 +        loop:
  45.604 +        while (bp < buflen) {
  45.605 +            switch (ch) {
  45.606 +                case '\n': case '\r': case '\f':
  45.607 +                    newline = true;
  45.608 +                    break;
  45.609 +
  45.610 +                case ' ': case '\t':
  45.611 +                    break;
  45.612 +
  45.613 +                case '"':
  45.614 +                    nextChar();
  45.615 +                    // trim trailing white-space?
  45.616 +                    return m.at(pos).Text(newString(pos, bp));
  45.617 +
  45.618 +                case '@':
  45.619 +                    if (newline)
  45.620 +                        break loop;
  45.621 +
  45.622 +            }
  45.623 +            nextChar();
  45.624 +        }
  45.625 +        return null;
  45.626 +    }
  45.627 +
  45.628 +    /**
  45.629 +     * Read general text content of an inline tag, including HTML entities and elements.
  45.630 +     * Matching pairs of { } are skipped; the text is terminated by the first
  45.631 +     * unmatched }. It is an error if the beginning of the next tag is detected.
  45.632 +     */
  45.633 +    @SuppressWarnings("fallthrough")
  45.634 +    protected List<DCTree> inlineContent() {
  45.635 +        ListBuffer<DCTree> trees = new ListBuffer<DCTree>();
  45.636 +
  45.637 +        skipWhitespace();
  45.638 +        int pos = bp;
  45.639 +        int depth = 1;
  45.640 +        textStart = -1;
  45.641 +
  45.642 +        loop:
  45.643 +        while (bp < buflen) {
  45.644 +
  45.645 +            switch (ch) {
  45.646 +                case '\n': case '\r': case '\f':
  45.647 +                    newline = true;
  45.648 +                    // fall through
  45.649 +
  45.650 +                case ' ': case '\t':
  45.651 +                    nextChar();
  45.652 +                    break;
  45.653 +
  45.654 +                case '&':
  45.655 +                    entity(trees);
  45.656 +                    break;
  45.657 +
  45.658 +                case '<':
  45.659 +                    newline = false;
  45.660 +                    addPendingText(trees, bp - 1);
  45.661 +                    trees.add(html());
  45.662 +                    break;
  45.663 +
  45.664 +                case '{':
  45.665 +                    newline = false;
  45.666 +                    depth++;
  45.667 +                    nextChar();
  45.668 +                    break;
  45.669 +
  45.670 +                case '}':
  45.671 +                    newline = false;
  45.672 +                    if (--depth == 0) {
  45.673 +                        addPendingText(trees, bp - 1);
  45.674 +                        nextChar();
  45.675 +                        return trees.toList();
  45.676 +                    }
  45.677 +                    nextChar();
  45.678 +                    break;
  45.679 +
  45.680 +                case '@':
  45.681 +                    if (newline)
  45.682 +                        break loop;
  45.683 +                    // fallthrough
  45.684 +
  45.685 +                default:
  45.686 +                    if (textStart == -1)
  45.687 +                        textStart = bp;
  45.688 +                    nextChar();
  45.689 +                    break;
  45.690 +            }
  45.691 +        }
  45.692 +
  45.693 +        return List.<DCTree>of(erroneous("dc.unterminated.inline.tag", pos));
  45.694 +    }
  45.695 +
  45.696 +    protected void entity(ListBuffer<DCTree> list) {
  45.697 +        newline = false;
  45.698 +        addPendingText(list, bp - 1);
  45.699 +        list.add(entity());
  45.700 +        if (textStart == -1) {
  45.701 +            textStart = bp;
  45.702 +            lastNonWhite = -1;
  45.703 +        }
  45.704 +    }
  45.705 +
  45.706 +    /**
  45.707 +     * Read an HTML entity.
  45.708 +     * {@literal &identifier; } or {@literal &#digits; } or {@literal &#xhex-digits; }
  45.709 +     */
  45.710 +    protected DCTree entity() {
  45.711 +        int p = bp;
  45.712 +        nextChar();
  45.713 +        int namep = bp;
  45.714 +        boolean checkSemi = false;
  45.715 +        if (ch == '#') {
  45.716 +            nextChar();
  45.717 +            if (isDecimalDigit(ch)) {
  45.718 +                nextChar();
  45.719 +                while (isDecimalDigit(ch))
  45.720 +                    nextChar();
  45.721 +                checkSemi = true;
  45.722 +            } else if (ch == 'x' || ch == 'X') {
  45.723 +                nextChar();
  45.724 +                if (isHexDigit(ch)) {
  45.725 +                    nextChar();
  45.726 +                    while (isHexDigit(ch))
  45.727 +                        nextChar();
  45.728 +                    checkSemi = true;
  45.729 +                }
  45.730 +            }
  45.731 +        } else if (isIdentifierStart(ch)) {
  45.732 +            nextChar();
  45.733 +            while (isIdentifierPart(ch))
  45.734 +                nextChar();
  45.735 +            checkSemi = true;
  45.736 +        }
  45.737 +
  45.738 +        if (checkSemi && ch == ';') {
  45.739 +            nextChar();
  45.740 +            return m.at(p).Entity(names.fromChars(buf, namep, bp - namep - 1));
  45.741 +        } else {
  45.742 +            String code = checkSemi ? "dc.missing.semicolon" : "dc.bad.entity";
  45.743 +            return erroneous(code, p);
  45.744 +        }
  45.745 +    }
  45.746 +
  45.747 +    /**
  45.748 +     * Read the start or end of an HTML tag, or an HTML comment
  45.749 +     * {@literal <identifier attrs> } or {@literal </identifier> }
  45.750 +     */
  45.751 +    protected DCTree html() {
  45.752 +        int p = bp;
  45.753 +        nextChar();
  45.754 +        if (isIdentifierStart(ch)) {
  45.755 +            int namePos = bp;
  45.756 +            nextChar();
  45.757 +            while (isIdentifierPart(ch))
  45.758 +                nextChar();
  45.759 +            int nameLen = bp - namePos;
  45.760 +            List<DCTree> attrs = htmlAttrs();
  45.761 +            if (attrs != null) {
  45.762 +                boolean selfClosing = false;
  45.763 +                if (ch == '/') {
  45.764 +                    nextChar();
  45.765 +                    selfClosing = true;
  45.766 +                }
  45.767 +                if (ch == '>') {
  45.768 +                    nextChar();
  45.769 +                    Name name = names.fromChars(buf, namePos, nameLen);
  45.770 +                    return m.at(p).StartElement(name, attrs, selfClosing);
  45.771 +                }
  45.772 +            }
  45.773 +        } else if (ch == '/') {
  45.774 +            nextChar();
  45.775 +            if (isIdentifierStart(ch)) {
  45.776 +                int namePos = bp;
  45.777 +                nextChar();
  45.778 +                while (isIdentifierPart(ch))
  45.779 +                    nextChar();
  45.780 +                int nameLen = bp - namePos;
  45.781 +                skipWhitespace();
  45.782 +                if (ch == '>') {
  45.783 +                    nextChar();
  45.784 +                    Name name = names.fromChars(buf, namePos, nameLen);
  45.785 +                    return m.at(p).EndElement(name);
  45.786 +                }
  45.787 +            }
  45.788 +        } else if (ch == '!') {
  45.789 +            nextChar();
  45.790 +            if (ch == '-') {
  45.791 +                nextChar();
  45.792 +                if (ch == '-') {
  45.793 +                    nextChar();
  45.794 +                    while (bp < buflen) {
  45.795 +                        int dash = 0;
  45.796 +                        while (ch == '-') {
  45.797 +                            dash++;
  45.798 +                            nextChar();
  45.799 +                        }
  45.800 +                        // strictly speaking, a comment should not contain "--"
  45.801 +                        // so dash > 2 is an error, dash == 2 implies ch == '>'
  45.802 +                        if (dash >= 2 && ch == '>') {
  45.803 +                            nextChar();
  45.804 +                            return m.at(p).Comment(newString(p, bp));
  45.805 +                        }
  45.806 +
  45.807 +                        nextChar();
  45.808 +                    }
  45.809 +                }
  45.810 +            }
  45.811 +        }
  45.812 +
  45.813 +        bp = p + 1;
  45.814 +        ch = buf[bp];
  45.815 +        return erroneous("dc.malformed.html", p);
  45.816 +    }
  45.817 +
  45.818 +    /**
  45.819 +     * Read a series of HTML attributes, terminated by {@literal > }.
  45.820 +     * Each attribute is of the form {@literal identifier[=value] }.
  45.821 +     * "value" may be unquoted, single-quoted, or double-quoted.
  45.822 +     */
  45.823 +    protected List<DCTree> htmlAttrs() {
  45.824 +        ListBuffer<DCTree> attrs = new ListBuffer<DCTree>();
  45.825 +        skipWhitespace();
  45.826 +
  45.827 +        loop:
  45.828 +        while (isIdentifierStart(ch)) {
  45.829 +            int namePos = bp;
  45.830 +            nextChar();
  45.831 +            while (isIdentifierPart(ch))
  45.832 +                nextChar();
  45.833 +            int nameLen = bp - namePos;
  45.834 +            skipWhitespace();
  45.835 +            List<DCTree> value = null;
  45.836 +            ValueKind vkind = ValueKind.EMPTY;
  45.837 +            if (ch == '=') {
  45.838 +                ListBuffer<DCTree> v = new ListBuffer<DCTree>();
  45.839 +                nextChar();
  45.840 +                skipWhitespace();
  45.841 +                if (ch == '\'' || ch == '"') {
  45.842 +                    vkind = (ch == '\'') ? ValueKind.SINGLE : ValueKind.DOUBLE;
  45.843 +                    char quote = ch;
  45.844 +                    nextChar();
  45.845 +                    textStart = bp;
  45.846 +                    while (bp < buflen && ch != quote) {
  45.847 +                        if (newline && ch == '@') {
  45.848 +                            attrs.add(erroneous("dc.unterminated.string", namePos));
  45.849 +                            // No point trying to read more.
  45.850 +                            // In fact, all attrs get discarded by the caller
  45.851 +                            // and superseded by a malformed.html node because
  45.852 +                            // the html tag itself is not terminated correctly.
  45.853 +                            break loop;
  45.854 +                        }
  45.855 +                        attrValueChar(v);
  45.856 +                    }
  45.857 +                    addPendingText(v, bp - 1);
  45.858 +                    nextChar();
  45.859 +                } else {
  45.860 +                    vkind = ValueKind.UNQUOTED;
  45.861 +                    textStart = bp;
  45.862 +                    while (bp < buflen && !isUnquotedAttrValueTerminator(ch)) {
  45.863 +                        attrValueChar(v);
  45.864 +                    }
  45.865 +                    addPendingText(v, bp - 1);
  45.866 +                }
  45.867 +                skipWhitespace();
  45.868 +                value = v.toList();
  45.869 +            }
  45.870 +            Name name = names.fromChars(buf, namePos, nameLen);
  45.871 +            DCAttribute attr = m.at(namePos).Attribute(name, vkind, value);
  45.872 +            attrs.add(attr);
  45.873 +        }
  45.874 +
  45.875 +        return attrs.toList();
  45.876 +    }
  45.877 +
  45.878 +    protected void attrValueChar(ListBuffer<DCTree> list) {
  45.879 +        switch (ch) {
  45.880 +            case '&':
  45.881 +                entity(list);
  45.882 +                break;
  45.883 +
  45.884 +            case '{':
  45.885 +                inlineTag(list);
  45.886 +                break;
  45.887 +
  45.888 +            default:
  45.889 +                nextChar();
  45.890 +        }
  45.891 +    }
  45.892 +
  45.893 +    protected void addPendingText(ListBuffer<DCTree> list, int textEnd) {
  45.894 +        if (textStart != -1 && textStart <= textEnd) {
  45.895 +            list.add(m.at(textStart).Text(newString(textStart, textEnd + 1)));
  45.896 +            textStart = -1;
  45.897 +        }
  45.898 +    }
  45.899 +
  45.900 +    protected DCErroneous erroneous(String code, int pos) {
  45.901 +        int i = bp - 1;
  45.902 +        loop:
  45.903 +        while (i > 0) {
  45.904 +            switch (buf[i]) {
  45.905 +                case '\f': case '\n': case '\r':
  45.906 +                    newline = true;
  45.907 +                    break;
  45.908 +                case '\t': case ' ':
  45.909 +                    break;
  45.910 +                default:
  45.911 +                    break loop;
  45.912 +            }
  45.913 +            i--;
  45.914 +        }
  45.915 +        textStart = -1;
  45.916 +        return m.at(pos).Erroneous(newString(pos, i + 1), diagSource, code);
  45.917 +    }
  45.918 +
  45.919 +    @SuppressWarnings("unchecked")
  45.920 +    <T> T getFirst(List<T>... lists) {
  45.921 +        for (List<T> list: lists) {
  45.922 +            if (list.nonEmpty())
  45.923 +                return list.head;
  45.924 +        }
  45.925 +        return null;
  45.926 +    }
  45.927 +
  45.928 +    protected boolean isIdentifierStart(char ch) {
  45.929 +        return Character.isUnicodeIdentifierStart(ch);
  45.930 +    }
  45.931 +
  45.932 +    protected boolean isIdentifierPart(char ch) {
  45.933 +        return Character.isUnicodeIdentifierPart(ch);
  45.934 +    }
  45.935 +
  45.936 +    protected boolean isJavaIdentifierStart(char ch) {
  45.937 +        return Character.isJavaIdentifierStart(ch);
  45.938 +    }
  45.939 +
  45.940 +    protected boolean isJavaIdentifierPart(char ch) {
  45.941 +        return Character.isJavaIdentifierPart(ch);
  45.942 +    }
  45.943 +
  45.944 +    protected boolean isDecimalDigit(char ch) {
  45.945 +        return ('0' <= ch && ch <= '9');
  45.946 +    }
  45.947 +
  45.948 +    protected boolean isHexDigit(char ch) {
  45.949 +        return ('0' <= ch && ch <= '9')
  45.950 +                || ('a' <= ch && ch <= 'f')
  45.951 +                || ('A' <= ch && ch <= 'F');
  45.952 +    }
  45.953 +
  45.954 +    protected boolean isUnquotedAttrValueTerminator(char ch) {
  45.955 +        switch (ch) {
  45.956 +            case '\f': case '\n': case '\r': case '\t':
  45.957 +            case ' ':
  45.958 +            case '"': case '\'': case '`':
  45.959 +            case '=': case '<': case '>':
  45.960 +                return true;
  45.961 +            default:
  45.962 +                return false;
  45.963 +        }
  45.964 +    }
  45.965 +
  45.966 +    protected boolean isWhitespace(char ch) {
  45.967 +        return Character.isWhitespace(ch);
  45.968 +    }
  45.969 +
  45.970 +    protected void skipWhitespace() {
  45.971 +        while (isWhitespace(ch))
  45.972 +            nextChar();
  45.973 +    }
  45.974 +
  45.975 +    protected int getSentenceBreak(String s) {
  45.976 +        if (sentenceBreaker != null) {
  45.977 +            sentenceBreaker.setText(s);
  45.978 +            int i = sentenceBreaker.next();
  45.979 +            return (i == s.length()) ? -1 : i;
  45.980 +        }
  45.981 +
  45.982 +        // scan for period followed by whitespace
  45.983 +        boolean period = false;
  45.984 +        for (int i = 0; i < s.length(); i++) {
  45.985 +            switch (s.charAt(i)) {
  45.986 +                case '.':
  45.987 +                    period = true;
  45.988 +                    break;
  45.989 +
  45.990 +                case ' ':
  45.991 +                case '\f':
  45.992 +                case '\n':
  45.993 +                case '\r':
  45.994 +                case '\t':
  45.995 +                    if (period)
  45.996 +                        return i;
  45.997 +                    break;
  45.998 +
  45.999 +                default:
 45.1000 +                    period = false;
 45.1001 +                    break;
 45.1002 +            }
 45.1003 +        }
 45.1004 +        return -1;
 45.1005 +    }
 45.1006 +
 45.1007 +
 45.1008 +    Set<String> htmlBlockTags = new HashSet<String>(Arrays.asList(
 45.1009 +                    "h1", "h2", "h3", "h4", "h5", "h6", "p", "pre"));
 45.1010 +
 45.1011 +    protected boolean isSentenceBreak(Name n) {
 45.1012 +        return htmlBlockTags.contains(n.toString().toLowerCase());
 45.1013 +    }
 45.1014 +
 45.1015 +    protected boolean isSentenceBreak(DCTree t) {
 45.1016 +        switch (t.getKind()) {
 45.1017 +            case START_ELEMENT:
 45.1018 +                return isSentenceBreak(((DCStartElement) t).getName());
 45.1019 +
 45.1020 +            case END_ELEMENT:
 45.1021 +                return isSentenceBreak(((DCEndElement) t).getName());
 45.1022 +        }
 45.1023 +        return false;
 45.1024 +    }
 45.1025 +
 45.1026 +    /**
 45.1027 +     * @param start position of first character of string
 45.1028 +     * @param end position of character beyond last character to be included
 45.1029 +     */
 45.1030 +    String newString(int start, int end) {
 45.1031 +        return new String(buf, start, end - start);
 45.1032 +    }
 45.1033 +
 45.1034 +    static abstract class TagParser {
 45.1035 +        enum Kind { INLINE, BLOCK }
 45.1036 +
 45.1037 +        Kind kind;
 45.1038 +        DCTree.Kind treeKind;
 45.1039 +
 45.1040 +        TagParser(Kind k, DCTree.Kind tk) {
 45.1041 +            kind = k;
 45.1042 +            treeKind = tk;
 45.1043 +        }
 45.1044 +
 45.1045 +        Kind getKind() {
 45.1046 +            return kind;
 45.1047 +        }
 45.1048 +
 45.1049 +        DCTree.Kind getTreeKind() {
 45.1050 +            return treeKind;
 45.1051 +        }
 45.1052 +
 45.1053 +        abstract DCTree parse(int pos) throws ParseException;
 45.1054 +    }
 45.1055 +
 45.1056 +    /**
 45.1057 +     * @see <a href="http://docs.oracle.com/javase/7/docs/technotes/tools/solaris/javadoc.html#javadoctags">Javadoc Tags</a>
 45.1058 +     */
 45.1059 +    private void initTagParsers() {
 45.1060 +        TagParser[] parsers = {
 45.1061 +            // @author name-text
 45.1062 +            new TagParser(Kind.BLOCK, DCTree.Kind.AUTHOR) {
 45.1063 +                public DCTree parse(int pos) {
 45.1064 +                    List<DCTree> name = blockContent();
 45.1065 +                    return m.at(pos).Author(name);
 45.1066 +                }
 45.1067 +            },
 45.1068 +
 45.1069 +            // {@code text}
 45.1070 +            new TagParser(Kind.INLINE, DCTree.Kind.CODE) {
 45.1071 +                public DCTree parse(int pos) throws ParseException {
 45.1072 +                    DCTree text = inlineText();
 45.1073 +                    nextChar();
 45.1074 +                    return m.at(pos).Code((DCText) text);
 45.1075 +                }
 45.1076 +            },
 45.1077 +
 45.1078 +            // @deprecated deprecated-text
 45.1079 +            new TagParser(Kind.BLOCK, DCTree.Kind.DEPRECATED) {
 45.1080 +                public DCTree parse(int pos) {
 45.1081 +                    List<DCTree> reason = blockContent();
 45.1082 +                    return m.at(pos).Deprecated(reason);
 45.1083 +                }
 45.1084 +            },
 45.1085 +
 45.1086 +            // {@docRoot}
 45.1087 +            new TagParser(Kind.INLINE, DCTree.Kind.DOC_ROOT) {
 45.1088 +                public DCTree parse(int pos) throws ParseException {
 45.1089 +                    if (ch == '}') {
 45.1090 +                        nextChar();
 45.1091 +                        return m.at(pos).DocRoot();
 45.1092 +                    }
 45.1093 +                    inlineText(); // skip unexpected content
 45.1094 +                    nextChar();
 45.1095 +                    throw new ParseException("dc.unexpected.content");
 45.1096 +                }
 45.1097 +            },
 45.1098 +
 45.1099 +            // @exception class-name description
 45.1100 +            new TagParser(Kind.BLOCK, DCTree.Kind.EXCEPTION) {
 45.1101 +                public DCTree parse(int pos) throws ParseException {
 45.1102 +                    skipWhitespace();
 45.1103 +                    DCReference ref = reference(false);
 45.1104 +                    List<DCTree> description = blockContent();
 45.1105 +                    return m.at(pos).Exception(ref, description);
 45.1106 +                }
 45.1107 +            },
 45.1108 +
 45.1109 +            // {@inheritDoc}
 45.1110 +            new TagParser(Kind.INLINE, DCTree.Kind.INHERIT_DOC) {
 45.1111 +                public DCTree parse(int pos) throws ParseException {
 45.1112 +                    if (ch == '}') {
 45.1113 +                        nextChar();
 45.1114 +                        return m.at(pos).InheritDoc();
 45.1115 +                    }
 45.1116 +                    inlineText(); // skip unexpected content
 45.1117 +                    nextChar();
 45.1118 +                    throw new ParseException("dc.unexpected.content");
 45.1119 +                }
 45.1120 +            },
 45.1121 +
 45.1122 +            // {@link package.class#member label}
 45.1123 +            new TagParser(Kind.INLINE, DCTree.Kind.LINK) {
 45.1124 +                public DCTree parse(int pos) throws ParseException {
 45.1125 +                    DCReference ref = reference(true);
 45.1126 +                    List<DCTree> label = inlineContent();
 45.1127 +                    return m.at(pos).Link(ref, label);
 45.1128 +                }
 45.1129 +            },
 45.1130 +
 45.1131 +            // {@linkplain package.class#member label}
 45.1132 +            new TagParser(Kind.INLINE, DCTree.Kind.LINK_PLAIN) {
 45.1133 +                public DCTree parse(int pos) throws ParseException {
 45.1134 +                    DCReference ref = reference(true);
 45.1135 +                    List<DCTree> label = inlineContent();
 45.1136 +                    return m.at(pos).LinkPlain(ref, label);
 45.1137 +                }
 45.1138 +            },
 45.1139 +
 45.1140 +            // {@literal text}
 45.1141 +            new TagParser(Kind.INLINE, DCTree.Kind.LITERAL) {
 45.1142 +                public DCTree parse(int pos) throws ParseException {
 45.1143 +                    DCTree text = inlineText();
 45.1144 +                    nextChar();
 45.1145 +                    return m.at(pos).Literal((DCText) text);
 45.1146 +                }
 45.1147 +            },
 45.1148 +
 45.1149 +            // @param parameter-name description
 45.1150 +            new TagParser(Kind.BLOCK, DCTree.Kind.PARAM) {
 45.1151 +                public DCTree parse(int pos) throws ParseException {
 45.1152 +                    skipWhitespace();
 45.1153 +
 45.1154 +                    boolean typaram = false;
 45.1155 +                    if (ch == '<') {
 45.1156 +                        typaram = true;
 45.1157 +                        nextChar();
 45.1158 +                    }
 45.1159 +
 45.1160 +                    DCIdentifier id = identifier();
 45.1161 +
 45.1162 +                    if (typaram) {
 45.1163 +                        if (ch != '>')
 45.1164 +                            throw new ParseException("dc.gt.expected");
 45.1165 +                        nextChar();
 45.1166 +                    }
 45.1167 +
 45.1168 +                    skipWhitespace();
 45.1169 +                    List<DCTree> desc = blockContent();
 45.1170 +                    return m.at(pos).Param(typaram, id, desc);
 45.1171 +                }
 45.1172 +            },
 45.1173 +
 45.1174 +            // @return description
 45.1175 +            new TagParser(Kind.BLOCK, DCTree.Kind.RETURN) {
 45.1176 +                public DCTree parse(int pos) {
 45.1177 +                    List<DCTree> description = blockContent();
 45.1178 +                    return m.at(pos).Return(description);
 45.1179 +                }
 45.1180 +            },
 45.1181 +
 45.1182 +            // @see reference | quoted-string | HTML
 45.1183 +            new TagParser(Kind.BLOCK, DCTree.Kind.SEE) {
 45.1184 +                public DCTree parse(int pos) throws ParseException {
 45.1185 +                    skipWhitespace();
 45.1186 +                    switch (ch) {
 45.1187 +                        case '"':
 45.1188 +                            DCText string = quotedString();
 45.1189 +                            if (string != null) {
 45.1190 +                                skipWhitespace();
 45.1191 +                                if (ch == '@')
 45.1192 +                                    return m.at(pos).See(List.<DCTree>of(string));
 45.1193 +                            }
 45.1194 +                            break;
 45.1195 +
 45.1196 +                        case '<':
 45.1197 +                            List<DCTree> html = blockContent();
 45.1198 +                            if (html != null)
 45.1199 +                                return m.at(pos).See(html);
 45.1200 +                            break;
 45.1201 +
 45.1202 +                        default:
 45.1203 +                            if (isJavaIdentifierStart(ch) || ch == '#') {
 45.1204 +                                DCReference ref = reference(true);
 45.1205 +                                List<DCTree> description = blockContent();
 45.1206 +                                return m.at(pos).See(description.prepend(ref));
 45.1207 +                            }
 45.1208 +                    }
 45.1209 +                    throw new ParseException("dc.unexpected.content");
 45.1210 +                }
 45.1211 +            },
 45.1212 +
 45.1213 +            // @serialData data-description
 45.1214 +            new TagParser(Kind.BLOCK, DCTree.Kind.SERIAL_DATA) {
 45.1215 +                public DCTree parse(int pos) {
 45.1216 +                    List<DCTree> description = blockContent();
 45.1217 +                    return m.at(pos).SerialData(description);
 45.1218 +                }
 45.1219 +            },
 45.1220 +
 45.1221 +            // @serialField field-name field-type description
 45.1222 +            new TagParser(Kind.BLOCK, DCTree.Kind.SERIAL_FIELD) {
 45.1223 +                public DCTree parse(int pos) throws ParseException {
 45.1224 +                    skipWhitespace();
 45.1225 +                    DCIdentifier name = identifier();
 45.1226 +                    skipWhitespace();
 45.1227 +                    DCReference type = reference(false);
 45.1228 +                    List<DCTree> description = null;
 45.1229 +                    if (isWhitespace(ch)) {
 45.1230 +                        skipWhitespace();
 45.1231 +                        description = blockContent();
 45.1232 +                    }
 45.1233 +                    return m.at(pos).SerialField(name, type, description);
 45.1234 +                }
 45.1235 +            },
 45.1236 +
 45.1237 +            // @serial field-description | include | exclude
 45.1238 +            new TagParser(Kind.BLOCK, DCTree.Kind.SERIAL) {
 45.1239 +                public DCTree parse(int pos) {
 45.1240 +                    List<DCTree> description = blockContent();
 45.1241 +                    return m.at(pos).Serial(description);
 45.1242 +                }
 45.1243 +            },
 45.1244 +
 45.1245 +            // @since since-text
 45.1246 +            new TagParser(Kind.BLOCK, DCTree.Kind.SINCE) {
 45.1247 +                public DCTree parse(int pos) {
 45.1248 +                    List<DCTree> description = blockContent();
 45.1249 +                    return m.at(pos).Since(description);
 45.1250 +                }
 45.1251 +            },
 45.1252 +
 45.1253 +            // @throws class-name description
 45.1254 +            new TagParser(Kind.BLOCK, DCTree.Kind.THROWS) {
 45.1255 +                public DCTree parse(int pos) throws ParseException {
 45.1256 +                    skipWhitespace();
 45.1257 +                    DCReference ref = reference(false);
 45.1258 +                    List<DCTree> description = blockContent();
 45.1259 +                    return m.at(pos).Throws(ref, description);
 45.1260 +                }
 45.1261 +            },
 45.1262 +
 45.1263 +            // {@value package.class#field}
 45.1264 +            new TagParser(Kind.INLINE, DCTree.Kind.VALUE) {
 45.1265 +                public DCTree parse(int pos) throws ParseException {
 45.1266 +                    DCReference ref = reference(true);
 45.1267 +                    skipWhitespace();
 45.1268 +                    if (ch == '}') {
 45.1269 +                        nextChar();
 45.1270 +                        return m.at(pos).Value(ref);
 45.1271 +                    }
 45.1272 +                    nextChar();
 45.1273 +                    throw new ParseException("dc.unexpected.content");
 45.1274 +                }
 45.1275 +            },
 45.1276 +
 45.1277 +            // @version version-text
 45.1278 +            new TagParser(Kind.BLOCK, DCTree.Kind.VERSION) {
 45.1279 +                public DCTree parse(int pos) {
 45.1280 +                    List<DCTree> description = blockContent();
 45.1281 +                    return m.at(pos).Version(description);
 45.1282 +                }
 45.1283 +            },
 45.1284 +        };
 45.1285 +
 45.1286 +        tagParsers = new HashMap<Name,TagParser>();
 45.1287 +        for (TagParser p: parsers)
 45.1288 +            tagParsers.put(names.fromString(p.getTreeKind().tagName), p);
 45.1289 +
 45.1290 +    }
 45.1291 +}
    46.1 --- a/src/share/classes/com/sun/tools/javac/parser/JavacParser.java	Wed Nov 14 16:41:51 2012 -0800
    46.2 +++ b/src/share/classes/com/sun/tools/javac/parser/JavacParser.java	Wed Nov 14 17:23:10 2012 -0800
    46.3 @@ -47,8 +47,8 @@
    46.4  import static com.sun.tools.javac.parser.Tokens.TokenKind.GT;
    46.5  import static com.sun.tools.javac.parser.Tokens.TokenKind.IMPORT;
    46.6  import static com.sun.tools.javac.parser.Tokens.TokenKind.LT;
    46.7 +import static com.sun.tools.javac.tree.JCTree.Tag.*;
    46.8  import static com.sun.tools.javac.util.ListBuffer.lb;
    46.9 -import static com.sun.tools.javac.tree.JCTree.Tag.*;
   46.10  
   46.11  /** The parser maps a token sequence into an abstract syntax
   46.12   *  tree. It operates by recursive descent, with code derived
   46.13 @@ -128,7 +128,7 @@
   46.14          this.allowDefaultMethods = source.allowDefaultMethods() &&
   46.15                  fac.options.isSet("allowDefaultMethods"); //pre-lambda guard
   46.16          this.keepDocComments = keepDocComments;
   46.17 -        docComments = newDocCommentTable(keepDocComments);
   46.18 +        docComments = newDocCommentTable(keepDocComments, fac);
   46.19          this.keepLineMap = keepLineMap;
   46.20          this.errorTree = F.Erroneous();
   46.21          endPosTable = newEndPosTable(keepEndPositions);
   46.22 @@ -140,8 +140,8 @@
   46.23                  : new EmptyEndPosTable();
   46.24      }
   46.25  
   46.26 -    protected DocCommentTable newDocCommentTable(boolean keepDocComments) {
   46.27 -        return keepDocComments ? new SimpleDocCommentTable() : null;
   46.28 +    protected DocCommentTable newDocCommentTable(boolean keepDocComments, ParserFactory fac) {
   46.29 +        return keepDocComments ? new LazyDocCommentTable(fac) : null;
   46.30      }
   46.31  
   46.32      /** Switch: Should generics be recognized?
   46.33 @@ -232,7 +232,11 @@
   46.34  
   46.35      protected Token token;
   46.36  
   46.37 -    protected void nextToken() {
   46.38 +    public Token token() {
   46.39 +        return token;
   46.40 +    }
   46.41 +
   46.42 +    public void nextToken() {
   46.43          S.nextToken();
   46.44          token = S.token();
   46.45      }
    47.1 --- a/src/share/classes/com/sun/tools/javac/parser/JavadocTokenizer.java	Wed Nov 14 16:41:51 2012 -0800
    47.2 +++ b/src/share/classes/com/sun/tools/javac/parser/JavadocTokenizer.java	Wed Nov 14 17:23:10 2012 -0800
    47.3 @@ -234,10 +234,12 @@
    47.4              // If we find an exact match for pos, the other item in the pair
    47.5              // gives the source pos; otherwise, compute the source position
    47.6              // relative to the best match found in the array.
    47.7 +            if (pos == Position.NOPOS)
    47.8 +                return Position.NOPOS;
    47.9              if (pos < 0 || pos >= docComment.length())
   47.10 -                throw new StringIndexOutOfBoundsException();
   47.11 +                throw new StringIndexOutOfBoundsException(String.valueOf(pos));
   47.12              if (docPosns == null)
   47.13 -                return -1;
   47.14 +                return Position.NOPOS;
   47.15              int start = 0;
   47.16              int end = docPosns.length;
   47.17              while (start < end - 2) {
    48.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    48.2 +++ b/src/share/classes/com/sun/tools/javac/parser/LazyDocCommentTable.java	Wed Nov 14 17:23:10 2012 -0800
    48.3 @@ -0,0 +1,92 @@
    48.4 +/*
    48.5 + * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
    48.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    48.7 + *
    48.8 + * This code is free software; you can redistribute it and/or modify it
    48.9 + * under the terms of the GNU General Public License version 2 only, as
   48.10 + * published by the Free Software Foundation.  Oracle designates this
   48.11 + * particular file as subject to the "Classpath" exception as provided
   48.12 + * by Oracle in the LICENSE file that accompanied this code.
   48.13 + *
   48.14 + * This code is distributed in the hope that it will be useful, but WITHOUT
   48.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   48.16 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   48.17 + * version 2 for more details (a copy is included in the LICENSE file that
   48.18 + * accompanied this code).
   48.19 + *
   48.20 + * You should have received a copy of the GNU General Public License version
   48.21 + * 2 along with this work; if not, write to the Free Software Foundation,
   48.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   48.23 + *
   48.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   48.25 + * or visit www.oracle.com if you need additional information or have any
   48.26 + * questions.
   48.27 + */
   48.28 +
   48.29 +package com.sun.tools.javac.parser;
   48.30 +
   48.31 +import java.util.HashMap;
   48.32 +import java.util.Map;
   48.33 +
   48.34 +import com.sun.tools.javac.parser.Tokens.Comment;
   48.35 +import com.sun.tools.javac.tree.DCTree.DCDocComment;
   48.36 +import com.sun.tools.javac.tree.DocCommentTable;
   48.37 +import com.sun.tools.javac.tree.JCTree;
   48.38 +import com.sun.tools.javac.util.DiagnosticSource;
   48.39 +
   48.40 +
   48.41 +/**
   48.42 + *
   48.43 + *  <p><b>This is NOT part of any supported API.
   48.44 + *  If you write code that depends on this, you do so at your own risk.
   48.45 + *  This code and its internal interfaces are subject to change or
   48.46 + *  deletion without notice.</b>
   48.47 + */
   48.48 +public class LazyDocCommentTable implements DocCommentTable {
   48.49 +    private static class Entry {
   48.50 +        final Comment comment;
   48.51 +        DCDocComment tree;
   48.52 +
   48.53 +        Entry(Comment c) {
   48.54 +            comment = c;
   48.55 +        }
   48.56 +    }
   48.57 +
   48.58 +    ParserFactory fac;
   48.59 +    DiagnosticSource diagSource;
   48.60 +    Map<JCTree, Entry> table;
   48.61 +
   48.62 +    LazyDocCommentTable(ParserFactory fac) {
   48.63 +        this.fac = fac;
   48.64 +        diagSource = fac.log.currentSource();
   48.65 +        table = new HashMap<JCTree, Entry>();
   48.66 +    }
   48.67 +
   48.68 +    public boolean hasComment(JCTree tree) {
   48.69 +        return table.containsKey(tree);
   48.70 +    }
   48.71 +
   48.72 +    public Comment getComment(JCTree tree) {
   48.73 +        Entry e = table.get(tree);
   48.74 +        return (e == null) ? null : e.comment;
   48.75 +    }
   48.76 +
   48.77 +    public String getCommentText(JCTree tree) {
   48.78 +        Comment c = getComment(tree);
   48.79 +        return (c == null) ? null : c.getText();
   48.80 +    }
   48.81 +
   48.82 +    public DCDocComment getCommentTree(JCTree tree) {
   48.83 +        Entry e = table.get(tree);
   48.84 +        if (e == null)
   48.85 +            return null;
   48.86 +        if (e.tree == null)
   48.87 +            e.tree = new DocCommentParser(fac, diagSource, e.comment).parse();
   48.88 +        return e.tree;
   48.89 +    }
   48.90 +
   48.91 +    public void putComment(JCTree tree, Comment c) {
   48.92 +        table.put(tree, new Entry(c));
   48.93 +    }
   48.94 +
   48.95 +}
    49.1 --- a/src/share/classes/com/sun/tools/javac/parser/ParserFactory.java	Wed Nov 14 16:41:51 2012 -0800
    49.2 +++ b/src/share/classes/com/sun/tools/javac/parser/ParserFactory.java	Wed Nov 14 17:23:10 2012 -0800
    49.3 @@ -1,5 +1,5 @@
    49.4  /*
    49.5 - * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
    49.6 + * Copyright (c) 1999, 2012, 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
   49.10 @@ -25,7 +25,10 @@
   49.11  
   49.12  package com.sun.tools.javac.parser;
   49.13  
   49.14 +import java.util.Locale;
   49.15 +
   49.16  import com.sun.tools.javac.code.Source;
   49.17 +import com.sun.tools.javac.tree.DocTreeMaker;
   49.18  import com.sun.tools.javac.tree.TreeMaker;
   49.19  import com.sun.tools.javac.util.Context;
   49.20  import com.sun.tools.javac.util.Log;
   49.21 @@ -54,26 +57,30 @@
   49.22      }
   49.23  
   49.24      final TreeMaker F;
   49.25 +    final DocTreeMaker docTreeMaker;
   49.26      final Log log;
   49.27      final Tokens tokens;
   49.28      final Source source;
   49.29      final Names names;
   49.30      final Options options;
   49.31      final ScannerFactory scannerFactory;
   49.32 +    final Locale locale;
   49.33  
   49.34      protected ParserFactory(Context context) {
   49.35          super();
   49.36          context.put(parserFactoryKey, this);
   49.37          this.F = TreeMaker.instance(context);
   49.38 +        this.docTreeMaker = DocTreeMaker.instance(context);
   49.39          this.log = Log.instance(context);
   49.40          this.names = Names.instance(context);
   49.41          this.tokens = Tokens.instance(context);
   49.42          this.source = Source.instance(context);
   49.43          this.options = Options.instance(context);
   49.44          this.scannerFactory = ScannerFactory.instance(context);
   49.45 +        this.locale = context.get(Locale.class);
   49.46      }
   49.47  
   49.48 -    public Parser newParser(CharSequence input, boolean keepDocComments, boolean keepEndPos, boolean keepLineMap) {
   49.49 +    public JavacParser newParser(CharSequence input, boolean keepDocComments, boolean keepEndPos, boolean keepLineMap) {
   49.50          Lexer lexer = scannerFactory.newScanner(input, keepDocComments);
   49.51          return new JavacParser(this, lexer, keepDocComments, keepLineMap, keepEndPos);
   49.52      }
    50.1 --- a/src/share/classes/com/sun/tools/javac/parser/SimpleDocCommentTable.java	Wed Nov 14 16:41:51 2012 -0800
    50.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    50.3 @@ -1,67 +0,0 @@
    50.4 -/*
    50.5 - * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
    50.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    50.7 - *
    50.8 - * This code is free software; you can redistribute it and/or modify it
    50.9 - * under the terms of the GNU General Public License version 2 only, as
   50.10 - * published by the Free Software Foundation.  Oracle designates this
   50.11 - * particular file as subject to the "Classpath" exception as provided
   50.12 - * by Oracle in the LICENSE file that accompanied this code.
   50.13 - *
   50.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
   50.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   50.16 - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   50.17 - * version 2 for more details (a copy is included in the LICENSE file that
   50.18 - * accompanied this code).
   50.19 - *
   50.20 - * You should have received a copy of the GNU General Public License version
   50.21 - * 2 along with this work; if not, write to the Free Software Foundation,
   50.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   50.23 - *
   50.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   50.25 - * or visit www.oracle.com if you need additional information or have any
   50.26 - * questions.
   50.27 - */
   50.28 -
   50.29 -package com.sun.tools.javac.parser;
   50.30 -
   50.31 -import java.util.HashMap;
   50.32 -import java.util.Map;
   50.33 -
   50.34 -import com.sun.tools.javac.parser.Tokens.Comment;
   50.35 -import com.sun.tools.javac.tree.DocCommentTable;
   50.36 -import com.sun.tools.javac.tree.JCTree;
   50.37 -
   50.38 -
   50.39 -/**
   50.40 - *
   50.41 - *  <p><b>This is NOT part of any supported API.
   50.42 - *  If you write code that depends on this, you do so at your own risk.
   50.43 - *  This code and its internal interfaces are subject to change or
   50.44 - *  deletion without notice.</b>
   50.45 - */
   50.46 -public class SimpleDocCommentTable implements DocCommentTable {
   50.47 -    Map<JCTree, Comment> table;
   50.48 -
   50.49 -    SimpleDocCommentTable() {
   50.50 -        table = new HashMap<JCTree, Comment>();
   50.51 -    }
   50.52 -
   50.53 -    public boolean hasComment(JCTree tree) {
   50.54 -        return table.containsKey(tree);
   50.55 -    }
   50.56 -
   50.57 -    public Comment getComment(JCTree tree) {
   50.58 -        return table.get(tree);
   50.59 -    }
   50.60 -
   50.61 -    public String getCommentText(JCTree tree) {
   50.62 -        Comment c = getComment(tree);
   50.63 -        return (c == null) ? null : c.getText();
   50.64 -    }
   50.65 -
   50.66 -    public void putComment(JCTree tree, Comment c) {
   50.67 -        table.put(tree, c);
   50.68 -    }
   50.69 -
   50.70 -}
    51.1 --- a/src/share/classes/com/sun/tools/javac/resources/compiler.properties	Wed Nov 14 16:41:51 2012 -0800
    51.2 +++ b/src/share/classes/com/sun/tools/javac/resources/compiler.properties	Wed Nov 14 17:23:10 2012 -0800
    51.3 @@ -2336,4 +2336,52 @@
    51.4  compiler.misc.where.description.intersection.1=\
    51.5      where {0} are intersection types:
    51.6  
    51.7 -
    51.8 +###
    51.9 +# errors related to doc comments
   51.10 +
   51.11 +compiler.err.dc.bad.entity=\
   51.12 +    bad HTML entity
   51.13 +
   51.14 +compiler.err.dc.bad.gt=\
   51.15 +    bad use of ''>''
   51.16 +
   51.17 +compiler.err.dc.bad.inline.tag=\
   51.18 +    incorrect use of inline tag
   51.19 +
   51.20 +compiler.err.dc.identifier.expected=\
   51.21 +    identifier expected
   51.22 +
   51.23 +compiler.err.dc.malformed.html=\
   51.24 +    malformed HTML
   51.25 +
   51.26 +compiler.err.dc.missing.semicolon=\
   51.27 +    semicolon missing
   51.28 +
   51.29 +compiler.err.dc.no.tag.name=\
   51.30 +    no tag name after '@'
   51.31 +
   51.32 +compiler.err.dc.gt.expected=\
   51.33 +    ''>'' expected
   51.34 +
   51.35 +compiler.err.dc.ref.bad.parens=\
   51.36 +    '')'' missing in reference
   51.37 +
   51.38 +compiler.err.dc.ref.syntax.error=\
   51.39 +    syntax error in reference
   51.40 +
   51.41 +compiler.err.dc.ref.unexpected.input=\
   51.42 +    unexpected text
   51.43 +
   51.44 +compiler.err.dc.unexpected.content=\
   51.45 +    unexpected content
   51.46 +
   51.47 +compiler.err.dc.unterminated.inline.tag=\
   51.48 +    unterminated inline tag
   51.49 +
   51.50 +compiler.err.dc.unterminated.signature=\
   51.51 +    unterminated signature
   51.52 +
   51.53 +compiler.err.dc.unterminated.string=\
   51.54 +    unterminated string
   51.55 +
   51.56 +
    52.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    52.2 +++ b/src/share/classes/com/sun/tools/javac/tree/DCTree.java	Wed Nov 14 17:23:10 2012 -0800
    52.3 @@ -0,0 +1,848 @@
    52.4 +/*
    52.5 + * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
    52.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    52.7 + *
    52.8 + * This code is free software; you can redistribute it and/or modify it
    52.9 + * under the terms of the GNU General Public License version 2 only, as
   52.10 + * published by the Free Software Foundation.  Oracle designates this
   52.11 + * particular file as subject to the "Classpath" exception as provided
   52.12 + * by Oracle in the LICENSE file that accompanied this code.
   52.13 + *
   52.14 + * This code is distributed in the hope that it will be useful, but WITHOUT
   52.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   52.16 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   52.17 + * version 2 for more details (a copy is included in the LICENSE file that
   52.18 + * accompanied this code).
   52.19 + *
   52.20 + * You should have received a copy of the GNU General Public License version
   52.21 + * 2 along with this work; if not, write to the Free Software Foundation,
   52.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   52.23 + *
   52.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   52.25 + * or visit www.oracle.com if you need additional information or have any
   52.26 + * questions.
   52.27 + */
   52.28 +
   52.29 +package com.sun.tools.javac.tree;
   52.30 +
   52.31 +
   52.32 +import javax.tools.Diagnostic;
   52.33 +
   52.34 +import com.sun.source.doctree.*;
   52.35 +import com.sun.tools.javac.parser.Tokens.Comment;
   52.36 +import com.sun.tools.javac.util.Assert;
   52.37 +import com.sun.tools.javac.util.DiagnosticSource;
   52.38 +import com.sun.tools.javac.util.JCDiagnostic;
   52.39 +import com.sun.tools.javac.util.JCDiagnostic.SimpleDiagnosticPosition;
   52.40 +import com.sun.tools.javac.util.List;
   52.41 +import com.sun.tools.javac.util.Name;
   52.42 +import javax.tools.JavaFileObject;
   52.43 +
   52.44 +/**
   52.45 + * <p><b>This is NOT part of any supported API.
   52.46 + * If you write code that depends on this, you do so at your own risk.
   52.47 + * This code and its internal interfaces are subject to change or
   52.48 + * deletion without notice.</b>
   52.49 + */
   52.50 +public abstract class DCTree implements DocTree {
   52.51 +
   52.52 +    /**
   52.53 +     * The position in the comment string.
   52.54 +     * Use {@link #getSourcePosition getSourcePosition} to convert
   52.55 +     * it to a position in the source file.
   52.56 +     *
   52.57 +     * TODO: why not simply translate all these values into
   52.58 +     * source file positions? Is it useful to have string-offset
   52.59 +     * positions as well?
   52.60 +     */
   52.61 +    public int pos;
   52.62 +
   52.63 +    public long getSourcePosition(DCDocComment dc) {
   52.64 +        return dc.comment.getSourcePos(pos);
   52.65 +    }
   52.66 +
   52.67 +    public JCDiagnostic.DiagnosticPosition pos(DCDocComment dc) {
   52.68 +        return new SimpleDiagnosticPosition(dc.comment.getSourcePos(pos));
   52.69 +    }
   52.70 +
   52.71 +    public static class DCDocComment extends DCTree implements DocCommentTree {
   52.72 +        final Comment comment; // required for the implicit source pos table
   52.73 +
   52.74 +        public final List<DCTree> firstSentence;
   52.75 +        public final List<DCTree> body;
   52.76 +        public final List<DCTree> tags;
   52.77 +
   52.78 +        public DCDocComment(Comment comment,
   52.79 +                List<DCTree> firstSentence, List<DCTree> body, List<DCTree> tags) {
   52.80 +            this.comment = comment;
   52.81 +            this.firstSentence = firstSentence;
   52.82 +            this.body = body;
   52.83 +            this.tags = tags;
   52.84 +        }
   52.85 +
   52.86 +        public Kind getKind() {
   52.87 +            return Kind.DOC_COMMENT;
   52.88 +        }
   52.89 +
   52.90 +        public <R, D> R accept(DocTreeVisitor<R, D> v, D d) {
   52.91 +            return v.visitDocComment(this, d);
   52.92 +        }
   52.93 +
   52.94 +        public List<? extends DocTree> getFirstSentence() {
   52.95 +            return firstSentence;
   52.96 +        }
   52.97 +
   52.98 +        public List<? extends DocTree> getBody() {
   52.99 +            return body;
  52.100 +        }
  52.101 +
  52.102 +        public List<? extends DocTree> getBlockTags() {
  52.103 +            return tags;
  52.104 +        }
  52.105 +
  52.106 +    }
  52.107 +
  52.108 +    public static abstract class DCBlockTag extends DCTree implements InlineTagTree {
  52.109 +        public String getTagName() {
  52.110 +            return getKind().tagName;
  52.111 +        }
  52.112 +    }
  52.113 +
  52.114 +    public static abstract class DCInlineTag extends DCTree implements InlineTagTree {
  52.115 +        public String getTagName() {
  52.116 +            return getKind().tagName;
  52.117 +        }
  52.118 +    }
  52.119 +
  52.120 +    public static class DCAttribute extends DCTree implements AttributeTree {
  52.121 +        public final Name name;
  52.122 +        public final ValueKind vkind;
  52.123 +        public final List<DCTree> value;
  52.124 +
  52.125 +        DCAttribute(Name name, ValueKind vkind, List<DCTree> value) {
  52.126 +            Assert.check((vkind == ValueKind.EMPTY) ? (value == null) : (value != null));
  52.127 +            this.name = name;
  52.128 +            this.vkind = vkind;
  52.129 +            this.value = value;
  52.130 +        }
  52.131 +
  52.132 +        @Override
  52.133 +        public Kind getKind() {
  52.134 +            return Kind.ATTRIBUTE;
  52.135 +        }
  52.136 +
  52.137 +        @Override
  52.138 +        public <R, D> R accept(DocTreeVisitor<R, D> v, D d) {
  52.139 +            return v.visitAttribute(this, d);
  52.140 +        }
  52.141 +
  52.142 +        @Override
  52.143 +        public Name getName() {
  52.144 +            return name;
  52.145 +        }
  52.146 +
  52.147 +        @Override
  52.148 +        public ValueKind getValueKind() {
  52.149 +            return vkind;
  52.150 +        }
  52.151 +
  52.152 +        @Override
  52.153 +        public List<DCTree> getValue() {
  52.154 +            return value;
  52.155 +        }
  52.156 +    }
  52.157 +
  52.158 +    public static class DCAuthor extends DCInlineTag implements AuthorTree {
  52.159 +        public final List<DCTree> name;
  52.160 +
  52.161 +        DCAuthor(List<DCTree> name) {
  52.162 +            this.name = name;
  52.163 +        }
  52.164 +
  52.165 +        @Override
  52.166 +        public Kind getKind() {
  52.167 +            return Kind.AUTHOR;
  52.168 +        }
  52.169 +
  52.170 +        @Override
  52.171 +        public <R, D> R accept(DocTreeVisitor<R, D> v, D d) {
  52.172 +            return v.visitAuthor(this, d);
  52.173 +        }
  52.174 +
  52.175 +        @Override
  52.176 +        public List<? extends DocTree> getName() {
  52.177 +            return name;
  52.178 +        }
  52.179 +    }
  52.180 +
  52.181 +    public static class DCComment extends DCTree implements CommentTree {
  52.182 +        public final String body;
  52.183 +
  52.184 +        DCComment(String body) {
  52.185 +            this.body = body;
  52.186 +        }
  52.187 +
  52.188 +        @Override
  52.189 +        public Kind getKind() {
  52.190 +            return Kind.COMMENT;
  52.191 +        }
  52.192 +
  52.193 +        @Override
  52.194 +        public <R, D> R accept(DocTreeVisitor<R, D> v, D d) {
  52.195 +            return v.visitComment(this, d);
  52.196 +        }
  52.197 +
  52.198 +        @Override
  52.199 +        public String getBody() {
  52.200 +            return body;
  52.201 +        }
  52.202 +    }
  52.203 +
  52.204 +    public static class DCDeprecated extends DCBlockTag implements DeprecatedTree {
  52.205 +        public final List<DCTree> body;
  52.206 +
  52.207 +        DCDeprecated(List<DCTree> body) {
  52.208 +            this.body = body;
  52.209 +        }
  52.210 +
  52.211 +        @Override
  52.212 +        public Kind getKind() {
  52.213 +            return Kind.DEPRECATED;
  52.214 +        }
  52.215 +
  52.216 +        @Override
  52.217 +        public <R, D> R accept(DocTreeVisitor<R, D> v, D d) {
  52.218 +            return v.visitDeprecated(this, d);
  52.219 +        }
  52.220 +
  52.221 +        @Override
  52.222 +        public List<? extends DocTree> getBody() {
  52.223 +            return body;
  52.224 +        }
  52.225 +    }
  52.226 +
  52.227 +    public static class DCDocRoot extends DCInlineTag implements DocRootTree {
  52.228 +
  52.229 +        @Override
  52.230 +        public Kind getKind() {
  52.231 +            return Kind.DOC_ROOT;
  52.232 +        }
  52.233 +
  52.234 +        @Override
  52.235 +        public <R, D> R accept(DocTreeVisitor<R, D> v, D d) {
  52.236 +            return v.visitDocRoot(this, d);
  52.237 +        }
  52.238 +    }
  52.239 +
  52.240 +    public static class DCEndElement extends DCTree implements EndElementTree {
  52.241 +        public final Name name;
  52.242 +
  52.243 +        DCEndElement(Name name) {
  52.244 +            this.name = name;
  52.245 +        }
  52.246 +
  52.247 +        @Override
  52.248 +        public Kind getKind() {
  52.249 +            return Kind.END_ELEMENT;
  52.250 +        }
  52.251 +
  52.252 +        @Override
  52.253 +        public <R, D> R accept(DocTreeVisitor<R, D> v, D d) {
  52.254 +            return v.visitEndElement(this, d);
  52.255 +        }
  52.256 +
  52.257 +        @Override
  52.258 +        public Name getName() {
  52.259 +            return name;
  52.260 +        }
  52.261 +    }
  52.262 +
  52.263 +    public static class DCEntity extends DCTree implements EntityTree {
  52.264 +        public final Name name;
  52.265 +
  52.266 +        DCEntity(Name name) {
  52.267 +            this.name = name;
  52.268 +        }
  52.269 +
  52.270 +        @Override
  52.271 +        public Kind getKind() {
  52.272 +            return Kind.ENTITY;
  52.273 +        }
  52.274 +
  52.275 +        @Override
  52.276 +        public <R, D> R accept(DocTreeVisitor<R, D> v, D d) {
  52.277 +            return v.visitEntity(this, d);
  52.278 +        }
  52.279 +
  52.280 +        @Override
  52.281 +        public Name getName() {
  52.282 +            return name;
  52.283 +        }
  52.284 +    }
  52.285 +
  52.286 +    public static class DCErroneous extends DCTree implements ErroneousTree, JCDiagnostic.DiagnosticPosition {
  52.287 +        public final String body;
  52.288 +        public final JCDiagnostic diag;
  52.289 +
  52.290 +        DCErroneous(String body, JCDiagnostic.Factory diags, DiagnosticSource diagSource, String code, Object... args) {
  52.291 +            this.body = body;
  52.292 +            this.diag = diags.error(diagSource, this, code, args);
  52.293 +        }
  52.294 +
  52.295 +        @Override
  52.296 +        public Kind getKind() {
  52.297 +            return Kind.ERRONEOUS;
  52.298 +        }
  52.299 +
  52.300 +        @Override
  52.301 +        public <R, D> R accept(DocTreeVisitor<R, D> v, D d) {
  52.302 +            return v.visitErroneous(this, d);
  52.303 +        }
  52.304 +
  52.305 +        @Override
  52.306 +        public String getBody() {
  52.307 +            return body;
  52.308 +        }
  52.309 +
  52.310 +        @Override
  52.311 +        public Diagnostic<JavaFileObject> getDiagnostic() {
  52.312 +            return diag;
  52.313 +        }
  52.314 +
  52.315 +        @Override
  52.316 +        public JCTree getTree() {
  52.317 +            return null;
  52.318 +        }
  52.319 +
  52.320 +        @Override
  52.321 +        public int getStartPosition() {
  52.322 +            return pos;
  52.323 +        }
  52.324 +
  52.325 +        @Override
  52.326 +        public int getPreferredPosition() {
  52.327 +            return pos + body.length() - 1;
  52.328 +        }
  52.329 +
  52.330 +        @Override
  52.331 +        public int getEndPosition(EndPosTable endPosTable) {
  52.332 +            return pos + body.length();
  52.333 +        }
  52.334 +    }
  52.335 +
  52.336 +    public static class DCIdentifier extends DCTree implements IdentifierTree {
  52.337 +        public final Name name;
  52.338 +
  52.339 +        DCIdentifier(Name name) {
  52.340 +            this.name = name;
  52.341 +        }
  52.342 +
  52.343 +        @Override
  52.344 +        public Kind getKind() {
  52.345 +            return Kind.IDENTIFIER;
  52.346 +        }
  52.347 +
  52.348 +        @Override
  52.349 +        public <R, D> R accept(DocTreeVisitor<R, D> v, D d) {
  52.350 +            return v.visitIdentifier(this, d);
  52.351 +        }
  52.352 +
  52.353 +        @Override
  52.354 +        public Name getName() {
  52.355 +            return name;
  52.356 +        }
  52.357 +    }
  52.358 +
  52.359 +    public static class DCInheritDoc extends DCInlineTag implements InheritDocTree {
  52.360 +        @Override
  52.361 +        public Kind getKind() {
  52.362 +            return Kind.INHERIT_DOC;
  52.363 +        }
  52.364 +
  52.365 +        @Override
  52.366 +        public <R, D> R accept(DocTreeVisitor<R, D> v, D d) {
  52.367 +            return v.visitInheritDoc(this, d);
  52.368 +        }
  52.369 +    }
  52.370 +
  52.371 +    public static class DCLink extends DCInlineTag implements LinkTree {
  52.372 +        public final Kind kind;
  52.373 +        public final DCReference ref;
  52.374 +        public final List<DCTree> label;
  52.375 +
  52.376 +        DCLink(Kind kind, DCReference ref, List<DCTree> label) {
  52.377 +            Assert.check(kind == Kind.LINK || kind == Kind.LINK_PLAIN);
  52.378 +            this.kind = kind;
  52.379 +            this.ref = ref;
  52.380 +            this.label = label;
  52.381 +        }
  52.382 +
  52.383 +        @Override
  52.384 +        public Kind getKind() {
  52.385 +            return kind;
  52.386 +        }
  52.387 +
  52.388 +        @Override
  52.389 +        public <R, D> R accept(DocTreeVisitor<R, D> v, D d) {
  52.390 +            return v.visitLink(this, d);
  52.391 +        }
  52.392 +
  52.393 +        @Override
  52.394 +        public ReferenceTree getReference() {
  52.395 +            return ref;
  52.396 +        }
  52.397 +
  52.398 +        @Override
  52.399 +        public List<? extends DocTree> getLabel() {
  52.400 +            return label;
  52.401 +        }
  52.402 +    }
  52.403 +
  52.404 +    public static class DCLiteral extends DCInlineTag implements LiteralTree {
  52.405 +        public final Kind kind;
  52.406 +        public final DCText body;
  52.407 +
  52.408 +        DCLiteral(Kind kind, DCText body) {
  52.409 +            Assert.check(kind == Kind.CODE || kind == Kind.LITERAL);
  52.410 +            this.kind = kind;
  52.411 +            this.body = body;
  52.412 +        }
  52.413 +
  52.414 +        @Override
  52.415 +        public Kind getKind() {
  52.416 +            return kind;
  52.417 +        }
  52.418 +
  52.419 +        @Override
  52.420 +        public <R, D> R accept(DocTreeVisitor<R, D> v, D d) {
  52.421 +            return v.visitLiteral(this, d);
  52.422 +        }
  52.423 +
  52.424 +        @Override
  52.425 +        public DCText getBody() {
  52.426 +            return body;
  52.427 +        }
  52.428 +    }
  52.429 +
  52.430 +    public static class DCParam extends DCBlockTag implements ParamTree {
  52.431 +        public final boolean isTypeParameter;
  52.432 +        public final DCIdentifier name;
  52.433 +        public final List<DCTree> description;
  52.434 +
  52.435 +        DCParam(boolean isTypeParameter, DCIdentifier name, List<DCTree> description) {
  52.436 +            this.isTypeParameter = isTypeParameter;
  52.437 +            this.name = name;
  52.438 +            this.description = description;
  52.439 +        }
  52.440 +
  52.441 +        @Override
  52.442 +        public Kind getKind() {
  52.443 +            return Kind.PARAM;
  52.444 +        }
  52.445 +
  52.446 +        @Override
  52.447 +        public <R, D> R accept(DocTreeVisitor<R, D> v, D d) {
  52.448 +            return v.visitParam(this, d);
  52.449 +        }
  52.450 +
  52.451 +        @Override
  52.452 +        public boolean isTypeParameter() {
  52.453 +            return isTypeParameter;
  52.454 +        }
  52.455 +
  52.456 +        @Override
  52.457 +        public IdentifierTree getName() {
  52.458 +            return name;
  52.459 +        }
  52.460 +
  52.461 +        @Override
  52.462 +        public List<? extends DocTree> getDescription() {
  52.463 +            return description;
  52.464 +        }
  52.465 +    }
  52.466 +
  52.467 +    public static class DCReference extends DCTree implements ReferenceTree {
  52.468 +        public final String signature;
  52.469 +
  52.470 +        // The following are not directly exposed through ReferenceTree
  52.471 +        // use DocTrees.getElement(TreePath,ReferenceTree)
  52.472 +        public final JCTree qualifierExpression;
  52.473 +        public final Name memberName;
  52.474 +        public final List<JCTree> paramTypes;
  52.475 +
  52.476 +
  52.477 +        DCReference(String signature, JCTree qualExpr, Name member, List<JCTree> paramTypes) {
  52.478 +            this.signature = signature;
  52.479 +            qualifierExpression = qualExpr;
  52.480 +            memberName = member;
  52.481 +            this.paramTypes = paramTypes;
  52.482 +        }
  52.483 +
  52.484 +        @Override
  52.485 +        public Kind getKind() {
  52.486 +            return Kind.REFERENCE;
  52.487 +        }
  52.488 +
  52.489 +        @Override
  52.490 +        public <R, D> R accept(DocTreeVisitor<R, D> v, D d) {
  52.491 +            return v.visitReference(this, d);
  52.492 +        }
  52.493 +
  52.494 +        @Override
  52.495 +        public String getSignature() {
  52.496 +            return signature;
  52.497 +        }
  52.498 +    }
  52.499 +
  52.500 +    public static class DCReturn extends DCBlockTag implements ReturnTree {
  52.501 +        public final List<DCTree> description;
  52.502 +
  52.503 +        DCReturn(List<DCTree> description) {
  52.504 +            this.description = description;
  52.505 +        }
  52.506 +
  52.507 +        @Override
  52.508 +        public Kind getKind() {
  52.509 +            return Kind.RETURN;
  52.510 +        }
  52.511 +
  52.512 +        @Override
  52.513 +        public <R, D> R accept(DocTreeVisitor<R, D> v, D d) {
  52.514 +            return v.visitReturn(this, d);
  52.515 +        }
  52.516 +
  52.517 +        @Override
  52.518 +        public List<? extends DocTree> getDescription() {
  52.519 +            return description;
  52.520 +        }
  52.521 +    }
  52.522 +
  52.523 +    public static class DCSee extends DCBlockTag implements SeeTree {
  52.524 +        public final List<DCTree> reference;
  52.525 +
  52.526 +        DCSee(List<DCTree> reference) {
  52.527 +            this.reference = reference;
  52.528 +        }
  52.529 +
  52.530 +        @Override
  52.531 +        public Kind getKind() {
  52.532 +            return Kind.SEE;
  52.533 +        }
  52.534 +
  52.535 +        @Override
  52.536 +        public <R, D> R accept(DocTreeVisitor<R, D> v, D d) {
  52.537 +            return v.visitSee(this, d);
  52.538 +        }
  52.539 +
  52.540 +        @Override
  52.541 +        public List<? extends DocTree> getReference() {
  52.542 +            return reference;
  52.543 +        }
  52.544 +    }
  52.545 +
  52.546 +    public static class DCSerial extends DCBlockTag implements SerialTree {
  52.547 +        public final List<DCTree> description;
  52.548 +
  52.549 +        DCSerial(List<DCTree> description) {
  52.550 +            this.description = description;
  52.551 +        }
  52.552 +
  52.553 +        @Override
  52.554 +        public Kind getKind() {
  52.555 +            return Kind.SERIAL;
  52.556 +        }
  52.557 +
  52.558 +        @Override
  52.559 +        public <R, D> R accept(DocTreeVisitor<R, D> v, D d) {
  52.560 +            return v.visitSerial(this, d);
  52.561 +        }
  52.562 +
  52.563 +        @Override
  52.564 +        public List<? extends DocTree> getDescription() {
  52.565 +            return description;
  52.566 +        }
  52.567 +    }
  52.568 +
  52.569 +    public static class DCSerialData extends DCBlockTag implements SerialDataTree {
  52.570 +        public final List<DCTree> description;
  52.571 +
  52.572 +        DCSerialData(List<DCTree> description) {
  52.573 +            this.description = description;
  52.574 +        }
  52.575 +
  52.576 +        @Override
  52.577 +        public Kind getKind() {
  52.578 +            return Kind.SERIAL_DATA;
  52.579 +        }
  52.580 +
  52.581 +        @Override
  52.582 +        public <R, D> R accept(DocTreeVisitor<R, D> v, D d) {
  52.583 +            return v.visitSerialData(this, d);
  52.584 +        }
  52.585 +
  52.586 +        @Override
  52.587 +        public List<? extends DocTree> getDescription() {
  52.588 +            return description;
  52.589 +        }
  52.590 +    }
  52.591 +
  52.592 +    public static class DCSerialField extends DCBlockTag implements SerialFieldTree {
  52.593 +        public final DCIdentifier name;
  52.594 +        public final DCReference type;
  52.595 +        public final List<DCTree> description;
  52.596 +
  52.597 +        DCSerialField(DCIdentifier name, DCReference type, List<DCTree> description) {
  52.598 +            this.description = description;
  52.599 +            this.name = name;
  52.600 +            this.type = type;
  52.601 +        }
  52.602 +
  52.603 +        @Override
  52.604 +        public Kind getKind() {
  52.605 +            return Kind.SERIAL_FIELD;
  52.606 +        }
  52.607 +
  52.608 +        @Override
  52.609 +        public <R, D> R accept(DocTreeVisitor<R, D> v, D d) {
  52.610 +            return v.visitSerialField(this, d);
  52.611 +        }
  52.612 +
  52.613 +        @Override
  52.614 +        public List<? extends DocTree> getDescription() {
  52.615 +            return description;
  52.616 +        }
  52.617 +
  52.618 +        @Override
  52.619 +        public IdentifierTree getName() {
  52.620 +            return name;
  52.621 +        }
  52.622 +
  52.623 +        @Override
  52.624 +        public ReferenceTree getType() {
  52.625 +            return type;
  52.626 +        }
  52.627 +    }
  52.628 +
  52.629 +    public static class DCSince extends DCInlineTag implements SinceTree {
  52.630 +        public final List<DCTree> body;
  52.631 +
  52.632 +        DCSince(List<DCTree> body) {
  52.633 +            this.body = body;
  52.634 +        }
  52.635 +
  52.636 +        @Override
  52.637 +        public Kind getKind() {
  52.638 +            return Kind.SINCE;
  52.639 +        }
  52.640 +
  52.641 +        @Override
  52.642 +        public <R, D> R accept(DocTreeVisitor<R, D> v, D d) {
  52.643 +            return v.visitSince(this, d);
  52.644 +        }
  52.645 +
  52.646 +        @Override
  52.647 +        public List<? extends DocTree> getBody() {
  52.648 +            return body;
  52.649 +        }
  52.650 +    }
  52.651 +
  52.652 +    public static class DCStartElement extends DCTree implements StartElementTree {
  52.653 +        public final Name name;
  52.654 +        public final List<DCTree> attrs;
  52.655 +        public final boolean selfClosing;
  52.656 +
  52.657 +        DCStartElement(Name name, List<DCTree> attrs, boolean selfClosing) {
  52.658 +            this.name = name;
  52.659 +            this.attrs = attrs;
  52.660 +            this.selfClosing = selfClosing;
  52.661 +        }
  52.662 +
  52.663 +        @Override
  52.664 +        public Kind getKind() {
  52.665 +            return Kind.START_ELEMENT;
  52.666 +        }
  52.667 +
  52.668 +        @Override
  52.669 +        public <R, D> R accept(DocTreeVisitor<R, D> v, D d) {
  52.670 +            return v.visitStartElement(this, d);
  52.671 +        }
  52.672 +
  52.673 +        @Override
  52.674 +        public Name getName() {
  52.675 +            return name;
  52.676 +        }
  52.677 +
  52.678 +        @Override
  52.679 +        public List<? extends DocTree> getAttributes() {
  52.680 +            return attrs;
  52.681 +        }
  52.682 +
  52.683 +        @Override
  52.684 +        public boolean isSelfClosing() {
  52.685 +            return selfClosing;
  52.686 +        }
  52.687 +    }
  52.688 +
  52.689 +    public static class DCText extends DCTree implements TextTree {
  52.690 +        public final String text;
  52.691 +
  52.692 +        DCText(String text) {
  52.693 +            this.text = text;
  52.694 +        }
  52.695 +
  52.696 +        @Override
  52.697 +        public Kind getKind() {
  52.698 +            return Kind.TEXT;
  52.699 +        }
  52.700 +
  52.701 +        @Override
  52.702 +        public <R, D> R accept(DocTreeVisitor<R, D> v, D d) {
  52.703 +            return v.visitText(this, d);
  52.704 +        }
  52.705 +
  52.706 +        @Override
  52.707 +        public String getBody() {
  52.708 +            return text;
  52.709 +        }
  52.710 +    }
  52.711 +
  52.712 +    public static class DCThrows extends DCBlockTag implements ThrowsTree {
  52.713 +        public final Kind kind;
  52.714 +        public final DCReference name;
  52.715 +        public final List<DCTree> description;
  52.716 +
  52.717 +        DCThrows(Kind kind, DCReference name, List<DCTree> description) {
  52.718 +            Assert.check(kind == Kind.EXCEPTION || kind == Kind.THROWS);
  52.719 +            this.kind = kind;
  52.720 +            this.name = name;
  52.721 +            this.description = description;
  52.722 +        }
  52.723 +
  52.724 +        @Override
  52.725 +        public Kind getKind() {
  52.726 +            return kind;
  52.727 +        }
  52.728 +
  52.729 +        @Override
  52.730 +        public <R, D> R accept(DocTreeVisitor<R, D> v, D d) {
  52.731 +            return v.visitThrows(this, d);
  52.732 +        }
  52.733 +
  52.734 +        @Override
  52.735 +        public ReferenceTree getExceptionName() {
  52.736 +            return name;
  52.737 +        }
  52.738 +
  52.739 +        @Override
  52.740 +        public List<? extends DocTree> getDescription() {
  52.741 +            return description;
  52.742 +        }
  52.743 +    }
  52.744 +
  52.745 +    public static class DCUnknownBlockTag extends DCBlockTag implements UnknownBlockTagTree {
  52.746 +        public final Name name;
  52.747 +        public final List<DCTree> content;
  52.748 +
  52.749 +        DCUnknownBlockTag(Name name, List<DCTree> content) {
  52.750 +            this.name = name;
  52.751 +            this.content = content;
  52.752 +        }
  52.753 +
  52.754 +        @Override
  52.755 +        public Kind getKind() {
  52.756 +            return Kind.UNKNOWN_BLOCK_TAG;
  52.757 +        }
  52.758 +
  52.759 +        @Override
  52.760 +        public <R, D> R accept(DocTreeVisitor<R, D> v, D d) {
  52.761 +            return v.visitUnknownBlockTag(this, d);
  52.762 +        }
  52.763 +
  52.764 +        @Override
  52.765 +        public String getTagName() {
  52.766 +            return name.toString();
  52.767 +        }
  52.768 +
  52.769 +        @Override
  52.770 +        public List<? extends DocTree> getContent() {
  52.771 +            return content;
  52.772 +        }
  52.773 +    }
  52.774 +
  52.775 +    public static class DCUnknownInlineTag extends DCInlineTag implements UnknownInlineTagTree {
  52.776 +        public final Name name;
  52.777 +        public final List<DCTree> content;
  52.778 +
  52.779 +        DCUnknownInlineTag(Name name, List<DCTree> content) {
  52.780 +            this.name = name;
  52.781 +            this.content = content;
  52.782 +        }
  52.783 +
  52.784 +        @Override
  52.785 +        public Kind getKind() {
  52.786 +            return Kind.UNKNOWN_INLINE_TAG;
  52.787 +        }
  52.788 +
  52.789 +        @Override
  52.790 +        public <R, D> R accept(DocTreeVisitor<R, D> v, D d) {
  52.791 +            return v.visitUnknownInlineTag(this, d);
  52.792 +        }
  52.793 +
  52.794 +        @Override
  52.795 +        public String getTagName() {
  52.796 +            return name.toString();
  52.797 +        }
  52.798 +
  52.799 +        @Override
  52.800 +        public List<? extends DocTree> getContent() {
  52.801 +            return content;
  52.802 +        }
  52.803 +    }
  52.804 +
  52.805 +    public static class DCValue extends DCInlineTag implements ValueTree {
  52.806 +        public final DCReference ref;
  52.807 +
  52.808 +        DCValue(DCReference ref) {
  52.809 +            this.ref = ref;
  52.810 +        }
  52.811 +
  52.812 +        @Override
  52.813 +        public Kind getKind() {
  52.814 +            return Kind.VALUE;
  52.815 +        }
  52.816 +
  52.817 +        @Override
  52.818 +        public <R, D> R accept(DocTreeVisitor<R, D> v, D d) {
  52.819 +            return v.visitValue(this, d);
  52.820 +        }
  52.821 +
  52.822 +        @Override
  52.823 +        public ReferenceTree getReference() {
  52.824 +            return ref;
  52.825 +        }
  52.826 +    }
  52.827 +
  52.828 +    public static class DCVersion extends DCBlockTag implements VersionTree {
  52.829 +        public final List<DCTree> body;
  52.830 +
  52.831 +        DCVersion(List<DCTree> body) {
  52.832 +            this.body = body;
  52.833 +        }
  52.834 +
  52.835 +        @Override
  52.836 +        public Kind getKind() {
  52.837 +            return Kind.VERSION;
  52.838 +        }
  52.839 +
  52.840 +        @Override
  52.841 +        public <R, D> R accept(DocTreeVisitor<R, D> v, D d) {
  52.842 +            return v.visitVersion(this, d);
  52.843 +        }
  52.844 +
  52.845 +        @Override
  52.846 +        public List<? extends DocTree> getBody() {
  52.847 +            return body;
  52.848 +        }
  52.849 +    }
  52.850 +
  52.851 +}
    53.1 --- a/src/share/classes/com/sun/tools/javac/tree/DocCommentTable.java	Wed Nov 14 16:41:51 2012 -0800
    53.2 +++ b/src/share/classes/com/sun/tools/javac/tree/DocCommentTable.java	Wed Nov 14 17:23:10 2012 -0800
    53.3 @@ -24,7 +24,9 @@
    53.4   */
    53.5  package com.sun.tools.javac.tree;
    53.6  
    53.7 +import com.sun.source.doctree.ErroneousTree;
    53.8  import com.sun.tools.javac.parser.Tokens.Comment;
    53.9 +import com.sun.tools.javac.tree.DCTree.DCDocComment;
   53.10  
   53.11  /**
   53.12   * A table giving the doc comment, if any, for any tree node.
   53.13 @@ -51,6 +53,13 @@
   53.14      public String getCommentText(JCTree tree);
   53.15  
   53.16      /**
   53.17 +     * Get the parsed form of the doc comment as a DocTree. If any errors
   53.18 +     * are detected during parsing, they will be reported via
   53.19 +     * {@link ErroneousTree ErroneousTree} nodes within the resulting tree.
   53.20 +     */
   53.21 +    public DCDocComment getCommentTree(JCTree tree);
   53.22 +
   53.23 +    /**
   53.24       * Set the Comment to be associated with a tree node.
   53.25       */
   53.26      public void putComment(JCTree tree, Comment c);
    54.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    54.2 +++ b/src/share/classes/com/sun/tools/javac/tree/DocPretty.java	Wed Nov 14 17:23:10 2012 -0800
    54.3 @@ -0,0 +1,520 @@
    54.4 +/*
    54.5 + * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
    54.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    54.7 + *
    54.8 + * This code is free software; you can redistribute it and/or modify it
    54.9 + * under the terms of the GNU General Public License version 2 only, as
   54.10 + * published by the Free Software Foundation.  Oracle designates this
   54.11 + * particular file as subject to the "Classpath" exception as provided
   54.12 + * by Oracle in the LICENSE file that accompanied this code.
   54.13 + *
   54.14 + * This code is distributed in the hope that it will be useful, but WITHOUT
   54.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   54.16 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   54.17 + * version 2 for more details (a copy is included in the LICENSE file that
   54.18 + * accompanied this code).
   54.19 + *
   54.20 + * You should have received a copy of the GNU General Public License version
   54.21 + * 2 along with this work; if not, write to the Free Software Foundation,
   54.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   54.23 + *
   54.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   54.25 + * or visit www.oracle.com if you need additional information or have any
   54.26 + * questions.
   54.27 + */
   54.28 +
   54.29 +package com.sun.tools.javac.tree;
   54.30 +
   54.31 +import java.io.Writer;
   54.32 +
   54.33 +import com.sun.source.doctree.*;
   54.34 +import com.sun.source.doctree.AttributeTree.ValueKind;
   54.35 +import com.sun.tools.javac.util.Convert;
   54.36 +import java.io.IOException;
   54.37 +import java.util.List;
   54.38 +
   54.39 +/**
   54.40 + * Prints out a doc comment tree.
   54.41 + *
   54.42 + *  <p><b>This is NOT part of any supported API.
   54.43 + *  If you write code that depends on this, you do so at your own risk.
   54.44 + *  This code and its internal interfaces are subject to change or
   54.45 + *  deletion without notice.</b>
   54.46 + */
   54.47 +public class DocPretty implements DocTreeVisitor<Void,Void> {
   54.48 +
   54.49 +    /**
   54.50 +     * The output stream on which trees are printed.
   54.51 +     */
   54.52 +    final Writer out;
   54.53 +
   54.54 +    /**
   54.55 +     * The left margin.
   54.56 +     */
   54.57 +    int lmargin = 0;
   54.58 +
   54.59 +    public DocPretty(Writer out) {
   54.60 +        this.out = out;
   54.61 +    }
   54.62 +
   54.63 +    /** Visitor method: print expression tree.
   54.64 +     */
   54.65 +    public void print(DocTree tree) throws IOException {
   54.66 +        try {
   54.67 +            if (tree == null)
   54.68 +                print("/*missing*/");
   54.69 +            else {
   54.70 +                tree.accept(this, null);
   54.71 +            }
   54.72 +        } catch (UncheckedIOException ex) {
   54.73 +            throw new IOException(ex.getMessage(), ex);
   54.74 +        }
   54.75 +    }
   54.76 +
   54.77 +    /**
   54.78 +     * Print string, replacing all non-ascii character with unicode escapes.
   54.79 +     */
   54.80 +    protected void print(Object s) throws IOException {
   54.81 +        out.write(Convert.escapeUnicode(s.toString()));
   54.82 +    }
   54.83 +
   54.84 +    /**
   54.85 +     * Print list.
   54.86 +     */
   54.87 +    protected void print(List<? extends DocTree> list) throws IOException {
   54.88 +        for (DocTree t: list) {
   54.89 +            print(t);
   54.90 +        }
   54.91 +    }
   54.92 +
   54.93 +    /**
   54.94 +     * Print list., with separators
   54.95 +     */
   54.96 +    protected void print(List<? extends DocTree> list, String sep) throws IOException {
   54.97 +        if (list.isEmpty())
   54.98 +            return;
   54.99 +        boolean first = true;
  54.100 +        for (DocTree t: list) {
  54.101 +            if (!first)
  54.102 +                print(sep);
  54.103 +            print(t);
  54.104 +            first = false;
  54.105 +        }
  54.106 +    }
  54.107 +
  54.108 +    /** Print new line.
  54.109 +     */
  54.110 +    protected void println() throws IOException {
  54.111 +        out.write(lineSep);
  54.112 +    }
  54.113 +
  54.114 +    protected void printTagName(DocTree node) throws IOException {
  54.115 +        out.write("@");
  54.116 +        out.write(node.getKind().tagName);
  54.117 +    }
  54.118 +
  54.119 +    final String lineSep = System.getProperty("line.separator");
  54.120 +
  54.121 +    /**************************************************************************
  54.122 +     * Traversal methods
  54.123 +     *************************************************************************/
  54.124 +
  54.125 +    /** Exception to propagate IOException through visitXXX methods */
  54.126 +    private static class UncheckedIOException extends Error {
  54.127 +        static final long serialVersionUID = -4032692679158424751L;
  54.128 +        UncheckedIOException(IOException e) {
  54.129 +            super(e.getMessage(), e);
  54.130 +        }
  54.131 +    }
  54.132 +
  54.133 +
  54.134 +    public Void visitAttribute(AttributeTree node, Void p) {
  54.135 +        try {
  54.136 +            print(node.getName());
  54.137 +            String quote;
  54.138 +            switch (node.getValueKind()) {
  54.139 +                case EMPTY:
  54.140 +                    quote = null;
  54.141 +                    break;
  54.142 +                case UNQUOTED:
  54.143 +                    quote = "";
  54.144 +                    break;
  54.145 +                case SINGLE:
  54.146 +                    quote = "'";
  54.147 +                    break;
  54.148 +                case DOUBLE:
  54.149 +                    quote = "\"";
  54.150 +                    break;
  54.151 +                default:
  54.152 +                    throw new AssertionError();
  54.153 +            }
  54.154 +            if (quote != null) {
  54.155 +                print("=" + quote);
  54.156 +                print(node.getValue());
  54.157 +                print(quote);
  54.158 +            }
  54.159 +        } catch (IOException e) {
  54.160 +            throw new UncheckedIOException(e);
  54.161 +        }
  54.162 +        return null;
  54.163 +    }
  54.164 +
  54.165 +    public Void visitAuthor(AuthorTree node, Void p) {
  54.166 +        try {
  54.167 +            printTagName(node);
  54.168 +            print(" ");
  54.169 +            print(node.getName());
  54.170 +        } catch (IOException e) {
  54.171 +            throw new UncheckedIOException(e);
  54.172 +        }
  54.173 +        return null;
  54.174 +    }
  54.175 +
  54.176 +    public Void visitComment(CommentTree node, Void p) {
  54.177 +        try {
  54.178 +            print(node.getBody());
  54.179 +        } catch (IOException e) {
  54.180 +            throw new UncheckedIOException(e);
  54.181 +        }
  54.182 +        return null;
  54.183 +    }
  54.184 +
  54.185 +    public Void visitDeprecated(DeprecatedTree node, Void p) {
  54.186 +        try {
  54.187 +            printTagName(node);
  54.188 +            if (!node.getBody().isEmpty()) {
  54.189 +                print(" ");
  54.190 +                print(node.getBody());
  54.191 +            }
  54.192 +        } catch (IOException e) {
  54.193 +            throw new UncheckedIOException(e);
  54.194 +        }
  54.195 +        return null;
  54.196 +    }
  54.197 +
  54.198 +    public Void visitDocComment(DocCommentTree node, Void p) {
  54.199 +        try {
  54.200 +            List<? extends DocTree> fs = node.getFirstSentence();
  54.201 +            List<? extends DocTree> b = node.getBody();
  54.202 +            List<? extends DocTree> t = node.getBlockTags();
  54.203 +            print(fs);
  54.204 +            if (!fs.isEmpty() && !b.isEmpty())
  54.205 +                print(" ");
  54.206 +            print(b);
  54.207 +            if ((!fs.isEmpty() || !b.isEmpty()) && !t.isEmpty())
  54.208 +                print("\n");
  54.209 +            print(t, "\n");
  54.210 +        } catch (IOException e) {
  54.211 +            throw new UncheckedIOException(e);
  54.212 +        }
  54.213 +        return null;
  54.214 +    }
  54.215 +
  54.216 +    public Void visitDocRoot(DocRootTree node, Void p) {
  54.217 +        try {
  54.218 +            print("{");
  54.219 +            printTagName(node);
  54.220 +            print("}");
  54.221 +        } catch (IOException e) {
  54.222 +            throw new UncheckedIOException(e);
  54.223 +        }
  54.224 +        return null;
  54.225 +    }
  54.226 +
  54.227 +    public Void visitEndElement(EndElementTree node, Void p) {
  54.228 +        try {
  54.229 +            print("</");
  54.230 +            print(node.getName());
  54.231 +            print(">");
  54.232 +        } catch (IOException e) {
  54.233 +            throw new UncheckedIOException(e);
  54.234 +        }
  54.235 +        return null;
  54.236 +    }
  54.237 +
  54.238 +    public Void visitEntity(EntityTree node, Void p) {
  54.239 +        try {
  54.240 +            print("&");
  54.241 +            print(node.getName());
  54.242 +            print(";");
  54.243 +        } catch (IOException e) {
  54.244 +            throw new UncheckedIOException(e);
  54.245 +        }
  54.246 +        return null;
  54.247 +    }
  54.248 +
  54.249 +    public Void visitErroneous(ErroneousTree node, Void p) {
  54.250 +        try {
  54.251 +            print(node.getBody());
  54.252 +        } catch (IOException e) {
  54.253 +            throw new UncheckedIOException(e);
  54.254 +        }
  54.255 +        return null;
  54.256 +    }
  54.257 +
  54.258 +    public Void visitIdentifier(IdentifierTree node, Void p) {
  54.259 +        try {
  54.260 +            print(node.getName());
  54.261 +        } catch (IOException e) {
  54.262 +            throw new UncheckedIOException(e);
  54.263 +        }
  54.264 +        return null;
  54.265 +    }
  54.266 +
  54.267 +    public Void visitInheritDoc(InheritDocTree node, Void p) {
  54.268 +        try {
  54.269 +            print("{");
  54.270 +            printTagName(node);
  54.271 +            print("}");
  54.272 +        } catch (IOException e) {
  54.273 +            throw new UncheckedIOException(e);
  54.274 +        }
  54.275 +        return null;
  54.276 +    }
  54.277 +
  54.278 +    public Void visitLink(LinkTree node, Void p) {
  54.279 +        try {
  54.280 +            print("{");
  54.281 +            printTagName(node);
  54.282 +            print(" ");
  54.283 +            print(node.getReference());
  54.284 +            if (!node.getLabel().isEmpty()) {
  54.285 +                print(" ");
  54.286 +                print(node.getLabel());
  54.287 +            }
  54.288 +            print("}");
  54.289 +        } catch (IOException e) {
  54.290 +            throw new UncheckedIOException(e);
  54.291 +        }
  54.292 +        return null;
  54.293 +    }
  54.294 +
  54.295 +    public Void visitLiteral(LiteralTree node, Void p) {
  54.296 +        try {
  54.297 +            print("{");
  54.298 +            printTagName(node);
  54.299 +            print(" ");
  54.300 +            print(node.getBody());
  54.301 +            print("}");
  54.302 +        } catch (IOException e) {
  54.303 +            throw new UncheckedIOException(e);
  54.304 +        }
  54.305 +        return null;
  54.306 +    }
  54.307 +
  54.308 +    public Void visitParam(ParamTree node, Void p) {
  54.309 +        try {
  54.310 +            printTagName(node);
  54.311 +            print(" ");
  54.312 +            if (node.isTypeParameter()) print("<");
  54.313 +            print(node.getName());
  54.314 +            if (node.isTypeParameter()) print(">");
  54.315 +            if (!node.getDescription().isEmpty()) {
  54.316 +                print(" ");
  54.317 +                print(node.getDescription());
  54.318 +            }
  54.319 +        } catch (IOException e) {
  54.320 +            throw new UncheckedIOException(e);
  54.321 +        }
  54.322 +        return null;
  54.323 +    }
  54.324 +
  54.325 +    public Void visitReference(ReferenceTree node, Void p) {
  54.326 +        try {
  54.327 +            print(node.getSignature());
  54.328 +        } catch (IOException e) {
  54.329 +            throw new UncheckedIOException(e);
  54.330 +        }
  54.331 +        return null;
  54.332 +    }
  54.333 +
  54.334 +    public Void visitReturn(ReturnTree node, Void p) {
  54.335 +        try {
  54.336 +            printTagName(node);
  54.337 +            print(" ");
  54.338 +            print(node.getDescription());
  54.339 +        } catch (IOException e) {
  54.340 +            throw new UncheckedIOException(e);
  54.341 +        }
  54.342 +        return null;
  54.343 +    }
  54.344 +
  54.345 +    public Void visitSee(SeeTree node, Void p) {
  54.346 +        try {
  54.347 +            printTagName(node);
  54.348 +            boolean first = true;
  54.349 +            boolean needSep = true;
  54.350 +            for (DocTree t: node.getReference()) {
  54.351 +                if (needSep) print(" ");
  54.352 +                needSep = (first && (t instanceof ReferenceTree));
  54.353 +                first = false;
  54.354 +                print(t);
  54.355 +            }
  54.356 +        } catch (IOException e) {
  54.357 +            throw new UncheckedIOException(e);
  54.358 +        }
  54.359 +        return null;
  54.360 +    }
  54.361 +
  54.362 +    public Void visitSerial(SerialTree node, Void p) {
  54.363 +        try {
  54.364 +            printTagName(node);
  54.365 +            if (!node.getDescription().isEmpty()) {
  54.366 +                print(" ");
  54.367 +                print(node.getDescription());
  54.368 +            }
  54.369 +        } catch (IOException e) {
  54.370 +            throw new UncheckedIOException(e);
  54.371 +        }
  54.372 +        return null;
  54.373 +    }
  54.374 +
  54.375 +    public Void visitSerialData(SerialDataTree node, Void p) {
  54.376 +        try {
  54.377 +            printTagName(node);
  54.378 +            if (!node.getDescription().isEmpty()) {
  54.379 +                print(" ");
  54.380 +                print(node.getDescription());
  54.381 +            }
  54.382 +        } catch (IOException e) {
  54.383 +            throw new UncheckedIOException(e);
  54.384 +        }
  54.385 +        return null;
  54.386 +    }
  54.387 +
  54.388 +    public Void visitSerialField(SerialFieldTree node, Void p) {
  54.389 +        try {
  54.390 +            printTagName(node);
  54.391 +            print(" ");
  54.392 +            print(node.getName());
  54.393 +            print(" ");
  54.394 +            print(node.getType());
  54.395 +            if (!node.getDescription().isEmpty()) {
  54.396 +                print(" ");
  54.397 +                print(node.getDescription());
  54.398 +            }
  54.399 +        } catch (IOException e) {
  54.400 +            throw new UncheckedIOException(e);
  54.401 +        }
  54.402 +        return null;
  54.403 +    }
  54.404 +
  54.405 +    public Void visitSince(SinceTree node, Void p) {
  54.406 +        try {
  54.407 +            printTagName(node);
  54.408 +            print(" ");
  54.409 +            print(node.getBody());
  54.410 +        } catch (IOException e) {
  54.411 +            throw new UncheckedIOException(e);
  54.412 +        }
  54.413 +        return null;
  54.414 +    }
  54.415 +
  54.416 +    public Void visitStartElement(StartElementTree node, Void p) {
  54.417 +        try {
  54.418 +            print("<");
  54.419 +            print(node.getName());
  54.420 +            List<? extends DocTree> attrs = node.getAttributes();
  54.421 +            if (!attrs.isEmpty()) {
  54.422 +                print(" ");
  54.423 +                print(attrs);
  54.424 +                DocTree last = node.getAttributes().get(attrs.size() - 1);
  54.425 +                if (node.isSelfClosing() && last instanceof AttributeTree
  54.426 +                        && ((AttributeTree) last).getValueKind() == ValueKind.UNQUOTED)
  54.427 +                    print(" ");
  54.428 +            }
  54.429 +            if (node.isSelfClosing())
  54.430 +                print("/");
  54.431 +            print(">");
  54.432 +        } catch (IOException e) {
  54.433 +            throw new UncheckedIOException(e);
  54.434 +        }
  54.435 +        return null;
  54.436 +    }
  54.437 +
  54.438 +    public Void visitText(TextTree node, Void p) {
  54.439 +        try {
  54.440 +            print(node.getBody());
  54.441 +        } catch (IOException e) {
  54.442 +            throw new UncheckedIOException(e);
  54.443 +        }
  54.444 +        return null;
  54.445 +    }
  54.446 +
  54.447 +    public Void visitThrows(ThrowsTree node, Void p) {
  54.448 +        try {
  54.449 +            printTagName(node);
  54.450 +            print(" ");
  54.451 +            print(node.getExceptionName());
  54.452 +            if (!node.getDescription().isEmpty()) {
  54.453 +                print(" ");
  54.454 +                print(node.getDescription());
  54.455 +            }
  54.456 +        } catch (IOException e) {
  54.457 +            throw new UncheckedIOException(e);
  54.458 +        }
  54.459 +        return null;
  54.460 +    }
  54.461 +
  54.462 +    public Void visitUnknownBlockTag(UnknownBlockTagTree node, Void p) {
  54.463 +        try {
  54.464 +            print("@");
  54.465 +            print(node.getTagName());
  54.466 +            print(" ");
  54.467 +            print(node.getContent());
  54.468 +        } catch (IOException e) {
  54.469 +            throw new UncheckedIOException(e);
  54.470 +        }
  54.471 +        return null;
  54.472 +    }
  54.473 +
  54.474 +    public Void visitUnknownInlineTag(UnknownInlineTagTree node, Void p) {
  54.475 +        try {
  54.476 +            print("{");
  54.477 +            print("@");
  54.478 +            print(node.getTagName());
  54.479 +            print(" ");
  54.480 +            print(node.getContent());
  54.481 +            print("}");
  54.482 +        } catch (IOException e) {
  54.483 +            throw new UncheckedIOException(e);
  54.484 +        }
  54.485 +        return null;
  54.486 +    }
  54.487 +
  54.488 +    public Void visitValue(ValueTree node, Void p) {
  54.489 +        try {
  54.490 +            print("{");
  54.491 +            printTagName(node);
  54.492 +            if (node.getReference() != null) {
  54.493 +                print(" ");
  54.494 +                print(node.getReference());
  54.495 +            }
  54.496 +            print("}");
  54.497 +        } catch (IOException e) {
  54.498 +            throw new UncheckedIOException(e);
  54.499 +        }
  54.500 +        return null;
  54.501 +    }
  54.502 +
  54.503 +    public Void visitVersion(VersionTree node, Void p) {
  54.504 +        try {
  54.505 +            printTagName(node);
  54.506 +            print(" ");
  54.507 +            print(node.getBody());
  54.508 +        } catch (IOException e) {
  54.509 +            throw new UncheckedIOException(e);
  54.510 +        }
  54.511 +        return null;
  54.512 +    }
  54.513 +
  54.514 +    public Void visitOther(DocTree node, Void p) {
  54.515 +        try {
  54.516 +            print("(UNKNOWN: " + node + ")");
  54.517 +            println();
  54.518 +        } catch (IOException e) {
  54.519 +            throw new UncheckedIOException(e);
  54.520 +        }
  54.521 +        return null;
  54.522 +    }
  54.523 +}
    55.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    55.2 +++ b/src/share/classes/com/sun/tools/javac/tree/DocTreeMaker.java	Wed Nov 14 17:23:10 2012 -0800
    55.3 @@ -0,0 +1,277 @@
    55.4 +/*
    55.5 + * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
    55.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    55.7 + *
    55.8 + * This code is free software; you can redistribute it and/or modify it
    55.9 + * under the terms of the GNU General Public License version 2 only, as
   55.10 + * published by the Free Software Foundation.  Oracle designates this
   55.11 + * particular file as subject to the "Classpath" exception as provided
   55.12 + * by Oracle in the LICENSE file that accompanied this code.
   55.13 + *
   55.14 + * This code is distributed in the hope that it will be useful, but WITHOUT
   55.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   55.16 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   55.17 + * version 2 for more details (a copy is included in the LICENSE file that
   55.18 + * accompanied this code).
   55.19 + *
   55.20 + * You should have received a copy of the GNU General Public License version
   55.21 + * 2 along with this work; if not, write to the Free Software Foundation,
   55.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   55.23 + *
   55.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   55.25 + * or visit www.oracle.com if you need additional information or have any
   55.26 + * questions.
   55.27 + */
   55.28 +
   55.29 +package com.sun.tools.javac.tree;
   55.30 +
   55.31 +import com.sun.source.doctree.AttributeTree.ValueKind;
   55.32 +import com.sun.source.doctree.DocTree.Kind;
   55.33 +
   55.34 +import com.sun.tools.javac.parser.Tokens.Comment;
   55.35 +import com.sun.tools.javac.tree.DCTree.*;
   55.36 +import com.sun.tools.javac.util.Context;
   55.37 +import com.sun.tools.javac.util.DiagnosticSource;
   55.38 +import com.sun.tools.javac.util.JCDiagnostic;
   55.39 +import com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition;
   55.40 +import com.sun.tools.javac.util.List;
   55.41 +import com.sun.tools.javac.util.Name;
   55.42 +import com.sun.tools.javac.util.Position;
   55.43 +
   55.44 +/**
   55.45 + *
   55.46 + *  <p><b>This is NOT part of any supported API.
   55.47 + *  If you write code that depends on this, you do so at your own risk.
   55.48 + *  This code and its internal interfaces are subject to change or
   55.49 + *  deletion without notice.</b>
   55.50 + */
   55.51 +public class DocTreeMaker {
   55.52 +
   55.53 +    /** The context key for the tree factory. */
   55.54 +    protected static final Context.Key<DocTreeMaker> treeMakerKey =
   55.55 +        new Context.Key<DocTreeMaker>();
   55.56 +
   55.57 +    /** Get the TreeMaker instance. */
   55.58 +    public static DocTreeMaker instance(Context context) {
   55.59 +        DocTreeMaker instance = context.get(treeMakerKey);
   55.60 +        if (instance == null)
   55.61 +            instance = new DocTreeMaker(context);
   55.62 +        return instance;
   55.63 +    }
   55.64 +
   55.65 +    /** The position at which subsequent trees will be created.
   55.66 +     */
   55.67 +    public int pos = Position.NOPOS;
   55.68 +
   55.69 +    /** Access to diag factory for ErroneousTrees. */
   55.70 +    private final JCDiagnostic.Factory diags;
   55.71 +
   55.72 +    /** Create a tree maker with NOPOS as initial position.
   55.73 +     */
   55.74 +    protected DocTreeMaker(Context context) {
   55.75 +        context.put(treeMakerKey, this);
   55.76 +        diags = JCDiagnostic.Factory.instance(context);
   55.77 +        this.pos = Position.NOPOS;
   55.78 +    }
   55.79 +
   55.80 +    /** Reassign current position.
   55.81 +     */
   55.82 +    public DocTreeMaker at(int pos) {
   55.83 +        this.pos = pos;
   55.84 +        return this;
   55.85 +    }
   55.86 +
   55.87 +    /** Reassign current position.
   55.88 +     */
   55.89 +    public DocTreeMaker at(DiagnosticPosition pos) {
   55.90 +        this.pos = (pos == null ? Position.NOPOS : pos.getStartPosition());
   55.91 +        return this;
   55.92 +    }
   55.93 +
   55.94 +    public DCAttribute Attribute(Name name, ValueKind vkind, List<DCTree> value) {
   55.95 +        DCAttribute tree = new DCAttribute(name, vkind, value);
   55.96 +        tree.pos = pos;
   55.97 +        return tree;
   55.98 +    }
   55.99 +
  55.100 +    public DCAuthor Author(List<DCTree> name) {
  55.101 +        DCAuthor tree = new DCAuthor(name);
  55.102 +        tree.pos = pos;
  55.103 +        return tree;
  55.104 +    }
  55.105 +
  55.106 +    public DCLiteral Code(DCText text) {
  55.107 +        DCLiteral tree = new DCLiteral(Kind.CODE, text);
  55.108 +        tree.pos = pos;
  55.109 +        return tree;
  55.110 +    }
  55.111 +
  55.112 +    public DCComment Comment(String text) {
  55.113 +        DCComment tree = new DCComment(text);
  55.114 +        tree.pos = pos;
  55.115 +        return tree;
  55.116 +    }
  55.117 +
  55.118 +    public DCDeprecated Deprecated(List<DCTree> text) {
  55.119 +        DCDeprecated tree = new DCDeprecated(text);
  55.120 +        tree.pos = pos;
  55.121 +        return tree;
  55.122 +    }
  55.123 +
  55.124 +    public DCDocComment DocComment(Comment comment, List<DCTree> firstSentence, List<DCTree> body, List<DCTree> tags) {
  55.125 +        DCDocComment tree = new DCDocComment(comment, firstSentence, body, tags);
  55.126 +        tree.pos = pos;
  55.127 +        return tree;
  55.128 +    }
  55.129 +
  55.130 +    public DCDocRoot DocRoot() {
  55.131 +        DCDocRoot tree = new DCDocRoot();
  55.132 +        tree.pos = pos;
  55.133 +        return tree;
  55.134 +    }
  55.135 +
  55.136 +    public DCEndElement EndElement(Name name) {
  55.137 +        DCEndElement tree = new DCEndElement(name);
  55.138 +        tree.pos = pos;
  55.139 +        return tree;
  55.140 +    }
  55.141 +
  55.142 +    public DCEntity Entity(Name name) {
  55.143 +        DCEntity tree = new DCEntity(name);
  55.144 +        tree.pos = pos;
  55.145 +        return tree;
  55.146 +    }
  55.147 +
  55.148 +    public DCErroneous Erroneous(String text, DiagnosticSource diagSource, String code, Object... args) {
  55.149 +        DCErroneous tree = new DCErroneous(text, diags, diagSource, code, args);
  55.150 +        tree.pos = pos;
  55.151 +        return tree;
  55.152 +    }
  55.153 +
  55.154 +    public DCThrows Exception(DCReference name, List<DCTree> description) {
  55.155 +        DCThrows tree = new DCThrows(Kind.EXCEPTION, name, description);
  55.156 +        tree.pos = pos;
  55.157 +        return tree;
  55.158 +    }
  55.159 +
  55.160 +    public DCIdentifier Identifier(Name name) {
  55.161 +        DCIdentifier tree = new DCIdentifier(name);
  55.162 +        tree.pos = pos;
  55.163 +        return tree;
  55.164 +    }
  55.165 +
  55.166 +    public DCInheritDoc InheritDoc() {
  55.167 +        DCInheritDoc tree = new DCInheritDoc();
  55.168 +        tree.pos = pos;
  55.169 +        return tree;
  55.170 +    }
  55.171 +
  55.172 +    public DCLink Link(DCReference ref, List<DCTree> label) {
  55.173 +        DCLink tree = new DCLink(Kind.LINK, ref, label);
  55.174 +        tree.pos = pos;
  55.175 +        return tree;
  55.176 +    }
  55.177 +
  55.178 +    public DCLink LinkPlain(DCReference ref, List<DCTree> label) {
  55.179 +        DCLink tree = new DCLink(Kind.LINK_PLAIN, ref, label);
  55.180 +        tree.pos = pos;
  55.181 +        return tree;
  55.182 +    }
  55.183 +
  55.184 +    public DCLiteral Literal(DCText text) {
  55.185 +        DCLiteral tree = new DCLiteral(Kind.LITERAL, text);
  55.186 +        tree.pos = pos;
  55.187 +        return tree;
  55.188 +    }
  55.189 +
  55.190 +    public DCParam Param(boolean isTypeParameter, DCIdentifier name, List<DCTree> description) {
  55.191 +        DCParam tree = new DCParam(isTypeParameter, name, description);
  55.192 +        tree.pos = pos;
  55.193 +        return tree;
  55.194 +    }
  55.195 +
  55.196 +    public DCReference Reference(String signature,
  55.197 +            JCTree qualExpr, Name member, List<JCTree> paramTypes) {
  55.198 +        DCReference tree = new DCReference(signature, qualExpr, member, paramTypes);
  55.199 +        tree.pos = pos;
  55.200 +        return tree;
  55.201 +    }
  55.202 +
  55.203 +    public DCReturn Return(List<DCTree> description) {
  55.204 +        DCReturn tree = new DCReturn(description);
  55.205 +        tree.pos = pos;
  55.206 +        return tree;
  55.207 +    }
  55.208 +
  55.209 +    public DCSee See(List<DCTree> reference) {
  55.210 +        DCSee tree = new DCSee(reference);
  55.211 +        tree.pos = pos;
  55.212 +        return tree;
  55.213 +    }
  55.214 +
  55.215 +    public DCSerial Serial(List<DCTree> description) {
  55.216 +        DCSerial tree = new DCSerial(description);
  55.217 +        tree.pos = pos;
  55.218 +        return tree;
  55.219 +    }
  55.220 +
  55.221 +    public DCSerialData SerialData(List<DCTree> description) {
  55.222 +        DCSerialData tree = new DCSerialData(description);
  55.223 +        tree.pos = pos;
  55.224 +        return tree;
  55.225 +    }
  55.226 +
  55.227 +    public DCSerialField SerialField(DCIdentifier name, DCReference type, List<DCTree> description) {
  55.228 +        DCSerialField tree = new DCSerialField(name, type, description);
  55.229 +        tree.pos = pos;
  55.230 +        return tree;
  55.231 +    }
  55.232 +
  55.233 +    public DCSince Since(List<DCTree> text) {
  55.234 +        DCSince tree = new DCSince(text);
  55.235 +        tree.pos = pos;
  55.236 +        return tree;
  55.237 +    }
  55.238 +
  55.239 +    public DCStartElement StartElement(Name name, List<DCTree> attrs, boolean selfClosing) {
  55.240 +        DCStartElement tree = new DCStartElement(name, attrs, selfClosing);
  55.241 +        tree.pos = pos;
  55.242 +        return tree;
  55.243 +    }
  55.244 +
  55.245 +    public DCText Text(String text) {
  55.246 +        DCText tree = new DCText(text);
  55.247 +        tree.pos = pos;
  55.248 +        return tree;
  55.249 +    }
  55.250 +
  55.251 +    public DCThrows Throws(DCReference name, List<DCTree> description) {
  55.252 +        DCThrows tree = new DCThrows(Kind.THROWS, name, description);
  55.253 +        tree.pos = pos;
  55.254 +        return tree;
  55.255 +    }
  55.256 +
  55.257 +    public DCUnknownBlockTag UnknownBlockTag(Name name, List<DCTree> content) {
  55.258 +        DCUnknownBlockTag tree = new DCUnknownBlockTag(name, content);
  55.259 +        tree.pos = pos;
  55.260 +        return tree;
  55.261 +    }
  55.262 +
  55.263 +    public DCUnknownInlineTag UnknownInlineTag(Name name, List<DCTree> content) {
  55.264 +        DCUnknownInlineTag tree = new DCUnknownInlineTag(name, content);
  55.265 +        tree.pos = pos;
  55.266 +        return tree;
  55.267 +    }
  55.268 +
  55.269 +    public DCValue Value(DCReference ref) {
  55.270 +        DCValue tree = new DCValue(ref);
  55.271 +        tree.pos = pos;
  55.272 +        return tree;
  55.273 +    }
  55.274 +
  55.275 +    public DCVersion Version(List<DCTree> text) {
  55.276 +        DCVersion tree = new DCVersion(text);
  55.277 +        tree.pos = pos;
  55.278 +        return tree;
  55.279 +    }
  55.280 +}
    56.1 --- a/src/share/classes/com/sun/tools/javadoc/DocEnv.java	Wed Nov 14 16:41:51 2012 -0800
    56.2 +++ b/src/share/classes/com/sun/tools/javadoc/DocEnv.java	Wed Nov 14 17:23:10 2012 -0800
    56.3 @@ -102,6 +102,7 @@
    56.4      Check chk;
    56.5      Types types;
    56.6      JavaFileManager fileManager;
    56.7 +    Context context;
    56.8  
    56.9      /** Allow documenting from class files? */
   56.10      boolean docClasses = false;
   56.11 @@ -122,6 +123,7 @@
   56.12       */
   56.13      protected DocEnv(Context context) {
   56.14          context.put(docEnvKey, this);
   56.15 +        this.context = context;
   56.16  
   56.17          messager = Messager.instance0(context);
   56.18          syms = Symtab.instance(context);
    57.1 --- a/src/share/classes/com/sun/tools/javadoc/SeeTagImpl.java	Wed Nov 14 16:41:51 2012 -0800
    57.2 +++ b/src/share/classes/com/sun/tools/javadoc/SeeTagImpl.java	Wed Nov 14 17:23:10 2012 -0800
    57.3 @@ -25,7 +25,14 @@
    57.4  
    57.5  package com.sun.tools.javadoc;
    57.6  
    57.7 +import java.io.File;
    57.8 +import java.util.Locale;
    57.9 +
   57.10  import com.sun.javadoc.*;
   57.11 +import com.sun.tools.javac.code.Kinds;
   57.12 +import com.sun.tools.javac.code.Printer;
   57.13 +import com.sun.tools.javac.code.Symbol;
   57.14 +import com.sun.tools.javac.code.Type.CapturedType;
   57.15  import com.sun.tools.javac.util.*;
   57.16  
   57.17  /**
   57.18 @@ -75,9 +82,63 @@
   57.19                  container = (ClassDocImpl)holder;
   57.20              }
   57.21              findReferenced(container);
   57.22 +            if (showRef) showRef();
   57.23          }
   57.24      }
   57.25  
   57.26 +    private static final boolean showRef = false;
   57.27 +
   57.28 +    private void showRef() {
   57.29 +        Symbol sym;
   57.30 +        if (referencedMember != null) {
   57.31 +            if (referencedMember instanceof MethodDocImpl)
   57.32 +                sym = ((MethodDocImpl) referencedMember).sym;
   57.33 +            else if (referencedMember instanceof FieldDocImpl)
   57.34 +                sym = ((FieldDocImpl) referencedMember).sym;
   57.35 +            else
   57.36 +                sym = ((ConstructorDocImpl) referencedMember).sym;
   57.37 +        } else if (referencedClass != null) {
   57.38 +            sym = ((ClassDocImpl) referencedClass).tsym;
   57.39 +        } else if (referencedPackage != null) {
   57.40 +            sym = ((PackageDocImpl) referencedPackage).sym;
   57.41 +        } else
   57.42 +            return;
   57.43 +
   57.44 +        final JavacMessages messages = JavacMessages.instance(docenv().context);
   57.45 +        Locale locale = Locale.getDefault();
   57.46 +        Printer printer = new Printer() {
   57.47 +            int count;
   57.48 +            @Override
   57.49 +            protected String localize(Locale locale, String key, Object... args) {
   57.50 +                return messages.getLocalizedString(locale, key, args);
   57.51 +            }
   57.52 +            @Override
   57.53 +            protected String capturedVarId(CapturedType t, Locale locale) {
   57.54 +                return "CAP#" + (++count);
   57.55 +            }
   57.56 +        };
   57.57 +
   57.58 +        String s = text.replaceAll("\\s+", " ");  // normalize white space
   57.59 +        int sp = s.indexOf(" ");
   57.60 +        int lparen = s.indexOf("(");
   57.61 +        int rparen = s.indexOf(")");
   57.62 +        String seetext = (sp == -1) ? s
   57.63 +                : (lparen == -1 || sp < lparen) ? s.substring(0, sp)
   57.64 +                : s.substring(0, rparen + 1);
   57.65 +
   57.66 +        File file = new File(holder.position().file().getAbsoluteFile().toURI().normalize());
   57.67 +
   57.68 +        StringBuilder sb = new StringBuilder();
   57.69 +        sb.append("+++ ").append(file).append(": ")
   57.70 +                .append(name()).append(" ").append(seetext).append(": ");
   57.71 +        sb.append(sym.getKind()).append(" ");
   57.72 +        if (sym.kind == Kinds.MTH || sym.kind == Kinds.VAR)
   57.73 +            sb.append(printer.visit(sym.owner, locale)).append(".");
   57.74 +        sb.append(printer.visit(sym, locale));
   57.75 +
   57.76 +        System.err.println(sb);
   57.77 +    }
   57.78 +
   57.79      /**
   57.80       * get the class name part of @see, For instance,
   57.81       * if the comment is @see String#startsWith(java.lang.String) .
    58.1 --- a/test/tools/javac/diags/CheckExamples.java	Wed Nov 14 16:41:51 2012 -0800
    58.2 +++ b/test/tools/javac/diags/CheckExamples.java	Wed Nov 14 17:23:10 2012 -0800
    58.3 @@ -25,9 +25,10 @@
    58.4   * @test
    58.5   * @bug 6968063 7127924
    58.6   * @summary provide examples of code that generate diagnostics
    58.7 - * @build Example CheckExamples
    58.8 + * @build Example CheckExamples DocCommentProcessor
    58.9   * @run main/othervm CheckExamples
   58.10   */
   58.11 +
   58.12  /*
   58.13   *      See CR 7127924 for info on why othervm is used.
   58.14   */
    59.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    59.2 +++ b/test/tools/javac/diags/DocCommentProcessor.java	Wed Nov 14 17:23:10 2012 -0800
    59.3 @@ -0,0 +1,114 @@
    59.4 +/*
    59.5 + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
    59.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    59.7 + *
    59.8 + * This code is free software; you can redistribute it and/or modify it
    59.9 + * under the terms of the GNU General Public License version 2 only, as
   59.10 + * published by the Free Software Foundation.
   59.11 + *
   59.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   59.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   59.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   59.15 + * version 2 for more details (a copy is included in the LICENSE file that
   59.16 + * accompanied this code).
   59.17 + *
   59.18 + * You should have received a copy of the GNU General Public License version
   59.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   59.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   59.21 + *
   59.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   59.23 + * or visit www.oracle.com if you need additional information or have any
   59.24 + * questions.
   59.25 + */
   59.26 +
   59.27 +import java.util.*;
   59.28 +
   59.29 +import javax.annotation.processing.*;
   59.30 +import javax.lang.model.*;
   59.31 +import javax.lang.model.element.*;
   59.32 +
   59.33 +import com.sun.source.doctree.DocCommentTree;
   59.34 +import com.sun.source.doctree.ErroneousTree;
   59.35 +import com.sun.source.tree.ClassTree;
   59.36 +import com.sun.source.tree.MethodTree;
   59.37 +import com.sun.source.tree.VariableTree;
   59.38 +import com.sun.source.util.DocTreeScanner;
   59.39 +import com.sun.source.util.DocTrees;
   59.40 +import com.sun.source.util.TreePath;
   59.41 +import com.sun.source.util.TreePathScanner;
   59.42 +import com.sun.source.util.TreeScanner;
   59.43 +import com.sun.tools.javac.tree.DocPretty;
   59.44 +import java.io.PrintWriter;
   59.45 +import javax.tools.Diagnostic;
   59.46 +
   59.47 +/**
   59.48 + * Standard annotation processor for use by examples to
   59.49 + * scan DocCommentTree nodes looking for ErroneousTree,
   59.50 + * on which to call {@code getMessage}.
   59.51 + */
   59.52 +@SupportedAnnotationTypes("*")
   59.53 +public class DocCommentProcessor extends AbstractProcessor {
   59.54 +    @Override
   59.55 +    public SourceVersion getSupportedSourceVersion() {
   59.56 +        return SourceVersion.latest();
   59.57 +    }
   59.58 +
   59.59 +    @Override
   59.60 +    public void init(ProcessingEnvironment pEnv) {
   59.61 +        super.init(pEnv);
   59.62 +        trees = DocTrees.instance(pEnv);
   59.63 +        messager = pEnv.getMessager();
   59.64 +    }
   59.65 +
   59.66 +    @Override
   59.67 +    public boolean process(Set<? extends TypeElement> annos, RoundEnvironment rEnv) {
   59.68 +        for (Element e : rEnv.getRootElements()) {
   59.69 +            new DocCommentScanner().scan(e);
   59.70 +        }
   59.71 +        return true;
   59.72 +    }
   59.73 +
   59.74 +    class DocCommentScanner extends TreePathScanner<Void,Void> {
   59.75 +        public void scan(Element e) {
   59.76 +            scan(trees.getPath(e), null);
   59.77 +        }
   59.78 +
   59.79 +        @Override
   59.80 +        public Void visitClass(ClassTree tree, Void ignore) {
   59.81 +            check();
   59.82 +            return super.visitClass(tree, ignore);
   59.83 +        }
   59.84 +
   59.85 +        @Override
   59.86 +        public Void visitMethod(MethodTree tree, Void ignore) {
   59.87 +            check();
   59.88 +            return super.visitMethod(tree, ignore);
   59.89 +        }
   59.90 +
   59.91 +        @Override
   59.92 +        public Void visitVariable(VariableTree tree, Void ignore) {
   59.93 +            check();
   59.94 +            return super.visitVariable(tree, ignore);
   59.95 +        }
   59.96 +
   59.97 +        private void check() {
   59.98 +            DocCommentTree dc = trees.getDocCommentTree(getCurrentPath());
   59.99 +            if (dc == null)
  59.100 +                return;
  59.101 +
  59.102 +            DocTreeScanner<Void, Void> s = new DocTreeScanner<Void, Void>() {
  59.103 +                @Override
  59.104 +                public Void visitErroneous(ErroneousTree tree, Void ignore) {
  59.105 +                    messager.printMessage(Diagnostic.Kind.NOTE, tree.getDiagnostic().getMessage(null));
  59.106 +                    return null;
  59.107 +                }
  59.108 +            };
  59.109 +
  59.110 +            s.scan(dc, null);
  59.111 +        }
  59.112 +
  59.113 +    }
  59.114 +
  59.115 +    private DocTrees trees;
  59.116 +    private Messager messager;
  59.117 +}
    60.1 --- a/test/tools/javac/diags/Example.java	Wed Nov 14 16:41:51 2012 -0800
    60.2 +++ b/test/tools/javac/diags/Example.java	Wed Nov 14 17:23:10 2012 -0800
    60.3 @@ -1,5 +1,5 @@
    60.4  /*
    60.5 - * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
    60.6 + * Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
    60.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    60.8   *
    60.9   * This code is free software; you can redistribute it and/or modify it
   60.10 @@ -209,6 +209,13 @@
   60.11              opts.add("-classpath"); // avoid using -processorpath for now
   60.12              opts.add(classesDir.getPath());
   60.13              createAnnotationServicesFile(classesDir, procFiles);
   60.14 +        } else if (options != null) {
   60.15 +            int i = options.indexOf("-processor");
   60.16 +            // check for built-in anno-processor(s)
   60.17 +            if (i != -1 && options.get(i + 1).equals("DocCommentProcessor")) {
   60.18 +                opts.add("-classpath");
   60.19 +                opts.add(System.getProperty("test.classes"));
   60.20 +            }
   60.21          }
   60.22  
   60.23          if (srcPathDir != null) {
    61.1 --- a/test/tools/javac/diags/RunExamples.java	Wed Nov 14 16:41:51 2012 -0800
    61.2 +++ b/test/tools/javac/diags/RunExamples.java	Wed Nov 14 17:23:10 2012 -0800
    61.3 @@ -25,7 +25,7 @@
    61.4   * @test
    61.5   * @bug 6968063 7127924
    61.6   * @summary provide examples of code that generate diagnostics
    61.7 - * @build ArgTypeCompilerFactory Example HTMLWriter RunExamples
    61.8 + * @build ArgTypeCompilerFactory Example HTMLWriter RunExamples DocCommentProcessor
    61.9   * @run main/othervm RunExamples
   61.10   */
   61.11  /*
    62.1 --- a/test/tools/javac/diags/examples.not-yet.txt	Wed Nov 14 16:41:51 2012 -0800
    62.2 +++ b/test/tools/javac/diags/examples.not-yet.txt	Wed Nov 14 17:23:10 2012 -0800
    62.3 @@ -3,6 +3,7 @@
    62.4  compiler.err.annotation.value.not.allowable.type        # cannot happen: precluded by complete type-specific tests
    62.5  compiler.err.cant.read.file                             # (apt.JavaCompiler?)
    62.6  compiler.err.cant.select.static.class.from.param.type
    62.7 +compiler.err.dc.unterminated.string                     # cannot happen
    62.8  compiler.err.illegal.char.for.encoding
    62.9  compiler.err.invalid.containedby.annotation             # should not happen
   62.10  compiler.err.invalid.containedby.annotation.invalid.value # "can't" happen
   62.11 @@ -105,3 +106,4 @@
   62.12  compiler.warn.unexpected.archive.file                   # Paths: zip file with unknown extn
   62.13  compiler.warn.unknown.enum.constant                     # in bad class file
   62.14  compiler.warn.unknown.enum.constant.reason              # in bad class file
   62.15 +
    63.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    63.2 +++ b/test/tools/javac/diags/examples/BadEntity.java	Wed Nov 14 17:23:10 2012 -0800
    63.3 @@ -0,0 +1,32 @@
    63.4 +/*
    63.5 + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
    63.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    63.7 + *
    63.8 + * This code is free software; you can redistribute it and/or modify it
    63.9 + * under the terms of the GNU General Public License version 2 only, as
   63.10 + * published by the Free Software Foundation.
   63.11 + *
   63.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   63.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   63.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   63.15 + * version 2 for more details (a copy is included in the LICENSE file that
   63.16 + * accompanied this code).
   63.17 + *
   63.18 + * You should have received a copy of the GNU General Public License version
   63.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   63.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   63.21 + *
   63.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   63.23 + * or visit www.oracle.com if you need additional information or have any
   63.24 + * questions.
   63.25 + */
   63.26 +
   63.27 +// key: compiler.err.dc.bad.entity
   63.28 +// key: compiler.note.note
   63.29 +// key: compiler.note.proc.messager
   63.30 +// run: backdoor
   63.31 +// options: -processor DocCommentProcessor -proc:only
   63.32 +
   63.33 +/** & */
   63.34 +class BadEntity { }
   63.35 +
    64.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    64.2 +++ b/test/tools/javac/diags/examples/BadGreaterThan.java	Wed Nov 14 17:23:10 2012 -0800
    64.3 @@ -0,0 +1,32 @@
    64.4 +/*
    64.5 + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
    64.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    64.7 + *
    64.8 + * This code is free software; you can redistribute it and/or modify it
    64.9 + * under the terms of the GNU General Public License version 2 only, as
   64.10 + * published by the Free Software Foundation.
   64.11 + *
   64.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   64.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   64.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   64.15 + * version 2 for more details (a copy is included in the LICENSE file that
   64.16 + * accompanied this code).
   64.17 + *
   64.18 + * You should have received a copy of the GNU General Public License version
   64.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   64.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   64.21 + *
   64.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   64.23 + * or visit www.oracle.com if you need additional information or have any
   64.24 + * questions.
   64.25 + */
   64.26 +
   64.27 +// key: compiler.err.dc.bad.gt
   64.28 +// key: compiler.note.note
   64.29 +// key: compiler.note.proc.messager
   64.30 +// run: backdoor
   64.31 +// options: -processor DocCommentProcessor -proc:only
   64.32 +
   64.33 +/** > */
   64.34 +class BadGreaterThan { }
   64.35 +
    65.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    65.2 +++ b/test/tools/javac/diags/examples/BadInlineTag.java	Wed Nov 14 17:23:10 2012 -0800
    65.3 @@ -0,0 +1,32 @@
    65.4 +/*
    65.5 + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
    65.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    65.7 + *
    65.8 + * This code is free software; you can redistribute it and/or modify it
    65.9 + * under the terms of the GNU General Public License version 2 only, as
   65.10 + * published by the Free Software Foundation.
   65.11 + *
   65.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   65.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   65.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   65.15 + * version 2 for more details (a copy is included in the LICENSE file that
   65.16 + * accompanied this code).
   65.17 + *
   65.18 + * You should have received a copy of the GNU General Public License version
   65.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   65.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   65.21 + *
   65.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   65.23 + * or visit www.oracle.com if you need additional information or have any
   65.24 + * questions.
   65.25 + */
   65.26 +
   65.27 +// key: compiler.err.dc.bad.inline.tag
   65.28 +// key: compiler.note.note
   65.29 +// key: compiler.note.proc.messager
   65.30 +// run: backdoor
   65.31 +// options: -processor DocCommentProcessor -proc:only
   65.32 +
   65.33 +/** @inheritDoc */
   65.34 +class BadInlineTag { }
   65.35 +
    66.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    66.2 +++ b/test/tools/javac/diags/examples/GreaterThanExpected.java	Wed Nov 14 17:23:10 2012 -0800
    66.3 @@ -0,0 +1,34 @@
    66.4 +/*
    66.5 + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
    66.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    66.7 + *
    66.8 + * This code is free software; you can redistribute it and/or modify it
    66.9 + * under the terms of the GNU General Public License version 2 only, as
   66.10 + * published by the Free Software Foundation.
   66.11 + *
   66.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   66.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   66.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   66.15 + * version 2 for more details (a copy is included in the LICENSE file that
   66.16 + * accompanied this code).
   66.17 + *
   66.18 + * You should have received a copy of the GNU General Public License version
   66.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   66.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   66.21 + *
   66.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   66.23 + * or visit www.oracle.com if you need additional information or have any
   66.24 + * questions.
   66.25 + */
   66.26 +
   66.27 +// key: compiler.err.dc.gt.expected
   66.28 +// key: compiler.note.note
   66.29 +// key: compiler.note.proc.messager
   66.30 +// run: backdoor
   66.31 +// options: -processor DocCommentProcessor -proc:only
   66.32 +
   66.33 +class GreaterThanExpected {
   66.34 +    /** @param <T */
   66.35 +    <T> void m(T t) { }
   66.36 +}
   66.37 +
    67.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    67.2 +++ b/test/tools/javac/diags/examples/MalformedHTML.java	Wed Nov 14 17:23:10 2012 -0800
    67.3 @@ -0,0 +1,31 @@
    67.4 +/*
    67.5 + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
    67.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    67.7 + *
    67.8 + * This code is free software; you can redistribute it and/or modify it
    67.9 + * under the terms of the GNU General Public License version 2 only, as
   67.10 + * published by the Free Software Foundation.
   67.11 + *
   67.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   67.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   67.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   67.15 + * version 2 for more details (a copy is included in the LICENSE file that
   67.16 + * accompanied this code).
   67.17 + *
   67.18 + * You should have received a copy of the GNU General Public License version
   67.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   67.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   67.21 + *
   67.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   67.23 + * or visit www.oracle.com if you need additional information or have any
   67.24 + * questions.
   67.25 + */
   67.26 +
   67.27 +// key: compiler.err.dc.malformed.html
   67.28 +// key: compiler.note.note
   67.29 +// key: compiler.note.proc.messager
   67.30 +// run: backdoor
   67.31 +// options: -processor DocCommentProcessor -proc:only
   67.32 +
   67.33 +/** <b */
   67.34 +class MalformedHTML { }
    68.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    68.2 +++ b/test/tools/javac/diags/examples/MissingSemicolon.java	Wed Nov 14 17:23:10 2012 -0800
    68.3 @@ -0,0 +1,32 @@
    68.4 +/*
    68.5 + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
    68.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    68.7 + *
    68.8 + * This code is free software; you can redistribute it and/or modify it
    68.9 + * under the terms of the GNU General Public License version 2 only, as
   68.10 + * published by the Free Software Foundation.
   68.11 + *
   68.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   68.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   68.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   68.15 + * version 2 for more details (a copy is included in the LICENSE file that
   68.16 + * accompanied this code).
   68.17 + *
   68.18 + * You should have received a copy of the GNU General Public License version
   68.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   68.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   68.21 + *
   68.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   68.23 + * or visit www.oracle.com if you need additional information or have any
   68.24 + * questions.
   68.25 + */
   68.26 +
   68.27 +// key: compiler.err.dc.missing.semicolon
   68.28 +// key: compiler.note.note
   68.29 +// key: compiler.note.proc.messager
   68.30 +// run: backdoor
   68.31 +// options: -processor DocCommentProcessor -proc:only
   68.32 +
   68.33 +/** &lt */
   68.34 +class MissingSemicolon { }
   68.35 +
    69.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    69.2 +++ b/test/tools/javac/diags/examples/NoTagName.java	Wed Nov 14 17:23:10 2012 -0800
    69.3 @@ -0,0 +1,32 @@
    69.4 +/*
    69.5 + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
    69.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    69.7 + *
    69.8 + * This code is free software; you can redistribute it and/or modify it
    69.9 + * under the terms of the GNU General Public License version 2 only, as
   69.10 + * published by the Free Software Foundation.
   69.11 + *
   69.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   69.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   69.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   69.15 + * version 2 for more details (a copy is included in the LICENSE file that
   69.16 + * accompanied this code).
   69.17 + *
   69.18 + * You should have received a copy of the GNU General Public License version
   69.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   69.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   69.21 + *
   69.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   69.23 + * or visit www.oracle.com if you need additional information or have any
   69.24 + * questions.
   69.25 + */
   69.26 +
   69.27 +// key: compiler.err.dc.no.tag.name
   69.28 +// key: compiler.note.note
   69.29 +// key: compiler.note.proc.messager
   69.30 +// run: backdoor
   69.31 +// options: -processor DocCommentProcessor -proc:only
   69.32 +
   69.33 +/** @ */
   69.34 +class NoTagName { }
   69.35 +
    70.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    70.2 +++ b/test/tools/javac/diags/examples/RefBadParens.java	Wed Nov 14 17:23:10 2012 -0800
    70.3 @@ -0,0 +1,32 @@
    70.4 +/*
    70.5 + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
    70.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    70.7 + *
    70.8 + * This code is free software; you can redistribute it and/or modify it
    70.9 + * under the terms of the GNU General Public License version 2 only, as
   70.10 + * published by the Free Software Foundation.
   70.11 + *
   70.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   70.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   70.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   70.15 + * version 2 for more details (a copy is included in the LICENSE file that
   70.16 + * accompanied this code).
   70.17 + *
   70.18 + * You should have received a copy of the GNU General Public License version
   70.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   70.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   70.21 + *
   70.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   70.23 + * or visit www.oracle.com if you need additional information or have any
   70.24 + * questions.
   70.25 + */
   70.26 +
   70.27 +// key: compiler.err.dc.ref.bad.parens
   70.28 +// key: compiler.note.note
   70.29 +// key: compiler.note.proc.messager
   70.30 +// run: backdoor
   70.31 +// options: -processor DocCommentProcessor -proc:only
   70.32 +
   70.33 +/** @see #m((int)) */
   70.34 +class RefBadParens { }
   70.35 +
    71.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    71.2 +++ b/test/tools/javac/diags/examples/RefIdentifierExpected.java	Wed Nov 14 17:23:10 2012 -0800
    71.3 @@ -0,0 +1,34 @@
    71.4 +/*
    71.5 + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
    71.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    71.7 + *
    71.8 + * This code is free software; you can redistribute it and/or modify it
    71.9 + * under the terms of the GNU General Public License version 2 only, as
   71.10 + * published by the Free Software Foundation.
   71.11 + *
   71.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   71.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   71.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   71.15 + * version 2 for more details (a copy is included in the LICENSE file that
   71.16 + * accompanied this code).
   71.17 + *
   71.18 + * You should have received a copy of the GNU General Public License version
   71.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   71.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   71.21 + *
   71.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   71.23 + * or visit www.oracle.com if you need additional information or have any
   71.24 + * questions.
   71.25 + */
   71.26 +
   71.27 +// key: compiler.err.dc.identifier.expected
   71.28 +// key: compiler.note.note
   71.29 +// key: compiler.note.proc.messager
   71.30 +// run: backdoor
   71.31 +// options: -processor DocCommentProcessor -proc:only
   71.32 +
   71.33 +class IdentifierExpected2 {
   71.34 +    /** @param 123 */
   71.35 +    void m() { }
   71.36 +}
   71.37 +
    72.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    72.2 +++ b/test/tools/javac/diags/examples/RefSyntaxError.java	Wed Nov 14 17:23:10 2012 -0800
    72.3 @@ -0,0 +1,32 @@
    72.4 +/*
    72.5 + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
    72.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    72.7 + *
    72.8 + * This code is free software; you can redistribute it and/or modify it
    72.9 + * under the terms of the GNU General Public License version 2 only, as
   72.10 + * published by the Free Software Foundation.
   72.11 + *
   72.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   72.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   72.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   72.15 + * version 2 for more details (a copy is included in the LICENSE file that
   72.16 + * accompanied this code).
   72.17 + *
   72.18 + * You should have received a copy of the GNU General Public License version
   72.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   72.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   72.21 + *
   72.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   72.23 + * or visit www.oracle.com if you need additional information or have any
   72.24 + * questions.
   72.25 + */
   72.26 +
   72.27 +// key: compiler.err.dc.ref.syntax.error
   72.28 +// key: compiler.note.note
   72.29 +// key: compiler.note.proc.messager
   72.30 +// run: backdoor
   72.31 +// options: -processor DocCommentProcessor -proc:only
   72.32 +
   72.33 +/** @see #m(int [) */
   72.34 +class RefSyntaxError { }
   72.35 +
    73.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    73.2 +++ b/test/tools/javac/diags/examples/RefUnexpectedInput.java	Wed Nov 14 17:23:10 2012 -0800
    73.3 @@ -0,0 +1,32 @@
    73.4 +/*
    73.5 + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
    73.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    73.7 + *
    73.8 + * This code is free software; you can redistribute it and/or modify it
    73.9 + * under the terms of the GNU General Public License version 2 only, as
   73.10 + * published by the Free Software Foundation.
   73.11 + *
   73.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   73.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   73.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   73.15 + * version 2 for more details (a copy is included in the LICENSE file that
   73.16 + * accompanied this code).
   73.17 + *
   73.18 + * You should have received a copy of the GNU General Public License version
   73.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   73.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   73.21 + *
   73.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   73.23 + * or visit www.oracle.com if you need additional information or have any
   73.24 + * questions.
   73.25 + */
   73.26 +
   73.27 +// key: compiler.err.dc.ref.unexpected.input
   73.28 +// key: compiler.note.note
   73.29 +// key: compiler.note.proc.messager
   73.30 +// run: backdoor
   73.31 +// options: -processor DocCommentProcessor -proc:only
   73.32 +
   73.33 +/** @see String#isEmpty% */
   73.34 +class UnexpectedInput { }
   73.35 +
    74.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    74.2 +++ b/test/tools/javac/diags/examples/UnexpectedContent.java	Wed Nov 14 17:23:10 2012 -0800
    74.3 @@ -0,0 +1,32 @@
    74.4 +/*
    74.5 + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
    74.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    74.7 + *
    74.8 + * This code is free software; you can redistribute it and/or modify it
    74.9 + * under the terms of the GNU General Public License version 2 only, as
   74.10 + * published by the Free Software Foundation.
   74.11 + *
   74.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   74.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   74.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   74.15 + * version 2 for more details (a copy is included in the LICENSE file that
   74.16 + * accompanied this code).
   74.17 + *
   74.18 + * You should have received a copy of the GNU General Public License version
   74.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   74.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   74.21 + *
   74.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   74.23 + * or visit www.oracle.com if you need additional information or have any
   74.24 + * questions.
   74.25 + */
   74.26 +
   74.27 +// key: compiler.err.dc.unexpected.content
   74.28 +// key: compiler.note.note
   74.29 +// key: compiler.note.proc.messager
   74.30 +// run: backdoor
   74.31 +// options: -processor DocCommentProcessor -proc:only
   74.32 +
   74.33 +/** {@docRoot a} */
   74.34 +class UnterminatedSignature { }
   74.35 +
    75.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    75.2 +++ b/test/tools/javac/diags/examples/UnterminatedInlineTag.java	Wed Nov 14 17:23:10 2012 -0800
    75.3 @@ -0,0 +1,32 @@
    75.4 +/*
    75.5 + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
    75.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    75.7 + *
    75.8 + * This code is free software; you can redistribute it and/or modify it
    75.9 + * under the terms of the GNU General Public License version 2 only, as
   75.10 + * published by the Free Software Foundation.
   75.11 + *
   75.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   75.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   75.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   75.15 + * version 2 for more details (a copy is included in the LICENSE file that
   75.16 + * accompanied this code).
   75.17 + *
   75.18 + * You should have received a copy of the GNU General Public License version
   75.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   75.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   75.21 + *
   75.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   75.23 + * or visit www.oracle.com if you need additional information or have any
   75.24 + * questions.
   75.25 + */
   75.26 +
   75.27 +// key: compiler.err.dc.unterminated.inline.tag
   75.28 +// key: compiler.note.note
   75.29 +// key: compiler.note.proc.messager
   75.30 +// run: backdoor
   75.31 +// options: -processor DocCommentProcessor -proc:only
   75.32 +
   75.33 +/** {@code */
   75.34 +class UnterminatedInlineTag { }
   75.35 +
    76.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    76.2 +++ b/test/tools/javac/diags/examples/UnterminatedSignature.java	Wed Nov 14 17:23:10 2012 -0800
    76.3 @@ -0,0 +1,32 @@
    76.4 +/*
    76.5 + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
    76.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    76.7 + *
    76.8 + * This code is free software; you can redistribute it and/or modify it
    76.9 + * under the terms of the GNU General Public License version 2 only, as
   76.10 + * published by the Free Software Foundation.
   76.11 + *
   76.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   76.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   76.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   76.15 + * version 2 for more details (a copy is included in the LICENSE file that
   76.16 + * accompanied this code).
   76.17 + *
   76.18 + * You should have received a copy of the GNU General Public License version
   76.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   76.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   76.21 + *
   76.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   76.23 + * or visit www.oracle.com if you need additional information or have any
   76.24 + * questions.
   76.25 + */
   76.26 +
   76.27 +// key: compiler.err.dc.unterminated.signature
   76.28 +// key: compiler.note.note
   76.29 +// key: compiler.note.proc.messager
   76.30 +// run: backdoor
   76.31 +// options: -processor DocCommentProcessor -proc:only
   76.32 +
   76.33 +/** @see String#equals( */
   76.34 +class UnterminatedSignature { }
   76.35 +
    77.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    77.2 +++ b/test/tools/javac/doctree/AttrTest.java	Wed Nov 14 17:23:10 2012 -0800
    77.3 @@ -0,0 +1,281 @@
    77.4 +/*
    77.5 + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
    77.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    77.7 + *
    77.8 + * This code is free software; you can redistribute it and/or modify it
    77.9 + * under the terms of the GNU General Public License version 2 only, as
   77.10 + * published by the Free Software Foundation.
   77.11 + *
   77.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   77.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   77.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   77.15 + * version 2 for more details (a copy is included in the LICENSE file that
   77.16 + * accompanied this code).
   77.17 + *
   77.18 + * You should have received a copy of the GNU General Public License version
   77.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   77.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   77.21 + *
   77.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   77.23 + * or visit www.oracle.com if you need additional information or have any
   77.24 + * questions.
   77.25 + */
   77.26 +
   77.27 +/*
   77.28 + * @test
   77.29 + * @bug 7021614
   77.30 + * @summary extend com.sun.source API to support parsing javadoc comments
   77.31 + * @build DocCommentTester
   77.32 + * @run main DocCommentTester AttrTest.java
   77.33 + */
   77.34 +
   77.35 +class AttrTest {
   77.36 +    /**
   77.37 +     * <a name=unquoted>foo</a>
   77.38 +     */
   77.39 +    void unquoted_attr() { }
   77.40 +/*
   77.41 +DocComment[DOC_COMMENT, pos:1
   77.42 +  firstSentence: 3
   77.43 +    StartElement[START_ELEMENT, pos:1
   77.44 +      name:a
   77.45 +      attributes: 1
   77.46 +        Attribute[ATTRIBUTE, pos:4
   77.47 +          name: name
   77.48 +          vkind: UNQUOTED
   77.49 +          value: 1
   77.50 +            Text[TEXT, pos:9, unquoted]
   77.51 +        ]
   77.52 +    ]
   77.53 +    Text[TEXT, pos:18, foo]
   77.54 +    EndElement[END_ELEMENT, pos:21, a]
   77.55 +  body: empty
   77.56 +  block tags: empty
   77.57 +]
   77.58 +*/
   77.59 +
   77.60 +    /**
   77.61 +     * <a name="double_quoted">foo</a>
   77.62 +     */
   77.63 +    void double_quoted_attr() { }
   77.64 +/*
   77.65 +DocComment[DOC_COMMENT, pos:1
   77.66 +  firstSentence: 3
   77.67 +    StartElement[START_ELEMENT, pos:1
   77.68 +      name:a
   77.69 +      attributes: 1
   77.70 +        Attribute[ATTRIBUTE, pos:4
   77.71 +          name: name
   77.72 +          vkind: DOUBLE
   77.73 +          value: 1
   77.74 +            Text[TEXT, pos:10, double_quoted]
   77.75 +        ]
   77.76 +    ]
   77.77 +    Text[TEXT, pos:25, foo]
   77.78 +    EndElement[END_ELEMENT, pos:28, a]
   77.79 +  body: empty
   77.80 +  block tags: empty
   77.81 +]
   77.82 +*/
   77.83 +
   77.84 +    /**
   77.85 +     * <a name='single_quoted'>foo</a>
   77.86 +     */
   77.87 +    void single_quoted_attr() { }
   77.88 +/*
   77.89 +DocComment[DOC_COMMENT, pos:1
   77.90 +  firstSentence: 3
   77.91 +    StartElement[START_ELEMENT, pos:1
   77.92 +      name:a
   77.93 +      attributes: 1
   77.94 +        Attribute[ATTRIBUTE, pos:4
   77.95 +          name: name
   77.96 +          vkind: SINGLE
   77.97 +          value: 1
   77.98 +            Text[TEXT, pos:10, single_quoted]
   77.99 +        ]
  77.100 +    ]
  77.101 +    Text[TEXT, pos:25, foo]
  77.102 +    EndElement[END_ELEMENT, pos:28, a]
  77.103 +  body: empty
  77.104 +  block tags: empty
  77.105 +]
  77.106 +*/
  77.107 +
  77.108 +    /**
  77.109 +     * <hr size="3">
  77.110 +     */
  77.111 +    void numeric_attr() { }
  77.112 +/*
  77.113 +DocComment[DOC_COMMENT, pos:1
  77.114 +  firstSentence: 1
  77.115 +    StartElement[START_ELEMENT, pos:1
  77.116 +      name:hr
  77.117 +      attributes: 1
  77.118 +        Attribute[ATTRIBUTE, pos:5
  77.119 +          name: size
  77.120 +          vkind: DOUBLE
  77.121 +          value: 1
  77.122 +            Text[TEXT, pos:11, 3]
  77.123 +        ]
  77.124 +    ]
  77.125 +  body: empty
  77.126 +  block tags: empty
  77.127 +]
  77.128 +*/
  77.129 +
  77.130 +    /**
  77.131 +     * <a href="{@docRoot}/index.html">
  77.132 +     */
  77.133 +    void docRoot_attr() { }
  77.134 +/*
  77.135 +DocComment[DOC_COMMENT, pos:1
  77.136 +  firstSentence: 1
  77.137 +    StartElement[START_ELEMENT, pos:1
  77.138 +      name:a
  77.139 +      attributes: 1
  77.140 +        Attribute[ATTRIBUTE, pos:4
  77.141 +          name: href
  77.142 +          vkind: DOUBLE
  77.143 +          value: 2
  77.144 +            DocRoot[DOC_ROOT, pos:10]
  77.145 +            Text[TEXT, pos:20, /index.html]
  77.146 +        ]
  77.147 +    ]
  77.148 +  body: empty
  77.149 +  block tags: empty
  77.150 +]
  77.151 +*/
  77.152 +
  77.153 +    /**
  77.154 +     * <a name="abc&quot;def">
  77.155 +     */
  77.156 +    void entity_attr() { }
  77.157 +/*
  77.158 +DocComment[DOC_COMMENT, pos:1
  77.159 +  firstSentence: 1
  77.160 +    StartElement[START_ELEMENT, pos:1
  77.161 +      name:a
  77.162 +      attributes: 1
  77.163 +        Attribute[ATTRIBUTE, pos:4
  77.164 +          name: name
  77.165 +          vkind: DOUBLE
  77.166 +          value: 3
  77.167 +            Text[TEXT, pos:10, abc]
  77.168 +            Entity[ENTITY, pos:13, quot]
  77.169 +            Text[TEXT, pos:19, def]
  77.170 +        ]
  77.171 +    ]
  77.172 +  body: empty
  77.173 +  block tags: empty
  77.174 +]
  77.175 +*/
  77.176 +
  77.177 +    /**
  77.178 +     * <hr noshade>
  77.179 +     */
  77.180 +    void no_value_attr() { }
  77.181 +/*
  77.182 +DocComment[DOC_COMMENT, pos:1
  77.183 +  firstSentence: 1
  77.184 +    StartElement[START_ELEMENT, pos:1
  77.185 +      name:hr
  77.186 +      attributes: 1
  77.187 +        Attribute[ATTRIBUTE, pos:5
  77.188 +          name: noshade
  77.189 +          vkind: EMPTY
  77.190 +          value: null
  77.191 +        ]
  77.192 +    ]
  77.193 +  body: empty
  77.194 +  block tags: empty
  77.195 +]
  77.196 +*/
  77.197 +
  77.198 +    /**
  77.199 +     * abc <hr size='3'/>
  77.200 +     */
  77.201 +    void self_closing_attr_1() { }
  77.202 +/*
  77.203 +DocComment[DOC_COMMENT, pos:1
  77.204 +  firstSentence: 2
  77.205 +    Text[TEXT, pos:1, abc_]
  77.206 +    StartElement[START_ELEMENT, pos:5
  77.207 +      name:hr
  77.208 +      attributes: 1
  77.209 +        Attribute[ATTRIBUTE, pos:9
  77.210 +          name: size
  77.211 +          vkind: SINGLE
  77.212 +          value: 1
  77.213 +            Text[TEXT, pos:15, 3]
  77.214 +        ]
  77.215 +    ]
  77.216 +  body: empty
  77.217 +  block tags: empty
  77.218 +]
  77.219 +*/
  77.220 +
  77.221 +    /**
  77.222 +     * abc <hr size=3 />
  77.223 +     */
  77.224 +    void self_closing_attr_2() { }
  77.225 +/*
  77.226 +DocComment[DOC_COMMENT, pos:1
  77.227 +  firstSentence: 2
  77.228 +    Text[TEXT, pos:1, abc_]
  77.229 +    StartElement[START_ELEMENT, pos:5
  77.230 +      name:hr
  77.231 +      attributes: 1
  77.232 +        Attribute[ATTRIBUTE, pos:9
  77.233 +          name: size
  77.234 +          vkind: UNQUOTED
  77.235 +          value: 1
  77.236 +            Text[TEXT, pos:14, 3]
  77.237 +        ]
  77.238 +    ]
  77.239 +  body: empty
  77.240 +  block tags: empty
  77.241 +]
  77.242 +*/
  77.243 +
  77.244 +    /**
  77.245 +     * abc <hr size="3
  77.246 +     */
  77.247 +    void unterminated_attr_eoi() { }
  77.248 +/*
  77.249 +DocComment[DOC_COMMENT, pos:1
  77.250 +  firstSentence: 3
  77.251 +    Text[TEXT, pos:1, abc_]
  77.252 +    Erroneous[ERRONEOUS, pos:5
  77.253 +      code: compiler.err.dc.malformed.html
  77.254 +      body: <
  77.255 +    ]
  77.256 +    Text[TEXT, pos:6, hr_size="3]
  77.257 +  body: empty
  77.258 +  block tags: empty
  77.259 +]
  77.260 +*/
  77.261 +
  77.262 +    /**
  77.263 +     * abc <hr size="3
  77.264 +     * @author jjg
  77.265 +     */
  77.266 +    void unterminated_attr_block() { }
  77.267 +/*
  77.268 +DocComment[DOC_COMMENT, pos:1
  77.269 +  firstSentence: 3
  77.270 +    Text[TEXT, pos:1, abc_]
  77.271 +    Erroneous[ERRONEOUS, pos:5
  77.272 +      code: compiler.err.dc.malformed.html
  77.273 +      body: <
  77.274 +    ]
  77.275 +    Text[TEXT, pos:6, hr_size="3]
  77.276 +  body: empty
  77.277 +  block tags: 1
  77.278 +    Author[AUTHOR, pos:18
  77.279 +      name: 1
  77.280 +        Text[TEXT, pos:26, jjg]
  77.281 +    ]
  77.282 +]
  77.283 +*/
  77.284 +}
    78.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    78.2 +++ b/test/tools/javac/doctree/AuthorTest.java	Wed Nov 14 17:23:10 2012 -0800
    78.3 @@ -0,0 +1,46 @@
    78.4 +/*
    78.5 + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
    78.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    78.7 + *
    78.8 + * This code is free software; you can redistribute it and/or modify it
    78.9 + * under the terms of the GNU General Public License version 2 only, as
   78.10 + * published by the Free Software Foundation.
   78.11 + *
   78.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   78.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   78.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   78.15 + * version 2 for more details (a copy is included in the LICENSE file that
   78.16 + * accompanied this code).
   78.17 + *
   78.18 + * You should have received a copy of the GNU General Public License version
   78.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   78.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   78.21 + *
   78.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   78.23 + * or visit www.oracle.com if you need additional information or have any
   78.24 + * questions.
   78.25 + */
   78.26 +
   78.27 +/*
   78.28 + * @test
   78.29 + * @bug 7021614
   78.30 + * @summary extend com.sun.source API to support parsing javadoc comments
   78.31 + * @build DocCommentTester
   78.32 + * @run main DocCommentTester AuthorTest.java
   78.33 + */
   78.34 +
   78.35 +class AuthorTest {
   78.36 +    /** abc @author jjg &amp; others */
   78.37 +    void standard() { }
   78.38 +/*
   78.39 +DocComment[DOC_COMMENT, pos:0
   78.40 +  firstSentence: 3
   78.41 +    Text[TEXT, pos:0, abc_@author_jjg_]
   78.42 +    Entity[ENTITY, pos:16, amp]
   78.43 +    Text[TEXT, pos:21, _others]
   78.44 +  body: empty
   78.45 +  block tags: empty
   78.46 +]
   78.47 +*/
   78.48 +
   78.49 +}
    79.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    79.2 +++ b/test/tools/javac/doctree/BadTest.java	Wed Nov 14 17:23:10 2012 -0800
    79.3 @@ -0,0 +1,52 @@
    79.4 +/*
    79.5 + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
    79.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    79.7 + *
    79.8 + * This code is free software; you can redistribute it and/or modify it
    79.9 + * under the terms of the GNU General Public License version 2 only, as
   79.10 + * published by the Free Software Foundation.
   79.11 + *
   79.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   79.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   79.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   79.15 + * version 2 for more details (a copy is included in the LICENSE file that
   79.16 + * accompanied this code).
   79.17 + *
   79.18 + * You should have received a copy of the GNU General Public License version
   79.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   79.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   79.21 + *
   79.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   79.23 + * or visit www.oracle.com if you need additional information or have any
   79.24 + * questions.
   79.25 + */
   79.26 +
   79.27 +/*
   79.28 + * @test
   79.29 + * @bug 7021614
   79.30 + * @summary extend com.sun.source API to support parsing javadoc comments
   79.31 + * @build DocCommentTester
   79.32 + * @run main DocCommentTester Bad.java
   79.33 + */
   79.34 +
   79.35 +class BadTest {
   79.36 +
   79.37 +    /**
   79.38 +     * abc {@value java.awt.Color#RED junk}
   79.39 +     */
   79.40 +    int trailing_junk() { }
   79.41 +/*
   79.42 +DocComment[DOC_COMMENT, pos:1
   79.43 +  firstSentence: 3
   79.44 +    Text[TEXT, pos:1, abc_]
   79.45 +    Erroneous[ERRONEOUS, pos:5
   79.46 +      code: compiler.err.dc.unexpected.content
   79.47 +      body: {@value_java.awt.Color#RED_j
   79.48 +    ]
   79.49 +    Text[TEXT, pos:33, unk}]
   79.50 +  body: empty
   79.51 +  block tags: empty
   79.52 +]
   79.53 +*/
   79.54 +
   79.55 +}
    80.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    80.2 +++ b/test/tools/javac/doctree/CodeTest.java	Wed Nov 14 17:23:10 2012 -0800
    80.3 @@ -0,0 +1,133 @@
    80.4 +/*
    80.5 + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
    80.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    80.7 + *
    80.8 + * This code is free software; you can redistribute it and/or modify it
    80.9 + * under the terms of the GNU General Public License version 2 only, as
   80.10 + * published by the Free Software Foundation.
   80.11 + *
   80.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   80.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   80.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   80.15 + * version 2 for more details (a copy is included in the LICENSE file that
   80.16 + * accompanied this code).
   80.17 + *
   80.18 + * You should have received a copy of the GNU General Public License version
   80.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   80.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   80.21 + *
   80.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   80.23 + * or visit www.oracle.com if you need additional information or have any
   80.24 + * questions.
   80.25 + */
   80.26 +
   80.27 +/*
   80.28 + * @test
   80.29 + * @bug 7021614
   80.30 + * @summary extend com.sun.source API to support parsing javadoc comments
   80.31 + * @build DocCommentTester
   80.32 + * @run main DocCommentTester CodeTest.java
   80.33 + */
   80.34 +
   80.35 +class CodeTest {
   80.36 +    /** {@code if (a < b) { }} */
   80.37 +    void minimal() { }
   80.38 +/*
   80.39 +DocComment[DOC_COMMENT, pos:0
   80.40 +  firstSentence: 1
   80.41 +    Literal[CODE, pos:0, if_(a_<_b)_{_}]
   80.42 +  body: empty
   80.43 +  block tags: empty
   80.44 +]
   80.45 +*/
   80.46 +
   80.47 +    /** [{@code if (a < b) { }}] */
   80.48 +    void in_brackets() { }
   80.49 +/*
   80.50 +DocComment[DOC_COMMENT, pos:0
   80.51 +  firstSentence: 3
   80.52 +    Text[TEXT, pos:0, []
   80.53 +    Literal[CODE, pos:1, if_(a_<_b)_{_}]
   80.54 +    Text[TEXT, pos:23, ]]
   80.55 +  body: empty
   80.56 +  block tags: empty
   80.57 +]
   80.58 +*/
   80.59 +
   80.60 +    /** [ {@code if (a < b) { }} ] */
   80.61 +    void in_brackets_with_whitespace() { }
   80.62 +/*
   80.63 +DocComment[DOC_COMMENT, pos:0
   80.64 +  firstSentence: 3
   80.65 +    Text[TEXT, pos:0, [_]
   80.66 +    Literal[CODE, pos:2, if_(a_<_b)_{_}]
   80.67 +    Text[TEXT, pos:24, _]]
   80.68 +  body: empty
   80.69 +  block tags: empty
   80.70 +]
   80.71 +*/
   80.72 +
   80.73 +    /**
   80.74 +     * {@code {@code nested} }
   80.75 +     */
   80.76 +    void nested() { }
   80.77 +/*
   80.78 +DocComment[DOC_COMMENT, pos:1
   80.79 +  firstSentence: 1
   80.80 +    Literal[CODE, pos:1, {@code_nested}_]
   80.81 +  body: empty
   80.82 +  block tags: empty
   80.83 +]
   80.84 +*/
   80.85 +
   80.86 +    /**
   80.87 +     * {@code if (a < b) {
   80.88 +     *        }
   80.89 +     * }
   80.90 +     */
   80.91 +    void embedded_newline() { }
   80.92 +/*
   80.93 +DocComment[DOC_COMMENT, pos:1
   80.94 +  firstSentence: 1
   80.95 +    Literal[CODE, pos:1, if_(a_<_b)_{|________}|_]
   80.96 +  body: empty
   80.97 +  block tags: empty
   80.98 +]
   80.99 +*/
  80.100 +
  80.101 +    /** {@code if (a < b) { } */
  80.102 +    void unterminated_1() { }
  80.103 +/*
  80.104 +DocComment[DOC_COMMENT, pos:0
  80.105 +  firstSentence: 1
  80.106 +    Erroneous[ERRONEOUS, pos:0
  80.107 +      code: compiler.err.dc.unterminated.inline.tag
  80.108 +      body: {@code_if_(a_<_b)_{_}
  80.109 +    ]
  80.110 +  body: empty
  80.111 +  block tags: empty
  80.112 +]
  80.113 +*/
  80.114 +
  80.115 +    /**
  80.116 +     * {@code if (a < b) { }
  80.117 +     * @author jjg */
  80.118 +    void unterminated_2() { }
  80.119 +/*
  80.120 +DocComment[DOC_COMMENT, pos:1
  80.121 +  firstSentence: 1
  80.122 +    Erroneous[ERRONEOUS, pos:1
  80.123 +      code: compiler.err.dc.unterminated.inline.tag
  80.124 +      body: {@code_if_(a_<_b)_{_}
  80.125 +    ]
  80.126 +  body: empty
  80.127 +  block tags: 1
  80.128 +    Author[AUTHOR, pos:24
  80.129 +      name: 1
  80.130 +        Text[TEXT, pos:32, jjg]
  80.131 +    ]
  80.132 +]
  80.133 +*/
  80.134 +
  80.135 +}
  80.136 +
    81.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    81.2 +++ b/test/tools/javac/doctree/DeprecatedTest.java	Wed Nov 14 17:23:10 2012 -0800
    81.3 @@ -0,0 +1,64 @@
    81.4 +/*
    81.5 + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
    81.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    81.7 + *
    81.8 + * This code is free software; you can redistribute it and/or modify it
    81.9 + * under the terms of the GNU General Public License version 2 only, as
   81.10 + * published by the Free Software Foundation.
   81.11 + *
   81.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   81.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   81.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   81.15 + * version 2 for more details (a copy is included in the LICENSE file that
   81.16 + * accompanied this code).
   81.17 + *
   81.18 + * You should have received a copy of the GNU General Public License version
   81.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   81.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   81.21 + *
   81.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   81.23 + * or visit www.oracle.com if you need additional information or have any
   81.24 + * questions.
   81.25 + */
   81.26 +
   81.27 +/*
   81.28 + * @test
   81.29 + * @bug 7021614
   81.30 + * @summary extend com.sun.source API to support parsing javadoc comments
   81.31 + * @build DocCommentTester
   81.32 + * @run main DocCommentTester DeprecatedTest.java
   81.33 + */
   81.34 +
   81.35 +class DeprecatedTest {
   81.36 +    /**
   81.37 +     * @deprecated
   81.38 +     */
   81.39 +    void deprecated() { }
   81.40 +/*
   81.41 +DocComment[DOC_COMMENT, pos:1
   81.42 +  firstSentence: empty
   81.43 +  body: empty
   81.44 +  block tags: 1
   81.45 +    Deprecated[DEPRECATED, pos:1
   81.46 +      body: empty
   81.47 +    ]
   81.48 +]
   81.49 +*/
   81.50 +
   81.51 +    /**
   81.52 +     * @deprecated text
   81.53 +     */
   81.54 +    void deprecated_text() { }
   81.55 +/*
   81.56 +DocComment[DOC_COMMENT, pos:1
   81.57 +  firstSentence: empty
   81.58 +  body: empty
   81.59 +  block tags: 1
   81.60 +    Deprecated[DEPRECATED, pos:1
   81.61 +      body: 1
   81.62 +        Text[TEXT, pos:13, text]
   81.63 +    ]
   81.64 +]
   81.65 +*/
   81.66 +
   81.67 +}
    82.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    82.2 +++ b/test/tools/javac/doctree/DocCommentTester.java	Wed Nov 14 17:23:10 2012 -0800
    82.3 @@ -0,0 +1,778 @@
    82.4 +/*
    82.5 + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
    82.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    82.7 + *
    82.8 + * This code is free software; you can redistribute it and/or modify it
    82.9 + * under the terms of the GNU General Public License version 2 only, as
   82.10 + * published by the Free Software Foundation.
   82.11 + *
   82.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   82.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   82.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   82.15 + * version 2 for more details (a copy is included in the LICENSE file that
   82.16 + * accompanied this code).
   82.17 + *
   82.18 + * You should have received a copy of the GNU General Public License version
   82.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   82.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   82.21 + *
   82.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   82.23 + * or visit www.oracle.com if you need additional information or have any
   82.24 + * questions.
   82.25 + */
   82.26 +
   82.27 +import java.io.File;
   82.28 +import java.io.FileWriter;
   82.29 +import java.io.IOException;
   82.30 +import java.io.PrintWriter;
   82.31 +import java.io.StringWriter;
   82.32 +import java.io.Writer;
   82.33 +import java.util.ArrayList;
   82.34 +import java.util.List;
   82.35 +import java.util.regex.Matcher;
   82.36 +import java.util.regex.Pattern;
   82.37 +
   82.38 +import javax.lang.model.element.Name;
   82.39 +import javax.tools.JavaFileObject;
   82.40 +import javax.tools.StandardJavaFileManager;
   82.41 +
   82.42 +import com.sun.source.doctree.*;
   82.43 +import com.sun.source.tree.ClassTree;
   82.44 +import com.sun.source.tree.CompilationUnitTree;
   82.45 +import com.sun.source.tree.MethodTree;
   82.46 +import com.sun.source.tree.Tree;
   82.47 +import com.sun.source.tree.VariableTree;
   82.48 +import com.sun.source.util.DocTreeScanner;
   82.49 +import com.sun.source.util.DocTrees;
   82.50 +import com.sun.source.util.JavacTask;
   82.51 +import com.sun.source.util.TreePath;
   82.52 +import com.sun.source.util.TreePathScanner;
   82.53 +import com.sun.tools.javac.api.JavacTool;
   82.54 +import com.sun.tools.javac.tree.DCTree;
   82.55 +import com.sun.tools.javac.tree.DCTree.DCDocComment;
   82.56 +import com.sun.tools.javac.tree.DCTree.DCErroneous;
   82.57 +import com.sun.tools.javac.tree.DocPretty;
   82.58 +
   82.59 +public class DocCommentTester {
   82.60 +
   82.61 +    public static void main(String... args) throws Exception {
   82.62 +        new DocCommentTester().run(args);
   82.63 +    }
   82.64 +
   82.65 +    public void run(String... args) throws Exception {
   82.66 +        String testSrc = System.getProperty("test.src");
   82.67 +
   82.68 +        List<File> files = new ArrayList<File>();
   82.69 +        for (String arg: args)
   82.70 +            files.add(new File(testSrc, arg));
   82.71 +
   82.72 +        JavacTool javac = JavacTool.create();
   82.73 +        StandardJavaFileManager fm = javac.getStandardFileManager(null, null, null);
   82.74 +
   82.75 +        Iterable<? extends JavaFileObject> fos = fm.getJavaFileObjectsFromFiles(files);
   82.76 +
   82.77 +        JavacTask t = javac.getTask(null, fm, null, null, null, fos);
   82.78 +        final DocTrees trees = DocTrees.instance(t);
   82.79 +
   82.80 +        final Checker[] checkers = {
   82.81 +            new ASTChecker(this, trees),
   82.82 +            new PosChecker(this, trees),
   82.83 +            new PrettyChecker(this, trees)
   82.84 +        };
   82.85 +
   82.86 +        DeclScanner d = new DeclScanner() {
   82.87 +            @Override
   82.88 +            public Void visitCompilationUnit(CompilationUnitTree tree, Void ignore) {
   82.89 +                for (Checker c: checkers)
   82.90 +                    c.visitCompilationUnit(tree);
   82.91 +                return super.visitCompilationUnit(tree, ignore);
   82.92 +            }
   82.93 +
   82.94 +            @Override
   82.95 +            void visitDecl(Tree tree, Name name) {
   82.96 +                TreePath path = getCurrentPath();
   82.97 +                String dc = trees.getDocComment(path);
   82.98 +                if (dc != null) {
   82.99 +                    for (Checker c : checkers) {
  82.100 +                        try {
  82.101 +                            System.err.println(path.getLeaf().getKind()
  82.102 +                                    + " " + name
  82.103 +                                    + " " + c.getClass().getSimpleName());
  82.104 +
  82.105 +                            c.check(path, name);
  82.106 +
  82.107 +                            System.err.println();
  82.108 +                        } catch (Exception e) {
  82.109 +                            error("Exception " + e);
  82.110 +                            e.printStackTrace(System.err);
  82.111 +                        }
  82.112 +                    }
  82.113 +                }
  82.114 +            }
  82.115 +        };
  82.116 +
  82.117 +        Iterable<? extends CompilationUnitTree> units = t.parse();
  82.118 +        for (CompilationUnitTree unit: units) {
  82.119 +            d.scan(unit, null);
  82.120 +        }
  82.121 +
  82.122 +        if (errors > 0)
  82.123 +            throw new Exception(errors + " errors occurred");
  82.124 +    }
  82.125 +
  82.126 +    static abstract class DeclScanner extends TreePathScanner<Void, Void> {
  82.127 +        abstract void visitDecl(Tree tree, Name name);
  82.128 +
  82.129 +        @Override
  82.130 +        public Void visitClass(ClassTree tree, Void ignore) {
  82.131 +            super.visitClass(tree, ignore);
  82.132 +            visitDecl(tree, tree.getSimpleName());
  82.133 +            return null;
  82.134 +        }
  82.135 +
  82.136 +        @Override
  82.137 +        public Void visitMethod(MethodTree tree, Void ignore) {
  82.138 +            super.visitMethod(tree, ignore);
  82.139 +            visitDecl(tree, tree.getName());
  82.140 +            return null;
  82.141 +        }
  82.142 +
  82.143 +        @Override
  82.144 +        public Void visitVariable(VariableTree tree, Void ignore) {
  82.145 +            super.visitVariable(tree, ignore);
  82.146 +            visitDecl(tree, tree.getName());
  82.147 +            return null;
  82.148 +        }
  82.149 +    }
  82.150 +
  82.151 +    /**
  82.152 +     * Base class for checkers to check the doc comment on a declaration
  82.153 +     * (when present.)
  82.154 +     */
  82.155 +    abstract class Checker {
  82.156 +        final DocTrees trees;
  82.157 +
  82.158 +        Checker(DocTrees trees) {
  82.159 +            this.trees = trees;
  82.160 +        }
  82.161 +
  82.162 +        void visitCompilationUnit(CompilationUnitTree tree) { }
  82.163 +
  82.164 +        abstract void check(TreePath tree, Name name) throws Exception;
  82.165 +
  82.166 +        void error(String msg) {
  82.167 +            DocCommentTester.this.error(msg);
  82.168 +        }
  82.169 +    }
  82.170 +
  82.171 +    void error(String msg) {
  82.172 +        System.err.println("Error: " + msg);
  82.173 +        errors++;
  82.174 +    }
  82.175 +
  82.176 +    int errors;
  82.177 +
  82.178 +    /**
  82.179 +     * Verify the structure of the DocTree AST by comparing it against golden text.
  82.180 +     */
  82.181 +    static class ASTChecker extends Checker {
  82.182 +        Printer printer = new Printer();
  82.183 +        String source;
  82.184 +
  82.185 +        ASTChecker(DocCommentTester test, DocTrees t) {
  82.186 +            test.super(t);
  82.187 +        }
  82.188 +
  82.189 +        @Override
  82.190 +        void visitCompilationUnit(CompilationUnitTree tree) {
  82.191 +            try {
  82.192 +                source = tree.getSourceFile().getCharContent(true).toString();
  82.193 +            } catch (IOException e) {
  82.194 +                source = "";
  82.195 +            }
  82.196 +        }
  82.197 +
  82.198 +        void check(TreePath path, Name name) {
  82.199 +            StringWriter out = new StringWriter();
  82.200 +            DocCommentTree dc = trees.getDocCommentTree(path);
  82.201 +            printer.print(dc, out);
  82.202 +            out.flush();
  82.203 +            String found = out.toString();
  82.204 +
  82.205 +            // Look for the first block comment after the first occurrence of name
  82.206 +            int start = source.indexOf("\n/*\n", findName(source, name));
  82.207 +            int end = source.indexOf("\n*/\n", start);
  82.208 +            String expect = source.substring(start + 4, end + 1);
  82.209 +            if (!found.equals(expect)) {
  82.210 +                System.err.println("Expect:\n" + expect);
  82.211 +                System.err.println("Found:\n" + found);
  82.212 +                error("AST mismatch for " + name);
  82.213 +            }
  82.214 +        }
  82.215 +
  82.216 +        /**
  82.217 +         * This main program is to set up the golden comments used by this
  82.218 +         * checker.
  82.219 +         * Usage:
  82.220 +         *     java DocCommentTester$ASTChecker -o dir file...
  82.221 +         * The given files are written to the output directory with their
  82.222 +         * golden comments updated. The intent is that the files should
  82.223 +         * then be compared with the originals, e.g. with meld, and if the
  82.224 +         * changes are approved, the new files can be used to replace the old.
  82.225 +         */
  82.226 +        public static void main(String... args) throws Exception {
  82.227 +            List<File> files = new ArrayList<File>();
  82.228 +            File o = null;
  82.229 +            for (int i = 0; i < args.length; i++) {
  82.230 +                String arg = args[i];
  82.231 +                if (arg.equals("-o"))
  82.232 +                    o = new File(args[++i]);
  82.233 +                else if (arg.startsWith("-"))
  82.234 +                    throw new IllegalArgumentException(arg);
  82.235 +                else {
  82.236 +                    files.add(new File(arg));
  82.237 +                }
  82.238 +            }
  82.239 +
  82.240 +            if (o == null)
  82.241 +                throw new IllegalArgumentException("no output dir specified");
  82.242 +            final File outDir = o;
  82.243 +
  82.244 +            JavacTool javac = JavacTool.create();
  82.245 +            StandardJavaFileManager fm = javac.getStandardFileManager(null, null, null);
  82.246 +            Iterable<? extends JavaFileObject> fos = fm.getJavaFileObjectsFromFiles(files);
  82.247 +
  82.248 +            JavacTask t = javac.getTask(null, fm, null, null, null, fos);
  82.249 +            final DocTrees trees = DocTrees.instance(t);
  82.250 +
  82.251 +            DeclScanner d = new DeclScanner() {
  82.252 +                Printer p = new Printer();
  82.253 +                String source;
  82.254 +
  82.255 +                @Override
  82.256 +                public Void visitCompilationUnit(CompilationUnitTree tree, Void ignore) {
  82.257 +                    System.err.println("processing " + tree.getSourceFile().getName());
  82.258 +                    try {
  82.259 +                        source = tree.getSourceFile().getCharContent(true).toString();
  82.260 +                    } catch (IOException e) {
  82.261 +                        source = "";
  82.262 +                    }
  82.263 +
  82.264 +                    // remove existing gold by removing all block comments after the first '{'.
  82.265 +                    int start = source.indexOf("{");
  82.266 +                    while ((start = source.indexOf("\n/*\n", start)) != -1) {
  82.267 +                        int end = source.indexOf("\n*/\n");
  82.268 +                        source = source.substring(0, start + 1) + source.substring(end + 4);
  82.269 +                    }
  82.270 +
  82.271 +                    // process decls in compilation unit
  82.272 +                    super.visitCompilationUnit(tree, ignore);
  82.273 +
  82.274 +                    // write the modified source
  82.275 +                    File f = new File(tree.getSourceFile().getName());
  82.276 +                    File outFile = new File(outDir, f.getName());
  82.277 +                    try {
  82.278 +                        FileWriter out = new FileWriter(outFile);
  82.279 +                        try {
  82.280 +                            out.write(source);
  82.281 +                        } finally {
  82.282 +                            out.close();
  82.283 +                        }
  82.284 +                    } catch (IOException e) {
  82.285 +                        System.err.println("Can't write " + tree.getSourceFile().getName()
  82.286 +                                + " to " + outFile + ": " + e);
  82.287 +                    }
  82.288 +                    return null;
  82.289 +                }
  82.290 +
  82.291 +                @Override
  82.292 +                void visitDecl(Tree tree, Name name) {
  82.293 +                    DocTree dc = trees.getDocCommentTree(getCurrentPath());
  82.294 +                    if (dc != null) {
  82.295 +                        StringWriter out = new StringWriter();
  82.296 +                        p.print(dc, out);
  82.297 +                        String found = out.toString();
  82.298 +
  82.299 +                        // Look for the empty line after the first occurrence of name
  82.300 +                        int pos = source.indexOf("\n\n", findName(source, name));
  82.301 +
  82.302 +                        // Insert the golden comment
  82.303 +                        source = source.substring(0, pos)
  82.304 +                                + "\n/*\n"
  82.305 +                                + found
  82.306 +                                + "*/"
  82.307 +                                + source.substring(pos);
  82.308 +                    }
  82.309 +                }
  82.310 +
  82.311 +            };
  82.312 +
  82.313 +            Iterable<? extends CompilationUnitTree> units = t.parse();
  82.314 +            for (CompilationUnitTree unit: units) {
  82.315 +                d.scan(unit, null);
  82.316 +            }
  82.317 +        }
  82.318 +
  82.319 +        static int findName(String source, Name name) {
  82.320 +            Pattern p = Pattern.compile("\\s" + name + "[(;]");
  82.321 +            Matcher m = p.matcher(source);
  82.322 +            if (!m.find())
  82.323 +                throw new Error("cannot find " + name);
  82.324 +            return m.start();
  82.325 +        }
  82.326 +
  82.327 +        static class Printer implements DocTreeVisitor<Void, Void> {
  82.328 +            PrintWriter out;
  82.329 +
  82.330 +            void print(DocTree tree, Writer out) {
  82.331 +                this.out = (out instanceof PrintWriter)
  82.332 +                        ? (PrintWriter) out : new PrintWriter(out);
  82.333 +                tree.accept(this, null);
  82.334 +                this.out.flush();
  82.335 +            }
  82.336 +
  82.337 +            public Void visitAttribute(AttributeTree node, Void p) {
  82.338 +                header(node);
  82.339 +                indent(+1);
  82.340 +                print("name", node.getName().toString());
  82.341 +                print("vkind", node.getValueKind().toString());
  82.342 +                print("value", node.getValue());
  82.343 +                indent(-1);
  82.344 +                indent();
  82.345 +                out.println("]");
  82.346 +                return null;
  82.347 +            }
  82.348 +
  82.349 +            public Void visitAuthor(AuthorTree node, Void p) {
  82.350 +                header(node);
  82.351 +                indent(+1);
  82.352 +                print("name", node.getName());
  82.353 +                indent(-1);
  82.354 +                indent();
  82.355 +                out.println("]");
  82.356 +                return null;
  82.357 +            }
  82.358 +
  82.359 +            public Void visitComment(CommentTree node, Void p) {
  82.360 +                header(node, compress(node.getBody()));
  82.361 +                return null;
  82.362 +            }
  82.363 +
  82.364 +            public Void visitDeprecated(DeprecatedTree node, Void p) {
  82.365 +                header(node);
  82.366 +                indent(+1);
  82.367 +                print("body", node.getBody());
  82.368 +                indent(-1);
  82.369 +                indent();
  82.370 +                out.println("]");
  82.371 +                return null;
  82.372 +            }
  82.373 +
  82.374 +            public Void visitDocComment(DocCommentTree node, Void p) {
  82.375 +                header(node);
  82.376 +                indent(+1);
  82.377 +                print("firstSentence", node.getFirstSentence());
  82.378 +                print("body", node.getBody());
  82.379 +                print("block tags", node.getBlockTags());
  82.380 +                indent(-1);
  82.381 +                indent();
  82.382 +                out.println("]");
  82.383 +                return null;
  82.384 +            }
  82.385 +
  82.386 +            public Void visitDocRoot(DocRootTree node, Void p) {
  82.387 +                header(node, "");
  82.388 +                return null;
  82.389 +            }
  82.390 +
  82.391 +            public Void visitEndElement(EndElementTree node, Void p) {
  82.392 +                header(node, node.getName().toString());
  82.393 +                return null;
  82.394 +            }
  82.395 +
  82.396 +            public Void visitEntity(EntityTree node, Void p) {
  82.397 +                header(node, node.getName().toString());
  82.398 +                return null;
  82.399 +            }
  82.400 +
  82.401 +            public Void visitErroneous(ErroneousTree node, Void p) {
  82.402 +                header(node);
  82.403 +                indent(+1);
  82.404 +                print("code", ((DCErroneous) node).diag.getCode());
  82.405 +                print("body", compress(node.getBody()));
  82.406 +                indent(-1);
  82.407 +                indent();
  82.408 +                out.println("]");
  82.409 +                return null;
  82.410 +            }
  82.411 +
  82.412 +            public Void visitIdentifier(IdentifierTree node, Void p) {
  82.413 +                header(node, compress(node.getName().toString()));
  82.414 +                return null;
  82.415 +            }
  82.416 +
  82.417 +            public Void visitInheritDoc(InheritDocTree node, Void p) {
  82.418 +                header(node, "");
  82.419 +                return null;
  82.420 +            }
  82.421 +
  82.422 +            public Void visitLink(LinkTree node, Void p) {
  82.423 +                header(node);
  82.424 +                indent(+1);
  82.425 +                print("reference", node.getReference());
  82.426 +                print("body", node.getLabel());
  82.427 +                indent(-1);
  82.428 +                indent();
  82.429 +                out.println("]");
  82.430 +                return null;
  82.431 +            }
  82.432 +
  82.433 +            public Void visitLiteral(LiteralTree node, Void p) {
  82.434 +                header(node, compress(node.getBody().getBody()));
  82.435 +                return null;
  82.436 +            }
  82.437 +
  82.438 +            public Void visitParam(ParamTree node, Void p) {
  82.439 +                header(node);
  82.440 +                indent(+1);
  82.441 +                print("name", node.getName());
  82.442 +                print("description", node.getDescription());
  82.443 +                indent(-1);
  82.444 +                indent();
  82.445 +                out.println("]");
  82.446 +                return null;
  82.447 +            }
  82.448 +
  82.449 +            public Void visitReference(ReferenceTree node, Void p) {
  82.450 +                header(node, compress(node.getSignature()));
  82.451 +                return null;
  82.452 +            }
  82.453 +
  82.454 +            public Void visitReturn(ReturnTree node, Void p) {
  82.455 +                header(node);
  82.456 +                indent(+1);
  82.457 +                print("description", node.getDescription());
  82.458 +                indent(-1);
  82.459 +                indent();
  82.460 +                out.println("]");
  82.461 +                return null;
  82.462 +            }
  82.463 +
  82.464 +            public Void visitSee(SeeTree node, Void p) {
  82.465 +                header(node);
  82.466 +                indent(+1);
  82.467 +                print("reference", node.getReference());
  82.468 +                indent(-1);
  82.469 +                indent();
  82.470 +                out.println("]");
  82.471 +                return null;
  82.472 +            }
  82.473 +
  82.474 +            public Void visitSerial(SerialTree node, Void p) {
  82.475 +                header(node);
  82.476 +                indent(+1);
  82.477 +                print("description", node.getDescription());
  82.478 +                indent(-1);
  82.479 +                indent();
  82.480 +                out.println("]");
  82.481 +                return null;
  82.482 +            }
  82.483 +
  82.484 +            public Void visitSerialData(SerialDataTree node, Void p) {
  82.485 +                header(node);
  82.486 +                indent(+1);
  82.487 +                print("description", node.getDescription());
  82.488 +                indent(-1);
  82.489 +                indent();
  82.490 +                out.println("]");
  82.491 +                return null;
  82.492 +            }
  82.493 +
  82.494 +            public Void visitSerialField(SerialFieldTree node, Void p) {
  82.495 +                header(node);
  82.496 +                indent(+1);
  82.497 +                print("name", node.getName());
  82.498 +                print("type", node.getType());
  82.499 +                print("description", node.getDescription());
  82.500 +                indent(-1);
  82.501 +                indent();
  82.502 +                out.println("]");
  82.503 +                return null;
  82.504 +            }
  82.505 +
  82.506 +            public Void visitSince(SinceTree node, Void p) {
  82.507 +                header(node);
  82.508 +                indent(+1);
  82.509 +                print("body", node.getBody());
  82.510 +                indent(-1);
  82.511 +                indent();
  82.512 +                out.println("]");
  82.513 +                return null;
  82.514 +            }
  82.515 +
  82.516 +            public Void visitStartElement(StartElementTree node, Void p) {
  82.517 +                header(node);
  82.518 +                indent(+1);
  82.519 +                indent();
  82.520 +                out.println("name:" + node.getName());
  82.521 +                print("attributes", node.getAttributes());
  82.522 +                indent(-1);
  82.523 +                indent();
  82.524 +                out.println("]");
  82.525 +                return null;
  82.526 +            }
  82.527 +
  82.528 +            public Void visitText(TextTree node, Void p) {
  82.529 +                header(node, compress(node.getBody()));
  82.530 +                return null;
  82.531 +            }
  82.532 +
  82.533 +            public Void visitThrows(ThrowsTree node, Void p) {
  82.534 +                header(node);
  82.535 +                indent(+1);
  82.536 +                print("exceptionName", node.getExceptionName());
  82.537 +                print("description", node.getDescription());
  82.538 +                indent(-1);
  82.539 +                indent();
  82.540 +                out.println("]");
  82.541 +                return null;
  82.542 +            }
  82.543 +
  82.544 +            public Void visitUnknownBlockTag(UnknownBlockTagTree node, Void p) {
  82.545 +                header(node);
  82.546 +                indent(+1);
  82.547 +                indent();
  82.548 +                out.println("tag:" + node.getTagName());
  82.549 +                print("content", node.getContent());
  82.550 +                indent(-1);
  82.551 +                indent();
  82.552 +                out.println("]");
  82.553 +                return null;
  82.554 +            }
  82.555 +
  82.556 +            public Void visitUnknownInlineTag(UnknownInlineTagTree node, Void p) {
  82.557 +                header(node);
  82.558 +                indent(+1);
  82.559 +                indent();
  82.560 +                out.println("tag:" + node.getTagName());
  82.561 +                print("content", node.getContent());
  82.562 +                indent(-1);
  82.563 +                indent();
  82.564 +                out.println("]");
  82.565 +                return null;
  82.566 +            }
  82.567 +
  82.568 +            public Void visitValue(ValueTree node, Void p) {
  82.569 +                header(node);
  82.570 +                indent(+1);
  82.571 +                print("reference", node.getReference());
  82.572 +                indent(-1);
  82.573 +                indent();
  82.574 +                out.println("]");
  82.575 +                return null;
  82.576 +            }
  82.577 +
  82.578 +            public Void visitVersion(VersionTree node, Void p) {
  82.579 +                header(node);
  82.580 +                indent(+1);
  82.581 +                print("body", node.getBody());
  82.582 +                indent(-1);
  82.583 +                indent();
  82.584 +                out.println("]");
  82.585 +                return null;
  82.586 +            }
  82.587 +
  82.588 +            public Void visitOther(DocTree node, Void p) {
  82.589 +                throw new UnsupportedOperationException("Not supported yet.");
  82.590 +            }
  82.591 +
  82.592 +            void header(DocTree node) {
  82.593 +                indent();
  82.594 +                out.println(simpleClassName(node) + "[" + node.getKind() + ", pos:" + ((DCTree) node).pos);
  82.595 +            }
  82.596 +
  82.597 +            void header(DocTree node, String rest) {
  82.598 +                indent();
  82.599 +                out.println(simpleClassName(node) + "[" + node.getKind() + ", pos:" + ((DCTree) node).pos
  82.600 +                        + (rest.isEmpty() ? "" : ", " + rest)
  82.601 +                        + "]");
  82.602 +            }
  82.603 +
  82.604 +            String simpleClassName(DocTree node) {
  82.605 +                return node.getClass().getSimpleName().replaceAll("DC(.*)", "$1");
  82.606 +            }
  82.607 +
  82.608 +            void print(String name, DocTree item) {
  82.609 +                indent();
  82.610 +                if (item == null)
  82.611 +                    out.println(name + ": null");
  82.612 +                else {
  82.613 +                    out.println(name + ":");
  82.614 +                    indent(+1);
  82.615 +                    item.accept(this, null);
  82.616 +                    indent(-1);
  82.617 +                }
  82.618 +            }
  82.619 +
  82.620 +            void print(String name, String s) {
  82.621 +                indent();
  82.622 +                out.println(name + ": " + s);
  82.623 +            }
  82.624 +
  82.625 +            void print(String name, List<? extends DocTree> list) {
  82.626 +                indent();
  82.627 +                if (list == null)
  82.628 +                    out.println(name + ": null");
  82.629 +                else if (list.isEmpty())
  82.630 +                    out.println(name + ": empty");
  82.631 +                else {
  82.632 +                    out.println(name + ": " + list.size());
  82.633 +                    indent(+1);
  82.634 +                    for (DocTree tree: list) {
  82.635 +                        tree.accept(this, null);
  82.636 +                    }
  82.637 +                    indent(-1);
  82.638 +                }
  82.639 +            }
  82.640 +
  82.641 +            int indent = 0;
  82.642 +
  82.643 +            void indent() {
  82.644 +                for (int i = 0; i < indent; i++) {
  82.645 +                    out.print("  ");
  82.646 +                }
  82.647 +            }
  82.648 +
  82.649 +            void indent(int n) {
  82.650 +                indent += n;
  82.651 +            }
  82.652 +
  82.653 +            String compress(String s) {
  82.654 +                s = s.replace("\n", "|").replace(" ", "_");
  82.655 +                return (s.length() < 32)
  82.656 +                        ? s
  82.657 +                        : s.substring(0, 16) + "..." + s.substring(16);
  82.658 +            }
  82.659 +
  82.660 +            String quote(String s) {
  82.661 +                if (s.contains("\""))
  82.662 +                    return "'" + s + "'";
  82.663 +                else if (s.contains("'") || s.contains(" "))
  82.664 +                    return '"' + s + '"';
  82.665 +                else
  82.666 +                    return s;
  82.667 +            }
  82.668 +
  82.669 +
  82.670 +        }
  82.671 +    }
  82.672 +
  82.673 +    /**
  82.674 +     * Verify the reported tree positions by comparing the characters found
  82.675 +     * at and after the reported position with the beginning of the pretty-
  82.676 +     * printed text.
  82.677 +     */
  82.678 +    static class PosChecker extends Checker {
  82.679 +        PosChecker(DocCommentTester test, DocTrees t) {
  82.680 +            test.super(t);
  82.681 +        }
  82.682 +
  82.683 +        @Override
  82.684 +        void check(TreePath path, Name name) throws Exception {
  82.685 +            JavaFileObject fo = path.getCompilationUnit().getSourceFile();
  82.686 +            final CharSequence cs = fo.getCharContent(true);
  82.687 +
  82.688 +            final DCDocComment dc = (DCDocComment) trees.getDocCommentTree(path);
  82.689 +            DCTree t = (DCTree) trees.getDocCommentTree(path);
  82.690 +
  82.691 +            DocTreeScanner scanner = new DocTreeScanner<Void,Void>() {
  82.692 +                @Override
  82.693 +                public Void scan(DocTree node, Void ignore) {
  82.694 +                    if (node != null) {
  82.695 +                        try {
  82.696 +                            String expect = getExpectText(node);
  82.697 +                            long pos = ((DCTree) node).getSourcePosition(dc);
  82.698 +                            String found = getFoundText(cs, (int) pos, expect.length());
  82.699 +                            if (!found.equals(expect)) {
  82.700 +                                System.err.println("expect: " + expect);
  82.701 +                                System.err.println("found:  " + found);
  82.702 +                                error("mismatch");
  82.703 +                            }
  82.704 +
  82.705 +                        } catch (StringIndexOutOfBoundsException e) {
  82.706 +                            error(node.getClass() + ": " + e.toString());
  82.707 +                                e.printStackTrace();
  82.708 +                        }
  82.709 +                    }
  82.710 +                    return super.scan(node, ignore);
  82.711 +                }
  82.712 +            };
  82.713 +
  82.714 +            scanner.scan(t, null);
  82.715 +        }
  82.716 +
  82.717 +        String getExpectText(DocTree t) {
  82.718 +            StringWriter sw = new StringWriter();
  82.719 +            DocPretty p = new DocPretty(sw);
  82.720 +            try { p.print(t); } catch (IOException never) { }
  82.721 +            String s = sw.toString();
  82.722 +            if (s.length() <= 1)
  82.723 +                return s;
  82.724 +            int ws = s.replaceAll("\\s+", " ").indexOf(" ");
  82.725 +            if (ws != -1) s = s.substring(0, ws);
  82.726 +            return (s.length() < 5) ? s : s.substring(0, 5);
  82.727 +        }
  82.728 +
  82.729 +        String getFoundText(CharSequence cs, int pos, int len) {
  82.730 +            return (pos == -1) ? "" : cs.subSequence(pos, Math.min(pos + len, cs.length())).toString();
  82.731 +        }
  82.732 +    }
  82.733 +
  82.734 +    /**
  82.735 +     * Verify the pretty printed text against a normalized form of the
  82.736 +     * original doc comment.
  82.737 +     */
  82.738 +    static class PrettyChecker extends Checker {
  82.739 +
  82.740 +        PrettyChecker(DocCommentTester test, DocTrees t) {
  82.741 +            test.super(t);
  82.742 +        }
  82.743 +
  82.744 +        @Override
  82.745 +        void check(TreePath path, Name name) throws Exception {
  82.746 +            String raw = trees.getDocComment(path);
  82.747 +            String normRaw = normalize(raw);
  82.748 +
  82.749 +            StringWriter out = new StringWriter();
  82.750 +            DocPretty dp = new DocPretty(out);
  82.751 +            dp.print(trees.getDocCommentTree(path));
  82.752 +            String pretty = out.toString();
  82.753 +
  82.754 +            if (!pretty.equals(normRaw)) {
  82.755 +                error("mismatch");
  82.756 +                System.err.println("*** expected:");
  82.757 +                System.err.println(normRaw.replace(" ", "_"));
  82.758 +                System.err.println("*** found:");
  82.759 +                System.err.println(pretty.replace(" ", "_"));
  82.760 +    //            throw new Error();
  82.761 +            }
  82.762 +        }
  82.763 +
  82.764 +        /**
  82.765 +         * Normalize white space in places where the tree does not preserve it.
  82.766 +         */
  82.767 +        String normalize(String s) {
  82.768 +            return s.trim()
  82.769 +                    .replaceFirst("\\.\\s++([^@])", ". $1")
  82.770 +                    .replaceFirst("\\.\\s*\\n *@", ".\n@")
  82.771 +                    .replaceFirst("\\s+<(/?p|pre|h[1-6])>", " <$1>")
  82.772 +                    .replaceAll("\\{@docRoot\\s+\\}", "{@docRoot}")
  82.773 +                    .replaceAll("\\{@inheritDoc\\s+\\}", "{@inheritDoc}")
  82.774 +                    .replaceAll("(\\{@value\\s+[^}]+)\\s+(\\})", "$1$2")
  82.775 +                    .replaceAll("\n[ \t]+@", "\n@");
  82.776 +        }
  82.777 +
  82.778 +    }
  82.779 +
  82.780 +}
  82.781 +
    83.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    83.2 +++ b/test/tools/javac/doctree/DocRootTest.java	Wed Nov 14 17:23:10 2012 -0800
    83.3 @@ -0,0 +1,84 @@
    83.4 +/*
    83.5 + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
    83.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    83.7 + *
    83.8 + * This code is free software; you can redistribute it and/or modify it
    83.9 + * under the terms of the GNU General Public License version 2 only, as
   83.10 + * published by the Free Software Foundation.
   83.11 + *
   83.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   83.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   83.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   83.15 + * version 2 for more details (a copy is included in the LICENSE file that
   83.16 + * accompanied this code).
   83.17 + *
   83.18 + * You should have received a copy of the GNU General Public License version
   83.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   83.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   83.21 + *
   83.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   83.23 + * or visit www.oracle.com if you need additional information or have any
   83.24 + * questions.
   83.25 + */
   83.26 +
   83.27 +/*
   83.28 + * @test
   83.29 + * @bug 7021614
   83.30 + * @summary extend com.sun.source API to support parsing javadoc comments
   83.31 + * @build DocCommentTester
   83.32 + * @run main DocCommentTester DocRootTest.java
   83.33 + */
   83.34 +
   83.35 +class DocRootTest {
   83.36 +    /** abc {@docRoot} */
   83.37 +    void standard() { }
   83.38 +/*
   83.39 +DocComment[DOC_COMMENT, pos:0
   83.40 +  firstSentence: 2
   83.41 +    Text[TEXT, pos:0, abc_]
   83.42 +    DocRoot[DOC_ROOT, pos:4]
   83.43 +  body: empty
   83.44 +  block tags: empty
   83.45 +]
   83.46 +*/
   83.47 +
   83.48 +    /** abc {@docRoot } */
   83.49 +    void standard_ws1() { }
   83.50 +/*
   83.51 +DocComment[DOC_COMMENT, pos:0
   83.52 +  firstSentence: 2
   83.53 +    Text[TEXT, pos:0, abc_]
   83.54 +    DocRoot[DOC_ROOT, pos:4]
   83.55 +  body: empty
   83.56 +  block tags: empty
   83.57 +]
   83.58 +*/
   83.59 +
   83.60 +    /** abc {@docRoot  } */
   83.61 +    void standard_ws2() { }
   83.62 +/*
   83.63 +DocComment[DOC_COMMENT, pos:0
   83.64 +  firstSentence: 2
   83.65 +    Text[TEXT, pos:0, abc_]
   83.66 +    DocRoot[DOC_ROOT, pos:4]
   83.67 +  body: empty
   83.68 +  block tags: empty
   83.69 +]
   83.70 +*/
   83.71 +
   83.72 +    /** abc {@docRoot junk} */
   83.73 +    void error() { }
   83.74 +/*
   83.75 +DocComment[DOC_COMMENT, pos:0
   83.76 +  firstSentence: 2
   83.77 +    Text[TEXT, pos:0, abc_]
   83.78 +    Erroneous[ERRONEOUS, pos:4
   83.79 +      code: compiler.err.dc.unexpected.content
   83.80 +      body: {@docRoot_junk}
   83.81 +    ]
   83.82 +  body: empty
   83.83 +  block tags: empty
   83.84 +]
   83.85 +*/
   83.86 +
   83.87 +}
    84.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    84.2 +++ b/test/tools/javac/doctree/ElementTest.java	Wed Nov 14 17:23:10 2012 -0800
    84.3 @@ -0,0 +1,250 @@
    84.4 +/*
    84.5 + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
    84.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    84.7 + *
    84.8 + * This code is free software; you can redistribute it and/or modify it
    84.9 + * under the terms of the GNU General Public License version 2 only, as
   84.10 + * published by the Free Software Foundation.
   84.11 + *
   84.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   84.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   84.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   84.15 + * version 2 for more details (a copy is included in the LICENSE file that
   84.16 + * accompanied this code).
   84.17 + *
   84.18 + * You should have received a copy of the GNU General Public License version
   84.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   84.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   84.21 + *
   84.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   84.23 + * or visit www.oracle.com if you need additional information or have any
   84.24 + * questions.
   84.25 + */
   84.26 +
   84.27 +/*
   84.28 + * @test
   84.29 + * @bug 7021614
   84.30 + * @summary extend com.sun.source API to support parsing javadoc comments
   84.31 + * @build DocCommentTester
   84.32 + * @run main DocCommentTester ElementTest.java
   84.33 + */
   84.34 +
   84.35 +class ElementTest {
   84.36 +    /**
   84.37 +     * <p>para</p>
   84.38 +     */
   84.39 +    void simple() { }
   84.40 +/*
   84.41 +DocComment[DOC_COMMENT, pos:1
   84.42 +  firstSentence: empty
   84.43 +  body: 3
   84.44 +    StartElement[START_ELEMENT, pos:1
   84.45 +      name:p
   84.46 +      attributes: empty
   84.47 +    ]
   84.48 +    Text[TEXT, pos:4, para]
   84.49 +    EndElement[END_ELEMENT, pos:8, p]
   84.50 +  block tags: empty
   84.51 +]
   84.52 +*/
   84.53 +
   84.54 +    /**
   84.55 +     * abc <hr/>
   84.56 +     */
   84.57 +    void self_closing() { }
   84.58 +/*
   84.59 +DocComment[DOC_COMMENT, pos:1
   84.60 +  firstSentence: 2
   84.61 +    Text[TEXT, pos:1, abc_]
   84.62 +    StartElement[START_ELEMENT, pos:5
   84.63 +      name:hr
   84.64 +      attributes: empty
   84.65 +    ]
   84.66 +  body: empty
   84.67 +  block tags: empty
   84.68 +]
   84.69 +*/
   84.70 +
   84.71 +    /**
   84.72 +     * abc < def
   84.73 +     */
   84.74 +    void bad_lt() { }
   84.75 +/*
   84.76 +DocComment[DOC_COMMENT, pos:1
   84.77 +  firstSentence: 3
   84.78 +    Text[TEXT, pos:1, abc_]
   84.79 +    Erroneous[ERRONEOUS, pos:5
   84.80 +      code: compiler.err.dc.malformed.html
   84.81 +      body: <
   84.82 +    ]
   84.83 +    Text[TEXT, pos:6, _def]
   84.84 +  body: empty
   84.85 +  block tags: empty
   84.86 +]
   84.87 +*/
   84.88 +
   84.89 +    /**
   84.90 +     * abc > def
   84.91 +     */
   84.92 +    void bad_gt() { }
   84.93 +/*
   84.94 +DocComment[DOC_COMMENT, pos:1
   84.95 +  firstSentence: 3
   84.96 +    Text[TEXT, pos:1, abc_]
   84.97 +    Erroneous[ERRONEOUS, pos:5
   84.98 +      code: compiler.err.dc.bad.gt
   84.99 +      body: >
  84.100 +    ]
  84.101 +    Text[TEXT, pos:6, _def]
  84.102 +  body: empty
  84.103 +  block tags: empty
  84.104 +]
  84.105 +*/
  84.106 +
  84.107 +    /**
  84.108 +     * abc <p 123> def
  84.109 +     */
  84.110 +    void bad_chars_start();
  84.111 +/*
  84.112 +DocComment[DOC_COMMENT, pos:1
  84.113 +  firstSentence: 5
  84.114 +    Text[TEXT, pos:1, abc_]
  84.115 +    Erroneous[ERRONEOUS, pos:5
  84.116 +      code: compiler.err.dc.malformed.html
  84.117 +      body: <
  84.118 +    ]
  84.119 +    Text[TEXT, pos:6, p_123]
  84.120 +    Erroneous[ERRONEOUS, pos:11
  84.121 +      code: compiler.err.dc.bad.gt
  84.122 +      body: >
  84.123 +    ]
  84.124 +    Text[TEXT, pos:12, _def]
  84.125 +  body: empty
  84.126 +  block tags: empty
  84.127 +]
  84.128 +*/
  84.129 +
  84.130 +    /**
  84.131 +     * abc </p 123> def
  84.132 +     */
  84.133 +    void bad_chars_end();
  84.134 +/*
  84.135 +DocComment[DOC_COMMENT, pos:1
  84.136 +  firstSentence: 5
  84.137 +    Text[TEXT, pos:1, abc_]
  84.138 +    Erroneous[ERRONEOUS, pos:5
  84.139 +      code: compiler.err.dc.malformed.html
  84.140 +      body: <
  84.141 +    ]
  84.142 +    Text[TEXT, pos:6, /p_123]
  84.143 +    Erroneous[ERRONEOUS, pos:12
  84.144 +      code: compiler.err.dc.bad.gt
  84.145 +      body: >
  84.146 +    ]
  84.147 +    Text[TEXT, pos:13, _def]
  84.148 +  body: empty
  84.149 +  block tags: empty
  84.150 +]
  84.151 +*/
  84.152 +
  84.153 +    /**
  84.154 +     * abc <hr
  84.155 +     */
  84.156 +    void unterminated_eoi() { }
  84.157 +/*
  84.158 +DocComment[DOC_COMMENT, pos:1
  84.159 +  firstSentence: 3
  84.160 +    Text[TEXT, pos:1, abc_]
  84.161 +    Erroneous[ERRONEOUS, pos:5
  84.162 +      code: compiler.err.dc.malformed.html
  84.163 +      body: <
  84.164 +    ]
  84.165 +    Text[TEXT, pos:6, hr]
  84.166 +  body: empty
  84.167 +  block tags: empty
  84.168 +]
  84.169 +*/
  84.170 +
  84.171 +    /**
  84.172 +     * abc <hr
  84.173 +     * @author jjg
  84.174 +     */
  84.175 +    void unterminated_block() { }
  84.176 +/*
  84.177 +DocComment[DOC_COMMENT, pos:1
  84.178 +  firstSentence: 3
  84.179 +    Text[TEXT, pos:1, abc_]
  84.180 +    Erroneous[ERRONEOUS, pos:5
  84.181 +      code: compiler.err.dc.malformed.html
  84.182 +      body: <
  84.183 +    ]
  84.184 +    Text[TEXT, pos:6, hr]
  84.185 +  body: empty
  84.186 +  block tags: 1
  84.187 +    Author[AUTHOR, pos:10
  84.188 +      name: 1
  84.189 +        Text[TEXT, pos:18, jjg]
  84.190 +    ]
  84.191 +]
  84.192 +*/
  84.193 +
  84.194 +
  84.195 +    /**
  84.196 +     * abc </p
  84.197 +     */
  84.198 +    void unterminated_end_eoi() { }
  84.199 +/*
  84.200 +DocComment[DOC_COMMENT, pos:1
  84.201 +  firstSentence: 3
  84.202 +    Text[TEXT, pos:1, abc_]
  84.203 +    Erroneous[ERRONEOUS, pos:5
  84.204 +      code: compiler.err.dc.malformed.html
  84.205 +      body: <
  84.206 +    ]
  84.207 +    Text[TEXT, pos:6, /p]
  84.208 +  body: empty
  84.209 +  block tags: empty
  84.210 +]
  84.211 +*/
  84.212 +
  84.213 +    /**
  84.214 +     * abc </p
  84.215 +     * @author jjg
  84.216 +     */
  84.217 +    void unterminated_end_block() { }
  84.218 +/*
  84.219 +DocComment[DOC_COMMENT, pos:1
  84.220 +  firstSentence: 3
  84.221 +    Text[TEXT, pos:1, abc_]
  84.222 +    Erroneous[ERRONEOUS, pos:5
  84.223 +      code: compiler.err.dc.malformed.html
  84.224 +      body: <
  84.225 +    ]
  84.226 +    Text[TEXT, pos:6, /p]
  84.227 +  body: empty
  84.228 +  block tags: 1
  84.229 +    Author[AUTHOR, pos:10
  84.230 +      name: 1
  84.231 +        Text[TEXT, pos:18, jjg]
  84.232 +    ]
  84.233 +]
  84.234 +*/
  84.235 +
  84.236 +    /**
  84.237 +     * abc
  84.238 +     * <!-- comment -->
  84.239 +     * def
  84.240 +     */
  84.241 +    void comment() { }
  84.242 +/*
  84.243 +DocComment[DOC_COMMENT, pos:1
  84.244 +  firstSentence: 3
  84.245 +    Text[TEXT, pos:1, abc|_]
  84.246 +    Comment[COMMENT, pos:6, <!--_comment_-->]
  84.247 +    Text[TEXT, pos:22, |_def]
  84.248 +  body: empty
  84.249 +  block tags: empty
  84.250 +]
  84.251 +*/
  84.252 +
  84.253 +}
    85.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    85.2 +++ b/test/tools/javac/doctree/EntityTest.java	Wed Nov 14 17:23:10 2012 -0800
    85.3 @@ -0,0 +1,165 @@
    85.4 +/*
    85.5 + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
    85.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    85.7 + *
    85.8 + * This code is free software; you can redistribute it and/or modify it
    85.9 + * under the terms of the GNU General Public License version 2 only, as
   85.10 + * published by the Free Software Foundation.
   85.11 + *
   85.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   85.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   85.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   85.15 + * version 2 for more details (a copy is included in the LICENSE file that
   85.16 + * accompanied this code).
   85.17 + *
   85.18 + * You should have received a copy of the GNU General Public License version
   85.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   85.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   85.21 + *
   85.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   85.23 + * or visit www.oracle.com if you need additional information or have any
   85.24 + * questions.
   85.25 + */
   85.26 +
   85.27 +/*
   85.28 + * @test
   85.29 + * @bug 7021614
   85.30 + * @summary extend com.sun.source API to support parsing javadoc comments
   85.31 + * @build DocCommentTester
   85.32 + * @run main DocCommentTester EntityTest.java
   85.33 + */
   85.34 +
   85.35 +class EntityTest {
   85.36 +    /**
   85.37 +     *  abc &lt; def
   85.38 +     */
   85.39 +    public void name() { }
   85.40 +/*
   85.41 +DocComment[DOC_COMMENT, pos:2
   85.42 +  firstSentence: 3
   85.43 +    Text[TEXT, pos:2, abc_]
   85.44 +    Entity[ENTITY, pos:6, lt]
   85.45 +    Text[TEXT, pos:10, _def]
   85.46 +  body: empty
   85.47 +  block tags: empty
   85.48 +]
   85.49 +*/
   85.50 +
   85.51 +    /**
   85.52 +     *  abc &#160; def
   85.53 +     */
   85.54 +    public void decimal_value() { }
   85.55 +/*
   85.56 +DocComment[DOC_COMMENT, pos:2
   85.57 +  firstSentence: 3
   85.58 +    Text[TEXT, pos:2, abc_]
   85.59 +    Entity[ENTITY, pos:6, #160]
   85.60 +    Text[TEXT, pos:12, _def]
   85.61 +  body: empty
   85.62 +  block tags: empty
   85.63 +]
   85.64 +*/
   85.65 +
   85.66 +    /**
   85.67 +     *  abc &#xa0; def
   85.68 +     */
   85.69 +    public void lower_hex_value() { }
   85.70 +/*
   85.71 +DocComment[DOC_COMMENT, pos:2
   85.72 +  firstSentence: 3
   85.73 +    Text[TEXT, pos:2, abc_]
   85.74 +    Entity[ENTITY, pos:6, #xa0]
   85.75 +    Text[TEXT, pos:12, _def]
   85.76 +  body: empty
   85.77 +  block tags: empty
   85.78 +]
   85.79 +*/
   85.80 +
   85.81 +    /**
   85.82 +     *  abc &#XA0; def
   85.83 +     */
   85.84 +    public void upper_hex_value() { }
   85.85 +/*
   85.86 +DocComment[DOC_COMMENT, pos:2
   85.87 +  firstSentence: 3
   85.88 +    Text[TEXT, pos:2, abc_]
   85.89 +    Entity[ENTITY, pos:6, #XA0]
   85.90 +    Text[TEXT, pos:12, _def]
   85.91 +  body: empty
   85.92 +  block tags: empty
   85.93 +]
   85.94 +*/
   85.95 +
   85.96 +    /**
   85.97 +     *  abc & def
   85.98 +     */
   85.99 +    public void bad_amp() { }
  85.100 +/*
  85.101 +DocComment[DOC_COMMENT, pos:2
  85.102 +  firstSentence: 3
  85.103 +    Text[TEXT, pos:2, abc_]
  85.104 +    Erroneous[ERRONEOUS, pos:6
  85.105 +      code: compiler.err.dc.bad.entity
  85.106 +      body: &
  85.107 +    ]
  85.108 +    Text[TEXT, pos:7, _def]
  85.109 +  body: empty
  85.110 +  block tags: empty
  85.111 +]
  85.112 +*/
  85.113 +
  85.114 +    /**
  85.115 +     *  abc &1 def
  85.116 +     */
  85.117 +    public void bad_entity_name() { }
  85.118 +/*
  85.119 +DocComment[DOC_COMMENT, pos:2
  85.120 +  firstSentence: 3
  85.121 +    Text[TEXT, pos:2, abc_]
  85.122 +    Erroneous[ERRONEOUS, pos:6
  85.123 +      code: compiler.err.dc.bad.entity
  85.124 +      body: &
  85.125 +    ]
  85.126 +    Text[TEXT, pos:7, 1_def]
  85.127 +  body: empty
  85.128 +  block tags: empty
  85.129 +]
  85.130 +*/
  85.131 +
  85.132 +    /**
  85.133 +     *  abc &#012.3; def
  85.134 +     */
  85.135 +    public void bad_entity_decimal_value() { }
  85.136 +/*
  85.137 +DocComment[DOC_COMMENT, pos:2
  85.138 +  firstSentence: 3
  85.139 +    Text[TEXT, pos:2, abc_]
  85.140 +    Erroneous[ERRONEOUS, pos:6
  85.141 +      code: compiler.err.dc.missing.semicolon
  85.142 +      body: &#012
  85.143 +    ]
  85.144 +    Text[TEXT, pos:11, .3;_def]
  85.145 +  body: empty
  85.146 +  block tags: empty
  85.147 +]
  85.148 +*/
  85.149 +
  85.150 +    /**
  85.151 +     *  abc &#x012azc; def
  85.152 +     */
  85.153 +    public void bad_entity_hex_value() { }
  85.154 +/*
  85.155 +DocComment[DOC_COMMENT, pos:2
  85.156 +  firstSentence: 3
  85.157 +    Text[TEXT, pos:2, abc_]
  85.158 +    Erroneous[ERRONEOUS, pos:6
  85.159 +      code: compiler.err.dc.missing.semicolon
  85.160 +      body: &#x012a
  85.161 +    ]
  85.162 +    Text[TEXT, pos:13, zc;_def]
  85.163 +  body: empty
  85.164 +  block tags: empty
  85.165 +]
  85.166 +*/
  85.167 +
  85.168 +}
    86.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    86.2 +++ b/test/tools/javac/doctree/ExceptionTest.java	Wed Nov 14 17:23:10 2012 -0800
    86.3 @@ -0,0 +1,69 @@
    86.4 +/*
    86.5 + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
    86.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    86.7 + *
    86.8 + * This code is free software; you can redistribute it and/or modify it
    86.9 + * under the terms of the GNU General Public License version 2 only, as
   86.10 + * published by the Free Software Foundation.
   86.11 + *
   86.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   86.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   86.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   86.15 + * version 2 for more details (a copy is included in the LICENSE file that
   86.16 + * accompanied this code).
   86.17 + *
   86.18 + * You should have received a copy of the GNU General Public License version
   86.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   86.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   86.21 + *
   86.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   86.23 + * or visit www.oracle.com if you need additional information or have any
   86.24 + * questions.
   86.25 + */
   86.26 +
   86.27 +/*
   86.28 + * @test
   86.29 + * @bug 7021614
   86.30 + * @summary extend com.sun.source API to support parsing javadoc comments
   86.31 + * @build DocCommentTester
   86.32 + * @run main DocCommentTester ExceptionTest.java
   86.33 + */
   86.34 +
   86.35 +class ExceptionTest {
   86.36 +    /**
   86.37 +     * @exception Exception
   86.38 +     */
   86.39 +    void exception() throws Exception { }
   86.40 +/*
   86.41 +DocComment[DOC_COMMENT, pos:1
   86.42 +  firstSentence: empty
   86.43 +  body: empty
   86.44 +  block tags: 1
   86.45 +    Throws[EXCEPTION, pos:1
   86.46 +      exceptionName:
   86.47 +        Reference[REFERENCE, pos:12, Exception]
   86.48 +      description: empty
   86.49 +    ]
   86.50 +]
   86.51 +*/
   86.52 +
   86.53 +    /**
   86.54 +     * @exception Exception text
   86.55 +     */
   86.56 +    void exception_text() throws Exception { }
   86.57 +/*
   86.58 +DocComment[DOC_COMMENT, pos:1
   86.59 +  firstSentence: empty
   86.60 +  body: empty
   86.61 +  block tags: 1
   86.62 +    Throws[EXCEPTION, pos:1
   86.63 +      exceptionName:
   86.64 +        Reference[REFERENCE, pos:12, Exception]
   86.65 +      description: 1
   86.66 +        Text[TEXT, pos:22, text]
   86.67 +    ]
   86.68 +]
   86.69 +*/
   86.70 +
   86.71 +}
   86.72 +
    87.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    87.2 +++ b/test/tools/javac/doctree/FirstSentenceTest.java	Wed Nov 14 17:23:10 2012 -0800
    87.3 @@ -0,0 +1,198 @@
    87.4 +/*
    87.5 + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
    87.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    87.7 + *
    87.8 + * This code is free software; you can redistribute it and/or modify it
    87.9 + * under the terms of the GNU General Public License version 2 only, as
   87.10 + * published by the Free Software Foundation.
   87.11 + *
   87.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   87.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   87.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   87.15 + * version 2 for more details (a copy is included in the LICENSE file that
   87.16 + * accompanied this code).
   87.17 + *
   87.18 + * You should have received a copy of the GNU General Public License version
   87.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   87.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   87.21 + *
   87.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   87.23 + * or visit www.oracle.com if you need additional information or have any
   87.24 + * questions.
   87.25 + */
   87.26 +
   87.27 +/*
   87.28 + * @test
   87.29 + * @bug 7021614
   87.30 + * @summary extend com.sun.source API to support parsing javadoc comments
   87.31 + * @build DocCommentTester
   87.32 + * @run main DocCommentTester FirstSentenceTest.java
   87.33 + */
   87.34 +
   87.35 +class FirstSentenceTest {
   87.36 +    /** */
   87.37 +    void empty() { }
   87.38 +/*
   87.39 +DocComment[DOC_COMMENT, pos:-1
   87.40 +  firstSentence: empty
   87.41 +  body: empty
   87.42 +  block tags: empty
   87.43 +]
   87.44 +*/
   87.45 +
   87.46 +    /** abc def ghi */
   87.47 +    void no_terminator() { }
   87.48 +/*
   87.49 +DocComment[DOC_COMMENT, pos:0
   87.50 +  firstSentence: 1
   87.51 +    Text[TEXT, pos:0, abc_def_ghi]
   87.52 +  body: empty
   87.53 +  block tags: empty
   87.54 +]
   87.55 +*/
   87.56 +
   87.57 +    /**
   87.58 +     * abc def ghi.
   87.59 +     */
   87.60 +    void no_body() { }
   87.61 +/*
   87.62 +DocComment[DOC_COMMENT, pos:1
   87.63 +  firstSentence: 1
   87.64 +    Text[TEXT, pos:1, abc_def_ghi.]
   87.65 +  body: empty
   87.66 +  block tags: empty
   87.67 +]
   87.68 +*/
   87.69 +
   87.70 +    /**
   87.71 +     * abc def ghi. jkl mno pqr.
   87.72 +     */
   87.73 +    void dot_space() { }
   87.74 +/*
   87.75 +DocComment[DOC_COMMENT, pos:1
   87.76 +  firstSentence: 1
   87.77 +    Text[TEXT, pos:1, abc_def_ghi.]
   87.78 +  body: 1
   87.79 +    Text[TEXT, pos:14, jkl_mno_pqr.]
   87.80 +  block tags: empty
   87.81 +]
   87.82 +*/
   87.83 +
   87.84 +    /**
   87.85 +     * abc def ghi.
   87.86 +     * jkl mno pqr
   87.87 +     */
   87.88 +    void dot_newline() { }
   87.89 +/*
   87.90 +DocComment[DOC_COMMENT, pos:1
   87.91 +  firstSentence: 1
   87.92 +    Text[TEXT, pos:1, abc_def_ghi.]
   87.93 +  body: 1
   87.94 +    Text[TEXT, pos:15, jkl_mno_pqr]
   87.95 +  block tags: empty
   87.96 +]
   87.97 +*/
   87.98 +
   87.99 +    /**
  87.100 +     * abc def ghi
  87.101 +     * <p>jkl mno pqr
  87.102 +     */
  87.103 +    void dot_p() { }
  87.104 +/*
  87.105 +DocComment[DOC_COMMENT, pos:1
  87.106 +  firstSentence: 1
  87.107 +    Text[TEXT, pos:1, abc_def_ghi]
  87.108 +  body: 2
  87.109 +    StartElement[START_ELEMENT, pos:14
  87.110 +      name:p
  87.111 +      attributes: empty
  87.112 +    ]
  87.113 +    Text[TEXT, pos:17, jkl_mno_pqr]
  87.114 +  block tags: empty
  87.115 +]
  87.116 +*/
  87.117 +
  87.118 +    /**
  87.119 +     * abc def ghi
  87.120 +     * </p>jkl mno pqr
  87.121 +     */
  87.122 +    void dot_end_p() { }
  87.123 +/*
  87.124 +DocComment[DOC_COMMENT, pos:1
  87.125 +  firstSentence: 1
  87.126 +    Text[TEXT, pos:1, abc_def_ghi]
  87.127 +  body: 2
  87.128 +    EndElement[END_ELEMENT, pos:14, p]
  87.129 +    Text[TEXT, pos:18, jkl_mno_pqr]
  87.130 +  block tags: empty
  87.131 +]
  87.132 +*/
  87.133 +
  87.134 +    /**
  87.135 +     * abc &lt; ghi. jkl mno pqr.
  87.136 +     */
  87.137 +    void entity() { }
  87.138 +/*
  87.139 +DocComment[DOC_COMMENT, pos:1
  87.140 +  firstSentence: 3
  87.141 +    Text[TEXT, pos:1, abc_]
  87.142 +    Entity[ENTITY, pos:5, lt]
  87.143 +    Text[TEXT, pos:9, _ghi.]
  87.144 +  body: 1
  87.145 +    Text[TEXT, pos:15, jkl_mno_pqr.]
  87.146 +  block tags: empty
  87.147 +]
  87.148 +*/
  87.149 +
  87.150 +    /**
  87.151 +     * abc {@code code} ghi. jkl mno pqr.
  87.152 +     */
  87.153 +    void inline_tag() { }
  87.154 +/*
  87.155 +DocComment[DOC_COMMENT, pos:1
  87.156 +  firstSentence: 3
  87.157 +    Text[TEXT, pos:1, abc_]
  87.158 +    Literal[CODE, pos:5, code]
  87.159 +    Text[TEXT, pos:17, _ghi.]
  87.160 +  body: 1
  87.161 +    Text[TEXT, pos:23, jkl_mno_pqr.]
  87.162 +  block tags: empty
  87.163 +]
  87.164 +*/
  87.165 +
  87.166 +    /**
  87.167 +     * abc def ghi
  87.168 +     * @author jjg
  87.169 +     */
  87.170 +    void block_tag() { }
  87.171 +/*
  87.172 +DocComment[DOC_COMMENT, pos:1
  87.173 +  firstSentence: 1
  87.174 +    Text[TEXT, pos:1, abc_def_ghi]
  87.175 +  body: empty
  87.176 +  block tags: 1
  87.177 +    Author[AUTHOR, pos:14
  87.178 +      name: 1
  87.179 +        Text[TEXT, pos:22, jjg]
  87.180 +    ]
  87.181 +]
  87.182 +*/
  87.183 +
  87.184 +    /**
  87.185 +     * @author jjg
  87.186 +     */
  87.187 +    void just_tag() { }
  87.188 +/*
  87.189 +DocComment[DOC_COMMENT, pos:1
  87.190 +  firstSentence: empty
  87.191 +  body: empty
  87.192 +  block tags: 1
  87.193 +    Author[AUTHOR, pos:1
  87.194 +      name: 1
  87.195 +        Text[TEXT, pos:9, jjg]
  87.196 +    ]
  87.197 +]
  87.198 +*/
  87.199 +
  87.200 +}
  87.201 +
    88.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    88.2 +++ b/test/tools/javac/doctree/InheritDocTest.java	Wed Nov 14 17:23:10 2012 -0800
    88.3 @@ -0,0 +1,84 @@
    88.4 +/*
    88.5 + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
    88.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    88.7 + *
    88.8 + * This code is free software; you can redistribute it and/or modify it
    88.9 + * under the terms of the GNU General Public License version 2 only, as
   88.10 + * published by the Free Software Foundation.
   88.11 + *
   88.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   88.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   88.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   88.15 + * version 2 for more details (a copy is included in the LICENSE file that
   88.16 + * accompanied this code).
   88.17 + *
   88.18 + * You should have received a copy of the GNU General Public License version
   88.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   88.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   88.21 + *
   88.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   88.23 + * or visit www.oracle.com if you need additional information or have any
   88.24 + * questions.
   88.25 + */
   88.26 +
   88.27 +/*
   88.28 + * @test
   88.29 + * @bug 7021614
   88.30 + * @summary extend com.sun.source API to support parsing javadoc comments
   88.31 + * @build DocCommentTester
   88.32 + * @run main DocCommentTester InheritDocTest.java
   88.33 + */
   88.34 +
   88.35 +class InheritDocTest {
   88.36 +    /** abc {@inheritDoc} */
   88.37 +    void standard() { }
   88.38 +/*
   88.39 +DocComment[DOC_COMMENT, pos:0
   88.40 +  firstSentence: 2
   88.41 +    Text[TEXT, pos:0, abc_]
   88.42 +    InheritDoc[INHERIT_DOC, pos:4]
   88.43 +  body: empty
   88.44 +  block tags: empty
   88.45 +]
   88.46 +*/
   88.47 +
   88.48 +    /** abc {@inheritDoc } */
   88.49 +    void standard_ws1() { }
   88.50 +/*
   88.51 +DocComment[DOC_COMMENT, pos:0
   88.52 +  firstSentence: 2
   88.53 +    Text[TEXT, pos:0, abc_]
   88.54 +    InheritDoc[INHERIT_DOC, pos:4]
   88.55 +  body: empty
   88.56 +  block tags: empty
   88.57 +]
   88.58 +*/
   88.59 +
   88.60 +    /** abc {@inheritDoc  } */
   88.61 +    void standard_ws2() { }
   88.62 +/*
   88.63 +DocComment[DOC_COMMENT, pos:0
   88.64 +  firstSentence: 2
   88.65 +    Text[TEXT, pos:0, abc_]
   88.66 +    InheritDoc[INHERIT_DOC, pos:4]
   88.67 +  body: empty
   88.68 +  block tags: empty
   88.69 +]
   88.70 +*/
   88.71 +
   88.72 +    /** abc {@inheritDoc junk} */
   88.73 +    void error() { }
   88.74 +/*
   88.75 +DocComment[DOC_COMMENT, pos:0
   88.76 +  firstSentence: 2
   88.77 +    Text[TEXT, pos:0, abc_]
   88.78 +    Erroneous[ERRONEOUS, pos:4
   88.79 +      code: compiler.err.dc.unexpected.content
   88.80 +      body: {@inheritDoc_junk}
   88.81 +    ]
   88.82 +  body: empty
   88.83 +  block tags: empty
   88.84 +]
   88.85 +*/
   88.86 +
   88.87 +}
    89.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    89.2 +++ b/test/tools/javac/doctree/LinkPlainTest.java	Wed Nov 14 17:23:10 2012 -0800
    89.3 @@ -0,0 +1,192 @@
    89.4 +/*
    89.5 + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
    89.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    89.7 + *
    89.8 + * This code is free software; you can redistribute it and/or modify it
    89.9 + * under the terms of the GNU General Public License version 2 only, as
   89.10 + * published by the Free Software Foundation.
   89.11 + *
   89.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   89.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   89.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   89.15 + * version 2 for more details (a copy is included in the LICENSE file that
   89.16 + * accompanied this code).
   89.17 + *
   89.18 + * You should have received a copy of the GNU General Public License version
   89.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   89.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   89.21 + *
   89.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   89.23 + * or visit www.oracle.com if you need additional information or have any
   89.24 + * questions.
   89.25 + */
   89.26 +
   89.27 +/*
   89.28 + * @test
   89.29 + * @bug 7021614
   89.30 + * @summary extend com.sun.source API to support parsing javadoc comments
   89.31 + * @build DocCommentTester
   89.32 + * @run main DocCommentTester LinkPlainTest.java
   89.33 + */
   89.34 +
   89.35 +class LinkPlainTest {
   89.36 +    /**
   89.37 +     * abc {@linkplain String} def
   89.38 +      */
   89.39 +    void simple_name() { }
   89.40 +/*
   89.41 +DocComment[DOC_COMMENT, pos:1
   89.42 +  firstSentence: 3
   89.43 +    Text[TEXT, pos:1, abc_]
   89.44 +    Link[LINK_PLAIN, pos:5
   89.45 +      reference:
   89.46 +        Reference[REFERENCE, pos:17, String]
   89.47 +      body: empty
   89.48 +    ]
   89.49 +    Text[TEXT, pos:24, _def]
   89.50 +  body: empty
   89.51 +  block tags: empty
   89.52 +]
   89.53 +*/
   89.54 +
   89.55 +    /**
   89.56 +     * abc {@linkplain String desc} def
   89.57 +     */
   89.58 +    void simple_name_desc() { }
   89.59 +/*
   89.60 +DocComment[DOC_COMMENT, pos:1
   89.61 +  firstSentence: 3
   89.62 +    Text[TEXT, pos:1, abc_]
   89.63 +    Link[LINK_PLAIN, pos:5
   89.64 +      reference:
   89.65 +        Reference[REFERENCE, pos:17, String]
   89.66 +      body: 1
   89.67 +        Text[TEXT, pos:24, desc]
   89.68 +    ]
   89.69 +    Text[TEXT, pos:29, _def]
   89.70 +  body: empty
   89.71 +  block tags: empty
   89.72 +]
   89.73 +*/
   89.74 +
   89.75 +    /**
   89.76 +     * abc {@linkplain java.lang.String desc} def
   89.77 +     */
   89.78 +    void pkg_name_desc() { }
   89.79 +/*
   89.80 +DocComment[DOC_COMMENT, pos:1
   89.81 +  firstSentence: 3
   89.82 +    Text[TEXT, pos:1, abc_]
   89.83 +    Link[LINK_PLAIN, pos:5
   89.84 +      reference:
   89.85 +        Reference[REFERENCE, pos:17, java.lang.String]
   89.86 +      body: 1
   89.87 +        Text[TEXT, pos:34, desc]
   89.88 +    ]
   89.89 +    Text[TEXT, pos:39, _def]
   89.90 +  body: empty
   89.91 +  block tags: empty
   89.92 +]
   89.93 +*/
   89.94 +
   89.95 +    /**
   89.96 +     * abc {@linkplain java.lang.String#isEmpty desc} def
   89.97 +     */
   89.98 +    void method_desc() { }
   89.99 +/*
  89.100 +DocComment[DOC_COMMENT, pos:1
  89.101 +  firstSentence: 3
  89.102 +    Text[TEXT, pos:1, abc_]
  89.103 +    Link[LINK_PLAIN, pos:5
  89.104 +      reference:
  89.105 +        Reference[REFERENCE, pos:17, java.lang.String#isEmpty]
  89.106 +      body: 1
  89.107 +        Text[TEXT, pos:42, desc]
  89.108 +    ]
  89.109 +    Text[TEXT, pos:47, _def]
  89.110 +  body: empty
  89.111 +  block tags: empty
  89.112 +]
  89.113 +*/
  89.114 +
  89.115 +    /**
  89.116 +     * abc {@linkplain java.lang.String#isEmpty() desc} def
  89.117 +     */
  89.118 +    void method_0_args_desc() { }
  89.119 +/*
  89.120 +DocComment[DOC_COMMENT, pos:1
  89.121 +  firstSentence: 3
  89.122 +    Text[TEXT, pos:1, abc_]
  89.123 +    Link[LINK_PLAIN, pos:5
  89.124 +      reference:
  89.125 +        Reference[REFERENCE, pos:17, java.lang.String#isEmpty()]
  89.126 +      body: 1
  89.127 +        Text[TEXT, pos:44, desc]
  89.128 +    ]
  89.129 +    Text[TEXT, pos:49, _def]
  89.130 +  body: empty
  89.131 +  block tags: empty
  89.132 +]
  89.133 +*/
  89.134 +
  89.135 +    /**
  89.136 +     * abc {@linkplain java.lang.String#substring(int) desc} def
  89.137 +     */
  89.138 +    void method_1_args_desc() { }
  89.139 +/*
  89.140 +DocComment[DOC_COMMENT, pos:1
  89.141 +  firstSentence: 3
  89.142 +    Text[TEXT, pos:1, abc_]
  89.143 +    Link[LINK_PLAIN, pos:5
  89.144 +      reference:
  89.145 +        Reference[REFERENCE, pos:17, java.lang.String#substring(int)]
  89.146 +      body: 1
  89.147 +        Text[TEXT, pos:49, desc]
  89.148 +    ]
  89.149 +    Text[TEXT, pos:54, _def]
  89.150 +  body: empty
  89.151 +  block tags: empty
  89.152 +]
  89.153 +*/
  89.154 +
  89.155 +    /**
  89.156 +     * abc {@linkplain java.lang.String#substring(int, int) desc} def
  89.157 +     */
  89.158 +    void method_2_args_desc() { }
  89.159 +/*
  89.160 +DocComment[DOC_COMMENT, pos:1
  89.161 +  firstSentence: 3
  89.162 +    Text[TEXT, pos:1, abc_]
  89.163 +    Link[LINK_PLAIN, pos:5
  89.164 +      reference:
  89.165 +        Reference[REFERENCE, pos:17, java.lang.String...#substring(int,_int)]
  89.166 +      body: 1
  89.167 +        Text[TEXT, pos:54, desc]
  89.168 +    ]
  89.169 +    Text[TEXT, pos:59, _def]
  89.170 +  body: empty
  89.171 +  block tags: empty
  89.172 +]
  89.173 +*/
  89.174 +
  89.175 +    /**
  89.176 +     * abc {@linkplain java.util.List<T> desc} def
  89.177 +     */
  89.178 +    void pkg_name_typarams_desc() { }
  89.179 +/*
  89.180 +DocComment[DOC_COMMENT, pos:1
  89.181 +  firstSentence: 3
  89.182 +    Text[TEXT, pos:1, abc_]
  89.183 +    Link[LINK_PLAIN, pos:5
  89.184 +      reference:
  89.185 +        Reference[REFERENCE, pos:17, java.util.List<T>]
  89.186 +      body: 1
  89.187 +        Text[TEXT, pos:35, desc]
  89.188 +    ]
  89.189 +    Text[TEXT, pos:40, _def]
  89.190 +  body: empty
  89.191 +  block tags: empty
  89.192 +]
  89.193 +*/
  89.194 +
  89.195 +}
    90.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    90.2 +++ b/test/tools/javac/doctree/LinkTest.java	Wed Nov 14 17:23:10 2012 -0800
    90.3 @@ -0,0 +1,192 @@
    90.4 +/*
    90.5 + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
    90.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    90.7 + *
    90.8 + * This code is free software; you can redistribute it and/or modify it
    90.9 + * under the terms of the GNU General Public License version 2 only, as
   90.10 + * published by the Free Software Foundation.
   90.11 + *
   90.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   90.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   90.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   90.15 + * version 2 for more details (a copy is included in the LICENSE file that
   90.16 + * accompanied this code).
   90.17 + *
   90.18 + * You should have received a copy of the GNU General Public License version
   90.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   90.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   90.21 + *
   90.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   90.23 + * or visit www.oracle.com if you need additional information or have any
   90.24 + * questions.
   90.25 + */
   90.26 +
   90.27 +/*
   90.28 + * @test
   90.29 + * @bug 7021614
   90.30 + * @summary extend com.sun.source API to support parsing javadoc comments
   90.31 + * @build DocCommentTester
   90.32 + * @run main DocCommentTester LinkTest.java
   90.33 + */
   90.34 +
   90.35 +class LinkTest {
   90.36 +    /**
   90.37 +     * abc {@link String} def
   90.38 +      */
   90.39 +    void simple_name() { }
   90.40 +/*
   90.41 +DocComment[DOC_COMMENT, pos:1
   90.42 +  firstSentence: 3
   90.43 +    Text[TEXT, pos:1, abc_]
   90.44 +    Link[LINK, pos:5
   90.45 +      reference:
   90.46 +        Reference[REFERENCE, pos:12, String]
   90.47 +      body: empty
   90.48 +    ]
   90.49 +    Text[TEXT, pos:19, _def]
   90.50 +  body: empty
   90.51 +  block tags: empty
   90.52 +]
   90.53 +*/
   90.54 +
   90.55 +    /**
   90.56 +     * abc {@link String desc} def
   90.57 +     */
   90.58 +    void simple_name_desc() { }
   90.59 +/*
   90.60 +DocComment[DOC_COMMENT, pos:1
   90.61 +  firstSentence: 3
   90.62 +    Text[TEXT, pos:1, abc_]
   90.63 +    Link[LINK, pos:5
   90.64 +      reference:
   90.65 +        Reference[REFERENCE, pos:12, String]
   90.66 +      body: 1
   90.67 +        Text[TEXT, pos:19, desc]
   90.68 +    ]
   90.69 +    Text[TEXT, pos:24, _def]
   90.70 +  body: empty
   90.71 +  block tags: empty
   90.72 +]
   90.73 +*/
   90.74 +
   90.75 +    /**
   90.76 +     * abc {@link java.lang.String desc} def
   90.77 +     */
   90.78 +    void pkg_name_desc() { }
   90.79 +/*
   90.80 +DocComment[DOC_COMMENT, pos:1
   90.81 +  firstSentence: 3
   90.82 +    Text[TEXT, pos:1, abc_]
   90.83 +    Link[LINK, pos:5
   90.84 +      reference:
   90.85 +        Reference[REFERENCE, pos:12, java.lang.String]
   90.86 +      body: 1
   90.87 +        Text[TEXT, pos:29, desc]
   90.88 +    ]
   90.89 +    Text[TEXT, pos:34, _def]
   90.90 +  body: empty
   90.91 +  block tags: empty
   90.92 +]
   90.93 +*/
   90.94 +
   90.95 +    /**
   90.96 +     * abc {@link java.lang.String#isEmpty desc} def
   90.97 +     */
   90.98 +    void method_desc() { }
   90.99 +/*
  90.100 +DocComment[DOC_COMMENT, pos:1
  90.101 +  firstSentence: 3
  90.102 +    Text[TEXT, pos:1, abc_]
  90.103 +    Link[LINK, pos:5
  90.104 +      reference:
  90.105 +        Reference[REFERENCE, pos:12, java.lang.String#isEmpty]
  90.106 +      body: 1
  90.107 +        Text[TEXT, pos:37, desc]
  90.108 +    ]
  90.109 +    Text[TEXT, pos:42, _def]
  90.110 +  body: empty
  90.111 +  block tags: empty
  90.112 +]
  90.113 +*/
  90.114 +
  90.115 +    /**
  90.116 +     * abc {@link java.lang.String#isEmpty() desc} def
  90.117 +     */
  90.118 +    void method_0_args_desc() { }
  90.119 +/*
  90.120 +DocComment[DOC_COMMENT, pos:1
  90.121 +  firstSentence: 3
  90.122 +    Text[TEXT, pos:1, abc_]
  90.123 +    Link[LINK, pos:5
  90.124 +      reference:
  90.125 +        Reference[REFERENCE, pos:12, java.lang.String#isEmpty()]
  90.126 +      body: 1
  90.127 +        Text[TEXT, pos:39, desc]
  90.128 +    ]
  90.129 +    Text[TEXT, pos:44, _def]
  90.130 +  body: empty
  90.131 +  block tags: empty
  90.132 +]
  90.133 +*/
  90.134 +
  90.135 +    /**
  90.136 +     * abc {@link java.lang.String#substring(int) desc} def
  90.137 +     */
  90.138 +    void method_1_args_desc() { }
  90.139 +/*
  90.140 +DocComment[DOC_COMMENT, pos:1
  90.141 +  firstSentence: 3
  90.142 +    Text[TEXT, pos:1, abc_]
  90.143 +    Link[LINK, pos:5
  90.144 +      reference:
  90.145 +        Reference[REFERENCE, pos:12, java.lang.String#substring(int)]
  90.146 +      body: 1
  90.147 +        Text[TEXT, pos:44, desc]
  90.148 +    ]
  90.149 +    Text[TEXT, pos:49, _def]
  90.150 +  body: empty
  90.151 +  block tags: empty
  90.152 +]
  90.153 +*/
  90.154 +
  90.155 +    /**
  90.156 +     * abc {@link java.lang.String#substring(int, int) desc} def
  90.157 +     */
  90.158 +    void method_2_args_desc() { }
  90.159 +/*
  90.160 +DocComment[DOC_COMMENT, pos:1
  90.161 +  firstSentence: 3
  90.162 +    Text[TEXT, pos:1, abc_]
  90.163 +    Link[LINK, pos:5
  90.164 +      reference:
  90.165 +        Reference[REFERENCE, pos:12, java.lang.String...#substring(int,_int)]
  90.166 +      body: 1
  90.167 +        Text[TEXT, pos:49, desc]
  90.168 +    ]
  90.169 +    Text[TEXT, pos:54, _def]
  90.170 +  body: empty
  90.171 +  block tags: empty
  90.172 +]
  90.173 +*/
  90.174 +
  90.175 +    /**
  90.176 +     * abc {@link java.util.List<T> desc} def
  90.177 +     */
  90.178 +    void pkg_name_typarams_desc() { }
  90.179 +/*
  90.180 +DocComment[DOC_COMMENT, pos:1
  90.181 +  firstSentence: 3
  90.182 +    Text[TEXT, pos:1, abc_]
  90.183 +    Link[LINK, pos:5
  90.184 +      reference:
  90.185 +        Reference[REFERENCE, pos:12, java.util.List<T>]
  90.186 +      body: 1
  90.187 +        Text[TEXT, pos:30, desc]
  90.188 +    ]
  90.189 +    Text[TEXT, pos:35, _def]
  90.190 +  body: empty
  90.191 +  block tags: empty
  90.192 +]
  90.193 +*/
  90.194 +
  90.195 +}
    91.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    91.2 +++ b/test/tools/javac/doctree/LiteralTest.java	Wed Nov 14 17:23:10 2012 -0800
    91.3 @@ -0,0 +1,134 @@
    91.4 +/*
    91.5 + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
    91.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    91.7 + *
    91.8 + * This code is free software; you can redistribute it and/or modify it
    91.9 + * under the terms of the GNU General Public License version 2 only, as
   91.10 + * published by the Free Software Foundation.
   91.11 + *
   91.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   91.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   91.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   91.15 + * version 2 for more details (a copy is included in the LICENSE file that
   91.16 + * accompanied this code).
   91.17 + *
   91.18 + * You should have received a copy of the GNU General Public License version
   91.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   91.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   91.21 + *
   91.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   91.23 + * or visit www.oracle.com if you need additional information or have any
   91.24 + * questions.
   91.25 + */
   91.26 +
   91.27 +/*
   91.28 + * @test
   91.29 + * @bug 7021614
   91.30 + * @summary extend com.sun.source API to support parsing javadoc comments
   91.31 + * @build DocCommentTester
   91.32 + * @run main DocCommentTester LiteralTest.java
   91.33 + */
   91.34 +
   91.35 +class LiteralTest {
   91.36 +    /** {@literal if (a < b) { }} */
   91.37 +    void minimal() { }
   91.38 +/*
   91.39 +DocComment[DOC_COMMENT, pos:0
   91.40 +  firstSentence: 1
   91.41 +    Literal[LITERAL, pos:0, if_(a_<_b)_{_}]
   91.42 +  body: empty
   91.43 +  block tags: empty
   91.44 +]
   91.45 +*/
   91.46 +
   91.47 +    /** [{@literal if (a < b) { }}] */
   91.48 +    void in_brackets() { }
   91.49 +/*
   91.50 +DocComment[DOC_COMMENT, pos:0
   91.51 +  firstSentence: 3
   91.52 +    Text[TEXT, pos:0, []
   91.53 +    Literal[LITERAL, pos:1, if_(a_<_b)_{_}]
   91.54 +    Text[TEXT, pos:26, ]]
   91.55 +  body: empty
   91.56 +  block tags: empty
   91.57 +]
   91.58 +*/
   91.59 +
   91.60 +    /** [ {@literal if (a < b) { }} ] */
   91.61 +    void in_brackets_with_whitespace() { }
   91.62 +/*
   91.63 +DocComment[DOC_COMMENT, pos:0
   91.64 +  firstSentence: 3
   91.65 +    Text[TEXT, pos:0, [_]
   91.66 +    Literal[LITERAL, pos:2, if_(a_<_b)_{_}]
   91.67 +    Text[TEXT, pos:27, _]]
   91.68 +  body: empty
   91.69 +  block tags: empty
   91.70 +]
   91.71 +*/
   91.72 +
   91.73 +    /**
   91.74 +     * {@literal {@literal nested} }
   91.75 +     */
   91.76 +    void nested() { }
   91.77 +/*
   91.78 +DocComment[DOC_COMMENT, pos:1
   91.79 +  firstSentence: 1
   91.80 +    Literal[LITERAL, pos:1, {@literal_nested}_]
   91.81 +  body: empty
   91.82 +  block tags: empty
   91.83 +]
   91.84 +*/
   91.85 +
   91.86 +    /**
   91.87 +     * {@literal if (a < b) {
   91.88 +     *        }
   91.89 +     * }
   91.90 +     */
   91.91 +    void embedded_newline() { }
   91.92 +/*
   91.93 +DocComment[DOC_COMMENT, pos:1
   91.94 +  firstSentence: 1
   91.95 +    Literal[LITERAL, pos:1, if_(a_<_b)_{|________}|_]
   91.96 +  body: empty
   91.97 +  block tags: empty
   91.98 +]
   91.99 +*/
  91.100 +
  91.101 +
  91.102 +    /** {@literal if (a < b) { } */
  91.103 +    void unterminated_1() { }
  91.104 +/*
  91.105 +DocComment[DOC_COMMENT, pos:0
  91.106 +  firstSentence: 1
  91.107 +    Erroneous[ERRONEOUS, pos:0
  91.108 +      code: compiler.err.dc.unterminated.inline.tag
  91.109 +      body: {@literal_if_(a_<_b)_{_}
  91.110 +    ]
  91.111 +  body: empty
  91.112 +  block tags: empty
  91.113 +]
  91.114 +*/
  91.115 +
  91.116 +    /**
  91.117 +     * {@literal if (a < b) { }
  91.118 +     * @author jjg */
  91.119 +    void unterminated_2() { }
  91.120 +/*
  91.121 +DocComment[DOC_COMMENT, pos:1
  91.122 +  firstSentence: 1
  91.123 +    Erroneous[ERRONEOUS, pos:1
  91.124 +      code: compiler.err.dc.unterminated.inline.tag
  91.125 +      body: {@literal_if_(a_<_b)_{_}
  91.126 +    ]
  91.127 +  body: empty
  91.128 +  block tags: 1
  91.129 +    Author[AUTHOR, pos:27
  91.130 +      name: 1
  91.131 +        Text[TEXT, pos:35, jjg]
  91.132 +    ]
  91.133 +]
  91.134 +*/
  91.135 +
  91.136 +}
  91.137 +
    92.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    92.2 +++ b/test/tools/javac/doctree/ParamTest.java	Wed Nov 14 17:23:10 2012 -0800
    92.3 @@ -0,0 +1,68 @@
    92.4 +/*
    92.5 + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
    92.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    92.7 + *
    92.8 + * This code is free software; you can redistribute it and/or modify it
    92.9 + * under the terms of the GNU General Public License version 2 only, as
   92.10 + * published by the Free Software Foundation.
   92.11 + *
   92.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   92.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   92.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   92.15 + * version 2 for more details (a copy is included in the LICENSE file that
   92.16 + * accompanied this code).
   92.17 + *
   92.18 + * You should have received a copy of the GNU General Public License version
   92.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   92.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   92.21 + *
   92.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   92.23 + * or visit www.oracle.com if you need additional information or have any
   92.24 + * questions.
   92.25 + */
   92.26 +
   92.27 +/*
   92.28 + * @test
   92.29 + * @bug 7021614
   92.30 + * @summary extend com.sun.source API to support parsing javadoc comments
   92.31 + * @build DocCommentTester
   92.32 + * @run main DocCommentTester ParamTest.java
   92.33 + */
   92.34 +
   92.35 +class ParamTest {
   92.36 +    /**
   92.37 +     * @param x
   92.38 +     */
   92.39 +    void no_description(int x) { }
   92.40 +/*
   92.41 +DocComment[DOC_COMMENT, pos:1
   92.42 +  firstSentence: empty
   92.43 +  body: empty
   92.44 +  block tags: 1
   92.45 +    Param[PARAM, pos:1
   92.46 +      name:
   92.47 +        Identifier[IDENTIFIER, pos:8, x]
   92.48 +      description: empty
   92.49 +    ]
   92.50 +]
   92.51 +*/
   92.52 +
   92.53 +    /**
   92.54 +     * @param x description
   92.55 +     */
   92.56 +    void with_description(int x) { }
   92.57 +/*
   92.58 +DocComment[DOC_COMMENT, pos:1
   92.59 +  firstSentence: empty
   92.60 +  body: empty
   92.61 +  block tags: 1
   92.62 +    Param[PARAM, pos:1
   92.63 +      name:
   92.64 +        Identifier[IDENTIFIER, pos:8, x]
   92.65 +      description: 1
   92.66 +        Text[TEXT, pos:10, description]
   92.67 +    ]
   92.68 +]
   92.69 +*/
   92.70 +
   92.71 +}
    93.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    93.2 +++ b/test/tools/javac/doctree/ReferenceTest.java	Wed Nov 14 17:23:10 2012 -0800
    93.3 @@ -0,0 +1,214 @@
    93.4 +/*
    93.5 + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
    93.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    93.7 + *
    93.8 + * This code is free software; you can redistribute it and/or modify it
    93.9 + * under the terms of the GNU General Public License version 2 only, as
   93.10 + * published by the Free Software Foundation.
   93.11 + *
   93.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   93.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   93.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   93.15 + * version 2 for more details (a copy is included in the LICENSE file that
   93.16 + * accompanied this code).
   93.17 + *
   93.18 + * You should have received a copy of the GNU General Public License version
   93.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   93.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   93.21 + *
   93.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   93.23 + * or visit www.oracle.com if you need additional information or have any
   93.24 + * questions.
   93.25 + */
   93.26 +
   93.27 +/*
   93.28 + * @test
   93.29 + * @bug 7021614
   93.30 + * @summary extend com.sun.source API to support parsing javadoc comments
   93.31 + * @summary check references in at-see and {at-link} tags
   93.32 + * @build ReferenceTest
   93.33 + * @compile -processor ReferenceTest -proc:only ReferenceTest.java
   93.34 + */
   93.35 +
   93.36 +import com.sun.source.doctree.DocCommentTree;
   93.37 +import com.sun.source.doctree.DocTree;
   93.38 +import com.sun.source.doctree.LinkTree;
   93.39 +import com.sun.source.doctree.ReferenceTree;
   93.40 +import com.sun.source.doctree.SeeTree;
   93.41 +import com.sun.source.doctree.TextTree;
   93.42 +import com.sun.source.util.DocTreeScanner;
   93.43 +import com.sun.source.util.DocTrees;
   93.44 +import com.sun.source.util.TreePath;
   93.45 +
   93.46 +import java.util.List;
   93.47 +import java.util.Set;
   93.48 +import javax.annotation.processing.AbstractProcessor;
   93.49 +import javax.annotation.processing.ProcessingEnvironment;
   93.50 +import javax.annotation.processing.RoundEnvironment;
   93.51 +import javax.annotation.processing.SupportedAnnotationTypes;
   93.52 +import javax.lang.model.SourceVersion;
   93.53 +import javax.lang.model.element.Element;
   93.54 +import javax.lang.model.element.TypeElement;
   93.55 +import javax.tools.Diagnostic.Kind;
   93.56 +
   93.57 +/**
   93.58 + * {@link java.lang        Package}
   93.59 + * {@link java.lang.ERROR  Bad}
   93.60 + *
   93.61 + * {@link java.lang.String Class}
   93.62 + * {@link           String Class}
   93.63 + * {@link java.lang.String#CASE_INSENSITIVE_ORDER Field}
   93.64 + * {@link java.lang.String#String Constructor}
   93.65 + * {@link java.lang.String#String(byte[]) Constructor}
   93.66 + * {@link java.lang.String#String(byte[] bytes) Constructor}
   93.67 + * {@link java.lang.String#String(byte[], String) Constructor}
   93.68 + * {@link java.lang.String#String(byte[] bytes, String charSetName) Constructor}
   93.69 + * {@link java.lang.String#isEmpty Method}
   93.70 + * {@link java.lang.String#isEmpty() Method}
   93.71 + * {@link java.lang.String#ERROR Bad}
   93.72 + * {@link java.lang.String#equals(Object) Method}
   93.73 + *
   93.74 + * {@link AbstractProcessor Class}
   93.75 + *
   93.76 + * {@link List#add(Object) Method}
   93.77 + *
   93.78 + * {@link #trees Field}
   93.79 + * {@link #getSupportedSourceVersion Method}
   93.80 + * {@link #init(ProcessingEnvironment Method}
   93.81 + *
   93.82 + * @see java.lang        Package
   93.83 + * @see java.lang.ERROR  Bad
   93.84 + *
   93.85 + * @see java.lang.String Class
   93.86 + * @see           String Class
   93.87 + * @see java.lang.String#CASE_INSENSITIVE_ORDER Field
   93.88 + * @see java.lang.String#String Constructor
   93.89 + * @see java.lang.String#String(byte[]) Constructor
   93.90 + * @see java.lang.String#String(byte[] bytes) Constructor
   93.91 + * @see java.lang.String#String(byte[],String) Constructor
   93.92 + * @see java.lang.String#String(byte[] bytes, String charsetName) Constructor
   93.93 + * @see java.lang.String#isEmpty Method
   93.94 + * @see java.lang.String#isEmpty() Method
   93.95 + * @see java.lang.String#ERROR Bad
   93.96 + * @see java.lang.String#equals(Object) Method
   93.97 + *
   93.98 + * @see AbstractProcessor Class
   93.99 + *
  93.100 + * @see List#add(Object) Method
  93.101 + *
  93.102 + * @see #trees Field
  93.103 + * @see #getSupportedSourceVersion Method
  93.104 + * @see #init(ProcessingEnvironment) Method
  93.105 + *
  93.106 + * @see java.io.BufferedInputStream#BufferedInputStream(InputStream) Constructor
  93.107 + */
  93.108 +@SupportedAnnotationTypes("*")
  93.109 +public class ReferenceTest extends AbstractProcessor {
  93.110 +    DocTrees trees;
  93.111 +
  93.112 +    @Override
  93.113 +    public SourceVersion getSupportedSourceVersion() {
  93.114 +        return SourceVersion.latest();
  93.115 +    }
  93.116 +
  93.117 +    @Override
  93.118 +    public void init(ProcessingEnvironment pEnv) {
  93.119 +        super.init(pEnv);
  93.120 +        trees = DocTrees.instance(pEnv);
  93.121 +    }
  93.122 +
  93.123 +    @Override
  93.124 +    public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
  93.125 +        for (Element e: roundEnv.getRootElements()) {
  93.126 +            new DocCommentScanner(trees.getPath(e)).scan();
  93.127 +        }
  93.128 +        return true;
  93.129 +    }
  93.130 +
  93.131 +    class DocCommentScanner extends DocTreeScanner<Void, Void> {
  93.132 +        TreePath path;
  93.133 +        DocCommentTree dc;
  93.134 +
  93.135 +        DocCommentScanner(TreePath path) {
  93.136 +            this.path = path;
  93.137 +        }
  93.138 +
  93.139 +        void scan() {
  93.140 +            dc = trees.getDocCommentTree(path);
  93.141 +            scan(dc, null);
  93.142 +        }
  93.143 +
  93.144 +        @Override
  93.145 +        public Void visitLink(LinkTree tree, Void ignore) {
  93.146 +            checkReference(tree.getReference(), tree.getLabel());
  93.147 +            return null;
  93.148 +        }
  93.149 +
  93.150 +        @Override
  93.151 +        public Void visitSee(SeeTree tree, Void ignore) {
  93.152 +            List<? extends DocTree> refLabel = tree.getReference();
  93.153 +            if (refLabel.size() > 1 && (refLabel.get(0) instanceof ReferenceTree)) {
  93.154 +                ReferenceTree ref = (ReferenceTree) refLabel.get(0);
  93.155 +                List<? extends DocTree> label = refLabel.subList(1, refLabel.size());
  93.156 +                checkReference(ref, label);
  93.157 +            }
  93.158 +            return null;
  93.159 +        }
  93.160 +
  93.161 +        void checkReference(ReferenceTree tree, List<? extends DocTree> label) {
  93.162 +            String sig = tree.getSignature();
  93.163 +
  93.164 +            Element found = trees.getElement(path, tree);
  93.165 +            if (found == null) {
  93.166 +                System.err.println(sig + " NOT FOUND");
  93.167 +            } else {
  93.168 +                System.err.println(sig + " found " + found.getKind() + " " + found);
  93.169 +            }
  93.170 +
  93.171 +            String expect = "UNKNOWN";
  93.172 +            if (label.size() > 0 && label.get(0) instanceof TextTree)
  93.173 +                expect = ((TextTree) label.get(0)).getBody();
  93.174 +
  93.175 +            if (!expect.equalsIgnoreCase(found == null ? "bad" : found.getKind().name())) {
  93.176 +                error(tree, "Unexpected value found: " + found +", expected: " + expect);
  93.177 +            }
  93.178 +        }
  93.179 +
  93.180 +        void error(DocTree tree, String msg) {
  93.181 +            trees.printMessage(Kind.ERROR, msg, tree, dc, path.getCompilationUnit());
  93.182 +        }
  93.183 +    }
  93.184 +}
  93.185 +
  93.186 +/**
  93.187 + * @see ReferenceTestExtras    Class
  93.188 + * @see #ReferenceTestExtras   Field
  93.189 + * @see #ReferenceTestExtras() Constructor
  93.190 + *
  93.191 + * @see #X    Field
  93.192 + * @see #X()  Method
  93.193 + *
  93.194 + * @see #m    Method
  93.195 + *
  93.196 + * @see #varargs(int...)        Method
  93.197 + * @see #varargs(int... args)   Method
  93.198 + * @see #varargs(int[])         Method
  93.199 + * @see #varargs(int[] args)    Method
  93.200 + */
  93.201 +class ReferenceTestExtras {
  93.202 +    int ReferenceTestExtras;            // field
  93.203 +    ReferenceTestExtras() { }           // constructor
  93.204 +    void ReferenceTestExtras() { }      // method
  93.205 +
  93.206 +    int X;
  93.207 +    void X() { }
  93.208 +    static class X { }
  93.209 +
  93.210 +    void m() { }
  93.211 +    void m(int i) { }
  93.212 +    void m(int i, int j) { }
  93.213 +
  93.214 +    void varargs(int... args) { }
  93.215 +}
  93.216 +
  93.217 +
    94.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    94.2 +++ b/test/tools/javac/doctree/ReturnTest.java	Wed Nov 14 17:23:10 2012 -0800
    94.3 @@ -0,0 +1,51 @@
    94.4 +/*
    94.5 + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
    94.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    94.7 + *
    94.8 + * This code is free software; you can redistribute it and/or modify it
    94.9 + * under the terms of the GNU General Public License version 2 only, as
   94.10 + * published by the Free Software Foundation.
   94.11 + *
   94.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   94.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   94.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   94.15 + * version 2 for more details (a copy is included in the LICENSE file that
   94.16 + * accompanied this code).
   94.17 + *
   94.18 + * You should have received a copy of the GNU General Public License version
   94.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   94.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   94.21 + *
   94.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   94.23 + * or visit www.oracle.com if you need additional information or have any
   94.24 + * questions.
   94.25 + */
   94.26 +
   94.27 +/*
   94.28 + * @test
   94.29 + * @bug 7021614
   94.30 + * @summary extend com.sun.source API to support parsing javadoc comments
   94.31 + * @build DocCommentTester
   94.32 + * @run main DocCommentTester ReturnTest.java
   94.33 + */
   94.34 +
   94.35 +class ReturnTest {
   94.36 +    /**
   94.37 +     * @return something
   94.38 +     */
   94.39 +    int an_int() { }
   94.40 +/*
   94.41 +DocComment[DOC_COMMENT, pos:1
   94.42 +  firstSentence: empty
   94.43 +  body: empty
   94.44 +  block tags: 1
   94.45 +    Return[RETURN, pos:1
   94.46 +      description: 1
   94.47 +        Text[TEXT, pos:9, something]
   94.48 +    ]
   94.49 +]
   94.50 +*/
   94.51 +
   94.52 +}
   94.53 +
   94.54 +
    95.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    95.2 +++ b/test/tools/javac/doctree/SeeTest.java	Wed Nov 14 17:23:10 2012 -0800
    95.3 @@ -0,0 +1,174 @@
    95.4 +/*
    95.5 + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
    95.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    95.7 + *
    95.8 + * This code is free software; you can redistribute it and/or modify it
    95.9 + * under the terms of the GNU General Public License version 2 only, as
   95.10 + * published by the Free Software Foundation.
   95.11 + *
   95.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   95.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   95.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   95.15 + * version 2 for more details (a copy is included in the LICENSE file that
   95.16 + * accompanied this code).
   95.17 + *
   95.18 + * You should have received a copy of the GNU General Public License version
   95.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   95.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   95.21 + *
   95.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   95.23 + * or visit www.oracle.com if you need additional information or have any
   95.24 + * questions.
   95.25 + */
   95.26 +
   95.27 +/*
   95.28 + * @test
   95.29 + * @bug 7021614
   95.30 + * @summary extend com.sun.source API to support parsing javadoc comments
   95.31 + * @build DocCommentTester
   95.32 + * @run main DocCommentTester SeeTest.java
   95.33 + */
   95.34 +
   95.35 +class SeeTest {
   95.36 +    /**
   95.37 +     * abc.
   95.38 +     * @see "String"
   95.39 +     */
   95.40 +    void quoted_text() { }
   95.41 +/*
   95.42 +DocComment[DOC_COMMENT, pos:1
   95.43 +  firstSentence: 1
   95.44 +    Text[TEXT, pos:1, abc.]
   95.45 +  body: empty
   95.46 +  block tags: 1
   95.47 +    Erroneous[ERRONEOUS, pos:7
   95.48 +      code: compiler.err.dc.unexpected.content
   95.49 +      body: @see_"String"
   95.50 +    ]
   95.51 +]
   95.52 +*/
   95.53 +
   95.54 +    /**
   95.55 +     * abc.
   95.56 +     * @see <a href="url">url</a>
   95.57 +     */
   95.58 +    void url() { }
   95.59 +/*
   95.60 +DocComment[DOC_COMMENT, pos:1
   95.61 +  firstSentence: 1
   95.62 +    Text[TEXT, pos:1, abc.]
   95.63 +  body: empty
   95.64 +  block tags: 1
   95.65 +    See[SEE, pos:7
   95.66 +      reference: 3
   95.67 +        StartElement[START_ELEMENT, pos:12
   95.68 +          name:a
   95.69 +          attributes: 1
   95.70 +            Attribute[ATTRIBUTE, pos:15
   95.71 +              name: href
   95.72 +              vkind: DOUBLE
   95.73 +              value: 1
   95.74 +                Text[TEXT, pos:21, url]
   95.75 +            ]
   95.76 +        ]
   95.77 +        Text[TEXT, pos:26, url]
   95.78 +        EndElement[END_ELEMENT, pos:29, a]
   95.79 +    ]
   95.80 +]
   95.81 +*/
   95.82 +
   95.83 +    /**
   95.84 +     * abc.
   95.85 +     * @see String text
   95.86 +     */
   95.87 +    void string() { }
   95.88 +/*
   95.89 +DocComment[DOC_COMMENT, pos:1
   95.90 +  firstSentence: 1
   95.91 +    Text[TEXT, pos:1, abc.]
   95.92 +  body: empty
   95.93 +  block tags: 1
   95.94 +    See[SEE, pos:7
   95.95 +      reference: 2
   95.96 +        Reference[REFERENCE, pos:12, String]
   95.97 +        Text[TEXT, pos:19, text]
   95.98 +    ]
   95.99 +]
  95.100 +*/
  95.101 +
  95.102 +    /**
  95.103 +     * abc.
  95.104 +     * @see java.lang.String text
  95.105 +     */
  95.106 +    void j_l_string() { }
  95.107 +/*
  95.108 +DocComment[DOC_COMMENT, pos:1
  95.109 +  firstSentence: 1
  95.110 +    Text[TEXT, pos:1, abc.]
  95.111 +  body: empty
  95.112 +  block tags: 1
  95.113 +    See[SEE, pos:7
  95.114 +      reference: 2
  95.115 +        Reference[REFERENCE, pos:12, java.lang.String]
  95.116 +        Text[TEXT, pos:29, text]
  95.117 +    ]
  95.118 +]
  95.119 +*/
  95.120 +
  95.121 +    /**
  95.122 +     * abc.
  95.123 +     * @see java.lang.String#length text
  95.124 +     */
  95.125 +    void j_l_string_length() { }
  95.126 +/*
  95.127 +DocComment[DOC_COMMENT, pos:1
  95.128 +  firstSentence: 1
  95.129 +    Text[TEXT, pos:1, abc.]
  95.130 +  body: empty
  95.131 +  block tags: 1
  95.132 +    See[SEE, pos:7
  95.133 +      reference: 2
  95.134 +        Reference[REFERENCE, pos:12, java.lang.String#length]
  95.135 +        Text[TEXT, pos:36, text]
  95.136 +    ]
  95.137 +]
  95.138 +*/
  95.139 +
  95.140 +    /**
  95.141 +     * abc.
  95.142 +     * @see java.lang.String#matches(String regex) text
  95.143 +     */
  95.144 +    void j_l_string_matches() { }
  95.145 +/*
  95.146 +DocComment[DOC_COMMENT, pos:1
  95.147 +  firstSentence: 1
  95.148 +    Text[TEXT, pos:1, abc.]
  95.149 +  body: empty
  95.150 +  block tags: 1
  95.151 +    See[SEE, pos:7
  95.152 +      reference: 2
  95.153 +        Reference[REFERENCE, pos:12, java.lang.String...#matches(String_regex)]
  95.154 +        Text[TEXT, pos:51, text]
  95.155 +    ]
  95.156 +]
  95.157 +*/
  95.158 +
  95.159 +    /**
  95.160 +     * abc.
  95.161 +     * @see 123 text
  95.162 +     */
  95.163 +    void bad_numeric() { }
  95.164 +/*
  95.165 +DocComment[DOC_COMMENT, pos:1
  95.166 +  firstSentence: 1
  95.167 +    Text[TEXT, pos:1, abc.]
  95.168 +  body: empty
  95.169 +  block tags: 1
  95.170 +    Erroneous[ERRONEOUS, pos:7
  95.171 +      code: compiler.err.dc.unexpected.content
  95.172 +      body: @see_123_text
  95.173 +    ]
  95.174 +]
  95.175 +*/
  95.176 +
  95.177 +}
    96.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    96.2 +++ b/test/tools/javac/doctree/SerialDataTest.java	Wed Nov 14 17:23:10 2012 -0800
    96.3 @@ -0,0 +1,50 @@
    96.4 +/*
    96.5 + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
    96.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    96.7 + *
    96.8 + * This code is free software; you can redistribute it and/or modify it
    96.9 + * under the terms of the GNU General Public License version 2 only, as
   96.10 + * published by the Free Software Foundation.
   96.11 + *
   96.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   96.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   96.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   96.15 + * version 2 for more details (a copy is included in the LICENSE file that
   96.16 + * accompanied this code).
   96.17 + *
   96.18 + * You should have received a copy of the GNU General Public License version
   96.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   96.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   96.21 + *
   96.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   96.23 + * or visit www.oracle.com if you need additional information or have any
   96.24 + * questions.
   96.25 + */
   96.26 +
   96.27 +/*
   96.28 + * @test
   96.29 + * @bug 7021614
   96.30 + * @summary extend com.sun.source API to support parsing javadoc comments
   96.31 + * @build DocCommentTester
   96.32 + * @run main DocCommentTester SerialDataTest.java
   96.33 + */
   96.34 +
   96.35 +class SerialDataTest {
   96.36 +    /**
   96.37 +     * @serialData description
   96.38 +     */
   96.39 +    void writeObject(ObjectOutputStream stream) { }
   96.40 +/*
   96.41 +DocComment[DOC_COMMENT, pos:1
   96.42 +  firstSentence: empty
   96.43 +  body: empty
   96.44 +  block tags: 1
   96.45 +    SerialData[SERIAL_DATA, pos:1
   96.46 +      description: 1
   96.47 +        Text[TEXT, pos:13, description]
   96.48 +    ]
   96.49 +]
   96.50 +*/
   96.51 +
   96.52 +}
   96.53 +
    97.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    97.2 +++ b/test/tools/javac/doctree/SerialFieldTest.java	Wed Nov 14 17:23:10 2012 -0800
    97.3 @@ -0,0 +1,74 @@
    97.4 +/*
    97.5 + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
    97.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    97.7 + *
    97.8 + * This code is free software; you can redistribute it and/or modify it
    97.9 + * under the terms of the GNU General Public License version 2 only, as
   97.10 + * published by the Free Software Foundation.
   97.11 + *
   97.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   97.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   97.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   97.15 + * version 2 for more details (a copy is included in the LICENSE file that
   97.16 + * accompanied this code).
   97.17 + *
   97.18 + * You should have received a copy of the GNU General Public License version
   97.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   97.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   97.21 + *
   97.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   97.23 + * or visit www.oracle.com if you need additional information or have any
   97.24 + * questions.
   97.25 + */
   97.26 +
   97.27 +/*
   97.28 + * @test
   97.29 + * @bug 7021614
   97.30 + * @summary extend com.sun.source API to support parsing javadoc comments
   97.31 + * @build DocCommentTester
   97.32 + * @run main DocCommentTester SerialFieldTest.java
   97.33 + */
   97.34 +
   97.35 +class SerialFieldTest {
   97.36 +
   97.37 +    /**
   97.38 +     * @serialField field String
   97.39 +     */
   97.40 +    String f1;
   97.41 +/*
   97.42 +DocComment[DOC_COMMENT, pos:1
   97.43 +  firstSentence: empty
   97.44 +  body: empty
   97.45 +  block tags: 1
   97.46 +    SerialField[SERIAL_FIELD, pos:1
   97.47 +      name:
   97.48 +        Identifier[IDENTIFIER, pos:14, field]
   97.49 +      type:
   97.50 +        Reference[REFERENCE, pos:20, String]
   97.51 +      description: empty
   97.52 +    ]
   97.53 +]
   97.54 +*/
   97.55 +
   97.56 +    /**
   97.57 +     * @serialField field String f2 is a String
   97.58 +     */
   97.59 +    String f2;
   97.60 +/*
   97.61 +DocComment[DOC_COMMENT, pos:1
   97.62 +  firstSentence: empty
   97.63 +  body: empty
   97.64 +  block tags: 1
   97.65 +    SerialField[SERIAL_FIELD, pos:1
   97.66 +      name:
   97.67 +        Identifier[IDENTIFIER, pos:14, field]
   97.68 +      type:
   97.69 +        Reference[REFERENCE, pos:20, String]
   97.70 +      description: 1
   97.71 +        Text[TEXT, pos:27, f2_is_a_String]
   97.72 +    ]
   97.73 +]
   97.74 +*/
   97.75 +
   97.76 +}
   97.77 +
    98.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    98.2 +++ b/test/tools/javac/doctree/SerialTest.java	Wed Nov 14 17:23:10 2012 -0800
    98.3 @@ -0,0 +1,97 @@
    98.4 +/*
    98.5 + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
    98.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    98.7 + *
    98.8 + * This code is free software; you can redistribute it and/or modify it
    98.9 + * under the terms of the GNU General Public License version 2 only, as
   98.10 + * published by the Free Software Foundation.
   98.11 + *
   98.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   98.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   98.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   98.15 + * version 2 for more details (a copy is included in the LICENSE file that
   98.16 + * accompanied this code).
   98.17 + *
   98.18 + * You should have received a copy of the GNU General Public License version
   98.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   98.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   98.21 + *
   98.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   98.23 + * or visit www.oracle.com if you need additional information or have any
   98.24 + * questions.
   98.25 + */
   98.26 +
   98.27 +/*
   98.28 + * @test
   98.29 + * @bug 7021614
   98.30 + * @summary extend com.sun.source API to support parsing javadoc comments
   98.31 + * @build DocCommentTester
   98.32 + * @run main DocCommentTester SerialTest.java
   98.33 + */
   98.34 +
   98.35 +class SerialTest {
   98.36 +    /**
   98.37 +     * @serial include
   98.38 +     */
   98.39 +    void include() { }
   98.40 +/*
   98.41 +DocComment[DOC_COMMENT, pos:1
   98.42 +  firstSentence: empty
   98.43 +  body: empty
   98.44 +  block tags: 1
   98.45 +    Serial[SERIAL, pos:1
   98.46 +      description: 1
   98.47 +        Text[TEXT, pos:9, include]
   98.48 +    ]
   98.49 +]
   98.50 +*/
   98.51 +
   98.52 +    /**
   98.53 +     * @serial exclude
   98.54 +     */
   98.55 +    void exclude() { }
   98.56 +/*
   98.57 +DocComment[DOC_COMMENT, pos:1
   98.58 +  firstSentence: empty
   98.59 +  body: empty
   98.60 +  block tags: 1
   98.61 +    Serial[SERIAL, pos:1
   98.62 +      description: 1
   98.63 +        Text[TEXT, pos:9, exclude]
   98.64 +    ]
   98.65 +]
   98.66 +*/
   98.67 +
   98.68 +    /**
   98.69 +     * @serial description
   98.70 +     */
   98.71 +    void description() { }
   98.72 +/*
   98.73 +DocComment[DOC_COMMENT, pos:1
   98.74 +  firstSentence: empty
   98.75 +  body: empty
   98.76 +  block tags: 1
   98.77 +    Serial[SERIAL, pos:1
   98.78 +      description: 1
   98.79 +        Text[TEXT, pos:9, description]
   98.80 +    ]
   98.81 +]
   98.82 +*/
   98.83 +
   98.84 +    /**
   98.85 +     * @serial
   98.86 +     */
   98.87 +    void empty() { }
   98.88 +/*
   98.89 +DocComment[DOC_COMMENT, pos:1
   98.90 +  firstSentence: empty
   98.91 +  body: empty
   98.92 +  block tags: 1
   98.93 +    Serial[SERIAL, pos:1
   98.94 +      description: empty
   98.95 +    ]
   98.96 +]
   98.97 +*/
   98.98 +
   98.99 +}
  98.100 +
    99.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    99.2 +++ b/test/tools/javac/doctree/SimpleDocTreeVisitorTest.java	Wed Nov 14 17:23:10 2012 -0800
    99.3 @@ -0,0 +1,166 @@
    99.4 +/*
    99.5 + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
    99.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    99.7 + *
    99.8 + * This code is free software; you can redistribute it and/or modify it
    99.9 + * under the terms of the GNU General Public License version 2 only, as
   99.10 + * published by the Free Software Foundation.
   99.11 + *
   99.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   99.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   99.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   99.15 + * version 2 for more details (a copy is included in the LICENSE file that
   99.16 + * accompanied this code).
   99.17 + *
   99.18 + * You should have received a copy of the GNU General Public License version
   99.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   99.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   99.21 + *
   99.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   99.23 + * or visit www.oracle.com if you need additional information or have any
   99.24 + * questions.
   99.25 + */
   99.26 +
   99.27 +/*
   99.28 + * @test
   99.29 + * @bug 7021614
   99.30 + * @summary extend com.sun.source API to support parsing javadoc comments
   99.31 + */
   99.32 +
   99.33 +import com.sun.source.doctree.DocCommentTree;
   99.34 +import com.sun.source.doctree.DocTree;
   99.35 +import com.sun.source.doctree.DocTreeVisitor;
   99.36 +import com.sun.source.tree.ClassTree;
   99.37 +import com.sun.source.tree.CompilationUnitTree;
   99.38 +import com.sun.source.tree.MethodTree;
   99.39 +import com.sun.source.tree.Tree;
   99.40 +import com.sun.source.tree.VariableTree;
   99.41 +import com.sun.source.util.DocTreeScanner;
   99.42 +import com.sun.source.util.DocTrees;
   99.43 +import com.sun.source.util.JavacTask;
   99.44 +import com.sun.source.util.SimpleDocTreeVisitor;
   99.45 +import com.sun.source.util.TreePath;
   99.46 +import com.sun.source.util.TreePathScanner;
   99.47 +import com.sun.tools.javac.api.JavacTool;
   99.48 +import java.io.File;
   99.49 +import java.util.ArrayList;
   99.50 +import java.util.EnumSet;
   99.51 +import java.util.List;
   99.52 +import java.util.Set;
   99.53 +import javax.lang.model.element.Name;
   99.54 +import javax.tools.JavaFileObject;
   99.55 +import javax.tools.StandardJavaFileManager;
   99.56 +
   99.57 +public class SimpleDocTreeVisitorTest {
   99.58 +    public static void main(String... args) throws Exception {
   99.59 +        SimpleDocTreeVisitorTest t = new SimpleDocTreeVisitorTest();
   99.60 +        t.run();
   99.61 +    }
   99.62 +
   99.63 +    void run() throws Exception {
   99.64 +        List<File> files = new ArrayList<File>();
   99.65 +        File testSrc = new File(System.getProperty("test.src"));
   99.66 +        for (File f: testSrc.listFiles()) {
   99.67 +            if (f.isFile() && f.getName().endsWith(".java"))
   99.68 +                files.add(f);
   99.69 +        }
   99.70 +
   99.71 +        JavacTool javac = JavacTool.create();
   99.72 +        StandardJavaFileManager fm = javac.getStandardFileManager(null, null, null);
   99.73 +
   99.74 +        Iterable<? extends JavaFileObject> fos = fm.getJavaFileObjectsFromFiles(files);
   99.75 +
   99.76 +        JavacTask t = javac.getTask(null, fm, null, null, null, fos);
   99.77 +        DocTrees trees = DocTrees.instance(t);
   99.78 +
   99.79 +        Iterable<? extends CompilationUnitTree> units = t.parse();
   99.80 +
   99.81 +        Set<DocTree.Kind> found = EnumSet.noneOf(DocTree.Kind.class);
   99.82 +        DeclScanner ds = new DeclScanner(trees, found);
   99.83 +        for (CompilationUnitTree unit: units) {
   99.84 +            ds.scan(unit, null);
   99.85 +        }
   99.86 +
   99.87 +        for (DocTree.Kind k: DocTree.Kind.values()) {
   99.88 +            if (!found.contains(k) && k != DocTree.Kind.OTHER)
   99.89 +                error("not found: " + k);
   99.90 +        }
   99.91 +
   99.92 +        if (errors > 0)
   99.93 +            throw new Exception(errors + " errors occurred");
   99.94 +    }
   99.95 +
   99.96 +    void error(String msg) {
   99.97 +        System.err.println("Error: " + msg);
   99.98 +        errors++;
   99.99 +    }
  99.100 +
  99.101 +    int errors;
  99.102 +
  99.103 +    static class DeclScanner extends TreePathScanner<Void, Void> {
  99.104 +        DocTrees trees;
  99.105 +        DocTreeScanner<Void,Void> cs;
  99.106 +
  99.107 +        DeclScanner(DocTrees trees, final Set<DocTree.Kind> found) {
  99.108 +            this.trees = trees;
  99.109 +            cs = new CommentScanner(found);
  99.110 +        }
  99.111 +
  99.112 +        @Override
  99.113 +        public Void visitClass(ClassTree tree, Void ignore) {
  99.114 +            super.visitClass(tree, ignore);
  99.115 +            visitDecl(tree, tree.getSimpleName());
  99.116 +            return null;
  99.117 +        }
  99.118 +
  99.119 +        @Override
  99.120 +        public Void visitMethod(MethodTree tree, Void ignore) {
  99.121 +            super.visitMethod(tree, ignore);
  99.122 +            visitDecl(tree, tree.getName());
  99.123 +            return null;
  99.124 +        }
  99.125 +
  99.126 +        @Override
  99.127 +        public Void visitVariable(VariableTree tree, Void ignore) {
  99.128 +            super.visitVariable(tree, ignore);
  99.129 +            visitDecl(tree, tree.getName());
  99.130 +            return null;
  99.131 +        }
  99.132 +
  99.133 +        void visitDecl(Tree tree, Name name) {
  99.134 +            TreePath path = getCurrentPath();
  99.135 +            DocCommentTree dc = trees.getDocCommentTree(path);
  99.136 +            if (dc != null)
  99.137 +                cs.scan(dc, null);
  99.138 +        }
  99.139 +    }
  99.140 +
  99.141 +    static class CommentScanner extends DocTreeScanner<Void, Void> {
  99.142 +        DocTreeVisitor<Void, Void> visitor;
  99.143 +
  99.144 +        CommentScanner(Set<DocTree.Kind> found) {
  99.145 +            visitor = new Visitor(found);
  99.146 +        }
  99.147 +
  99.148 +        @Override
  99.149 +        public Void scan(DocTree tree, Void ignore) {
  99.150 +            if (tree != null)
  99.151 +                tree.accept(visitor, ignore);
  99.152 +            return super.scan(tree, ignore);
  99.153 +        }
  99.154 +    }
  99.155 +
  99.156 +    static class Visitor extends SimpleDocTreeVisitor<Void, Void> {
  99.157 +        Set<DocTree.Kind> found;
  99.158 +
  99.159 +        Visitor(Set<DocTree.Kind> found) {
  99.160 +            this.found = found;
  99.161 +        }
  99.162 +
  99.163 +        @Override
  99.164 +        public Void defaultAction(DocTree tree, Void ignore) {
  99.165 +            found.add(tree.getKind());
  99.166 +            return null;
  99.167 +        }
  99.168 +    }
  99.169 +}
   100.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   100.2 +++ b/test/tools/javac/doctree/SinceTest.java	Wed Nov 14 17:23:10 2012 -0800
   100.3 @@ -0,0 +1,53 @@
   100.4 +/*
   100.5 + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
   100.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   100.7 + *
   100.8 + * This code is free software; you can redistribute it and/or modify it
   100.9 + * under the terms of the GNU General Public License version 2 only, as
  100.10 + * published by the Free Software Foundation.
  100.11 + *
  100.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
  100.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  100.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  100.15 + * version 2 for more details (a copy is included in the LICENSE file that
  100.16 + * accompanied this code).
  100.17 + *
  100.18 + * You should have received a copy of the GNU General Public License version
  100.19 + * 2 along with this work; if not, write to the Free Software Foundation,
  100.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  100.21 + *
  100.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  100.23 + * or visit www.oracle.com if you need additional information or have any
  100.24 + * questions.
  100.25 + */
  100.26 +
  100.27 +/*
  100.28 + * @test
  100.29 + * @bug 7021614
  100.30 + * @summary extend com.sun.source API to support parsing javadoc comments
  100.31 + * @build DocCommentTester
  100.32 + * @run main DocCommentTester SinceTest.java
  100.33 + */
  100.34 +
  100.35 +class SinceTest {
  100.36 +    /**
  100.37 +     * abc.
  100.38 +     * @since then &amp; now.
  100.39 +     */
  100.40 +    void standard() { }
  100.41 +/*
  100.42 +DocComment[DOC_COMMENT, pos:1
  100.43 +  firstSentence: 1
  100.44 +    Text[TEXT, pos:1, abc.]
  100.45 +  body: empty
  100.46 +  block tags: 1
  100.47 +    Since[SINCE, pos:7
  100.48 +      body: 3
  100.49 +        Text[TEXT, pos:14, then_]
  100.50 +        Entity[ENTITY, pos:19, amp]
  100.51 +        Text[TEXT, pos:24, _now.]
  100.52 +    ]
  100.53 +]
  100.54 +*/
  100.55 +
  100.56 +}
   101.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   101.2 +++ b/test/tools/javac/doctree/TagTest.java	Wed Nov 14 17:23:10 2012 -0800
   101.3 @@ -0,0 +1,149 @@
   101.4 +/*
   101.5 + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
   101.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   101.7 + *
   101.8 + * This code is free software; you can redistribute it and/or modify it
   101.9 + * under the terms of the GNU General Public License version 2 only, as
  101.10 + * published by the Free Software Foundation.
  101.11 + *
  101.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
  101.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  101.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  101.15 + * version 2 for more details (a copy is included in the LICENSE file that
  101.16 + * accompanied this code).
  101.17 + *
  101.18 + * You should have received a copy of the GNU General Public License version
  101.19 + * 2 along with this work; if not, write to the Free Software Foundation,
  101.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  101.21 + *
  101.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  101.23 + * or visit www.oracle.com if you need additional information or have any
  101.24 + * questions.
  101.25 + */
  101.26 +
  101.27 +/*
  101.28 + * @test
  101.29 + * @bug 7021614
  101.30 + * @summary extend com.sun.source API to support parsing javadoc comments
  101.31 + * @build DocCommentTester
  101.32 + * @run main DocCommentTester TagTest.java
  101.33 + */
  101.34 +
  101.35 +class TagTest {
  101.36 +    /**
  101.37 +     * @author jjg
  101.38 +     */
  101.39 +    void simple_standard_block() { }
  101.40 +/*
  101.41 +DocComment[DOC_COMMENT, pos:1
  101.42 +  firstSentence: empty
  101.43 +  body: empty
  101.44 +  block tags: 1
  101.45 +    Author[AUTHOR, pos:1
  101.46 +      name: 1
  101.47 +        Text[TEXT, pos:9, jjg]
  101.48 +    ]
  101.49 +]
  101.50 +*/
  101.51 +
  101.52 +    /**
  101.53 +     * @ abc
  101.54 +     */
  101.55 +    void no_name_block() { }
  101.56 +/*
  101.57 +DocComment[DOC_COMMENT, pos:1
  101.58 +  firstSentence: empty
  101.59 +  body: empty
  101.60 +  block tags: 1
  101.61 +    Erroneous[ERRONEOUS, pos:1
  101.62 +      code: compiler.err.dc.no.tag.name
  101.63 +      body: @_abc
  101.64 +    ]
  101.65 +]
  101.66 +*/
  101.67 +
  101.68 +    /**
  101.69 +     * @abc def ghi
  101.70 +     */
  101.71 +    void unknown_name_block() { }
  101.72 +/*
  101.73 +DocComment[DOC_COMMENT, pos:1
  101.74 +  firstSentence: empty
  101.75 +  body: empty
  101.76 +  block tags: 1
  101.77 +    UnknownBlockTag[UNKNOWN_BLOCK_TAG, pos:1
  101.78 +      tag:abc
  101.79 +      content: 1
  101.80 +        Text[TEXT, pos:6, def_ghi]
  101.81 +    ]
  101.82 +]
  101.83 +*/
  101.84 +
  101.85 +    /**
  101.86 +     * {@link String}
  101.87 +     */
  101.88 +    void simple_standard_inline() { }
  101.89 +/*
  101.90 +DocComment[DOC_COMMENT, pos:1
  101.91 +  firstSentence: 1
  101.92 +    Link[LINK, pos:1
  101.93 +      reference:
  101.94 +        Reference[REFERENCE, pos:8, String]
  101.95 +      body: empty
  101.96 +    ]
  101.97 +  body: empty
  101.98 +  block tags: empty
  101.99 +]
 101.100 +*/
 101.101 +
 101.102 +    /**
 101.103 +     * {@ abc}
 101.104 +     */
 101.105 +    void no_name_inline() { }
 101.106 +/*
 101.107 +DocComment[DOC_COMMENT, pos:1
 101.108 +  firstSentence: 2
 101.109 +    Erroneous[ERRONEOUS, pos:1
 101.110 +      code: compiler.err.dc.no.tag.name
 101.111 +      body: {@
 101.112 +    ]
 101.113 +    Text[TEXT, pos:3, _abc}]
 101.114 +  body: empty
 101.115 +  block tags: empty
 101.116 +]
 101.117 +*/
 101.118 +
 101.119 +    /**
 101.120 +     * {@abc def ghi}
 101.121 +     */
 101.122 +    void unknown_name_inline() { }
 101.123 +/*
 101.124 +DocComment[DOC_COMMENT, pos:1
 101.125 +  firstSentence: 1
 101.126 +    UnknownInlineTag[UNKNOWN_INLINE_TAG, pos:1
 101.127 +      tag:abc
 101.128 +      content: 1
 101.129 +        Text[TEXT, pos:7, def_ghi]
 101.130 +    ]
 101.131 +  body: empty
 101.132 +  block tags: empty
 101.133 +]
 101.134 +*/
 101.135 +
 101.136 +    /**
 101.137 +     * {@abc def ghi
 101.138 +     */
 101.139 +    void unterminated_standard_inline() { }
 101.140 +/*
 101.141 +DocComment[DOC_COMMENT, pos:1
 101.142 +  firstSentence: 1
 101.143 +    Erroneous[ERRONEOUS, pos:1
 101.144 +      code: compiler.err.dc.unterminated.inline.tag
 101.145 +      body: {@abc_def_ghi
 101.146 +    ]
 101.147 +  body: empty
 101.148 +  block tags: empty
 101.149 +]
 101.150 +*/
 101.151 +
 101.152 +}
   102.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   102.2 +++ b/test/tools/javac/doctree/ThrowableTest.java	Wed Nov 14 17:23:10 2012 -0800
   102.3 @@ -0,0 +1,69 @@
   102.4 +/*
   102.5 + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
   102.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   102.7 + *
   102.8 + * This code is free software; you can redistribute it and/or modify it
   102.9 + * under the terms of the GNU General Public License version 2 only, as
  102.10 + * published by the Free Software Foundation.
  102.11 + *
  102.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
  102.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  102.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  102.15 + * version 2 for more details (a copy is included in the LICENSE file that
  102.16 + * accompanied this code).
  102.17 + *
  102.18 + * You should have received a copy of the GNU General Public License version
  102.19 + * 2 along with this work; if not, write to the Free Software Foundation,
  102.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  102.21 + *
  102.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  102.23 + * or visit www.oracle.com if you need additional information or have any
  102.24 + * questions.
  102.25 + */
  102.26 +
  102.27 +/*
  102.28 + * @test
  102.29 + * @bug 7021614
  102.30 + * @summary extend com.sun.source API to support parsing javadoc comments
  102.31 + * @build DocCommentTester
  102.32 + * @run main DocCommentTester ThrowableTest.java
  102.33 + */
  102.34 +
  102.35 +class ThrowableTest {
  102.36 +    /**
  102.37 +     * @throws Exception
  102.38 +     */
  102.39 +    void exception() throws Exception { }
  102.40 +/*
  102.41 +DocComment[DOC_COMMENT, pos:1
  102.42 +  firstSentence: empty
  102.43 +  body: empty
  102.44 +  block tags: 1
  102.45 +    Throws[THROWS, pos:1
  102.46 +      exceptionName:
  102.47 +        Reference[REFERENCE, pos:9, Exception]
  102.48 +      description: empty
  102.49 +    ]
  102.50 +]
  102.51 +*/
  102.52 +
  102.53 +    /**
  102.54 +     * @throws Exception text
  102.55 +     */
  102.56 +    void exception_text() throws Exception { }
  102.57 +/*
  102.58 +DocComment[DOC_COMMENT, pos:1
  102.59 +  firstSentence: empty
  102.60 +  body: empty
  102.61 +  block tags: 1
  102.62 +    Throws[THROWS, pos:1
  102.63 +      exceptionName:
  102.64 +        Reference[REFERENCE, pos:9, Exception]
  102.65 +      description: 1
  102.66 +        Text[TEXT, pos:19, text]
  102.67 +    ]
  102.68 +]
  102.69 +*/
  102.70 +
  102.71 +}
  102.72 +
   103.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   103.2 +++ b/test/tools/javac/doctree/ValueTest.java	Wed Nov 14 17:23:10 2012 -0800
   103.3 @@ -0,0 +1,103 @@
   103.4 +/*
   103.5 + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
   103.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   103.7 + *
   103.8 + * This code is free software; you can redistribute it and/or modify it
   103.9 + * under the terms of the GNU General Public License version 2 only, as
  103.10 + * published by the Free Software Foundation.
  103.11 + *
  103.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
  103.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  103.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  103.15 + * version 2 for more details (a copy is included in the LICENSE file that
  103.16 + * accompanied this code).
  103.17 + *
  103.18 + * You should have received a copy of the GNU General Public License version
  103.19 + * 2 along with this work; if not, write to the Free Software Foundation,
  103.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  103.21 + *
  103.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  103.23 + * or visit www.oracle.com if you need additional information or have any
  103.24 + * questions.
  103.25 + */
  103.26 +
  103.27 +/*
  103.28 + * @test
  103.29 + * @bug 7021614
  103.30 + * @summary extend com.sun.source API to support parsing javadoc comments
  103.31 + * @build DocCommentTester
  103.32 + * @run main DocCommentTester ValueTest.java
  103.33 + */
  103.34 +
  103.35 +class ValueTest {
  103.36 +    /**
  103.37 +     * abc {@value}
  103.38 +     */
  103.39 +    int no_ref() { }
  103.40 +/*
  103.41 +DocComment[DOC_COMMENT, pos:1
  103.42 +  firstSentence: 2
  103.43 +    Text[TEXT, pos:1, abc_]
  103.44 +    Value[VALUE, pos:5
  103.45 +      reference: null
  103.46 +    ]
  103.47 +  body: empty
  103.48 +  block tags: empty
  103.49 +]
  103.50 +*/
  103.51 +
  103.52 +    /**
  103.53 +     * abc {@value java.awt.Color#RED}
  103.54 +     */
  103.55 +    int typical() { }
  103.56 +/*
  103.57 +DocComment[DOC_COMMENT, pos:1
  103.58 +  firstSentence: 2
  103.59 +    Text[TEXT, pos:1, abc_]
  103.60 +    Value[VALUE, pos:5
  103.61 +      reference:
  103.62 +        Reference[REFERENCE, pos:13, java.awt.Color#RED]
  103.63 +    ]
  103.64 +  body: empty
  103.65 +  block tags: empty
  103.66 +]
  103.67 +*/
  103.68 +
  103.69 +    /**
  103.70 +     * abc {@value java.awt.Color#RED }
  103.71 +     */
  103.72 +    int trailing_ws() { }
  103.73 +/*
  103.74 +DocComment[DOC_COMMENT, pos:1
  103.75 +  firstSentence: 2
  103.76 +    Text[TEXT, pos:1, abc_]
  103.77 +    Value[VALUE, pos:5
  103.78 +      reference:
  103.79 +        Reference[REFERENCE, pos:13, java.awt.Color#RED]
  103.80 +    ]
  103.81 +  body: empty
  103.82 +  block tags: empty
  103.83 +]
  103.84 +*/
  103.85 +
  103.86 +    /**
  103.87 +     * abc {@value java.awt.Color#RED junk}
  103.88 +     */
  103.89 +    int trailing_junk() { }
  103.90 +/*
  103.91 +DocComment[DOC_COMMENT, pos:1
  103.92 +  firstSentence: 3
  103.93 +    Text[TEXT, pos:1, abc_]
  103.94 +    Erroneous[ERRONEOUS, pos:5
  103.95 +      code: compiler.err.dc.unexpected.content
  103.96 +      body: {@value_java.awt.Color#RED_j
  103.97 +    ]
  103.98 +    Text[TEXT, pos:33, unk}]
  103.99 +  body: empty
 103.100 +  block tags: empty
 103.101 +]
 103.102 +*/
 103.103 +
 103.104 +}
 103.105 +
 103.106 +
   104.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   104.2 +++ b/test/tools/javac/doctree/VersionTest.java	Wed Nov 14 17:23:10 2012 -0800
   104.3 @@ -0,0 +1,51 @@
   104.4 +/*
   104.5 + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
   104.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   104.7 + *
   104.8 + * This code is free software; you can redistribute it and/or modify it
   104.9 + * under the terms of the GNU General Public License version 2 only, as
  104.10 + * published by the Free Software Foundation.
  104.11 + *
  104.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
  104.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  104.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  104.15 + * version 2 for more details (a copy is included in the LICENSE file that
  104.16 + * accompanied this code).
  104.17 + *
  104.18 + * You should have received a copy of the GNU General Public License version
  104.19 + * 2 along with this work; if not, write to the Free Software Foundation,
  104.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  104.21 + *
  104.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  104.23 + * or visit www.oracle.com if you need additional information or have any
  104.24 + * questions.
  104.25 + */
  104.26 +
  104.27 +/*
  104.28 + * @test
  104.29 + * @bug 7021614
  104.30 + * @summary extend com.sun.source API to support parsing javadoc comments
  104.31 + * @build DocCommentTester
  104.32 + * @run main DocCommentTester VersionTest.java
  104.33 + */
  104.34 +
  104.35 +class VersionTest {
  104.36 +    /**
  104.37 +     * @version 1.2
  104.38 +     */
  104.39 +    void version() { }
  104.40 +/*
  104.41 +DocComment[DOC_COMMENT, pos:1
  104.42 +  firstSentence: empty
  104.43 +  body: empty
  104.44 +  block tags: 1
  104.45 +    Version[VERSION, pos:1
  104.46 +      body: 1
  104.47 +        Text[TEXT, pos:10, 1.2]
  104.48 +    ]
  104.49 +]
  104.50 +*/
  104.51 +
  104.52 +}
  104.53 +
  104.54 +

mercurial