Example #1
0
  /** {@inheritDoc} */
  public void inherit(DocFinder.Input input, DocFinder.Output output) {
    ClassDoc exception;
    if (input.tagId == null) {
      ThrowsTag throwsTag = (ThrowsTag) input.tag;
      exception = throwsTag.exception();
      input.tagId =
          exception == null ? throwsTag.exceptionName() : throwsTag.exception().qualifiedName();
    } else {
      exception = input.method.containingClass().findClass(input.tagId);
    }

    ThrowsTag[] tags = input.method.throwsTags();
    for (int i = 0; i < tags.length; i++) {
      if (input.tagId.equals(tags[i].exceptionName())
          || (tags[i].exception() != null
              && (input.tagId.equals(tags[i].exception().qualifiedName())))) {
        output.holder = input.method;
        output.holderTag = tags[i];
        output.inlineTags =
            input.isFirstSentence ? tags[i].firstSentenceTags() : tags[i].inlineTags();
        output.tagList.add(tags[i]);
      } else if (exception != null
          && tags[i].exception() != null
          && tags[i].exception().subclassOf(exception)) {
        output.tagList.add(tags[i]);
      }
    }
  }
Example #2
0
 /** {@inheritDoc} */
 public void inherit(DocFinder.Input input, DocFinder.Output output) {
   if (input.tagId == null) {
     input.isTypeVariableParamTag = ((ParamTag) input.tag).isTypeParameter();
     Object[] parameters =
         input.isTypeVariableParamTag
             ? (Object[]) ((MethodDoc) input.tag.holder()).typeParameters()
             : (Object[]) ((MethodDoc) input.tag.holder()).parameters();
     String target = ((ParamTag) input.tag).parameterName();
     int i;
     for (i = 0; i < parameters.length; i++) {
       String name =
           parameters[i] instanceof Parameter
               ? ((Parameter) parameters[i]).name()
               : ((TypeVariable) parameters[i]).typeName();
       if (name.equals(target)) {
         input.tagId = String.valueOf(i);
         break;
       }
     }
     if (i == parameters.length) {
       // Someone used {@inheritDoc} on an invalid @param tag.
       // We don't know where to inherit from.
       // XXX: in the future when Configuration is available here,
       // print a warning for this mistake.
       return;
     }
   }
   ParamTag[] tags =
       input.isTypeVariableParamTag ? input.method.typeParamTags() : input.method.paramTags();
   Map rankMap =
       getRankMap(
           input.isTypeVariableParamTag
               ? (Object[]) input.method.typeParameters()
               : (Object[]) input.method.parameters());
   for (int i = 0; i < tags.length; i++) {
     if (rankMap.containsKey(tags[i].parameterName())
         && rankMap.get(tags[i].parameterName()).equals((input.tagId))) {
       output.holder = input.method;
       output.holderTag = tags[i];
       output.inlineTags =
           input.isFirstSentence ? tags[i].firstSentenceTags() : tags[i].inlineTags();
       return;
     }
   }
 }