From 899aaf66d9bee71fb226aa947535cd7c1e258ddd Mon Sep 17 00:00:00 2001 From: Rafael Winterhalter Date: Wed, 14 Aug 2024 20:36:28 +0200 Subject: [PATCH] Add another type check. --- .../net/bytebuddy/description/annotation/AnnotationValue.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/byte-buddy-dep/src/main/java/net/bytebuddy/description/annotation/AnnotationValue.java b/byte-buddy-dep/src/main/java/net/bytebuddy/description/annotation/AnnotationValue.java index b7e37fc833..1f64b70d2d 100644 --- a/byte-buddy-dep/src/main/java/net/bytebuddy/description/annotation/AnnotationValue.java +++ b/byte-buddy-dep/src/main/java/net/bytebuddy/description/annotation/AnnotationValue.java @@ -2452,6 +2452,9 @@ public Sort getSort() { public AnnotationValue filter(MethodDescription.InDefinedShape property, TypeDefinition typeDefinition) { if (typeDefinition.isArray() && typeDefinition.getComponentType().asErasure().equals(componentType)) { for (AnnotationValue value : values) { + if (value.getSort() != Sort.of(componentType)) { + return new ForMismatchedType(property, RenderingDispatcher.CURRENT.toArrayErrorString(value.getSort())); + } value = value.filter(property, typeDefinition.getComponentType()); if (value.getState() != State.RESOLVED) { return (AnnotationValue) value;