JDK-5092092 : (reflect) Class.getConstructors returns Constructor[], expect Constructor[
  • Type: Enhancement
  • Component: core-libs
  • Sub-Component: java.lang:reflect
  • Affected Version: 5.0
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • OS: linux
  • CPU: x86
  • Submitted: 2004-08-25
  • Updated: 2012-09-28
  • Resolved: 2005-11-08
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 6
6Resolved
Related Reports
Duplicate :  
Description
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) 
======================================================================

Comments
EVALUATION The issue identified in this bug is a member of the set of issues identified in 6229784; therefore, I'm closing this bug as a dup of the other. As explained in 6229784, unfortunately, returning Constructor<T>[] would not be type safe so Constructor<?>[] must be returned instead.
08-11-2005

CONVERTED DATA BugTraq+ Release Management Values COMMIT TO FIX: mustang
18-09-2004

EVALUATION The language support for arrays of parameterized types evolved during the course of Tiger; the return type for getConstructors was not ammdned to the most appropriate value once arrays of type parameterized types were allowed. Will consider this api refinement for Mustang; although changing the return type will cause some additional warnings in current clients. ###@###.### 2004-09-17
17-09-2004