-
Bug
-
Resolution: Fixed
-
P4
-
8u20
-
b17
-
generic
-
generic
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8064741 | 9 | Eric Mccorkle | P4 | Closed | Fixed | b40 |
JDK-8084200 | emb-9 | Unassigned | P4 | Resolved | Fixed | team |
JDK-8067581 | 8u45 | Eric Mccorkle | P4 | Resolved | Fixed | b01 |
JDK-8070069 | emb-8u47 | Eric Mccorkle | P4 | Resolved | Fixed | team |
JDK-8064474 | na | Eric Mccorkle | P4 | Closed | Not an Issue |
java version "1.8.0_20-ea"
Java(TM) SE Runtime Environment (build 1.8.0_20-ea-b23)
Java HotSpot(TM) 64-Bit Server VM (build 25.20-b22, mixed mode)
A DESCRIPTION OF THE PROBLEM :
Let there be an non-static inner class with a constructor which has a generic parameter type. Invoking toString() on a j.l.r.Parameter instance representing this parameter fails with an ArrayIndexOutOfBoundsException. As of 1.8.0_20-ea-b23, also Parameter#getAnnotatedType() is effected.
I believe this is related to issue https://bugs.openjdk.java.net/browse/JDK-5087240. I'm creating this separate issue as also getAnnotatedType() is concerned and now not only user code invoking Constructor#getGenericParameterTypes() is affected, but JDK code itself which invokes this method.
Note that getAnnotatedType() used to work as of 1.8.0_11 (the implementation of Executable#getAnnotatedParameterTypes() has changed since then and now also uses getGenericParameterTypes()).
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
public class ParameterBug {
public static void main(String[] args) throws Exception {
Constructor<MyEntity> constructor = MyEntity.class.getConstructor( ReflectionBug.class, Set.class );
for ( Parameter parameter : constructor.getParameters() ) {
// the following line raises an AIOOBE for the second parameter
System.out.println( parameter.toString() );
// this fails as well
System.out.println( parameter.getAnnotatedType() );
}
}
public class MyEntity {
public MyEntity(Set<?> names) {
}
}
}
---------- END SOURCE ----------
- backported by
-
JDK-8067581 Parameter#toString() fails w/ AIOOBE for ctr of inner class w/ generic type
- Resolved
-
JDK-8070069 Parameter#toString() fails w/ AIOOBE for ctr of inner class w/ generic type
- Resolved
-
JDK-8084200 Parameter#toString() fails w/ AIOOBE for ctr of inner class w/ generic type
- Resolved
-
JDK-8064474 Parameter#toString() fails w/ AIOOBE for ctr of inner class w/ generic type
- Closed
-
JDK-8064741 Parameter#toString() fails w/ AIOOBE for ctr of inner class w/ generic type
- Closed
- duplicates
-
JDK-8066092 java.lang.reflect.Parameter::toString throws exception on certain circumstances
- Closed
- is blocked by
-
JDK-8062582 Classfile format contains insufficent information for implementing parts of the reflection API
- Open
-
JDK-8029012 parameter_index for type annotation not updated after outer.this added
- Closed
- relates to
-
JDK-5087240 (reflect) Constructor.getGenericParameterTypes for nested class w/ generics fail
- Closed