{"record":{"id":"ff8ce383d6b33929","repo":"oracle/graal","slug":"invalid-character","errorCode":null,"errorMessage":"Invalid character '","messagePattern":"Invalid character '","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/util/SignatureUtil.java","lineNumber":141,"sourceCode":"        }\n    }\n\n    /**\n     * Checks if the given signature can be successfully parsed by\n     * {@link #parseSignature(String, List)}.\n     *\n     * @param signature the signature to check\n     * @param acceptMissingReturnType whether a signature without a return type is considered to be\n     *            valid\n     * @return whether the signature can be successfully parsed\n     */\n    public static boolean isSignatureValid(String signature, boolean acceptMissingReturnType) {\n        return parseSignatureInternal(signature, null, false, acceptMissingReturnType) != null;\n    }\n\n    private static <T> T throwOrReturn(boolean shouldThrow, T returnValue, String errorMessage) {\n        if (shouldThrow) {\n            throw new IllegalArgumentException(errorMessage);\n        } else {\n            return returnValue;\n        }\n    }\n}\n","sourceCodeStart":123,"sourceCodeEnd":147,"githubUrl":"https://github.com/oracle/graal/blob/a66e9ccd1d7bf2552883939aa0788dfd0e294aab/compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/util/SignatureUtil.java#L123-L147","documentation":"IllegalArgumentException from SignatureUtil.parseParameterSignature: after consuming any '[' array prefixes, the next character of a parameter/return type is not one of the valid JVMS type codes ('B','C','D','F','I','J','S','Z','V','L'). The message names the offending character, its index, and the full signature, so malformed type codes like 'u', 'A', or a stray '(' inside the parameter list are pinpointed.","triggerScenarios":"Calling SignatureUtil.parseSignature with descriptors containing an invalid type letter — e.g. '(u)V' (lowercase), '(LA;)V' (missing 'java/' style but valid shape is fine; invalid only when first char after '[' is not a code), '()[xV', or where a parameter descriptor was mangled by templating ('%s' left unsubstituted).","commonSituations":"Hand-building descriptor strings with typos; format-string placeholders never filled in; lowercase/uppercase confusion ('i' vs 'I'); descriptors from a non-JVM source (e.g. .NET-style 'System.Int32') fed into JVM tooling.","solutions":["Look at the character and index in the message and correct that type code against the JVMS table: B byte, C char, D double, F float, I int, J long, S short, Z boolean, V void, L...; object, [ array.","Never hand-concatenate descriptors; derive them from MethodType.toMethodDescriptorString() or javap -s output.","Validate external input with SignatureUtil.isSignatureValid(sig, false) and reject early."],"exampleFix":"// before\nString sig = \"(i)V\"; // lowercase 'i' invalid\n\n// after\nString sig = \"(I)V\";","handlingStrategy":"validation","validationCode":"private static final String VALID_TYPE_CHARS = \"BCDFIJSZVL[\";\nstatic boolean hasPlausibleTypeCodes(String sig) {\n    for (int i = 0; i < sig.length(); i++) {\n        char c = sig.charAt(i);\n        if (\"()[\".indexOf(c) < 0 && VALID_TYPE_CHARS.indexOf(c) < 0) return false;\n    }\n    return SignatureUtil.isSignatureValid(sig, false);\n}","typeGuard":null,"tryCatchPattern":"try {\n    SignatureUtil.parseSignature(sig, params);\n} catch (IllegalArgumentException e) {\n    if (e.getMessage().startsWith(\"Invalid character\")) {\n        reportDescriptorTypo(sig, e.getMessage());\n    } else throw e;\n}","preventionTips":["Memorize or tabulate the JVMS type codes: B C D F I J S Z V L [ — no lowercase forms.","Generate descriptors programmatically; avoid hand-typing them.","Check format-string templates for unsubstituted '%s' before parsing output."],"tags":["metadata","signature","parsing","jvm-descriptor","illegal-argument"],"backgroundTag":null,"analyzedSha":"a66e9ccd1d7bf2552883939aa0788dfd0e294aab","analyzedAt":"2026-08-14T13:58:47.161Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}