apache/maven · error · DIException

@{} annotation is not allowed on {}

Error message

@{} annotation is not allowed on {}

What it means

Error "@{} annotation is not allowed on {}" thrown in apache/maven.

Source

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

    }

    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) {
        List<T> result = new ArrayList<>();
        while (cls != null) {
            for (T element : extractor.apply(cls)) {
                if (element.isAnnotationPresent(annotationType)) {
                    if (!allowStatic && Modifier.isStatic(element.getModifiers())) {
                        throw new DIException(
                                "@" + annotationType.getSimpleName() + " annotation is not allowed on " + element);
                    }
                    result.add(element);
                }
            }
            cls = cls.getSuperclass();
        }
        return result;
    }

    public static <T> @Nullable Binding<T> generateImplicitBinding(Key<T> key) {
        Binding<T> binding = generateConstructorBinding(key);
        if (binding != null) {
            Annotation scope = scopeOf(key.getRawType());
            if (scope != null) {
                binding = binding.scope(scope);
            }
            binding = binding.initializeWith(generateInjectingInitializer(key));

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:129 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/435a3c1c8f2c6217. Report an issue: GitHub.