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

(reflect) getGenericParameterTypes() should return GenericArrayType

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • 5.0
    • core-libs



      Name: rmT116609 Date: 02/25/2004


      FULL PRODUCT VERSION :
      java version "1.5.0-beta"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-beta-b32c)
      Java HotSpot(TM) Client VM (build 1.5.0-beta-b32c, mixed mode)

      ADDITIONAL OS VERSION INFORMATION :
      Windows XP

      A DESCRIPTION OF THE PROBLEM :
      getGenericParameterTypes() returns confusing values under certain conditions.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      javac -source 1.5 BugTest.java
      java BugTest

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      public BugTest(java.lang.String[],java.util.List)
              class [Ljava.lang.String; sun.reflect.generics.reflectiveObjects.ParameterizedTypeImpl@530daa
      public BugTest(java.lang.String[])
              class [Ljava.lang.String;

      ACTUAL -
      public BugTest(java.lang.String[],java.util.List)
              sun.reflect.generics.reflectiveObjects.GenericArrayTypeImpl@1729854
              sun.reflect.generics.reflectiveObjects.ParameterizedTypeImpl@6eb38a
      public BugTest(java.lang.String[])
              class [Ljava.lang.String;


      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import java.lang.reflect.*;
      import java.util.*;
      public class BugTest<E> {
         public BugTest(String []args) {
         }
         public BugTest(String []args, List<E> list) {
         }
         public static void main(String... args){
            Class c = BugTest.class;
            Constructor[] constructors = c.getConstructors();
            for(Constructor cons : constructors){
               System.out.println(cons);
               Type[] types = cons.getGenericParameterTypes();
               for(Type t : types){
                  System.out.println("\t" + t);
               }
            }
         }
      }

      ---------- END SOURCE ----------
      (Incident Review ID: 240296)
      ======================================================================
      ###@###.### 2004-02-25

            darcy Joe Darcy
            rmandalasunw Ranjith Mandala (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: