oracle/graal · error · IllegalArgumentException

Directed inlining rule {componentName} filter must be a sing

Error message

Directed inlining rule {componentName} filter must be a single positive MethodFilter pattern; use ',' to separate rules: {ruleSpec}

What it means

parseSinglePositiveMethodFilter (DirectedInliningRules.java:391) validates the caller/callee method filter of each directed-inlining rule. It must be a single positive MethodFilter pattern: no wildcards ('*', '?'), no comma-separated alternatives, no '|' alternation, no '@', no braces, and no leading '~' negation. The restriction exists because a directed rule must identify exactly one callsite path.

Source

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

    private static ReceiverTypeFilter parseReceiverTypeFilter(String typeSpec, String ruleSpec) {
        if (typeSpec.indexOf('*') >= 0 || typeSpec.indexOf('?') >= 0 ||
                        typeSpec.indexOf('|') >= 0 || typeSpec.indexOf('@') >= 0 ||
                        typeSpec.indexOf('(') >= 0 || typeSpec.indexOf(')') >= 0 ||
                        typeSpec.indexOf('{') >= 0 || typeSpec.indexOf('}') >= 0 ||
                        typeSpec.startsWith("~")) {
            throw new IllegalArgumentException("Directed inlining rule receiver type filter must contain simple or qualified positive type names: " +
                            ruleSpec);
        }
        return new ReceiverTypeFilter(typeSpec);
    }

    private static MethodFilter parseSinglePositiveMethodFilter(String filterSpec, String componentName, String ruleSpec) {
        if (filterSpec.indexOf('*') >= 0 || filterSpec.indexOf('?') >= 0 ||
                        findLastTopLevel(filterSpec, ',') >= 0 || filterSpec.indexOf('|') >= 0 ||
                        filterSpec.indexOf('@') >= 0 || filterSpec.indexOf('{') >= 0 || filterSpec.indexOf('}') >= 0 ||
                        filterSpec.startsWith("~")) {
            throw new IllegalArgumentException("Directed inlining rule " + componentName +
                            " filter must be a single positive MethodFilter pattern; use ',' to separate rules: " + ruleSpec);
        }
        return MethodFilter.parse(filterSpec);
    }

    private static IllegalArgumentException invalidRule(String ruleSpec) {
        return new IllegalArgumentException("Directed inlining rule must have the form " + EXPECTED_RULE_FORMAT + ": " + ruleSpec);
    }

    private String findRule(Callsite[] callsites, ResolvedJavaMethod declaredCalleeMethod, ResolvedJavaMethod concreteCalleeMethod, ResolvedJavaType receiverType, boolean includePrefixes) {
        for (Rule rule : rules) {
            if (rule.matchesDirectedInvoke(callsites, declaredCalleeMethod, receiverType) ||
                            (includePrefixes && rule.matchesDirectedPrefix(callsites, declaredCalleeMethod, concreteCalleeMethod, receiverType))) {
                return rule.ruleSpec();
            }
        }
        return null;
    }

View on GitHub (pinned to a66e9ccd1d)

Solutions

  1. Write one exact method or exact-class pattern per rule (e.g., 'com.foo.A.f' or 'com.foo.A::*')
  2. Emit multiple rules instead of comma-separated alternatives
  3. Re-read the error text: it explicitly says to use ',' to separate rules

Example fix

# before
inline : com.foo.*,com.bar.* -> com.baz.C.g()

# after
inline : com.foo.* -> com.baz.C.g()
inline : com.bar.* -> com.baz.C.g()
Defensive patterns

Strategy: validation

Validate before calling

static boolean isSinglePositiveFilter(String f) {
    return !f.contains("*") && !f.contains("?") && !f.contains(",") && !f.contains("|") && !f.contains("@") && !f.contains("{") && !f.contains("}") && !f.startsWith("~");
}

Prevention

When it happens

Trigger: A rule like 'inline : com.foo.* -> com.bar.B.g()' (wildcard), 'A.f,B.h -> C.g()' (comma list), or '~A.f -> B.g()' (negation).

Common situations: Copying glob-style patterns from -Dgraal.MethodFilter-style options into directed rules; trying to compress many rules into one line.

Related errors


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