{"record":{"id":"1361583940894c7c","repo":"quarkusio/quarkus","slug":"annotationtransformation-is-not-an-annotationstran-136158","errorCode":null,"errorMessage":"AnnotationTransformation is not an AnnotationsTransformer: ${transformer}","messagePattern":"AnnotationTransformation is not an AnnotationsTransformer: (.+?)","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"extensions/resteasy-reactive/rest/spi-deployment/src/main/java/io/quarkus/resteasy/reactive/server/spi/AnnotationsTransformerBuildItem.java","lineNumber":46,"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":28,"sourceCodeEnd":54,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/resteasy-reactive/rest/spi-deployment/src/main/java/io/quarkus/resteasy/reactive/server/spi/AnnotationsTransformerBuildItem.java#L28-L54","documentation":"AnnotationsTransformerBuildItem historically wrapped an AnnotationsTransformer, but was generalized to hold an AnnotationTransformation (a newer, cheaper API). This deprecated getter throws UnsupportedOperationException when the wrapped object is only an AnnotationTransformation and cannot be cast to AnnotationsTransformer.","triggerScenarios":"Calling (deprecated) AnnotationsTransformerBuildItem.getAnnotationsTransformer() on a build item constructed via new AnnotationsTransformerBuildItem(AnnotationTransformation) rather than with an actual AnnotationsTransformer instance.","commonSituations":"Extension code updated to the new AnnotationTransformation API but still consumed by older helper code calling the legacy getter; copy-pasted build-step code from older Quarkus versions;@Deprecated(forRemoval=true) migration in progress.","solutions":["Switch the consuming build step to call getAnnotationTransformation() and use the AnnotationTransformation API","If you truly need an AnnotationsTransformer, construct the build item with new AnnotationsTransformerBuildItem((AnnotationsTransformer) ...) instead of an AnnotationTransformation lambda","Update any framework/util code that calls the deprecated getter — it is scheduled for removal"],"exampleFix":"// before\nAnnotationsTransformer t = annotationsTransformerBuildItem.getAnnotationsTransformer(); // throws\n// after\nAnnotationTransformation t = annotationsTransformerBuildItem.getAnnotationTransformation();","handlingStrategy":"type-guard","validationCode":"Object t = buildItem.getTransformer();\nif (!(t instanceof AnnotationsTransformer) && !(t instanceof AnnotationTransformation)) {\n    throw new IllegalArgumentException(\"Unsupported transformer type: \" + t);\n}","typeGuard":"boolean isLegacyTransformer(AnnotationsTransformerBuildItem bi) {\n    return bi.getAnnotationTransformation() instanceof AnnotationsTransformer;\n}","tryCatchPattern":"try {\n    AnnotationsTransformer t = item.getAnnotationsTransformer();\n} catch (UnsupportedOperationException e) {\n    AnnotationTransformation t2 = item.getAnnotationTransformation(); // migrate path\n}","preventionTips":["Always use getAnnotationTransformation() — the legacy getter is @Deprecated(forRemoval=true)","Migrate custom transformers to the AnnotationTransformation API","Wrap access in an instanceof check on the stored transformer before casting","Pin consumers and producers of this build item to the same Quarkus version"],"tags":["build-time","resteasy-reactive","deprecated-api","unsupported-operation"],"backgroundTag":"deprecated-api-removed","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"}