{"record":{"id":"c088f4ece03efd5e","repo":"oracle/graal","slug":"missing-at-end-of-method-filter-pattern","errorCode":null,"errorMessage":"missing ')' at end of method filter pattern: ","messagePattern":"missing '\\)' at end of method filter pattern: ","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/debug/MethodFilter.java","lineNumber":282,"sourceCode":"            return Pattern.compile(createGlobString(pattern));\n        } else {\n            return Pattern.compile(\"([^\\\\.\\\\$]*[\\\\.\\\\$])*\" + createGlobString(pattern));\n        }\n    }\n\n    private static final class BaseFilter {\n        private final Pattern clazz;\n        private final Pattern methodName;\n        private final Pattern[] signature;\n\n        private BaseFilter(String sourcePattern) {\n            String pattern = sourcePattern.trim();\n\n            // extract parameter part\n            int pos = pattern.indexOf('(');\n            if (pos != -1) {\n                if (pattern.charAt(pattern.length() - 1) != ')') {\n                    throw new IllegalArgumentException(\"missing ')' at end of method filter pattern: \" + pattern);\n                }\n                String[] signatureClasses = pattern.substring(pos + 1, pattern.length() - 1).split(\";\", -1);\n                signature = new Pattern[signatureClasses.length];\n                for (int i = 0; i < signatureClasses.length; i++) {\n                    signature[i] = createClassGlobPattern(signatureClasses[i].trim());\n                }\n                pattern = pattern.substring(0, pos);\n            } else {\n                signature = null;\n            }\n\n            // If there is at least one \".\" then everything before the last \".\" is the class name.\n            // Otherwise, the pattern contains only the method name.\n            pos = pattern.lastIndexOf('.');\n            if (pos != -1) {\n                clazz = createClassGlobPattern(pattern.substring(0, pos));\n                methodName = Pattern.compile(createGlobString(pattern.substring(pos + 1)));\n            } else {","sourceCodeStart":264,"sourceCodeEnd":300,"githubUrl":"https://github.com/oracle/graal/blob/a66e9ccd1d7bf2552883939aa0788dfd0e294aab/compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/debug/MethodFilter.java#L264-L300","documentation":"MethodFilter.BaseFilter parses patterns like 'Class.method(param;param)'. Once an opening '(' is found, the pattern must end with ')'; otherwise the parameter section cannot be extracted and IllegalArgumentException('missing ')' at end of method filter pattern: <pattern>') is thrown.","triggerScenarios":"Supplying -Dgraal.MethodFilter=Foo.bar(Baz or -Dgraal.Dump=Foo.bar(String (a filter with a signature but unbalanced parentheses). Note only the final character is checked — a pattern like 'Foo.bar(String' fails, and whitespace is trimmed before the check so a trailing ') ' is fine.","commonSituations":"Writing method filters for -Dgraal.Dump/-Dgraal.MethodFilter by hand and forgetting the closing paren on signature filters; shell line-wrapping splitting a long signature pattern; semicolon-separated signature lists (parameters are separated by ';' not ',') written with an unbalanced terminator.","solutions":["Close the parameter list: Foo.bar(java.lang.String).","If you did not mean to filter by signature, remove the '(' entirely — a bare class.method pattern needs no parentheses.","Remember parameters are ';'-separated inside the parens: Foo.Bar.method(java.lang.String;int)."],"exampleFix":"# before\n-Dgraal.MethodFilter=com.my.Foo.bar(java.lang.String\n\n# after\n-Dgraal.MethodFilter=com.my.Foo.bar(java.lang.String)","handlingStrategy":"validation","validationCode":"static boolean isValidMethodFilterPattern(String p) {\n    String t = p.trim();\n    int open = t.indexOf('(');\n    return open == -1 || t.charAt(t.length() - 1) == ')';\n}\n// call before new MethodFilter(...) / setting -Dgraal.MethodFilter","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Remember the pattern grammar: Class.method(param;param) with ';' between parameters.","Add a filter-pattern lint step to scripts that assemble -Dgraal.Dump / -Dgraal.MethodFilter values."],"tags":["method-filter","debug-options","pattern-parsing","illegal-argument"],"backgroundTag":null,"analyzedSha":"a66e9ccd1d7bf2552883939aa0788dfd0e294aab","analyzedAt":"2026-08-14T13:58:47.161Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}