quarkusio/quarkus · error · UnsupportedOperationException
AnnotationTransformation is not an AnnotationsTransformer: "
Error message
AnnotationTransformation is not an AnnotationsTransformer: " + transformer
What it means
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.
Source
Thrown at extensions/resteasy-reactive/rest-client/spi-deployment/src/main/java/io/quarkus/rest/client/reactive/spi/RestClientAnnotationsTransformerBuildItem.java:46
*/
@Deprecated(forRemoval = true)
public RestClientAnnotationsTransformerBuildItem(AnnotationsTransformer transformer) {
this.transformer = transformer;
}
public RestClientAnnotationsTransformerBuildItem(AnnotationTransformation transformation) {
this.transformer = transformation;
}
/**
* @deprecated use {@link #getAnnotationTransformation()}
*/
@Deprecated(forRemoval = true)
public AnnotationsTransformer getAnnotationsTransformer() {
if (transformer instanceof AnnotationsTransformer) {
return (AnnotationsTransformer) transformer;
}
throw new UnsupportedOperationException("AnnotationTransformation is not an AnnotationsTransformer: " + transformer);
}
public AnnotationTransformation getAnnotationTransformation() {
return transformer;
}
}
View on GitHub (pinned to e1c734241f)
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
Example fix
// before AnnotationsTransformer t = item.getAnnotationsTransformer(); // after AnnotationTransformation t = item.getAnnotationTransformation();
Defensive patterns
Strategy: validation
Validate before calling
if (item.getAnnotationTransformation() == null && !(item instanceof RestClientAnnotationsTransformerBuildItem it && it.getAnnotationTransformation() instanceof AnnotationsTransformer)) { throw new IllegalStateException("Build item does not wrap an AnnotationsTransformer"); } Type guard
boolean isLegacyTransformer(RestClientAnnotationsTransformerBuildItem item) { return item.getAnnotationTransformation() instanceof AnnotationsTransformer; } Try / catch
try { t = item.getAnnotationsTransformer(); } catch (UnsupportedOperationException e) { t = null; /* use getAnnotationTransformation() */ } Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- Specifying executor service is not supported. The underlying
- AnnotationTransformation is not an AnnotationsTransformer: <
- Stateless operations not supported
- This isn't used for schema generation - see SessionFactoryOb
- This method is not available at runtime in Quarkus
AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05).
Data as JSON: /api/errors/c8e29ae07243d389.
Report an issue: GitHub.