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

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

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P3
    • tbd
    • 6
    • core-libs
    • Fix Understood
    • x86
    • 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

              darcy Joe Darcy
              jssunw Jitender S (Inactive)
              Votes:
              1 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Imported:
                Indexed: