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

getDeclaredClasses always returns zero-length array

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P1 P1
    • None
    • 1.1
    • core-libs
    • None
    • sparc
    • solaris_2.5.1

      As far as I can tell, getDeclaredClasses always returns a zero-length array. Try running this:

      class t {
          class b { }
          int i, j;
       
          public static void main(String[] args) {
              System.out.println(t.class.getDeclaredClasses().length + " classes");
              System.out.println(t.class.getDeclaredFields().length + " fields");
              System.out.println(t.class.getDeclaredMethods().length + " methods");
          }
      }

      The output I get with JDK1.1.1E is

      0 classes
      3 fields
      2 methods

      I presume that t.b should be returned.

            nsaraiyasunw Nakul Saraiya (Inactive)
            karnoldsunw Kenneth Arnold (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: