Apply instanceof pattern matching

See gh-40085
This commit is contained in:
Felix
2024-03-23 18:42:27 +03:00
committed by Scott Frederick
parent 6825bdaf79
commit 8a42935dad
23 changed files with 76 additions and 78 deletions

View File

@@ -106,8 +106,8 @@ final class ModifiedClassPathClassLoader extends URLClassLoader {
private static Collection<AnnotatedElement> getAnnotatedElements(Object[] array) {
Set<AnnotatedElement> result = new LinkedHashSet<>();
for (Object item : array) {
if (item instanceof AnnotatedElement) {
result.add((AnnotatedElement) item);
if (item instanceof AnnotatedElement annotatedElement) {
result.add(annotatedElement);
}
else if (ObjectUtils.isArray(item)) {
result.addAll(getAnnotatedElements(ObjectUtils.toObjectArray(item)));