{"record":{"id":"e018a6d40a44a44a","repo":"junit-team/junit5","slug":"argumentsaggregator-does-not-override-the-convert","errorCode":null,"errorMessage":"ArgumentsAggregator does not override the convert(ArgumentsAccessor, FieldContext) method. Please report this issue to the maintainers of %s.","messagePattern":"ArgumentsAggregator does not override the convert\\(ArgumentsAccessor, FieldContext\\) method\\. Please report this issue to the maintainers of (.+?)\\.","errorType":"exception","errorClass":"JUnitException","httpStatus":null,"severity":"error","filePath":"junit-jupiter-params/src/main/java/org/junit/jupiter/params/aggregator/ArgumentsAggregator.java","lineNumber":94,"sourceCode":"\n\t/**\n\t * Aggregate the arguments contained in the supplied {@code accessor} into a\n\t * single object.\n\t *\n\t * @param accessor an {@link ArgumentsAccessor} containing the arguments to be\n\t * aggregated; never {@code null}\n\t * @param context the field context where the aggregated result is to be\n\t * injected; never {@code null}\n\t * @return the aggregated result; may be {@code null} but only if the target\n\t * type is a reference type\n\t * @throws ArgumentsAggregationException if an error occurs during the\n\t * aggregation\n\t * @since 5.13\n\t */\n\t@API(status = EXPERIMENTAL, since = \"6.0\")\n\tdefault @Nullable Object aggregateArguments(ArgumentsAccessor accessor, FieldContext context)\n\t\t\tthrows ArgumentsAggregationException {\n\t\tthrow new JUnitException(\"\"\"\n\t\t\t\tArgumentsAggregator does not override the convert(ArgumentsAccessor, FieldContext) method. \\\n\t\t\t\tPlease report this issue to the maintainers of %s.\"\"\".formatted(getClass().getName()));\n\t}\n\n}\n","sourceCodeStart":76,"sourceCodeEnd":100,"githubUrl":"https://github.com/junit-team/junit5/blob/f070c699a08b5d8393df9afd147af5c5e90bb21b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/aggregator/ArgumentsAggregator.java#L76-L100","documentation":"Thrown by the default method ArgumentsAggregator.aggregateArguments(ArgumentsAccessor, FieldContext) when a custom ArgumentsAggregator implementation is used via @AggregateWith on a @Parameter-annotated field (not a method parameter) but the aggregator does not override the FieldContext-based overload. This overload was added in JUnit 5.13 (API status EXPERIMENTAL, since 6.0) to support field-level aggregation in @ParameterizedClass. The %s placeholder is filled with the aggregator's actual class name.","triggerScenarios":"Implement ArgumentsAggregator and use it with @AggregateWith on a @Parameter field in a @ParameterizedClass, but only override the older aggregateArguments(ArgumentsAccessor, ParameterContext) method. The framework calls the FieldContext overload for field-based aggregation, hits the default, and throws.","commonSituations":"Existing custom ArgumentsAggregator implementations written before JUnit 5.13 that are now being used with @ParameterizedClass field-level aggregation. Developers upgrading JUnit versions and attempting to reuse their aggregators in the new field context without updating the implementation.","solutions":["Override the aggregateArguments(ArgumentsAccessor accessor, FieldContext context) method in your ArgumentsAggregator implementation","If the aggregation logic is the same regardless of context, delegate from the FieldContext overload to your existing logic","Alternatively, use the aggregator only on method parameters (where ParameterContext is used) until you update the implementation"],"exampleFix":"// before — only overrides ParameterContext variant\npublic class MyAggregator implements ArgumentsAggregator {\n    @Override\n    public Object aggregateArguments(ArgumentsAccessor accessor, ParameterContext context) {\n        return accessor.getString(0) + accessor.getString(1);\n    }\n}\n\n// after — also override FieldContext variant for field-level use\npublic class MyAggregator implements ArgumentsAggregator {\n    @Override\n    public Object aggregateArguments(ArgumentsAccessor accessor, ParameterContext context) {\n        return aggregate(accessor);\n    }\n    @Override\n    public Object aggregateArguments(ArgumentsAccessor accessor, FieldContext context) {\n        return aggregate(accessor);\n    }\n    private String aggregate(ArgumentsAccessor accessor) {\n        return accessor.getString(0) + accessor.getString(1);\n    }\n}","handlingStrategy":"validation","validationCode":"// Check if an ArgumentsAggregator supports field-level aggregation\nimport org.junit.jupiter.params.aggregator.ArgumentsAggregator;\nimport java.lang.reflect.Method;\n\nstatic boolean supportsFieldAggregation(Class<? extends ArgumentsAggregator> aggClass) throws Exception {\n    Method m = aggClass.getMethod(\"aggregateArguments\",\n        org.junit.jupiter.params.support.ArgumentsAccessor.class != null\n            ? org.junit.jupiter.params.aggregator.ArgumentsAccessor.class : null,\n        org.junit.jupiter.params.support.FieldContext.class);\n    return !m.getDeclaringClass().equals(ArgumentsAggregator.class); // overridden?\n}\n\n// Simplified: check if the method is overridden\nstatic boolean isFieldOverloadOverridden(Class<? extends ArgumentsAggregator> aggClass) {\n    try {\n        var m = aggClass.getMethod(\"aggregateArguments\",\n            org.junit.jupiter.params.aggregator.ArgumentsAccessor.class,\n            org.junit.jupiter.params.support.FieldContext.class);\n        return m.getDeclaringClass() != ArgumentsAggregator.class;\n    } catch (NoSuchMethodException e) { return false; }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["When upgrading to JUnit 5.13+, audit all custom ArgumentsAggregator implementations and add the FieldContext overload if missing","Use AbstractAggregateWith or SimpleArgumentsAggregator as base classes which handle context delegation","Write a unit test that invokes both overloads to catch missing implementations early"],"tags":["aggregator","field-context","spi","version-compatibility","junit-params"],"backgroundTag":null,"analyzedSha":"f070c699a08b5d8393df9afd147af5c5e90bb21b","analyzedAt":"2026-08-11T20:31:00.530Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}