{"record":{"id":"435a3c1c8f2c6217","repo":"apache/maven","slug":"annotation-is-not-allowed-on","errorCode":null,"errorMessage":"@{} annotation is not allowed on {}","messagePattern":"@(.+?) annotation is not allowed on (.+?)","errorType":"exception","errorClass":"DIException","httpStatus":null,"severity":"error","filePath":"impl/maven-di/src/main/java/org/apache/maven/di/impl/ReflectionUtils.java","lineNumber":129,"sourceCode":"    }\n\n    public static <T> Key<T> keyOf(@Nullable Type container, Type type, AnnotatedElement annotatedElement) {\n        return Key.ofType(\n                container != null ? Types.bind(type, Types.getAllTypeBindings(container)) : type,\n                qualifierOf(annotatedElement));\n    }\n\n    public static <T extends AnnotatedElement & Member> List<T> getAnnotatedElements(\n            Class<?> cls,\n            Class<? extends Annotation> annotationType,\n            Function<Class<?>, T[]> extractor,\n            boolean allowStatic) {\n        List<T> result = new ArrayList<>();\n        while (cls != null) {\n            for (T element : extractor.apply(cls)) {\n                if (element.isAnnotationPresent(annotationType)) {\n                    if (!allowStatic && Modifier.isStatic(element.getModifiers())) {\n                        throw new DIException(\n                                \"@\" + annotationType.getSimpleName() + \" annotation is not allowed on \" + element);\n                    }\n                    result.add(element);\n                }\n            }\n            cls = cls.getSuperclass();\n        }\n        return result;\n    }\n\n    public static <T> @Nullable Binding<T> generateImplicitBinding(Key<T> key) {\n        Binding<T> binding = generateConstructorBinding(key);\n        if (binding != null) {\n            Annotation scope = scopeOf(key.getRawType());\n            if (scope != null) {\n                binding = binding.scope(scope);\n            }\n            binding = binding.initializeWith(generateInjectingInitializer(key));","sourceCodeStart":111,"sourceCodeEnd":147,"githubUrl":"https://github.com/apache/maven/blob/e4093d4e120eac99d6bdce5ba67cace2f3085c97/impl/maven-di/src/main/java/org/apache/maven/di/impl/ReflectionUtils.java#L111-L147","documentation":"Error \"@{} annotation is not allowed on {}\" thrown in apache/maven.","triggerScenarios":"Thrown at impl/maven-di/src/main/java/org/apache/maven/di/impl/ReflectionUtils.java:129 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"e4093d4e120eac99d6bdce5ba67cace2f3085c97","analyzedAt":"2026-08-21T22:58:24.034Z","schemaVersion":2},"datasetVersion":"2026-08-21T23:17:16.201Z"}