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

(reflect) String[] java.lang.reflect.{Method,Constructor}.getParameterNames()

    Details

    • Type: Enhancement
    • Status: Closed
    • Priority: P4
    • Resolution: Duplicate
    • Affects Version/s: 1.4.2, 5.0
    • Fix Version/s: None
    • Component/s: core-libs
    • Labels:

      Description

      Name: js151677 Date: 08/04/2004


      A DESCRIPTION OF THE REQUEST :
      Hi,

      Until now, the reflection of Java make a great work for the programs that need to call the functions. BUT .. doesn't do so much for the humans that need to read the profile of a method during the execution : The names of the arguments of a method, even if they can be included in the class file with a -g option during the compilation, cannot be accessed via the reflection mecanism.

      I am requesting the add of the functions :
      String[] getParameterNames() in the class java.lang.reflect.Method
      String[] getParameterNames() in the class java.lang.reflect.Constructor

      JUSTIFICATION :
      This function will help all the programmers of any bean builder or custom IDE.

      For example, me :
      I am programming a tool to let the user design some specific programs graphically. Actually, my program is limited to display the classes of the arguments of a method and the user have to guess what each argument is for since I have no easy way to obtain their names.


      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      The expected behavior for the 2 functions in java.lang.reflect.Method and class java.lang.reflect.Constructor is the same :

      This function will return a null pointer if there is no information about the names in the class where the Method is and will return a array of String if the names are there.

      ACTUAL -
      No way to obtain the names of the argument of a method or a constructor by reflection.

      CUSTOMER SUBMITTED WORKAROUND :
      Doing manually a read of the bytecode of the class.

      Not every programmer can afford to lose time to do it since it require to read and understand all the low level structure of a class file and been able to unterpret its bytecode.
      (Incident Review ID: 295670)
      ======================================================================

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                darcy Joe Darcy
                Reporter:
                jssunw Jitender S (Inactive)
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: