{"record":{"id":"af74f257f3ef71b4","repo":"quarkusio/quarkus","slug":"the-delegate-type-delegateinjectionpoint-getrequ","errorCode":null,"errorMessage":"The delegate type ${delegateInjectionPoint.getRequiredType()} does not implement the decorated type: ${decoratedType}","messagePattern":"The delegate type (.+?) does not implement the decorated type: (.+?)","errorType":"exception","errorClass":"DefinitionException","httpStatus":null,"severity":"error","filePath":"independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/Decorators.java","lineNumber":93,"sourceCode":"        Set<Type> decoratedTypes = new HashSet<>();\n        for (Type type : types) {\n            if (type.name().equals(DotNames.SERIALIZABLE)) {\n                continue;\n            }\n            ClassInfo clazz = beanDeployment.getBeanArchiveIndex().getClassByName(type.name());\n            if (Modifier.isInterface(clazz.flags())) {\n                decoratedTypes.add(type);\n            }\n        }\n        if (decoratedTypes.isEmpty()) {\n            throw new DefinitionException(\"The decorator \" + decoratorClass + \" has no decorated type\");\n        }\n\n        // The delegate type of a decorator must implement or extend every decorated type\n        Set<Type> delegateTypes = Types.getDelegateTypeClosure(delegateInjectionPoint, beanDeployment);\n        for (Type decoratedType : decoratedTypes) {\n            if (!delegateTypes.contains(decoratedType)) {\n                throw new DefinitionException(\"The delegate type \" + delegateInjectionPoint.getRequiredType()\n                        + \" does not implement the decorated type: \" + decoratedType);\n            }\n            for (BuiltinBean bean : BuiltinBean.values()) {\n                if (bean.equals(BuiltinBean.RESOURCE)) {\n                    // do not take Resource into consideration\n                    continue;\n                }\n                if (bean.hasRawTypeDotName(decoratedType.name())) {\n                    throw new UnsupportedOperationException(\"Decorating built-in bean types is not supported! \" +\n                            \"Decorator \" + decoratorClass + \" is attempting to decorate \" + decoratedType.name());\n                }\n            }\n        }\n\n        if (priority == null) {\n            if (beanDeployment.strictCompatibility) {\n                // decorator without `@Priority` is disabled per the specification\n                return null;","sourceCodeStart":75,"sourceCodeEnd":111,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/Decorators.java#L75-L111","documentation":"CDI requires a decorator's @Delegate injection point type to implement or extend every decorated type of the decorator. Arc computes the delegate type closure from the injection point and fails deployment if a decorated interface is not in that closure.","triggerScenarios":"Decorator implements interface A (decorated type) but the @Delegate field's declared type only covers a different, unrelated type; e.g. @Delegate of type B while decorating A, so delegateTypes does not contain A.","commonSituations":"Delegate field typed to a concrete class or narrower type; generics mismatch (raw vs parameterized delegate); decorating multiple interfaces with one delegate that doesn't implement all of them.","solutions":["Change the @Delegate field's declared type so it includes every decorated interface (e.g. type it as the decorated interface itself).","If decorating several interfaces, make the delegate type implement/extend all of them or add separate delegate-typed generics matching each.","Match generic parameterization between the decorator and the delegate exactly.","Remove the decorated interface from the decorator's implements clause if it was not intended to be decorated."],"exampleFix":"// before\n@Decorator\npublic class LoudGreeter implements Greeter, Auditor {\n    @Delegate\n    Auditor delegate; // does not implement Greeter\n}\n\n// after\n@Decorator\npublic class LoudGreeter implements Greeter, Auditor {\n    @Delegate\n    Greeter delegate; // must implement every decorated type\n}","handlingStrategy":"validation","validationCode":"for (Class<?> itf : decorator.getClass().getInterfaces()) {\n    if (!itf.isAssignableFrom(delegateFieldType))\n        throw new IllegalStateException(\"Delegate type \" + delegateFieldType + \" does not implement decorated type \" + itf);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Type the @Delegate field as the decorated interface itself.","Keep generics of delegate and decorated types identical.","Add a unit test that instantiates the decorator and asserts the delegate field type satisfies every implemented interface."],"tags":["cdi","decorator","delegate","quarkus-arc"],"backgroundTag":"delegate-type-mismatch","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"}