{"record":{"id":"c8e29ae07243d389","repo":"quarkusio/quarkus","slug":"annotationtransformation-is-not-an-annotationstran-c8e29a","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/resteasy-reactive/rest-client/spi-deployment/src/main/java/io/quarkus/rest/client/reactive/spi/RestClientAnnotationsTransformerBuildItem.java","lineNumber":46,"sourceCode":"     */\n    @Deprecated(forRemoval = true)\n    public RestClientAnnotationsTransformerBuildItem(AnnotationsTransformer transformer) {\n        this.transformer = transformer;\n    }\n\n    public RestClientAnnotationsTransformerBuildItem(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-client/spi-deployment/src/main/java/io/quarkus/rest/client/reactive/spi/RestClientAnnotationsTransformerBuildItem.java#L28-L54","documentation":"RestClientAnnotationsTransformerBuildItem wraps an AnnotationTransformation; this getter casts it to the legacy AnnotationsTransformer interface. If the wrapped object is only an AnnotationTransformation (the newer API), it cannot be viewed as an AnnotationsTransformer, so an UnsupportedOperationException is thrown. This exists because the deprecated accessor assumes an old-style transformer was supplied.","triggerScenarios":"Calling getAnnotationsTransformer() on a RestClientAnnotationsTransformerBuildItem that was constructed with an AnnotationTransformation (lambda or functional style) rather than an AnnotationsTransformer implementation, typically from another build step or custom extension code.","commonSituations":"Extension authors migrating between the deprecated AnnotationsTransformer API and the newer AnnotationTransformation API; calling the old getter out of habit after switching the constructor argument to a lambda.","solutions":["Use getAnnotationTransformation() instead of the deprecated getAnnotationsTransformer()","If you need an AnnotationsTransformer, construct the build item with an AnnotationsTransformer implementation instead of an AnnotationTransformation lambda","Remove use of the deprecated accessor; it is marked @Deprecated(forRemoval = true) and will be deleted"],"exampleFix":"// before\nAnnotationsTransformer t = item.getAnnotationsTransformer();\n// after\nAnnotationTransformation t = item.getAnnotationTransformation();","handlingStrategy":"validation","validationCode":"if (item.getAnnotationTransformation() == null && !(item instanceof RestClientAnnotationsTransformerBuildItem it && it.getAnnotationTransformation() instanceof AnnotationsTransformer)) { throw new IllegalStateException(\"Build item does not wrap an AnnotationsTransformer\"); }","typeGuard":"boolean isLegacyTransformer(RestClientAnnotationsTransformerBuildItem item) { return item.getAnnotationTransformation() instanceof AnnotationsTransformer; }","tryCatchPattern":"try { t = item.getAnnotationsTransformer(); } catch (UnsupportedOperationException e) { t = null; /* use getAnnotationTransformation() */ }","preventionTips":["Prefer getAnnotationTransformation() (non-deprecated) in all new code","Only construct the build item with AnnotationsTransformer when legacy API is required","Check for @Deprecated accessors before adopting them"],"tags":["quarkus","rest-client","deprecated-api","unsupported-operation"],"backgroundTag":"deprecated-api-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"}