oracle/graal · error · IllegalArgumentException

has params

Error message

%s has params

What it means

JNIMethodResolver lazily resolves a static Java method on the entry-points class via JNI GetStaticMethodID. If the JNI call returns a null method ID (no pending exception mapping it to a Java exception), the wrapper throws InternalError naming the method: the class was found but the requested static method with that exact name/signature is not present. This usually means a version mismatch between the JNIutils native glue and the Java entry-points class.

Solutions

  1. Verify the method exists, is static, and its descriptor string exactly matches (e.g. "(ILjava/lang/String;)V") using javap -s on the entry-points class.
  2. Align versions: use matching org.graalvm.jniutils / Espresso / GraalVM artifacts from the same release so native and Java sides agree.
  3. If you control the resolver, double-check methodName/methodSignature spelling, especially class-name slashes vs dots.

Example fix

// before
new JNIMethodResolver("throwException", "(Ljava/lang/Throwable)V") // wrong: missing trailing ";" for object type? it is present; but e.g.

// after
// correct descriptor verified with `javap -s`:
new JNIMethodResolver("throwException", "(Ljava/lang/Throwable;)V")
Defensive patterns

Strategy: try-catch

Validate before calling

// Verify the static method and descriptor before resolving:
// javap -s -p target/classes/org/graalvm/jniutils/JNIExceptionWrapperEntryPoints
// then ensure methodName + methodSignature match one of the printed descriptors exactly.

Try / catch

try {
    resolver.resolve(env);
} catch (InternalError e) {
    if (e.getMessage().startsWith("No such method:")) {
        // version/signature mismatch: fail fast with diagnostics, list the class's static methods
    } else {
        throw e;
    }
}

Prevention

When it happens

Trigger: Calling GetStaticMethodID for a method whose signature string is wrong (e.g. missing semicolons or wrong argument order); renaming or removing the method in a newer org.graalvm.jniutils build while native code still references the old name; method exists but is non-static.

Common situations: Mixed-version GraalVM/Espresso jars on the classpath; hand-written signature strings for JNI method lookups; upgrading jniutils without rebuilding native counterparts.

Related errors


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

Appendix: source

Thrown at compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/annotation/AnnotationValueType.java:83

        return existing != null ? existing : created;
    }

    private AnnotationValueType(ResolvedJavaType annotationClass) {
        if (!annotationClass.isAnnotation()) {
            throw new IllegalArgumentException("Not an annotation type");
        }

        ResolvedJavaMethod[] methods = annotationClass.getDeclaredMethods();

        memberTypes = new EconomicHashMap<>(methods.length + 1);
        memberDefaults = new EconomicHashMap<>(0);

        for (ResolvedJavaMethod method : methods) {
            if (method.isPublic() &&
                            method.isAbstract() &&
                            !method.isSynthetic()) {
                if (method.getSignature().getParameterCount(false) != 0) {
                    throw new IllegalArgumentException(method + " has params");
                }
                String name = method.getName();
                ResolvedJavaType memberType = method.getSignature().getReturnType(annotationClass).resolve(annotationClass);
                memberTypes.put(name, memberType);

                Object defaultValue = AnnotationValueSupport.getAnnotationDefaultValue(method);
                if (defaultValue != null) {
                    memberDefaults.put(name, defaultValue);
                }
            }
        }
    }

    /**
     * Determines if the type of {@code elementValue} matches {@code elementType}.
     *
     * @param elementValue a value of a type returned by {@link AnnotationValue#get}
     * @param elementType an annotation element type (i.e. the return type of an annotation

View on GitHub (pinned to a66e9ccd1d)