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

Tue, 09 Oct 2012 19:10:00 -0700

author
jjg
date
Tue, 09 Oct 2012 19:10:00 -0700
changeset 1357
c75be5bc5283
parent 1053
0d8edba73d70
child 1358
fc123bdeddb8
permissions
-rw-r--r--

8000663: clean up langtools imports
Reviewed-by: darcy

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

mercurial