{"record":{"id":"19be7f2ce98a9aaf","repo":"quarkusio/quarkus","slug":"unknown-primitive-type-jandextype","errorCode":null,"errorMessage":"Unknown primitive type: ${jandexType}","messagePattern":"Unknown primitive type: (.+?)","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"core/deployment/src/main/java/io/quarkus/deployment/util/AsmUtil.java","lineNumber":145,"sourceCode":"     * @return the correct bytecode return instruction for that return type descriptor.\n     */\n    public static int getReturnInstruction(Type jandexType) {\n        if (jandexType.kind() == Kind.PRIMITIVE) {\n            switch (jandexType.asPrimitiveType().primitive()) {\n                case BOOLEAN:\n                case BYTE:\n                case SHORT:\n                case INT:\n                case CHAR:\n                    return Opcodes.IRETURN;\n                case DOUBLE:\n                    return Opcodes.DRETURN;\n                case FLOAT:\n                    return Opcodes.FRETURN;\n                case LONG:\n                    return Opcodes.LRETURN;\n                default:\n                    throw new IllegalArgumentException(\"Unknown primitive type: \" + jandexType);\n            }\n        } else if (jandexType.kind() == Kind.VOID) {\n            return Opcodes.RETURN;\n        }\n        return Opcodes.ARETURN;\n    }\n\n    /**\n     * Invokes the proper LDC Class Constant instructions for the given Jandex Type. This will properly create LDC instructions\n     * for array types, class/parameterized classes, and primitive types by loading their equivalent <tt>TYPE</tt>\n     * constants in their box types, as well as type variables (using the first bound or Object) and Void.\n     *\n     * @param mv The MethodVisitor on which to visit the LDC instructions\n     * @param jandexType the Jandex Type whose Class Constant to load.\n     */\n    public static void visitLdc(MethodVisitor mv, Type jandexType) {\n        switch (jandexType.kind()) {\n            case ARRAY:","sourceCodeStart":127,"sourceCodeEnd":163,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/core/deployment/src/main/java/io/quarkus/deployment/util/AsmUtil.java#L127-L163","documentation":"AsmUtil.getReturnInstruction maps a Jandex primitive type to the corresponding JVM *RETURN opcode (IRETURN, LRETURN, DRETURN, FRETURN). This IllegalArgumentException is thrown from the switch default when the given Jandex Type is a primitive kind the mapper does not recognize (e.g. an unexpected Kind) — effectively a bug/unhandled-case guard in bytecode generation.","triggerScenarios":"Calling getReturnInstruction with a Jandex Type whose kind() is not one of BOOLEAN/BYTE/CHAR/SHORT/INT/LONG/FLOAT/DOUBLE handled by the switch, e.g. a CLASS, ARRAY or TYPE_VALUE-containing primitive wrapper misclassified, or a new Jandex Kind not yet mapped.","commonSituations":"Bytecode-generating extensions (record proxies, config mappers) fed types from annotation inspection; mixing up a boxed type (java.lang.Integer) with the Jandex primitive INT; Jandex version upgrades introducing new kinds.","solutions":["Check the actual Jandex type passed; unbox or normalize to a true primitive Kind before calling","For reference/void/array types use the correct branch — the method already handles VOID and defaults to ARETURN for references, so verify the type is genuinely primitive","Update AsmUtil mapping if a new Jandex Kind must be supported","Add a unit test covering all primitive kinds reaching this method"],"exampleFix":"// before\nint opcode = AsmUtil.getReturnInstruction(typeFactory.getType(Integer.class)); // CLASS kind -> throws\n// after\nint opcode = AsmUtil.getReturnInstruction(typeFactory.getType(int.class)); // IRETURN","handlingStrategy":"validation","validationCode":"boolean isSupportedPrimitive(io.quarkus.gizmo.gencore... JandexType t) {\n    switch (t.kind()) {\n        case BOOLEAN: case BYTE: case CHAR: case SHORT:\n        case INT: case LONG: case FLOAT: case DOUBLE:\n            return true;\n        case VOID:\n        case CLASS:\n            return true; // handled by dedicated branches\n        default:\n            return false;\n    }\n}","typeGuard":null,"tryCatchPattern":"int opcode;\ntry {\n    opcode = AsmUtil.getReturnInstruction(jandexType);\n} catch (IllegalArgumentException e) {\n    opcode = org.objectweb.asm.Opcodes.ARETURN; // safe default for reference types\n}","preventionTips":["Confirm the Jandex type is a true primitive before requesting return opcodes","Use type.getName()/kind() checks (INT vs CLASS Integer) before bytecode generation","Update AsmUtil mappings when upgrading Jandex to a version with new kinds","Test generated methods for every primitive return type"],"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"}