apache/maven · error · DIException

More than one scope annotation on {}

Error message

More than one scope annotation on {}

What it means

Error "More than one scope annotation on {}" thrown in apache/maven.

Source

Thrown at impl/maven-di/src/main/java/org/apache/maven/di/impl/ReflectionUtils.java:105

                    throw new DIException("More than one qualifier annotation on " + annotatedElement);
                }
                if (annotation instanceof Named named) {
                    qualifier = named.value();
                } else {
                    Class<? extends Annotation> annotationType = annotation.annotationType();
                    qualifier = annotationType.getDeclaredMethods().length == 0 ? annotationType : annotation;
                }
            }
        }
        return qualifier;
    }

    public static @Nullable Annotation scopeOf(AnnotatedElement annotatedElement) {
        Annotation scope = null;
        for (Annotation annotation : annotatedElement.getDeclaredAnnotations()) {
            if (annotation.annotationType().isAnnotationPresent(org.apache.maven.api.di.Scope.class)) {
                if (scope != null) {
                    throw new DIException("More than one scope annotation on " + annotatedElement);
                }
                scope = annotation;
            }
        }
        return scope;
    }

    public static <T> Key<T> keyOf(@Nullable Type container, Type type, AnnotatedElement annotatedElement) {
        return Key.ofType(
                container != null ? Types.bind(type, Types.getAllTypeBindings(container)) : type,
                qualifierOf(annotatedElement));
    }

    public static <T extends AnnotatedElement & Member> List<T> getAnnotatedElements(
            Class<?> cls,
            Class<? extends Annotation> annotationType,
            Function<Class<?>, T[]> extractor,
            boolean allowStatic) {

View on GitHub (pinned to e4093d4e12)

When it happens

Trigger: Thrown at impl/maven-di/src/main/java/org/apache/maven/di/impl/ReflectionUtils.java:105 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of apache/maven@e4093d4e12 (2026-08-21). Data as JSON: /api/errors/be8a5e795564c238. Report an issue: GitHub.