oracle/graal · error · GraalError
INVOKEDYNAMIC not supported by%s
Error message
INVOKEDYNAMIC not supported by%s
What it means
Same provider limitation as the loadReferencedType variant, but hit on the lookupMethod(index, opcode) path during graph building: resolving a constant-pool entry under the INVOKEDYNAMIC opcode throws GraalError because ClassfileBytecodeProvider cannot perform dynamic linkage. (Note the message string is missing a space after 'by'.)
Source
Thrown at compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/replacements/classfile/ClassfileConstantPool.java:164
}
@Override
public void loadReferencedType(int index, int opcode) {
if (opcode == Bytecodes.INVOKEDYNAMIC) {
throw new GraalError("INVOKEDYNAMIC not supported by " + ClassfileBytecodeProvider.class.getSimpleName());
}
entries[index].loadReferencedType(this, index, opcode);
}
@Override
public JavaField lookupField(int index, ResolvedJavaMethod method, int opcode) {
return get(FieldRef.class, index).resolve(this, opcode);
}
@Override
public JavaMethod lookupMethod(int index, int opcode) {
if (opcode == Bytecodes.INVOKEDYNAMIC) {
throw new GraalError("INVOKEDYNAMIC not supported by" + ClassfileBytecodeProvider.class.getSimpleName());
}
return get(ExecutableRef.class, index).resolve(this, opcode);
}
@Override
public JavaMethod lookupMethod(int index, int opcode, ResolvedJavaMethod caller) {
if (opcode == Bytecodes.INVOKEDYNAMIC) {
throw new GraalError("INVOKEDYNAMIC not supported by" + ClassfileBytecodeProvider.class.getSimpleName());
}
ResolvedJavaMethod result = get(ExecutableRef.class, index).resolve(this, opcode);
if (result != null && result.getName().equals("getEventWriter") && result.getDeclaringClass().getName().equals("Ljdk/jfr/internal/event/EventWriterFactory;")) {
// Only JFR transformed methods can call
// jdk.jfr.internal.event.EventWriterFactory.getEventWriter(long)
// and this ClassfileBytecode will never be used to load such a class.
throw new IllegalAccessError("illegal access linking method 'jdk.jfr.internal.event.EventWriterFactory.getEventWriter(long)'");
}
return result;
}View on GitHub (pinned to a66e9ccd1d)
Solutions
- Remove lambda/method-reference/indy-concat constructs from code parsed as snippets.
- Use anonymous classes or static helpers and StringBuilder-based concatenation.
- Rebuild and re-run so the snippet class no longer contains INVOKEDYNAMIC opcodes (check with javap -c).
Example fix
// before
Consumer<Object> sink = o -> record(o); // invokedynamic
// after
Consumer<Object> sink = new Consumer<>() {
public void accept(Object o) { record(o); }
}; Defensive patterns
Strategy: validation
Prevention
- Never write lambdas or method references in classes parsed as snippets/replacements.
- After editing snippet code, run javap -c on the compiled class and confirm there are no invokedynamic instructions.
- Document the 'no indy' rule in the snippet package's package-info or README.
When it happens
Trigger: The bytecode of a class parsed by ClassfileBytecodeProvider executes an invokedynamic (lambda body reached during graph construction, indy string concat, method reference) and the graph builder calls lookupMethod for it.
Common situations: Lambdas, method references, or string concatenation written inside snippet/intrinsic classes; modern javac output reused as snippet bytecode.
Related errors
- INVOKEDYNAMIC not supported by %s
- Resolution of %s constant pool entries not supported by %s
- too many arguments
- Too deep inlining, probably caused by recursive inlining.
- Could not find method in %s named %s
AI-assisted analysis of oracle/graal@a66e9ccd1d (2026-08-14).
Data as JSON: /api/errors/c1ceb3b076ec134b.
Report an issue: GitHub.