/**
   * Given a <code>MethodDoc</code> item, a <code>Tag</code> in the <code>MethodDoc</code> item and
   * a String, replace all occurrences of @inheritDoc with documentation from it's superclass or
   * superinterface.
   *
   * @param writer the writer that is writing the output.
   * @param md the {@link MethodDoc} that we are documenting.
   * @param holderTag the tag that holds the inheritDoc tag.
   * @param isFirstSentence true if we only want to inherit the first sentence.
   */
  private TagletOutput retrieveInheritedDocumentation(
      TagletWriter writer, MethodDoc md, Tag holderTag, boolean isFirstSentence) {
    TagletOutput replacement = writer.getTagletOutputInstance();

    Configuration configuration = writer.configuration();
    Taglet inheritableTaglet =
        holderTag == null ? null : configuration.tagletManager.getTaglet(holderTag.name());
    if (inheritableTaglet != null && !(inheritableTaglet instanceof InheritableTaglet)) {
      // This tag does not support inheritence.
      configuration.message.warning(
          md.position(), "doclet.noInheritedDoc", md.name() + md.flatSignature());
    }
    DocFinder.Output inheritedDoc =
        DocFinder.search(
            new DocFinder.Input(
                md, (InheritableTaglet) inheritableTaglet, holderTag, isFirstSentence, true));
    if (inheritedDoc.isValidInheritDocTag == false) {
      configuration.message.warning(
          md.position(), "doclet.noInheritedDoc", md.name() + md.flatSignature());
    } else if (inheritedDoc.inlineTags.length > 0) {
      replacement =
          writer.commentTagsToOutput(
              inheritedDoc.holderTag,
              inheritedDoc.holder,
              inheritedDoc.inlineTags,
              isFirstSentence);
    }
    return replacement;
  }
Exemple #2
0
 /**
  * Convert the individual ParamTag into TagletOutput.
  *
  * @param isNonTypeParams true if this is just a regular param tag. False if this is a type param
  *     tag.
  * @param writer the taglet writer for output writing.
  * @param paramTag the tag whose inline tags will be printed.
  * @param name the name of the parameter. We can't rely on the name in the param tag because we
  *     might be inheriting documentation.
  * @param isFirstParam true if this is the first param tag being printed.
  */
 private TagletOutput processParamTag(
     boolean isNonTypeParams,
     TagletWriter writer,
     ParamTag paramTag,
     String name,
     boolean isFirstParam) {
   TagletOutput result = writer.getOutputInstance();
   String header =
       writer
           .configuration()
           .getText(isNonTypeParams ? "doclet.Parameters" : "doclet.TypeParameters");
   if (isFirstParam) {
     result.appendOutput(writer.getParamHeader(header));
   }
   result.appendOutput(writer.paramTagOutput(paramTag, name));
   return result;
 }