Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4767038

first sentence not determined correctly with use of {@inheritDoc}

XMLWordPrintable

    • tiger
    • x86, sparc
    • linux, solaris_8

      When {@inheritDoc} is used to inherit the beginning of the description of a method comment, the determination of the "first sentence" of the [overriding] method's comment doesn't seem to properly consider the content of the text that will be inherited; instead, the determination of the end of the first sentence seems to consider the description text before expanding the {@inheritDoc}.

      Here is an example:

      public class Super {
          /**
           * This is the first sentence of Super's method doc comment.
           * This is the rest of Super's method doc comment.
           */
          public void method() { }
      }

      public class Sub extends Super {
          /**
           * {@inheritDoc}
           * This is the first sentence of Sub's method doc comment.
           * This is the rest of Sub's method doc comment.
           */
          public void method() { }
      }

      I would like and desired the first sentence of Sub.method's doc comment to be considered to be

      This is the first sentence of Super's method doc comment.

      but instead, the description of Sub.method in Sub's "Method Summary" is generated to be

      This is the first sentence of Super's method doc comment. This is
      the rest of Super's method doc comment. This is the first sentence of
      Sub's method doc comment.

      It seems that the end of the Sub.method's first sentence is being chosen where it is because that's where the first period followed by a space (and a capital letter) is found *without* expanding the {@inheritDoc} for that consideration.


      Name: rmT116609 Date: 02/27/2003


      DESCRIPTION OF THE PROBLEM :
      Javadoc includes the whole inherited method comment in the
      first sentence summary, even when it contains many sentences.

      I haven't looked at the source, but javadoc seems to be
      parsing for the breakiterator before evaluating the inline
      taglets. Thus the first-sentence-summary contains all the
      sentences of the superclass plus the first sentence of the
      subclass, if the {@inheritDoc} appears before the end of the
      first sentence.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      1. javadoc SuperClass.java SubClass.java
      (same results, regardless of -breakiterator)

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      SubClass's METHOD SUMMARY contents:

      expected:
      foo()
                First sentence from superclass.

      actual:
      foo()
                First sentence from superclass. Second sentence
      from superclass. First sentence from subclass.

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      public class SuperClass {
              /**
               * First sentence from superclass. Second sentence from superclass.
               */
              public void foo() {}
      }

      public class SubClass extends SuperClass {
              /**
               * {@inheritDoc} First sentence from subclass. Second sentence from
      subclass.
               */
              public void foo() {}
      }

      ---------- END SOURCE ----------

      (Review ID: 181837)
      ======================================================================

            martin Martin Buchholz
            peterjones Peter Jones (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: