mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 15:24:43 +02:00
8266766: Arrays of types that cannot be an annotation member do not yield exceptions
Reviewed-by: darcy, jfranck
This commit is contained in:
parent
d43c8a74b3
commit
09243822eb
2 changed files with 142 additions and 2 deletions
|
@ -528,10 +528,11 @@ public class AnnotationParser {
|
|||
} else if (componentType.isEnum()) {
|
||||
return parseEnumArray(length, (Class<? extends Enum<?>>)componentType, buf,
|
||||
constPool, container);
|
||||
} else {
|
||||
assert componentType.isAnnotation();
|
||||
} else if (componentType.isAnnotation()) {
|
||||
return parseAnnotationArray(length, (Class <? extends Annotation>)componentType, buf,
|
||||
constPool, container);
|
||||
} else {
|
||||
return parseUnknownArray(length, buf);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -753,6 +754,18 @@ public class AnnotationParser {
|
|||
return (exceptionProxy != null) ? exceptionProxy : result;
|
||||
}
|
||||
|
||||
private static Object parseUnknownArray(int length,
|
||||
ByteBuffer buf) {
|
||||
int tag = 0;
|
||||
|
||||
for (int i = 0; i < length; i++) {
|
||||
tag = buf.get();
|
||||
skipMemberValue(tag, buf);
|
||||
}
|
||||
|
||||
return exceptionProxy(tag);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an appropriate exception proxy for a mismatching array
|
||||
* annotation where the erroneous array has the specified tag.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue