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

(reflect spec) Method.invoke() should discuss return type for primitive arrays

XMLWordPrintable

      javadoc of invoke() method of java.lang.reflect does not mention
      what will be the return type in case return types are arrays of
      primitive types. Whereas it says in cae of primitive type it is first
      appropriately wraped in an Object.

      As the return type is Object people trying to use the Syntax
      (Object[])invoke();
      will hit ClassCastException if return type of method they tried to invoke
      is primitive array type.

      It is more hard to guess now since Autoboxing is in place.

            darcy Joe Darcy
            jsinghsunw Jit Singh (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: