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

There seems to be no way to get an array Class from another Class.

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Not an Issue
    • Icon: P5 P5
    • None
    • 1.1, 1.1.5
    • core-libs
    • generic, sparc
    • generic, solaris_2.5.1



      Name: mc57594 Date: 02/11/97


      The problem is very simple: When one is working with the Core Reflection API, it is sometimes useful to be able to go from an arbitrary Class A to the Class representing an array of Class A. This is the sort of code I need to be able to write:

      Object gimmeAnArray (Class cls, int size)
      {
        Class arrayCls = cls.getArrayClass (); // this is what I can't currently do
        return arrayCls.newInstance (size);
      }

      company - Electric Communities , email - ###@###.###
      ======================================================================

            never Tom Rodriguez
            mchamnessunw Mark Chamness (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: