8213905: reflection not working for type annotations applied to exception types in the inner class constructor
Reviewed-by: jlahoda
This commit is contained in:
parent
295c0474c4
commit
2eab86b513
@ -132,7 +132,8 @@ public final class TypeAnnotationParser {
|
||||
Class<?> declaringClass = ctor.getDeclaringClass();
|
||||
if (!declaringClass.isEnum() &&
|
||||
(declaringClass.isMemberClass() &&
|
||||
(declaringClass.getModifiers() & Modifier.STATIC) == 0) ) {
|
||||
(declaringClass.getModifiers() & Modifier.STATIC) == 0) &&
|
||||
filter == TypeAnnotation.TypeAnnotationTarget.METHOD_FORMAL_PARAMETER) {
|
||||
offset = true;
|
||||
}
|
||||
}
|
||||
|
@ -39,7 +39,8 @@ public class TypeAnnotationReflection {
|
||||
testReturnType();
|
||||
testNested();
|
||||
testArray();
|
||||
testRunException();
|
||||
testRunException(TestClassException.class.getDeclaredMethod("foo", (Class<?>[])null));
|
||||
testRunException(Outer2.TestClassException2.class.getDeclaredConstructor(Outer2.class));
|
||||
testClassTypeVarBounds();
|
||||
testMethodTypeVarBounds();
|
||||
testFields();
|
||||
@ -142,9 +143,8 @@ public class TypeAnnotationReflection {
|
||||
check(((TypeAnno)annos[0]).value().equals("return4"));
|
||||
}
|
||||
|
||||
private static void testRunException() throws Exception {
|
||||
Method m = TestClassException.class.getDeclaredMethod("foo", (Class<?>[])null);
|
||||
AnnotatedType[] ts = m.getAnnotatedExceptionTypes();
|
||||
private static void testRunException(Executable e) throws Exception {
|
||||
AnnotatedType[] ts = e.getAnnotatedExceptionTypes();
|
||||
check(ts.length == 3);
|
||||
|
||||
AnnotatedType t;
|
||||
@ -624,6 +624,15 @@ abstract class TestClassException {
|
||||
}
|
||||
}
|
||||
|
||||
class Outer2 {
|
||||
abstract class TestClassException2 {
|
||||
public TestClassException2() throws
|
||||
@TypeAnno("RE") @TypeAnno2("RE2") RuntimeException,
|
||||
NullPointerException,
|
||||
@TypeAnno("AIOOBE") ArrayIndexOutOfBoundsException {}
|
||||
}
|
||||
}
|
||||
|
||||
abstract class TestClassTypeVarAndField <T extends @TypeAnno("Object1") Object
|
||||
& @TypeAnno("Runnable1") @TypeAnno2("Runnable2") Runnable,
|
||||
@TypeAnno("EE")EE extends @TypeAnno2("EEBound") Runnable, V > {
|
||||
|
Loading…
Reference in New Issue
Block a user