{"record":{"id":"581960be3f2f8581","repo":"quarkusio/quarkus","slug":"illegal-type-in-hierarchy","errorCode":null,"errorMessage":"Illegal type in hierarchy: ","messagePattern":"Illegal type in hierarchy: ","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"core/deployment/src/main/java/io/quarkus/deployment/util/JandexUtil.java","lineNumber":280,"sourceCode":"                return ArrayType.create(mapGenerics(arrayType.constituent(), mapping), arrayType.dimensions());\n            case CLASS:\n                return type;\n            case PARAMETERIZED_TYPE:\n                ParameterizedType parameterizedType = type.asParameterizedType();\n                Type owner = null;\n                if (parameterizedType.owner() != null) {\n                    owner = mapGenerics(parameterizedType.owner(), mapping);\n                }\n                return ParameterizedType.create(parameterizedType.name(),\n                        mapGenerics(parameterizedType.arguments(), mapping).toArray(new Type[0]), owner);\n            case TYPE_VARIABLE:\n                Type ret = mapping.get(type.asTypeVariable().identifier());\n                if (ret == null) {\n                    throw new IllegalArgumentException(\"Missing type argument mapping for \" + type);\n                }\n                return ret;\n            default:\n                throw new IllegalArgumentException(\"Illegal type in hierarchy: \" + type);\n        }\n    }\n\n    private static ClassInfo fetchFromIndex(DotName dotName, IndexView index) {\n        final ClassInfo classInfo = index.getClassByName(dotName);\n        if (classInfo == null) {\n            throw new ClassNotIndexedException(dotName);\n        }\n        return classInfo;\n    }\n\n    /**\n     * Returns the enclosing class of the given annotation instance. For field, method or record component annotations,\n     * this will return the enclosing class. For parameters, this will return the enclosing class of the enclosing\n     * method. For classes, it will return the class itself. For type annotations, it will return the class enclosing\n     * the annotated type usage.\n     *\n     * @param annotationInstance the annotation whose enclosing class to look up","sourceCodeStart":262,"sourceCodeEnd":298,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/core/deployment/src/main/java/io/quarkus/deployment/util/JandexUtil.java#L262-L298","documentation":"mapGenerics is a closed switch over Jandex Type kinds (ClassType, ParameterizedType, TYPE_VARIABLE, etc.). Encountering a Type kind it does not handle — e.g. an unresolved TypeVariableReference, primitive, wildcard or array type in the hierarchy — throws this IllegalArgumentException. It means Quarkus' generic hierarchy resolver met a type shape it cannot traverse.","triggerScenarios":"Resolving the type hierarchy of a class whose supertype chain contains an exotic Type kind (wildcard, array/generic-array, unresolved type-variable reference) rather than ClassType/ParameterizedType/TYPE_VARIABLE.","commonSituations":"Extensions or generated code that declares hierarchies with wildcard types (Comparable<? extends Foo>) or generic arrays in supertype positions; Jandex version differences producing new Type kinds; bugs in custom extension code that feeds arbitrary types into the resolver.","solutions":["Simplify the hierarchy: replace wildcard or array-typed supertype positions with concrete classes/interfaces.","Parameterize wildcards explicitly where the API requires a concrete type argument.","Check Jandex/Quarkus version alignment; upgrade Quarkus if a supported type shape is rejected.","If writing an extension, pre-filter the types you pass to hierarchy resolution to the supported kinds."],"exampleFix":"// before\nclass Foo extends Handler<?> {\n}\n// after\nclass Foo extends Handler<String> {\n}","handlingStrategy":"type-guard","validationCode":"static boolean isSupportedKind(org.jboss.jandex.Type t) {\n    switch (t.kind()) {\n        case CLASS: case PARAMETERIZED_TYPE: case TYPE_VARIABLE: return true;\n        default: return false;\n    }\n}","typeGuard":"if (type.kind() == Type.Kind.CLASS || type.kind() == Type.Kind.PARAMETERIZED_TYPE || type.kind() == Type.Kind.TYPE_VARIABLE) { /* safe */ }","tryCatchPattern":"try { resolve(type); } catch (IllegalArgumentException e) { if (e.getMessage().startsWith(\"Illegal type in hierarchy\")) { /* unsupported kind: simplify hierarchy or skip */ } else throw e; }","preventionTips":["Avoid wildcard/array types in supertype positions","Keep Jandex and Quarkus versions aligned","Pre-filter exotic Type kinds before hierarchy resolution"],"tags":["jandex","generics","unsupported-type"],"backgroundTag":"unsupported-generic-type","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}