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

APIs duplicated in JavaDoc

XMLWordPrintable

    • In Review
    • generic
    • generic

      FULL PRODUCT VERSION :
      java version "1.8.0_121"
      Java(TM) SE Runtime Environment (build 1.8.0_121-b13)
      Java HotSpot(TM) 64-Bit Server VM (build 25.121-b13, mixed mode)

      ADDITIONAL OS VERSION INFORMATION :
      Darwin Rosss-MBP 15.6.0 Darwin Kernel Version 15.6.0: Mon Jan 9 23:07:29 PST 2017; root:xnu-3248.60.11.2.1~1/RELEASE_X86_64 x86_64

      A DESCRIPTION OF THE PROBLEM :
      Given the following:

      interface A
      interface B extends A
      abstract class C implements A
      public class D extends C implements B

      Every method that appears in A is repeated twice in the JavaDoc for D. Note that adding the javadoc -private causes a similar issue in that the methods are listed as inherited from interface example.A and from class example.C.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Create the following classes:

      package example;
      interface A {
         /**
         * JavaDoc for method in class A.
         */
         abstract void testA ( );
      }

      package example;
      interface B extends A {
         /**
         * JavaDoc for method in class B.
         */
         abstract void testB ( );
      }

      package example;
      abstract class C implements A {
         /*
         * Inherited JavaDoc
         */
         public final void testA ( ) {
            // Do nothing.
         }
      }

      package example;
      public final class D extends C implements B {
         /*
         * Inherited JavaDoc
         */
         public final void testB ( ) {
            // Do nothing.
         }
      }

      Run the following command:
      javadoc -d docs -sourcepath src -subpackages example

      Note that the javadoc for the method "testA" appears twice in the JavaDoc for class D.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Since the signatures for the method "testA" are the same whether taken from class C or interface B, the javadoc for method testA should only appear once in class D.
      ACTUAL -
      The javadoc for the method "testA" appears twice in the JavaDoc for class D.

      Note that adding the javadoc -private causes a similar issue in that the "testA" method is listed as inherited from interface example.A and from class example.C.

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      package example;
      interface A {
         /**
         * JavaDoc for method in class A.
         */
         abstract void testA ( );
      }

      package example;
      interface B extends A {
         /**
         * JavaDoc for method in class B.
         */
         abstract void testB ( );
      }

      package example;
      abstract class C implements A {
         /*
         * Inherited JavaDoc
         */
         public final void testA ( ) {
            // Do nothing.
         }
      }

      package example;
      public final class D extends C implements B {
         /*
         * Inherited JavaDoc
         */
         public final void testB ( ) {
            // Do nothing.
         }
      }
      ---------- END SOURCE ----------

            nbenalla Nizar Benalla
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated: