{"record":{"id":"29ad7c53f1880ece","repo":"quarkusio/quarkus","slug":"unknown-jandex-type-jandextype","errorCode":null,"errorMessage":"Unknown jandex type: ${jandexType}","messagePattern":"Unknown jandex type: (.+?)","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"core/deployment/src/main/java/io/quarkus/deployment/util/AsmUtil.java","lineNumber":218,"sourceCode":"            case TYPE_VARIABLE:\n                List<Type> bounds = jandexType.asTypeVariable().bounds();\n                if (bounds.isEmpty())\n                    mv.visitLdcInsn(org.objectweb.asm.Type.getType(Object.class));\n                else\n                    visitLdc(mv, bounds.get(0));\n                break;\n            case UNRESOLVED_TYPE_VARIABLE:\n            case TYPE_VARIABLE_REFERENCE:\n                mv.visitLdcInsn(org.objectweb.asm.Type.getType(Object.class));\n                break;\n            case VOID:\n                mv.visitFieldInsn(Opcodes.GETSTATIC, \"java/lang/Void\", \"TYPE\", \"Ljava/lang/Class;\");\n                break;\n            case WILDCARD_TYPE:\n                visitLdc(mv, jandexType.asWildcardType().extendsBound());\n                break;\n            default:\n                throw new IllegalArgumentException(\"Unknown jandex type: \" + jandexType);\n        }\n    }\n\n    /**\n     * Calls the right boxing method for the given Jandex Type if it is a primitive.\n     *\n     * @param mv The MethodVisitor on which to visit the boxing instructions\n     * @param jandexType The Jandex Type to box if it is a primitive.\n     */\n    public static void boxIfRequired(MethodVisitor mv, Type jandexType) {\n        if (jandexType.kind() == Kind.PRIMITIVE) {\n            switch (jandexType.asPrimitiveType().primitive()) {\n                case BOOLEAN:\n                    mv.visitMethodInsn(Opcodes.INVOKESTATIC, \"java/lang/Boolean\", \"valueOf\", \"(Z)Ljava/lang/Boolean;\", false);\n                    break;\n                case BYTE:\n                    mv.visitMethodInsn(Opcodes.INVOKESTATIC, \"java/lang/Byte\", \"valueOf\", \"(B)Ljava/lang/Byte;\", false);\n                    break;","sourceCodeStart":200,"sourceCodeEnd":236,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/core/deployment/src/main/java/io/quarkus/deployment/util/AsmUtil.java#L200-L236","documentation":"The outer switch in AsmUtil.visitLdc handles non-primitive Jandex kinds: CLASS, TYPE_VARIABLE (bounds), WILDCARD_TYPE, VOID, etc. The default branch throws this IllegalArgumentException when a Jandex Type kind has no LDC emission strategy implemented — the requested type cannot be represented as a loadable constant by this utility.","triggerScenarios":"Calling visitLdc with kinds such as PARAMETERIZED_TYPE (if unhandled), ARRAY (if unhandled), or other composite kinds the switch does not enumerate; passing a null/empty or synthetic Jandex type whose kind() falls through.","commonSituations":"Generated-code extensions encountering generic/parameterized types at bytecode-generation time; annotation value extraction returning kinds the recorder did not anticipate; Jandex library upgrade changing kind coverage.","solutions":["Extend AsmUtil.visitLdc's switch to handle the reported kind (e.g. for parameterized types, load the raw class constant)","Pre-resolve the type: for parameterized types pass the erasure; for arrays load the array class constant","Check which caller passes this type and correct the type derivation upstream","Add tests for all Jandex kinds used by your extension's generated code"],"exampleFix":"// before\nAsmUtil.visitLdc(mv, parameterizedType); // kind unhandled -> throws\n// after\nAsmUtil.visitLdc(mv, parameterizedType.asParameterizedType().name()); // CLASS kind, loads raw class","handlingStrategy":"type-guard","validationCode":"boolean outerLdcSupported(org.jboss.jandex.Type t) {\n    return switch (t.kind()) {\n        case CLASS, PRIMITIVE, VOID, TYPE_VARIABLE, WILDCARD_TYPE -> true;\n        default -> false;\n    };\n}","typeGuard":"// erasure-first narrowing: only emit constants for erasable kinds\norg.jboss.jandex.Type erasureForLdc(org.jboss.jandex.Type t) {\n    if (t.kind() == org.jboss.jandex.Type.Kind.PARAMETERIZED_TYPE) {\n        return org.jboss.jandex.Type.create(t.asParameterizedType().name());\n    }\n    return t;\n}","tryCatchPattern":"try {\n    AsmUtil.visitLdc(mv, jandexType);\n} catch (IllegalArgumentException e) {\n    if (e.getMessage().startsWith(\"Unknown jandex type\")) {\n        throw new IllegalStateException(\"Unsupported type kind for LDC: \" + jandexType, e);\n    }\n    throw e;\n}","preventionTips":["Pass erasures/raw names for parameterized and array types","Audit generated-code inputs for all reachable Jandex kinds","Add switch coverage when new kinds are introduced by Jandex upgrades","Fail fast in recorders when a kind cannot be lowered to a constant"],"tags":["asm","bytecode","jandex"],"backgroundTag":"unhandled-type-kind","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"}