예제 #1
0
  /** {@inheritDoc} */
  public TagletOutput getTagletOutput(Doc holder, TagletWriter writer) {
    Type returnType = ((MethodDoc) holder).returnType();
    Tag[] tags = holder.tags(name);

    // Make sure we are not using @return tag on method with void return type.
    if (returnType.isPrimitive() && returnType.typeName().equals("void")) {
      if (tags.length > 0) {
        writer.getMsgRetriever().warning(holder.position(), "doclet.Return_tag_on_void_method");
      }
      return null;
    }
    // Inherit @return tag if necessary.
    if (tags.length == 0) {
      DocFinder.Output inheritedDoc =
          DocFinder.search(new DocFinder.Input((MethodDoc) holder, this));
      tags = inheritedDoc.holderTag == null ? tags : new Tag[] {inheritedDoc.holderTag};
    }
    return tags.length > 0 ? writer.returnTagOutput(tags[0]) : null;
  }
 /**
  * Given a <code>Doc</code>, return an anchor name for it.
  *
  * @param d the <code>Doc</code> to check.
  * @return the name of the anchor.
  */
 public static String getAnchorName(Doc d) {
   return "line." + d.position().line();
 }