quarkusio/quarkus · error · DefinitionException

No parameter of type ClassInfo, MethodInfo, FieldInfo, Class

Error message

No parameter of type ClassInfo, MethodInfo, FieldInfo, ClassConfig, MethodConfig, or FieldConfig for method " + method

What it means

Arc requires every build-time @Enhancement extension method to have exactly one 'query' parameter — a ClassInfo, MethodInfo, FieldInfo, ClassConfig, MethodConfig, or FieldConfig — that identifies what is being enhanced. ExtensionPhaseEnhancement.runExtensionMethod() throws DefinitionException during processing when it counts zero such parameters, because it cannot know which classes/members the method applies to.

Source

Thrown at independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/bcextensions/ExtensionPhaseEnhancement.java:41

    }

    @Override
    void runExtensionMethod(ExtensionMethod method) throws ReflectiveOperationException {
        int numQueryParameters = 0;
        List<ExtensionMethodParameter> parameters = new ArrayList<>(method.parametersCount());
        for (org.jboss.jandex.Type parameterType : method.parameterTypes()) {
            ExtensionMethodParameter parameter = ExtensionMethodParameter.of(parameterType);
            parameters.add(parameter);

            if (parameter.isQuery()) {
                numQueryParameters++;
            }

            parameter.verifyAvailable(ExtensionPhase.ENHANCEMENT, method);
        }

        if (numQueryParameters == 0) {
            throw new DefinitionException("No parameter of type ClassInfo, MethodInfo, FieldInfo, "
                    + "ClassConfig, MethodConfig, or FieldConfig for method " + method);
        }

        if (numQueryParameters > 1) {
            throw new DefinitionException("More than 1 parameter of type ClassInfo, MethodInfo, FieldInfo, "
                    + "ClassConfig, MethodConfig, or FieldConfig for method " + method);
        }

        ExtensionMethodParameter query = parameters.stream()
                .filter(ExtensionMethodParameter::isQuery)
                .findAny()
                .get(); // guaranteed to be there

        List<org.jboss.jandex.ClassInfo> matchingClasses = matchingClasses(method.jandex);
        List<?> allValuesForQueryParameter;
        if (query == ExtensionMethodParameter.CLASS_INFO) {
            allValuesForQueryParameter = matchingClasses.stream()
                    .map(it -> new ClassInfoImpl(index, annotationOverlay, it))

View on GitHub (pinned to e1c734241f)

Solutions

  1. Add exactly one query parameter of type ClassInfo, MethodInfo, FieldInfo, ClassConfig, MethodConfig, or FieldConfig to the @Enhancement method.
  2. If the method was not meant to enhance anything, remove the @Enhancement annotation or the method entirely.
  3. Verify the parameter types come from the correct packages (org.jboss.jandex for *Info, the config API for *Config) so they are recognized as query parameters.

Example fix

// before
@Enhancement
void enhance(EnhancementContext ctx) { ... }

// after
@Enhancement
void enhance(ClassConfig config, EnhancementContext ctx) { ... }
Defensive patterns

Strategy: validation

Validate before calling

long queries = Arrays.stream(method.getParameters())
    .map(p -> p.type().name().withoutPackagePrefix())
    .filter(n -> Set.of("ClassInfo","MethodInfo","FieldInfo","ClassConfig","MethodConfig","FieldConfig").contains(n))
    .count();
if (queries == 0) throw new IllegalStateException("@Enhancement method needs a query parameter");

Type guard

static boolean hasQueryParameter(MethodInfo m) {
    return Arrays.stream(m.parameters()).anyMatch(ExtensionPhaseEnhancement::isQueryType);
}

Try / catch

try {
    processor.run(extensionClass);
} catch (DefinitionException e) {
    fail("@Enhancement method missing target parameter: " + e.getMessage());
}

Prevention

When it happens

Trigger: Annotating a no-arg method (or one whose only parameters are config/context types, not the six query types) with @Enhancement in a build-time extension, so numQueryParameters == 0 when the processor runs the method.

Common situations: Writing an enhancement callback that only takes the enhancement context and forgetting the target info/config parameter; refactoring a method and accidentally removing its ClassInfo/MethodConfig parameter; applying @Enhancement to a plain helper method by mistake.

Related errors


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