quarkusio/quarkus · error · DefinitionException

The delegate type ${delegateInjectionPoint.getRequiredType()

Error message

The delegate type ${delegateInjectionPoint.getRequiredType()} does not implement the decorated type: ${decoratedType}

What it means

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.

Source

Thrown at independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/Decorators.java:93

        Set<Type> decoratedTypes = new HashSet<>();
        for (Type type : types) {
            if (type.name().equals(DotNames.SERIALIZABLE)) {
                continue;
            }
            ClassInfo clazz = beanDeployment.getBeanArchiveIndex().getClassByName(type.name());
            if (Modifier.isInterface(clazz.flags())) {
                decoratedTypes.add(type);
            }
        }
        if (decoratedTypes.isEmpty()) {
            throw new DefinitionException("The decorator " + decoratorClass + " has no decorated type");
        }

        // The delegate type of a decorator must implement or extend every decorated type
        Set<Type> delegateTypes = Types.getDelegateTypeClosure(delegateInjectionPoint, beanDeployment);
        for (Type decoratedType : decoratedTypes) {
            if (!delegateTypes.contains(decoratedType)) {
                throw new DefinitionException("The delegate type " + delegateInjectionPoint.getRequiredType()
                        + " does not implement the decorated type: " + decoratedType);
            }
            for (BuiltinBean bean : BuiltinBean.values()) {
                if (bean.equals(BuiltinBean.RESOURCE)) {
                    // do not take Resource into consideration
                    continue;
                }
                if (bean.hasRawTypeDotName(decoratedType.name())) {
                    throw new UnsupportedOperationException("Decorating built-in bean types is not supported! " +
                            "Decorator " + decoratorClass + " is attempting to decorate " + decoratedType.name());
                }
            }
        }

        if (priority == null) {
            if (beanDeployment.strictCompatibility) {
                // decorator without `@Priority` is disabled per the specification
                return null;

View on GitHub (pinned to e1c734241f)

Solutions

  1. Change the @Delegate field's declared type so it includes every decorated interface (e.g. type it as the decorated interface itself).
  2. If decorating several interfaces, make the delegate type implement/extend all of them or add separate delegate-typed generics matching each.
  3. Match generic parameterization between the decorator and the delegate exactly.
  4. Remove the decorated interface from the decorator's implements clause if it was not intended to be decorated.

Example fix

// before
@Decorator
public class LoudGreeter implements Greeter, Auditor {
    @Delegate
    Auditor delegate; // does not implement Greeter
}

// after
@Decorator
public class LoudGreeter implements Greeter, Auditor {
    @Delegate
    Greeter delegate; // must implement every decorated type
}
Defensive patterns

Strategy: validation

Validate before calling

for (Class<?> itf : decorator.getClass().getInterfaces()) {
    if (!itf.isAssignableFrom(delegateFieldType))
        throw new IllegalStateException("Delegate type " + delegateFieldType + " does not implement decorated type " + itf);
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05). Data as JSON: /api/errors/af74f257f3ef71b4. Report an issue: GitHub.