quarkusio/quarkus · error · UnsupportedOperationException

Method ${method} not implemented

Error message

Method ${method} not implemented

What it means

The annotation literal proxy's InvocationHandler implements only annotation member accessors and object/annotationType methods; any other method call on the proxy is rejected with this UnsupportedOperationException, because a recorded annotation literal cannot implement arbitrary behavior.

Source

Thrown at core/deployment/src/main/java/io/quarkus/deployment/recording/AnnotationProxyProvider.java:172

                                case "getValues" -> values;
                                default -> {
                                    MethodInfo member = annotationClass.firstMethod(name);
                                    if (member != null) {
                                        if (values.containsKey(name)) {
                                            yield values.get(name);
                                        }
                                        if (annotationInstance.value(name) != null) {
                                            yield annotationInstance.value(name).value();
                                        }
                                        if (defaultValues.containsKey(name)) {
                                            yield defaultValues.get(name);
                                        }
                                        if (member.defaultValue() != null) {
                                            yield member.defaultValue().value();
                                        }
                                        throw new UnsupportedOperationException("Unknown value of annotation member " + name);
                                    }
                                    throw new UnsupportedOperationException("Method " + method + " not implemented");
                                }
                            };
                        }
                    });
        }

        public A build(io.quarkus.gizmo2.ClassOutput classOutput) {
            generatedLiterals.computeIfAbsent(annotationLiteral, generatedName -> {
                Gizmo gizmo = Gizmo.create(classOutput)
                        .withDebugInfo(false)
                        .withParameters(false);
                gizmo.class_(generatedName, cc -> {
                    ClassDesc annotationClassDesc = classDescOf(annotationInstance.name());
                    cc.extends_(GenericType.ofClass(AnnotationLiteral.class, TypeArgument.of(annotationClassDesc)));
                    cc.implements_(annotationClassDesc);

                    List<MethodInfo> members = annotationClass.methods()
                            .stream()

View on GitHub (pinned to e1c734241f)

Solutions

  1. Remove default (non-abstract) methods from the annotation interface or avoid invoking them on recorded literals
  2. Restrict code operating on the annotation to its declared abstract members
  3. File/update a Quarkus issue if a standard method (e.g. annotationType) is being missed

Example fix

// before
public @interface MyAnno {
    String value();
    default String upper() { return value().toUpperCase(); } // invoked on literal -> fails
}
// after
public @interface MyAnno {
    String value();
}
// compute upper() at usage site, not on the annotation
Defensive patterns

Strategy: type-guard

Validate before calling

for (Method m : MyAnno.class.getMethods()) {
    if (!m.isDefault() && m.getDeclaringClass() != Annotation.class
            && m.getDeclaringClass() != Object.class && !m.isAbstract()) {
        throw new IllegalStateException("unsupported on literal: " + m);
    }
}

Prevention

When it happens

Trigger: Invoking a method on the generated annotation proxy that invoke() does not handle — e.g. extra default methods on the annotation interface, or framework code calling unexpected methods (toString variants, private accessors) on the recorded instance.

Common situations: Custom annotations declaring default (defender) methods whose body is invoked on the literal; reflective code calling methods beyond value()/members on the recorded annotation.

Related errors


AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05). Data as JSON: /api/errors/7a71f3b5a1e8669a. Report an issue: GitHub.