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

Allow {@inheritDoc name} for constructors

    XMLWordPrintable

Details

    Description



      Name: nt126004 Date: 01/29/2003


      FULL PRODUCT VERSION :
      > java -version
      java version "1.4.1_01"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1_01-b01)
      Java HotSpot(TM) Client VM (build 1.4.1_01-b01, mixed mode)


      FULL OPERATING SYSTEM VERSION :
      > rpm --query glibc
      glibc-2.2.5-164
      > uname -a
      Linux jupiter 2.4.19-4GB #1 Fri Sep 13 13:19:15 UTC 2002
      i686 unknown

      A DESCRIPTION OF THE PROBLEM :
      {@inheritDoc} currently does not work on constructors. This is, of course, because constructors are not inherited. It is a feature of the Java language not to inherit constructors (as it is a feature of Perl to in fact inherit
      constructors).

      But sometimes, constructors are pseudo-inherited
      constructors like this:

      public class X {
          /** documentation */
          public X() {
          }
          /** documentation
           * @param a some parameter
           * @param b some other parameter
           */
          public X(int a, int b) {
          }
      }

      public class Y extends X implements Z {
          /** {@inheritDoc} */
          public X() {
              super();
          }
          /** {@inheritDoc} */
          public X(int a, int b) {
              super(a, b);
          }
      }

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      public class X {
          /** documentation */
          public X() {
          }
          /** documentation
           * @param a some parameter
           * @param b some other parameter
           */
          public X(int a, int b) {
          }
      }

      public class Y extends X implements Z {
          /** {@inheritDoc} */
          public X() {
              super();
          }
          /** {@inheritDoc} */
          public X(int a, int b) {
              super(a, b);
          }
      }
      ---------- END SOURCE ----------
      (Review ID: 180360)
      ======================================================================

      Duplicate bug 4743385 has a different justification for this feature:

      Sometimes one wants to imherit documentation in
      constructors, especially for Exceptions (they can be many in
      the system and they often have several constructors).

      Could we have a tag similar to inheritDoc (or could we make
      inheritDoc work with constructors (even if the name is not
      adapted).

      Attachments

        Issue Links

          Activity

            People

              bpatel Bhavesh Patel (Inactive)
              nthompsosunw Nathanael Thompson (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: