-
Bug
-
Resolution: Duplicate
-
P3
-
None
-
8
-
x86_64
-
linux
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
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
- duplicates
-
JDK-5087240 (reflect) Constructor.getGenericParameterTypes for nested class w/ generics fail
- Closed