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

(reflect spec) Class.getMethods() returns non-empty array for array classes

XMLWordPrintable



      Name: nt126004 Date: 09/28/2001


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

      The following example should return "0" as mentioned in the Java API
      Documentation for java.lang.Class.getMethods():

      -- extracted from documentation:

      This method returns an array of length 0 if this Class object represents a class
      or interface that has no public member methods, or if this Class object
      represents an array class, primitive type, or void.

      ---

      public class test
      {
          public static void main(String[] args) {
              System.out.println(args.getClass().getMethods().length);
          }
      }

      => returns 9 (all inherited Methods from java/lang/Object).
      (Review ID: 132553)
      ======================================================================

            iris Iris Clark
            nthompsosunw Nathanael Thompson (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: