src/share/classes/com/sun/tools/javadoc/ThrowsTagImpl.java

Mon, 27 Sep 2010 14:20:39 -0700

author
jjg
date
Mon, 27 Sep 2010 14:20:39 -0700
changeset 695
3c9b64e55c5d
parent 554
9d9f26857129
child 1053
0d8edba73d70
permissions
-rw-r--r--

6877202: Elements.getDocComment() is not getting JavaDocComments
6861094: javac -Xprint <file> does not print comments
6985205: access to tree positions and doc comments may be lost across annotation processing rounds
Reviewed-by: darcy

     1 /*
     2  * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.  Oracle designates this
     8  * particular file as subject to the "Classpath" exception as provided
     9  * by Oracle in the LICENSE file that accompanied this code.
    10  *
    11  * This code is distributed in the hope that it will be useful, but WITHOUT
    12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    14  * version 2 for more details (a copy is included in the LICENSE file that
    15  * accompanied this code).
    16  *
    17  * You should have received a copy of the GNU General Public License version
    18  * 2 along with this work; if not, write to the Free Software Foundation,
    19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    20  *
    21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    22  * or visit www.oracle.com if you need additional information or have any
    23  * questions.
    24  */
    26 package com.sun.tools.javadoc;
    28 import com.sun.javadoc.*;
    30 /**
    31  * Represents a @throws or @exception documentation tag.
    32  * Parses and holds the exception name and exception comment.
    33  * The exception name my be the name of a type variable.
    34  * Note: @exception is a backwards compatible synonymy for @throws.
    35  *
    36  * @author Robert Field
    37  * @author Atul M Dambalkar
    38  * @see ExecutableMemberDocImpl#throwsTags()
    39  *
    40  */
    41 class ThrowsTagImpl extends TagImpl implements ThrowsTag {
    43     private final String exceptionName;
    44     private final String exceptionComment;
    46     ThrowsTagImpl(DocImpl holder, String name, String text) {
    47         super(holder, name, text);
    48         String[] sa = divideAtWhite();
    49         exceptionName = sa[0];
    50         exceptionComment = sa[1];
    51     }
    53     /**
    54      * Return the exception name.
    55      */
    56     public String exceptionName() {
    57         return exceptionName;
    58     }
    60     /**
    61      * Return the exception comment.
    62      */
    63     public String exceptionComment() {
    64         return exceptionComment;
    65     }
    67     /**
    68      * Return the exception as a ClassDocImpl.
    69      */
    70     public ClassDoc exception() {
    71         ClassDocImpl exceptionClass;
    72         if (!(holder instanceof ExecutableMemberDoc)) {
    73             exceptionClass = null;
    74         } else {
    75             ExecutableMemberDocImpl emd = (ExecutableMemberDocImpl)holder;
    76             ClassDocImpl con = (ClassDocImpl)emd.containingClass();
    77             exceptionClass = (ClassDocImpl)con.findClass(exceptionName);
    78         }
    79         return exceptionClass;
    80     }
    82     /**
    83      * Return the type that represents the exception.
    84      * This may be a <code>ClassDoc</code> or a <code>TypeVariable</code>.
    85      */
    86     public Type exceptionType() {
    87         //###(gj) TypeVariable not yet supported.
    88         return exception();
    89     }
    92     /**
    93      * Return the kind of this tag.  Always "@throws" for instances
    94      * of ThrowsTagImpl.
    95      */
    96     public String kind() {
    97         return "@throws";
    98     }
   100     /**
   101      * For the exception comment with embedded @link tags return the array of
   102      * TagImpls consisting of SeeTagImpl(s) and text containing TagImpl(s).
   103      *
   104      * @return TagImpl[] Array of tags with inline SeeTagImpls.
   105      * @see TagImpl#inlineTagImpls()
   106      * @see ParamTagImpl#inlineTagImpls()
   107      */
   108     public Tag[] inlineTags() {
   109         return Comment.getInlineTags(holder, exceptionComment());
   110     }
   111 }

mercurial