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

(reflect) Class<T>.getConstructors returns Constructor[], expect Constructor<T>[

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Duplicate
    • Icon: P3 P3
    • 6
    • 5.0
    • core-libs

      Name: jl125535 Date: 08/25/2004


      A DESCRIPTION OF THE REQUEST :
      The title says it all. It ruins the type safety of it. Strangely, getConstructor() does return Constructor<T>.

      JUSTIFICATION :
      Much code cannot run with it like this and I can think of no reason why the API should be phrased this way.


      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Return Constructor<T>[], not Constructor[].

      CUSTOMER SUBMITTED WORKAROUND :
      I have patched the source to java/lang/Class.java, it compiles and seems to test out OK. Unfortunately, code developed with the patched RT cannot be run on client's machines since they want to use virgin RTs.

      (Incident Review ID: 300776)
      ======================================================================

            darcy Joe Darcy
            jleesunw Jon Lee (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: