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

(reflect) Constructor.getGenericParameterTypes for nested class w/ generics fail

    Details

    • Type: Bug
    • Status: Open
    • Priority: P3
    • Resolution: Unresolved
    • Affects Version/s: 6
    • Fix Version/s: tbd_major
    • Component/s: core-libs
    • Labels:
    • Subcomponent:
    • Understanding:
      Fix Understood
    • CPU:
      x86
    • OS:
      windows_xp

      Description

      Name: js151677 Date: 08/16/2004


      FULL PRODUCT VERSION :
      build 1.5.0-beta2-b51

      ADDITIONAL OS VERSION INFORMATION :
      Windows XP

      A DESCRIPTION OF THE PROBLEM :
      Constructor.getGenericParameterTypes for a nested class fail with a parameterized type.
      The number of parameters is wrong (The first is missing).

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      See code

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      ConstructorBugTest$Nested(ConstructorBugTest,java.util.List,long)
              class ConstructorBugTest class java.lang.Class
              java.util.List<java.lang.String> class sun.reflect.generics.reflectiveObjects.ParameterizedTypeImpl
              long class java.lang.Class

      ACTUAL -
      ConstructorBugTest$Nested(ConstructorBugTest,java.util.List,long)
              java.util.List<java.lang.String> class sun.reflect.generics.reflectiveObjects.ParameterizedTypeImpl
              long class java.lang.Class


      REPRODUCIBILITY :
      This bug can be reproduced always.

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

      ---------- END SOURCE ----------
      (Incident Review ID: 297027)
      ======================================================================

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                darcy Joe Darcy
                Reporter:
                jssunw Jitender S (Inactive)
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Imported:
                  Indexed: