Java Solaris Communities Sun Store Join SDN My Profile Why Join?
 
Bug Database
Bug Detail
Quick Lists
Top 25 Bugs
Top 25 RFE's
Recently Closed Bugs
Printable Page Printable Page


Bug Database
Bug ID: 5041975
Votes 0
Synopsis (reflect) please retrofit varargs onto Array.newInstance
Category java:classes_lang
Reported Against tiger-beta2
Release Fixed mustang(b63)
State 10-Fix Delivered, Verified, bug
Priority: 3-Medium
Related Bugs
Submit Date 04-MAY-2004
Description
The following method can usefully be retrofitted with varargs:

public static
Object java.lang.reflect.Array.newInstance(
    Class<?> componentType,
    int... dimensions);
See below for the suggested fix and JUnit testcase:

A DESCRIPTION OF THE FIX :
version :
java version "1.6.0-ea"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.6.0-ea-b54)
Java HotSpot(TM) Client VM (build 1.6.0-ea-b54, mixed mode, sharing)

diff -u :
--- Array.java.old      Wed Oct 12 14:58:53 2005
+++ Array.java.new      Wed Oct 12 15:01:40 2005
@@ -85,7 +85,7 @@
      * @exception NegativeArraySizeException if any of the components in
      * the specified <code>dimensions</code> argument is negative.
      */
-    public static Object newInstance(Class<?> componentType, int[] dimensions)
+    public static Object newInstance(Class<?> componentType, int... dimensions)
        throws IllegalArgumentException, NegativeArraySizeException {
        return multiNewArray(componentType, dimensions);
     }


JUnit TESTCASE :
/** javac -Xbootclasspath/p:. Path5041975Test.java
 *  java -Xbootclasspath/p:. Path5041975Test
 * @author remi
 */
public class Path5041975Test {
  public static void main(String[] args) {
    Object array=Array.newInstance(String.class, 2,3);
    if (!(array instanceof String[][]))
      throw new AssertionError("erreor in newInstance");
  }
}

FIX FOR BUG NUMBER:
5041975
Posted Date : 2005-10-12 13:57:03.0
Work Around
N/A
Evaluation
Perhaps for 1.6.

  xxxxx@xxxxx   2004-05-04
A reasonable request; trying for 1.6.
Posted Date : 2005-11-15 01:36:20.0
Comments
  
  Include a link with my name & email   


PLEASE NOTE: JDK6 is formerly known as Project Mustang