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

Constructor.getGenericParameterTypes() with wrong number of parameters

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P3 P3
    • None
    • 8
    • core-libs

      FULL PRODUCT VERSION :
      java version "1.8.0"
      Java(TM) SE Runtime Environment (build 1.8.0-b132)
      Java HotSpot(TM) 64-Bit Server VM (build 25.0-b70, mixed mode)


      ADDITIONAL OS VERSION INFORMATION :
      Linux ivostmaina 3.13.6-gentoo #1 SMP Thu Mar 20 02:22:16 CET 2014 x86_64 AMD FX(tm)-8350 Eight-Core Processor AuthenticAMD GNU/Linux

      A DESCRIPTION OF THE PROBLEM :
      Constructor.getGenericParameterTypes() returns the wrong number of parameters if the Constructor instance is a constructor of an inner class. Constructor.getAnnotatedParameterTypes() returns the right number of types.

      Example:
      see test case

      REGRESSION. Last worked in version 8


      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      @Test
      public void java8_constructor_getGenericParameterTypes_v1()
      throws NoSuchMethodException, SecurityException {

      class OuterClass {

      class GenericClass<T> {

      }

      class InnerClass<T> {

      @SuppressWarnings("unused")
      public InnerClass(GenericClass<T> p) {
      }

      }
      }

      @SuppressWarnings("rawtypes")
      Constructor<OuterClass.InnerClass> constructor = OuterClass.InnerClass.class
      .getConstructor(OuterClass.class, OuterClass.GenericClass.class);

      assertEquals(2, constructor.getGenericParameterTypes().length);
      }
      ---------- END SOURCE ----------

      SUPPORT :
      YES

            darcy Joe Darcy
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: