oracle/graal · error · IllegalArgumentException

{file}:{line}: {cause}

Error message

{file}:{line}: {cause}

What it means

While parsing each line of the directed inlining rules file, parseCommandFileLine (DirectedInliningRules.java:257) delegates to parseRule and rethrows any IllegalArgumentException prefixed with '<file>:<line>:' so the user knows exactly which rule line is malformed. The message itself comes from the inner parse error (e.g., empty rule, bad receiver type filter).

Solutions

  1. Open the named file at the reported line number and fix the rule according to the EXPECTED_RULE_FORMAT shown in the 'Directed inlining rule must have the form ...' companion message
  2. Strip anything after '#' only as comments; ensure the line has the form 'inline|dontinline : callerSpec -> ... -> calleeSpec'
  3. Re-run and fix lines one at a time; each remaining error reports the next bad line

Example fix

# before (rules.txt:3)
inline : com.foo.A.* ->

# after (rules.txt:3)
inline : com.foo.A.* -> com.bar.B.quad(int)
Defensive patterns

Strategy: try-catch

Try / catch

try {
    rules = DirectedInliningRules.fromFile(path);
} catch (IllegalArgumentException e) {
    // message is '<file>:<line>: <cause>' — log it and surface to the user editing the file
    log.error("bad directed-inlining rule: {}", e.getMessage());
}

Prevention

When it happens

Trigger: Any syntax error in a rule line (after '#' comment stripping) in the file named by -Dgraal.DirectedInliningCommandFile: missing caller/callee, stray '@', bad receiver-type braces, etc.

Common situations: Hand-edited rules files; comments using the wrong comment character; copy-pasting rules from docs that mangle unicode dashes or quotes.

Related errors


AI-assisted analysis of oracle/graal@a66e9ccd1d (2026-08-14). Data as JSON: /api/errors/cedbfda4ccc9acbe. Report an issue: GitHub.

Appendix: source

Thrown at compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/phases/common/inlining/DirectedInliningRules.java:257

            return;
        }
        int commandSeparator = findCommandSeparator(commandLine);
        if (commandSeparator < 0) {
            throw invalidCommand(commandFile, lineNumber, commandLine);
        }
        String command = commandLine.substring(0, commandSeparator).trim().toLowerCase(Locale.ROOT);
        String ruleSpec = commandLine.substring(commandSeparator + 1).trim();
        if (ruleSpec.startsWith(String.valueOf(DIRECTIVE_SEPARATOR))) {
            ruleSpec = ruleSpec.substring(1).trim();
        }
        if (ruleSpec.isEmpty()) {
            throw invalidCommand(commandFile, lineNumber, commandLine);
        }
        Rule rule;
        try {
            rule = parseRule(ruleSpec);
        } catch (IllegalArgumentException e) {
            throw new IllegalArgumentException(commandFile + ":" + lineNumber + ": " + e.getMessage(), e);
        }
        switch (command) {
            case "inline" -> inlineRules.add(rule);
            case "dontinline" -> dontInlineRules.add(rule);
            default -> throw invalidCommand(commandFile, lineNumber, commandLine);
        }
    }

    private static String stripComment(String line) {
        int commentStart = line.indexOf('#');
        return commentStart < 0 ? line : line.substring(0, commentStart);
    }

    private static int findCommandSeparator(String commandLine) {
        for (int i = 0; i < commandLine.length(); i++) {
            char c = commandLine.charAt(i);
            if (c == DIRECTIVE_SEPARATOR || Character.isWhitespace(c)) {
                return i;

View on GitHub (pinned to a66e9ccd1d)