{"record":{"id":"3f6c5416994e9c41","repo":"oracle/graal","slug":"unknown-primitive-or-void-type-character","errorCode":null,"errorMessage":"unknown primitive or void type character: ","messagePattern":"unknown primitive or void type character: ","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"compiler/src/jdk.graal.compiler.processor/src/jdk/graal/compiler/replacements/processor/APHotSpotSignature.java","lineNumber":181,"sourceCode":"                return TypeKind.BOOLEAN;\n            case 'C':\n                return TypeKind.CHAR;\n            case 'F':\n                return TypeKind.FLOAT;\n            case 'D':\n                return TypeKind.DOUBLE;\n            case 'B':\n                return TypeKind.BYTE;\n            case 'S':\n                return TypeKind.SHORT;\n            case 'I':\n                return TypeKind.INT;\n            case 'J':\n                return TypeKind.LONG;\n            case 'V':\n                return TypeKind.VOID;\n        }\n        throw new IllegalArgumentException(\"unknown primitive or void type character: \" + ch);\n    }\n\n    public TypeMirror getReturnType(ProcessingEnvironment env) {\n        if (returnTypeCache == null) {\n            if (returnType == null) {\n                throw new RuntimeException(\"Invalid return type.\");\n            }\n            returnTypeCache = lookupType(env, returnType);\n        }\n        return returnTypeCache;\n    }\n\n    @Override\n    public String toString() {\n        return \"Signature<\" + originalString + \">\";\n    }\n}\n","sourceCodeStart":163,"sourceCodeEnd":199,"githubUrl":"https://github.com/oracle/graal/blob/a66e9ccd1d7bf2552883939aa0788dfd0e294aab/compiler/src/jdk.graal.compiler.processor/src/jdk/graal/compiler/replacements/processor/APHotSpotSignature.java#L163-L199","documentation":"Thrown by APHotSpotSignature while resolving a single type-signature character to a javax.lang.model TypeKind during annotation processing. The signature grammar only accepts the JVM primitive/void characters 'Z','C','F','D','B','S','I','J','V' at this position; any other character means the signature string being parsed is not a valid JVM method/type descriptor. This class is used by the Graal annotation processor to parse @MethodSubstitution/@NodeIntrinsic style signatures, so the exception indicates a malformed signature literal in processor input.","triggerScenarios":"A method signature string like \"(Ljava/lang/Object;)X\" or \"hello\" is handed to the APHotSpotSignature constructor; lookupType later calls the primitive-switch and falls through on 'X', 'L' at the wrong position, '[' , lowercase letters, or any non-descriptor character. Only the eight primitive chars plus 'V' reach this switch, so any Object/array return in a spot expecting a primitive char, or a typo in a signature annotation attribute, triggers it.","commonSituations":"Hand-writing a signature in a replacements annotation (e.g. @MethodSubstitution(isStatic = ..., signature = ...)), typo'ing the return descriptor (\"I\" vs \"i\", \"V\" vs \"void\"), or pasting a partial descriptor that omits the leading '(' or the return character. Also occurs after refactoring a substituted method's signature without updating the annotation string.","solutions":["Correct the signature string to be a valid JVM descriptor: parentheses-wrapped parameter descriptors followed by exactly one return descriptor (e.g. \"(ILjava/lang/String;)J\").","Use fully qualified slash-separated names for reference types ('Ljava/lang/Object;') and '[' prefixes for arrays; do not use '.', '<', or source-type names.","If the signature is derived, print the string being parsed at the construction site and compare it against javap output for the target method.","Add a unit test that constructs APHotSpotSignature for every substitution signature to catch typos at build time."],"exampleFix":"// before\n@MethodSubstitution(value = \"append\", signature = \"(ljava/lang/String;)i\")\n// after\n@MethodSubstitution(value = \"append\", signature = \"(Ljava/lang/String;)I\")","handlingStrategy":"validation","validationCode":"private static final String PRIM = \"ZCFDBSIJV\";\nstatic boolean isValidPrimitiveChar(char ch) { return PRIM.indexOf(ch) >= 0; }\n// validate whole descriptor before parsing:\nstatic boolean isValidDescriptor(String sig) {\n    return sig.matches(\"\\\\((\\\\[*(Z|C|F|D|B|S|I|J|L[^;]+;))*\\\\)(\\\\[*(Z|C|F|D|B|S|I|J|V|L[^;]+;))\");\n}","typeGuard":null,"tryCatchPattern":"try { sig.lookupType(env); } catch (IllegalArgumentException e) { messager.printMessage(Diagnostic.Kind.ERROR, \"bad signature '\" + sig + \"': \" + e.getMessage(), element); }","preventionTips":["Generate descriptors from Element objects (executableElement.getParameters + return type) instead of hand-writing strings.","Add a descriptor-format unit test for every signature constant.","Remember reference types must be 'L<name>;' with slashes, not dots."],"tags":["graalvm","annotation-processing","jvm-descriptor","validation"],"backgroundTag":null,"analyzedSha":"a66e9ccd1d7bf2552883939aa0788dfd0e294aab","analyzedAt":"2026-08-14T13:58:47.161Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}