oracle/graal · error · IllegalArgumentException

Directed inlining rule must have non-empty caller and callee

Error message

Directed inlining rule must have non-empty caller and callee filters: {ruleSpec}

What it means

DirectedInliningRules.parseRule (DirectedInliningRules.java:297) splits a rule on the caller->callee edge separator and requires every caller component to be non-empty. This error fires when an intermediate caller component (not the last/callee position) trims to an empty string, e.g., a doubled separator 'A::m -> -> B::n'.

Source

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

    }

    private static IllegalArgumentException invalidCommand(Path commandFile, int lineNumber, String commandLine) {
        return new IllegalArgumentException(commandFile + ":" + lineNumber +
                        ": Directed inlining command must have the form 'inline <rule>' or 'dontinline <rule>': " + commandLine);
    }

    private static Rule parseRule(String ruleSpec) {
        ArrayList<String> components = splitTopLevel(ruleSpec, EDGE_SEPARATOR);
        if (components.size() < 2) {
            throw invalidRule(ruleSpec);
        }

        ComponentFilter[] callerFilters = new ComponentFilter[components.size() - 1];
        int[] callerBcis = new int[callerFilters.length];
        for (int i = 0; i < callerFilters.length; i++) {
            String callerSpec = components.get(i).trim();
            if (callerSpec.isEmpty()) {
                throw new IllegalArgumentException("Directed inlining rule must have non-empty caller and callee filters: " + ruleSpec);
            }
            ParsedMethodSpec caller = parseMethodSpec(callerSpec, i == 0 ? "root" : "inlined caller", ruleSpec);
            if (i == 0) {
                callerFilters[i] = new ComponentFilter(parseSinglePositiveMethodFilter(caller.methodSpec(), "root", ruleSpec), ReceiverTypeFilter.EMPTY_ARRAY);
            } else {
                ParsedCalleeSpec callerTarget = parseCalleeSpec(caller.methodSpec(), ruleSpec);
                callerFilters[i] = new ComponentFilter(parseSinglePositiveMethodFilter(callerTarget.methodSpec(), "inlined caller", ruleSpec), callerTarget.receiverTypes());
            }
            callerBcis[i] = caller.bci();
        }

        String calleeSpec = components.get(components.size() - 1).trim();
        if (calleeSpec.isEmpty()) {
            throw new IllegalArgumentException("Directed inlining rule must have non-empty caller and callee filters: " + ruleSpec);
        }

        ParsedCalleeSpec callee = parseCalleeSpec(calleeSpec, ruleSpec);

View on GitHub (pinned to a66e9ccd1d)

Solutions

  1. Fix the rule so each caller segment between separators names a method (class.method or class::* form)
  2. Remove accidental doubled separators or leading/trailing separators
  3. Consult EXPECTED_RULE_FORMAT in the class docs for the exact grammar

Example fix

# before
inline : com.foo.A.f -> -> com.bar.B.g

# after
inline : com.foo.A.f -> com.bar.B.g
Defensive patterns

Strategy: validation

Validate before calling

static void lintRule(String rule) {
    for (String comp : rule.split("->")) {
        if (comp.trim().isEmpty() && !rule.trim().endsWith(comp.trim())) throw new IllegalArgumentException("empty caller segment: " + rule);
    }
}

Prevention

When it happens

Trigger: A rule in the directed inlining rules file with an empty caller segment between edge separators, or a leading separator making the first caller empty.

Common situations: Typos with duplicated '->'; rules edited to remove a middle callsite but leaving the separator; whitespace-only segments.

Related errors


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