JDK-6404663 : Varargs parameter in Class.getConstructor(Class...) is not generic, among others
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.lang:reflect
  • Affected Version: 6
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: linux,windows_xp
  • CPU: x86
  • Submitted: 2006-03-27
  • Updated: 2017-05-16
  • Resolved: 2006-07-01
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
6 b91Fixed
Related Reports
Duplicate :  
Relates :  
Description
FULL PRODUCT VERSION :
java version "1.6.0-beta2"
Java(TM) SE Runtime Environment (build 1.6.0-beta2-b77)
Java HotSpot(TM) Client VM (build 1.6.0-beta2-b77, mixed mode)

EXTRA RELEVANT SYSTEM CONFIGURATION :
The Mustang API at:
http://download.java.net/jdk6/docs/api/

A DESCRIPTION OF THE PROBLEM :
Other bugs exist in the database, and have been fixed for various method arguments and return types in java.lang.Class that use the raw type instead of the wildcard; but there are still several references to the raw type that appear to need to be fixed:

    Constructor<T> getConstructor(Class...)
should be:
    Constructor<T> getConstructor(Class<?>...)

    Class[] getDeclaredClasses()
should be:
    Class<?>[] getDeclaredClasses()

    Constructor<T> getDeclaredConstructor(Class...)
should be:
    Constructor<T> getDeclaredConstructor(Class<?>...)

    Constructor[] getDeclaredConstructors()
should be:
    Constructor<T>[] getDeclaredConstructors()

    Method getDeclaredMethod(String, Class...)
should be:
    Method getDeclaredMethod(String, Class<?>...)

    Method getMethod(String, Class...)
should be:
    Method getMethod(String, Class<?>...)


And also:

java.lang.Member:
    Class getDeclaringClass()
should be:
    Class<?> getDeclaringClass()


(These cause compiler warnings in JSE 5.)  Are these also scheduled to be fixed before release?


REPRODUCIBILITY :
This bug can be reproduced always.

Comments
EVALUATION Generic arrays are not typesafe. That's why, for example, you are not allowed to do this: new Constructor<T>[17] For the same reason, the proper generification of: Constructor[] getDeclaredConstructors() is: Constructor<?>[] getDeclaredConstructors() rather than: Constructor<T>[] getDeclaredConstructors()
12-06-2006

EVALUATION Should be addressed subject to compatability limitations.
13-04-2006