oracle/graal · error · IllegalArgumentException
%s 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.
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 annotationView on GitHub (pinned to a66e9ccd1d)
Solutions
- 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.
- Align versions: use matching org.graalvm.jniutils / Espresso / GraalVM artifacts from the same release so native and Java sides agree.
- 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
- Pin all GraalVM artifacts (jniutils, espresso, substratevm) to one BOM/release version.
- Generate JNI descriptors from javap -s output rather than hand-writing them.
- Add a startup assertion that the expected entry-points methods resolve before native code depends on them.
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
- %s is not an enum type
- No such method: %s
- expected %s, got %s
- %s is not an annotation interface
- Cannot look up %s annotation at Native Image runtime
AI-assisted analysis of oracle/graal@a66e9ccd1d (2026-08-14).
Data as JSON: /api/errors/384c7aeadcf85df0.
Report an issue: GitHub.