Add another type check. · raphw/byte-buddy@899aaf6 (original) (raw)

File tree

Original file line number Diff line number Diff line change
@@ -2452,6 +2452,9 @@ public Sort getSort() {
2452 2452 public AnnotationValue<U, V> filter(MethodDescription.InDefinedShape property, TypeDefinition typeDefinition) {
2453 2453 if (typeDefinition.isArray() && typeDefinition.getComponentType().asErasure().equals(componentType)) {
2454 2454 for (AnnotationValue value : values) {
2455 +if (value.getSort() != Sort.of(componentType)) {
2456 +return new ForMismatchedType<U, V>(property, RenderingDispatcher.CURRENT.toArrayErrorString(value.getSort()));
2457 + }
2455 2458 value = value.filter(property, typeDefinition.getComponentType());
2456 2459 if (value.getState() != State.RESOLVED) {
2457 2460 return (AnnotationValue<U, V>) value;