Repository: micronaut-projects/micronaut-core
File: core/src/main/java/io/micronaut/core/annotation/AnnotationValue.java (Java)

Code before:
        Class<?>[] type = resolveClassValues(o);
        if (type != null) {
            return type;
        }
        return EMPTY_CLASS_ARRAY;
    }

    @NonNull
    @Override
    public AnnotationClassValue<?>[] annotationClassValues(@NonNull String member) {
        if (StringUtils.isEmpty(member)) {
            return AnnotationClassValue.ZERO_ANNOTATION_CLASS_VALUES;
        }
        Object o = values.get(member);
        if (o instanceof AnnotationClassValue<?> annotationClassValue) {
            return new AnnotationClassValue[]{annotationClassValue};
        }
        if (o instanceof AnnotationClassValue<?>[] annotationClassValues) {
            return annotationClassValues;
        }
        if (o instanceof String className) {
            return new AnnotationClassValue[] { getAnnotationClassValue(className) };
        }
        if (o instanceof String[] classNames) {
            return Arrays.stream(classNames).map(AnnotationValue::getAnnotationClassValue).toArray(AnnotationClassValue[]::new);
        }
        return AnnotationClassValue.ZERO_ANNOTATION_CLASS_VALUES;
    }

    @Override
    public Optional<AnnotationClassValue<?>> annotationClassValue(@NonNull String member) {
        if (StringUtils.isEmpty(member)) {
            return Optional.empty();
        }
        Object o = values.get(member);
        if (o instanceof AnnotationClassValue<?> annotationClassValue) {
            return Optional.of(annotationClassValue);
        }
        if (o instanceof AnnotationClassValue<?>[] annotationClassValues) {
            if (annotationClassValues.length > 0) {
                return Optional.of(annotationClassValues[0]);
            }
        }
        return Optional.empty();
    }

    /**
     * The integer value of the given member.
     *
     * @param member The annotation member
     * @return An {@link OptionalInt}

Review comment (suggestion):
Please also add the same logic to the method below `public Optional<AnnotationClassValue<?>> annotationClassValue(@NonNull String member) {`

Code after:
        Class<?>[] type = resolveClassValues(o);
        if (type != null) {
            return type;
        }
        return EMPTY_CLASS_ARRAY;
    }

    @NonNull
    @Override
    public AnnotationClassValue<?>[] annotationClassValues(@NonNull String member) {
        if (StringUtils.isEmpty(member)) {
            return AnnotationClassValue.ZERO_ANNOTATION_CLASS_VALUES;
        }
        Object o = values.get(member);
        if (o instanceof AnnotationClassValue<?> annotationClassValue) {
            return new AnnotationClassValue[]{annotationClassValue};
        }
        if (o instanceof AnnotationClassValue<?>[] annotationClassValues) {
            return annotationClassValues;
        }
        if (o instanceof String className) {
            return new AnnotationClassValue[] { getAnnotationClassValue(className) };
        }
        if (o instanceof String[] classNames) {
            return Arrays.stream(classNames).map(AnnotationValue::getAnnotationClassValue).toArray(AnnotationClassValue[]::new);
        }
        return AnnotationClassValue.ZERO_ANNOTATION_CLASS_VALUES;
    }

    @Override
    public Optional<AnnotationClassValue<?>> annotationClassValue(@NonNull String member) {
        if (StringUtils.isEmpty(member)) {
            return Optional.empty();
        }
        Object o = values.get(member);
        if (o instanceof AnnotationClassValue<?> annotationClassValue) {
            return Optional.of(annotationClassValue);
        }
        if (o instanceof AnnotationClassValue<?>[] annotationClassValues) {
            if (annotationClassValues.length > 0) {
                return Optional.of(annotationClassValues[0]);
            }
        }
        if (o instanceof String className) {
            return Optional.of(getAnnotationClassValue(className));
        }
        if (o instanceof String[] classNames && classNames.length > 0) {
            return Optional.of(getAnnotationClassValue(classNames[0]));
        }
        return Optional.empty();
    }