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

stddoclet: Javadoc fails to document private inner class methods & members

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • 1.3.1, 1.4.0
    • tools
    • x86, sparc
    • solaris_8, windows_2000



      Name: bsC130419 Date: 06/22/2001


      java version "1.3.0"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0)
      Java HotSpot(TM) Client VM (build 1.3.0, mixed mode)


      If an inner class is private, Javadoc won't produce documentation for any of its
      methods or data members when using the -private command-line switch. It -will-
      produce a page that contains the class description. Declaring the inner class
      static doesn't make a difference, either. There is nothing in the Javadoc
      documentation that mentions this, so I'm assuming that it's a bug (and not a
      feature request. Here's a sample source file that exhibits the bug when using
      the command line
      javadoc -private Man.java

      *** start source ***

      /**
       * <p>A class with class.</p>
       */
      public
      class Man {
        public static
        void
        main( String[] argv ) {
          Man man = new Man();
          Man.Bar bar = new Man.Bar();

          man.walkInto( bar );
          man.duck( bar );

        } // end main()

        /**
         * <p>Avoid the specified {@link Man.Bar}.</p>
         */
        public void duck( final Bar bar ) { }
        
        /**
         * <p>Walk into the specified {@link Man.Bar}.</p>
         */
        public void walkInto( final Bar bar ) { }
        

        /**
         * <p>An inner class of {@link Man}.</p>
         */
        private static class Bar {
          /**
           * <p>Construct a {@link Man.Bar}.</p>
           */
          public Bar() { }

          /**
           * <p>Do something.</p>
           */
          public void doSomething() { }
        
          /**
           * <p>Do something else.</p>
           */
          public void doSomethingElse() {
        
          } // end doSomethingElse()

        } // end Bar inner class

      } // end Man class

      *** end source ***

      The text-only version of the page that's produced looks like this:

      Class Man.Bar

      java.lang.Object
        |
        +--Man.Bar

      Enclosing class:
            Man



      private static class Man.Bar
      extends java.lang.Object

      An inner class of Man.



       Methods inherited from class java.lang.Object
       , clone, equals, finalize, getClass, hashCode, notify, notifyAll,
      registerNatives, toString,
       wait, wait, wait
      (Review ID: 125433)
      ======================================================================

      Name: bsC130419 Date: 06/22/2001


      java version "1.3.1"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.1-b24)
      Java HotSpot(TM) Client VM (build 1.3.1-b24, mixed mode)


      javadoc -private displays private fields and methods of an outer class
      and of nested non-private inner classes, but not of nested private inner
      classes. I think it should display everything.

      Here's an outer class with three inner classes: one private, one protected,
      one public. Run javadoc -private JavadocBug.java and look at the results.
      The protected and public inner classes work as I expect, but the private
      gets displayed without its methods and fields.

      /**
       * An outer class.
       *
       * @author Jutta Degener
       * @created June 20, 2001
       */
      public class JavadocBug {

          private int privateMember;
          protected int protectedMember;
          public int publicMember;

          /** A public inner class. With -private, all its three fields and
           * three methods will be shown. Good.
           */
          public class PublicInnerClass
          {
              public int publicInnerMember = 0;
              protected int protectedInnerMember = 0;
              private int privateInnerMember = 0;

              public void publicInnerMethod() {}
              protected void protectedInnerMethod() {}
              private void privateInnerMethod() {}
          }

          /** A protected inner class. With -private, it is listed like
           * the public one. Good.
           */
          protected class ProtectedInnerClass
          {
              public int publicInnerMember = 0;
              protected int protectedInnerMember = 0;
              private int privateInnerMember = 0;

              public void publicInnerMethod() {}
              protected void protectedInnerMethod() {}
              private void privateInnerMethod() {}
          }

          /** A private inner class. It will be listed, but not
           * its fields or methods, even with javadoc -private. Bad.
           */
          private class PrivateInnerClass
          {
              /** None of these will show up. Why not? */

              public int publicInnerMember = 0;
              protected int protectedInnerMember = 0;
              private int privateInnerMember = 0;

              public void publicInnerMethod() {}
              protected void protectedInnerMethod() {}
              private void privateInnerMethod() {}
          }
      }
      (Review ID: 127047)
      ======================================================================

            jhosunw Jamie Ho (Inactive)
            bstrathesunw Bill Strathearn (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: