{"record":{"id":"cc0d59e2daf0190d","repo":"apache/maven","slug":"implementation-hint-is-ambiguous-for-sealed-t","errorCode":null,"errorMessage":"Implementation hint '{}' is ambiguous for sealed type {}: {}","messagePattern":"Implementation hint '(.+?)' is ambiguous for sealed type (.+?): (.+?)","errorType":"exception","errorClass":"ComponentConfigurationException","httpStatus":null,"severity":"error","filePath":"impl/maven-core/src/main/java/org/apache/maven/configuration/internal/EnhancedConfigurationConverter.java","lineNumber":157,"sourceCode":"            if (implementation.equals(permittedSubclass.getName())\n                    || implementation.equals(permittedSubclass.getCanonicalName())\n                    || implementation.equals(permittedSubclass.getSimpleName())) {\n                matches.add(permittedSubclass);\n            }\n        }\n\n        if (matches.size() == 1) {\n            return matches.get(0);\n        }\n        if (matches.isEmpty()) {\n            throw new ComponentConfigurationException(\n                    configuration,\n                    \"Cannot find permitted subclass '\" + implementation + \"' for sealed type \" + type.getName(),\n                    cause);\n        }\n        matches.sort(Comparator.comparing(Class::getName));\n\n        throw new ComponentConfigurationException(\n                configuration,\n                \"Implementation hint '\" + implementation + \"' is ambiguous for sealed type \" + type.getName() + \": \"\n                        + matches.stream().map(Class::getName).toList(),\n                cause);\n    }\n\n    public void processConfiguration(\n            final ConverterLookup lookup,\n            final Object bean,\n            final ClassLoader loader,\n            final PlexusConfiguration configuration,\n            final ExpressionEvaluator evaluator,\n            final ConfigurationListener listener)\n            throws ComponentConfigurationException {\n        final EnhancedCompositeBeanHelper helper = new EnhancedCompositeBeanHelper(lookup, loader, evaluator, listener);\n        for (int i = 0, size = configuration.getChildCount(); i < size; i++) {\n            final PlexusConfiguration element = configuration.getChild(i);\n            final String propertyName = fromXML(element.getName());","sourceCodeStart":139,"sourceCodeEnd":175,"githubUrl":"https://github.com/apache/maven/blob/e4093d4e120eac99d6bdce5ba67cace2f3085c97/impl/maven-core/src/main/java/org/apache/maven/configuration/internal/EnhancedConfigurationConverter.java#L139-L175","documentation":"The implementation hint in configuration matches MORE THAN ONE permitted subclass of a sealed type, so the converter cannot pick one deterministically. Matching runs against FQN, canonical name, and simple name; when matches.size() > 1 the error lists all matching classes sorted by name so you can disambiguate.","triggerScenarios":"An implementation attribute set to a simple class name (or any string equal to several permitted subclasses' names/canonical names) on a sealed configuration type, e.g. implementation=\"Default\" where two permitted classes in different packages are both named Default.","commonSituations":"Large APIs with several permitted implementations sharing simple names (Default, Impl, Simple); configuration snippets that rely on simple names across packages.","solutions":["Replace the simple name with the fully qualified class name of the implementation you want","Pick the exact class from the match list printed in the error message itself"],"exampleFix":"<!-- before: ambiguous simple name -->\n<param implementation=\"Default\"/>\n\n<!-- after: unique fully qualified name -->\n<param implementation=\"org.example.api.sealed.FileHandler\"/>","handlingStrategy":"validation","validationCode":"// Reject ambiguous hints before configuration is applied\nList<Class<?>> matches = Arrays.stream(sealed.getPermittedSubclasses())\n        .filter(c -> hint.equals(c.getName()) || hint.equals(c.getCanonicalName()) || hint.equals(c.getSimpleName()))\n        .toList();\nif (matches.size() != 1) {\n    throw new IllegalArgumentException(\n        matches.isEmpty() ? \"no permitted subclass matches '\" + hint + \"'\"\n                          : \"ambiguous hint '\" + hint + \"': \" + matches);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never rely on simple class names in implementation attributes","Lint configuration files to require FQNs whenever an implementation attribute is present"],"tags":["maven","plexus","sealed-classes","plugin-configuration","ambiguity"],"backgroundTag":"ambiguous-implementation-class","analyzedSha":"e4093d4e120eac99d6bdce5ba67cace2f3085c97","analyzedAt":"2026-08-21T22:58:24.034Z","schemaVersion":2},"datasetVersion":"2026-08-21T23:17:16.201Z"}