{"record":{"id":"e6b864fee4948881","repo":"quarkusio/quarkus","slug":"parameterized-type-s-can-not-be-inherited-from-by","errorCode":null,"errorMessage":"parameterized type %s can not be inherited from by %s (or a predecessor) with different type arguments.","messagePattern":"parameterized type (.+?) can not be inherited from by (.+?) \\(or a predecessor\\) with different type arguments\\.","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"extensions/resteasy-reactive/rest-client-jaxrs/deployment/src/main/java/io/quarkus/jaxrs/client/reactive/deployment/JaxrsClientReactiveProcessor.java","lineNumber":1565,"sourceCode":"\n    private void fillHierarchyIdentifierTypeLookupMap(IndexView index, ClassInfo owner,\n            Map<DotName, Map<String, Type>> hierarchyIdentifierTypeLookupMap) {\n        List<Type> interfaceTypes = owner.interfaceTypes();\n        // no need to check for Object, not an interface\n        if (!owner.isInterface() || interfaceTypes.isEmpty()) {\n            return;\n        }\n\n        for (Type interfaceType : interfaceTypes) {\n            Type resolvedInterfaceType = resolveType(interfaceType,\n                    hierarchyIdentifierTypeLookupMap.getOrDefault(owner.name(), Collections.emptyMap()), null);\n\n            Map<String, Type> identifierTypeLookupMap = determineIdentifierTypeLookupMap(index, resolvedInterfaceType);\n\n            if (hierarchyIdentifierTypeLookupMap.putIfAbsent(interfaceType.name(), identifierTypeLookupMap) != null) {\n                if (!hierarchyIdentifierTypeLookupMap.get(interfaceType.name()).equals(identifierTypeLookupMap)) {\n                    // Just to be safe, java should prevent this. This could maybe happen with different versions of a library on the classpath?\n                    throw new IllegalArgumentException(\n                            \"parameterized type %s can not be inherited from by %s (or a predecessor) with different type arguments.\"\n                                    .formatted(interfaceType.name(), owner.name()));\n                }\n            }\n\n            fillHierarchyIdentifierTypeLookupMap(index, index.getClassByName(interfaceType.name()),\n                    hierarchyIdentifierTypeLookupMap);\n        }\n    }\n\n    private Map<String, Type> determineIdentifierTypeLookupMap(IndexView index, Type type) {\n        Map<String, Type> result = new HashMap<>();\n        if (type.kind() == PARAMETERIZED_TYPE) {\n            ClassInfo classInfo = index.getClassByName(type.name());\n            ParameterizedType parameterizedType = type.asParameterizedType();\n\n            for (int i = 0; i < parameterizedType.arguments().size(); i++) {\n                // No need to check if the class even has type parameters, if the type has an argument for it, then the class must have a type parameter for it","sourceCodeStart":1547,"sourceCodeEnd":1583,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/resteasy-reactive/rest-client-jaxrs/deployment/src/main/java/io/quarkus/jaxrs/client/reactive/deployment/JaxrsClientReactiveProcessor.java#L1547-L1583","documentation":"During REST client build-time generation, Quarkus walks the interface hierarchy of a client interface to resolve generic type arguments. If the same parameterized interface appears twice in the hierarchy with different type arguments — which plain Java should prevent — the mapping cache detects a conflict and aborts. This usually indicates duplicate/conflicting versions of a library on the classpath or bytecode manipulated in ways Java's compiler would not produce.","triggerScenarios":"A client interface (or its superinterfaces) inherits the same generic interface through two paths with different type parameters, e.g. via different library versions providing classes like Foo extends Repo<String> and Repo<Integer> for the same interface name.","commonSituations":"Mixed versions of a library on the classpath after a dependency upgrade; shaded/relocated jars redefining the same DotName; build-time vs runtime classpath mismatch in fast-jar; generated sub-resource interfaces conflicting with hand-written ones.","solutions":["Run mvn dependency:tree and resolve duplicate/conflicting versions of the library owning the interface with dependencyManagement or exclusions","Clean and rebuild (mvn clean install) to remove stale generated/indexed classes","Ensure the generic interface hierarchy is consistent in source — a single type argument per interface across all subtypes","If caused by a generated sub-resource, regenerate/refresh annotation-indexed sources"],"exampleFix":"// before (pom.xml mixed versions)\n<dependency><groupId>com.example</groupId><artifactId>api-lib</artifactId><version>1.0</version></dependency>\n<dependency><groupId>com.example</groupId><artifactId>api-lib</artifactId><version>2.0</version></dependency>\n// after\n<dependencyManagement>\n  <dependencies>\n    <dependency><groupId>com.example</groupId><artifactId>api-lib</artifactId><version>2.0</version></dependency>\n  </dependencies>\n</dependencyManagement>","handlingStrategy":"validation","validationCode":"// Before building, check dependency conflicts:\n// mvn dependency:tree -Dincludes=com.example:api-lib\n// Ensure only one version of the library defining the generic interface exists.\nSet<String> versions = new LinkedHashSet<>();\nClassLoader cl = Thread.currentThread().getContextClassLoader();\n// verify a single consistent jar provides the interface:\nString res = \"com/example/Repo.class\";\ntry (InputStream in = cl.getResourceAsStream(res)) {\n    if (in == null) throw new IllegalStateException(\"interface missing from classpath\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep library versions aligned via dependencyManagement/BOM","Run mvn dependency:tree in CI to detect version convergence issues","Avoid shaded jars that redefine the same class names","Rebuild cleanly after dependency upgrades"],"tags":["quarkus","rest-client","classpath","generics"],"backgroundTag":"duplicate-classpath-versions","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-12T22:17:10.623Z"}