{"record":{"id":"99f49b72b82e4736","repo":"quarkusio/quarkus","slug":"the-decorator-decoratorclass-has-no-delegate-i","errorCode":null,"errorMessage":"The decorator ${decoratorClass} has no @Delegate injection point","messagePattern":"The decorator (.+?) has no @Delegate injection point","errorType":"exception","errorClass":"DefinitionException","httpStatus":null,"severity":"error","filePath":"independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/Decorators.java","lineNumber":52,"sourceCode":"     * @param transformer\n     * @return a new decorator info, or (only in strict mode) {@code null} if the decorator is disabled\n     */\n    static DecoratorInfo createDecorator(ClassInfo decoratorClass, BeanDeployment beanDeployment,\n            InjectionPointModifier transformer) {\n\n        // Find the delegate injection point\n        List<InjectionPointInfo> delegateInjectionPoints = new ArrayList<>();\n        List<Injection> injections = Injection.forBean(decoratorClass, null, beanDeployment, transformer,\n                Injection.BeanType.DECORATOR);\n        for (Injection injection : injections) {\n            for (InjectionPointInfo injectionPoint : injection.injectionPoints) {\n                if (injectionPoint.isDelegate()) {\n                    delegateInjectionPoints.add(injectionPoint);\n                }\n            }\n        }\n        if (delegateInjectionPoints.isEmpty()) {\n            throw new DefinitionException(\"The decorator \" + decoratorClass + \" has no @Delegate injection point\");\n        } else if (delegateInjectionPoints.size() > 1) {\n            throw new DefinitionException(\n                    \"The decorator \" + decoratorClass + \" has multiple @Delegate injection points: \" + delegateInjectionPoints);\n        }\n\n        InjectionPointInfo delegateInjectionPoint = delegateInjectionPoints.get(0);\n\n        Integer priority = null;\n        for (AnnotationInstance annotation : beanDeployment.getAnnotations(decoratorClass)) {\n            if (annotation.name().equals(DotNames.PRIORITY)) {\n                priority = annotation.value().asInt();\n            }\n            ScopeInfo scopeAnnotation = beanDeployment.getScope(annotation.name());\n            if (scopeAnnotation != null && !BuiltinScope.DEPENDENT.is(scopeAnnotation)) {\n                throw new DefinitionException(\n                        \"A decorator must be @Dependent but \" + decoratorClass + \" declares \" + scopeAnnotation.getDotName());\n            }\n        }","sourceCodeStart":34,"sourceCodeEnd":70,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/Decorators.java#L34-L70","documentation":"A CDI decorator must declare exactly one @Delegate injection point designating the object it decorates. Arc's Decorators.createDecorator raises a DefinitionException when the decorator class declares none.","triggerScenarios":"Implementing a decorator class whose @Delegate-annotated field is missing, misnamed annotation (e.g. import of wrong @Delegate), or whose delegate field was removed/renamed; decorator registered but implementing only the interface.","commonSituations":"Forgetting @Delegate after refactoring; importing jakarta Decorator but not annotating the field; copying a decorator example but dropping the delegate field; wrong package import of @Delegate.","solutions":["Add a field of the decorated type annotated with @Delegate (jakarta.enterprise.inject.spi/documentation-consistent import: jakarta.inject / jakarta.enterprise decorators use @Delegate from jakarta.enterprise.inject.spi? use io.quarkus/jakarta @Delegate)","Verify the annotation import resolves to jakarta/enterprise Delegate, not a custom class","Ensure exactly one delegate field exists (see companion error for multiples)"],"exampleFix":"// before\npublic class AuditDecorator implements Audited { public void audit() {...} }\n// after\n@Decorator\npublic class AuditDecorator implements Audited {\n  @Delegate @Inject Audited delegate;\n  public void audit() { delegate.audit(); }\n}","handlingStrategy":"validation","validationCode":"static void requireDelegate(Class<?> decorator) {\n  long n = java.util.Arrays.stream(decorator.getDeclaredFields())\n      .filter(f -> f.isAnnotationPresent(jakarta.decorator.Delegate.class)).count();\n  if (n == 0) throw new IllegalStateException(decorator + \" has no @Delegate injection point\");\n}","typeGuard":"static boolean hasDelegate(java.lang.reflect.Field[] fields) {\n  return java.util.Arrays.stream(fields)\n      .anyMatch(f -> f.isAnnotationPresent(jakarta.decorator.Delegate.class));\n}","tryCatchPattern":null,"preventionTips":["Always pair @Decorator with exactly one @Delegate field","Double-check @Delegate import (jakarta.decorator.Delegate)"],"tags":["quarkus","arc","cdi","decorator","delegate"],"backgroundTag":"missing-delegate-injection-point","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-12T22:17:10.623Z"}