{"record":{"id":"70f97278f99340f6","repo":"quarkusio/quarkus","slug":"annotationtransformation-is-not-an-annotationstran","errorCode":null,"errorMessage":"AnnotationTransformation is not an AnnotationsTransformer: <transformer>","messagePattern":"AnnotationTransformation is not an AnnotationsTransformer: <transformer>","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"extensions/arc/deployment/src/main/java/io/quarkus/arc/deployment/AnnotationsTransformerBuildItem.java","lineNumber":45,"sourceCode":"     */\n    @Deprecated(forRemoval = true)\n    public AnnotationsTransformerBuildItem(AnnotationsTransformer transformer) {\n        this.transformer = transformer;\n    }\n\n    public AnnotationsTransformerBuildItem(AnnotationTransformation transformation) {\n        this.transformer = transformation;\n    }\n\n    /**\n     * @deprecated use {@link #getAnnotationTransformation()}\n     */\n    @Deprecated(forRemoval = true)\n    public AnnotationsTransformer getAnnotationsTransformer() {\n        if (transformer instanceof AnnotationsTransformer) {\n            return (AnnotationsTransformer) transformer;\n        }\n        throw new UnsupportedOperationException(\"AnnotationTransformation is not an AnnotationsTransformer: \" + transformer);\n    }\n\n    public AnnotationTransformation getAnnotationTransformation() {\n        return transformer;\n    }\n\n}\n","sourceCodeStart":27,"sourceCodeEnd":53,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/arc/deployment/src/main/java/io/quarkus/arc/deployment/AnnotationsTransformerBuildItem.java#L27-L53","documentation":"AnnotationsTransformerBuildItem wraps either a legacy AnnotationsTransformer or the newer AnnotationTransformation API. This deprecated accessor throws UnsupportedOperationException when the wrapped object is an AnnotationTransformation (lambda-style) rather than an instance of the old AnnotationsTransformer interface, because it cannot be downcast.","triggerScenarios":"Calling getAnnotationsTransformer() on a build item constructed with an AnnotationTransformation (e.g. via AnnotationsTransformerBuildItem.builder()...transformation(...)), i.e. anything not created with an AnnotationsTransformer instance.","commonSituations":"Old code or third-party extensions migrated to the new AnnotationTransformation API still consuming the item through the deprecated getter; build steps written before the API split being paired with transformers written after it.","solutions":["Use getAnnotationTransformation() instead of the deprecated getAnnotationsTransformer()","If you need an AnnotationsTransformer, construct the build item with an AnnotationsTransformer instance (transformation(combine(AnnotationsTransformer)) style)","Check `transformer instanceof AnnotationsTransformer` before calling the getter"],"exampleFix":"// before\nAnnotationsTransformer t = item.getAnnotationsTransformer();\n// after\nAnnotationTransformation t = item.getAnnotationTransformation();","handlingStrategy":"type-guard","validationCode":"if (item.getAnnotationTransformation() instanceof AnnotationsTransformer at) { /* legacy path */ }","typeGuard":"boolean isLegacyTransformer(AnnotationsTransformerBuildItem item) {\n    return item.getAnnotationTransformation() instanceof AnnotationsTransformer;\n}","tryCatchPattern":null,"preventionTips":["Prefer getAnnotationTransformation() in all new code","Treat getAnnotationsTransformer() as removed despite deprecation","Isolate transformer-consumption code in one helper"],"tags":["quarkus","arc","deprecated-api","build-time"],"backgroundTag":"unsupported-cast","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}