{"record":{"id":"f63d458607ae6f30","repo":"quarkusio/quarkus","slug":"decorating-built-in-bean-types-is-not-supported-d","errorCode":null,"errorMessage":"Decorating built-in bean types is not supported! Decorator ${decoratorClass} is attempting to decorate ${decoratedType.name()}","messagePattern":"Decorating built-in bean types is not supported! Decorator (.+?) is attempting to decorate (.+?)","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/Decorators.java","lineNumber":102,"sourceCode":"        }\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;\n            }\n\n            LOGGER.info(\"The decorator \" + decoratorClass + \" does not declare any @Priority. \" +\n                    \"It will be assigned a default priority value of 0.\");\n            priority = 0;\n        }\n\n        if (Modifier.isAbstract(decoratorClass.flags())) {\n            JandexTypeSystem ts = JandexTypeSystem.of(beanDeployment.getBeanArchiveIndex());","sourceCodeStart":84,"sourceCodeEnd":120,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/Decorators.java#L84-L120","documentation":"Arc forbids decorating built-in bean types such as Instance, Event, BeanManager, or resource types. If a decorator's decorated type's raw name matches a BuiltinBean, createDecorator throws this UnsupportedOperationException because interception of built-in beans is not supported.","triggerScenarios":"Writing @Decorator SomeDecorator implements Instance<Foo> or decorating Event/BeanManager/other BuiltinBean raw types; only BuiltinBean.RESOURCE is skipped from the check.","commonSituations":"Trying to add cross-cutting behavior around Event firing or Instance resolution; misreading the spec that decorators apply only to managed beans; copying a decorator onto a built-in type interface.","solutions":["Do not decorate built-in types; wrap the usage in your own interface or intercept at your own bean instead.","For events, create your own event abstraction/facade and decorate that.","Use an observer or explicit wrapper class instead of @Decorator for built-in behavior.","Ensure the decorated type's raw type is your application interface, not a javax/jakarta or Arc built-in."],"exampleFix":"// before\n@Decorator\npublic class EventLogger implements Event<Payload> { ... }\n\n// after\npublic interface PayloadEventDispatcher { void dispatch(Payload p); }\n@Decorator\npublic class EventLogger implements PayloadEventDispatcher { @Delegate PayloadEventDispatcher delegate; }","handlingStrategy":"validation","validationCode":"Set<String> builtins = Set.of(\"jakarta.enterprise.inject.Instance\",\"jakarta.enterprise.event.Event\",\"jakarta.enterprise.inject.spi.BeanManager\");\nfor (Class<?> itf : decorator.getClass().getInterfaces())\n    if (builtins.contains(itf.getName())) throw new IllegalStateException(\"Cannot decorate built-in type \" + itf);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never write 'implements Instance<...>' or 'implements Event<...>' on a decorator.","Wrap built-in usage behind your own application interface if decoration is needed.","Code-review decorator interfaces for jakarta/javax built-in raw types."],"tags":["cdi","decorator","built-in-beans","unsupported"],"backgroundTag":"unsupported-built-in-type-decoration","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"}