mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 15:24:43 +02:00
8228988: AnnotationParser throws NullPointerException on incompatible member type
Reviewed-by: darcy
This commit is contained in:
parent
d61345984d
commit
f47faf283b
3 changed files with 182 additions and 4 deletions
|
@ -358,10 +358,14 @@ public class AnnotationParser {
|
|||
result = parseConst(tag, buf, constPool);
|
||||
}
|
||||
|
||||
if (!(result instanceof ExceptionProxy) &&
|
||||
!memberType.isInstance(result))
|
||||
if (result == null) {
|
||||
result = new AnnotationTypeMismatchExceptionProxy(
|
||||
memberType.getClass().getName());
|
||||
} else if (!(result instanceof ExceptionProxy) &&
|
||||
!memberType.isInstance(result)) {
|
||||
result = new AnnotationTypeMismatchExceptionProxy(
|
||||
result.getClass() + "[" + result + "]");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -469,8 +473,10 @@ public class AnnotationParser {
|
|||
String typeName = constPool.getUTF8At(typeNameIndex);
|
||||
int constNameIndex = buf.getShort() & 0xFFFF;
|
||||
String constName = constPool.getUTF8At(constNameIndex);
|
||||
|
||||
if (!typeName.endsWith(";")) {
|
||||
if (!enumType.isEnum()) {
|
||||
return new AnnotationTypeMismatchExceptionProxy(
|
||||
typeName + "." + constName);
|
||||
} else if (!typeName.endsWith(";")) {
|
||||
// support now-obsolete early jsr175-format class files.
|
||||
if (!enumType.getName().equals(typeName))
|
||||
return new AnnotationTypeMismatchExceptionProxy(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue