oracle/graal · error · GraalError

Method ${methodName} not found

Error message

Method ${methodName} not found

What it means

Thrown by the SymbolicMethod(Class, String, Class...) constructor when the receiver class declares (or inherits) no method with the given name and parameter types. SymbolicMethod is the name-based representation of compiler-interface methods used by replay proxies; the constructor sanity-checks in non-libgraal runtimes that the symbolic reference resolves to a real method, and GraalError reports it otherwise.

Source

Thrown at compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/replaycomp/proxy/CompilationProxy.java:160

         * @param receiverClass the receiver class
         * @param methodName the method name
         * @param params the parameter types
         */
        public SymbolicMethod(Class<?> receiverClass, String methodName, Class<?>... params) {
            this(methodName, params);
            if (!LibGraalSupport.inLibGraalRuntime()) {
                // Omit the check in the image to avoid increasing image size.
                try {
                    receiverClass.getDeclaredMethod(methodName, params);
                    return;
                } catch (NoSuchMethodException ignored) {
                }
                try {
                    receiverClass.getMethod(methodName, params);
                    return;
                } catch (NoSuchMethodException ignored) {
                }
                throw new GraalError("Method " + methodName + " not found");
            }
        }

        @Override
        public boolean equals(Object o) {
            if (o instanceof SymbolicMethod that) {
                return Arrays.equals(methodAndParamNames, that.methodAndParamNames);
            }
            return false;
        }

        @Override
        public int hashCode() {
            return Arrays.hashCode(methodAndParamNames);
        }

        @Override
        public String toString() {

View on GitHub (pinned to a66e9ccd1d)

Solutions

  1. Fix the method name and parameter types at the SymbolicMethod construction site to match a real method on the receiver class.
  2. If the method legitimately moved, update the receiver class argument to the new declaring class.
  3. If this fires only in a non-libgraal run after a refactor, align both sides to the same version and rebuild.

Example fix

// before
new SymbolicMethod(HotSpotResolvedJavaType.class, "getMetaspaceKlass", Long.class);

// after
new SymbolicMethod(HotSpotResolvedJavaType.class, "getKlassPointer"); // match the real signature
Defensive patterns

Strategy: validation

Validate before calling

// verify the symbolic method exists before building the proxy
try {
    receiverClass.getMethod(methodName, params);
} catch (NoSuchMethodException e) {
    throw new IllegalStateException("SymbolicMethod target missing: " + methodName, e);
}
new CompilationProxy.SymbolicMethod(receiverClass, methodName, params);

Prevention

When it happens

Trigger: Constructing a CompilationProxy.SymbolicMethod with a receiver class and a method name/parameter list that does not exist — getDeclaredMethod and getMethod both throw NoSuchMethodException. Common when a method was renamed, its signature changed, or the wrong receiver class is passed. The check is deliberately omitted in libgraal image builds to keep image size small.

Common situations: Refactoring a compiler-interface method (rename/moved parameters) without updating the symbolic reference site; version skew between the code constructing SymbolicMethod and the class it points at; typos in the method-name string.

Related errors


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