{"record":{"id":"c1ceb3b076ec134b","repo":"oracle/graal","slug":"invokedynamic-not-supported-by-s-c1ceb3","errorCode":null,"errorMessage":"INVOKEDYNAMIC not supported by%s","messagePattern":"INVOKEDYNAMIC not supported by(.+?)","errorType":"exception","errorClass":"GraalError","httpStatus":null,"severity":"error","filePath":"compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/replacements/classfile/ClassfileConstantPool.java","lineNumber":164,"sourceCode":"    }\n\n    @Override\n    public void loadReferencedType(int index, int opcode) {\n        if (opcode == Bytecodes.INVOKEDYNAMIC) {\n            throw new GraalError(\"INVOKEDYNAMIC not supported by \" + ClassfileBytecodeProvider.class.getSimpleName());\n        }\n        entries[index].loadReferencedType(this, index, opcode);\n    }\n\n    @Override\n    public JavaField lookupField(int index, ResolvedJavaMethod method, int opcode) {\n        return get(FieldRef.class, index).resolve(this, opcode);\n    }\n\n    @Override\n    public JavaMethod lookupMethod(int index, int opcode) {\n        if (opcode == Bytecodes.INVOKEDYNAMIC) {\n            throw new GraalError(\"INVOKEDYNAMIC not supported by\" + ClassfileBytecodeProvider.class.getSimpleName());\n        }\n        return get(ExecutableRef.class, index).resolve(this, opcode);\n    }\n\n    @Override\n    public JavaMethod lookupMethod(int index, int opcode, ResolvedJavaMethod caller) {\n        if (opcode == Bytecodes.INVOKEDYNAMIC) {\n            throw new GraalError(\"INVOKEDYNAMIC not supported by\" + ClassfileBytecodeProvider.class.getSimpleName());\n        }\n        ResolvedJavaMethod result = get(ExecutableRef.class, index).resolve(this, opcode);\n        if (result != null && result.getName().equals(\"getEventWriter\") && result.getDeclaringClass().getName().equals(\"Ljdk/jfr/internal/event/EventWriterFactory;\")) {\n            // Only JFR transformed methods can call\n            // jdk.jfr.internal.event.EventWriterFactory.getEventWriter(long)\n            // and this ClassfileBytecode will never be used to load such a class.\n            throw new IllegalAccessError(\"illegal access linking method 'jdk.jfr.internal.event.EventWriterFactory.getEventWriter(long)'\");\n        }\n        return result;\n    }","sourceCodeStart":146,"sourceCodeEnd":182,"githubUrl":"https://github.com/oracle/graal/blob/a66e9ccd1d7bf2552883939aa0788dfd0e294aab/compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/replacements/classfile/ClassfileConstantPool.java#L146-L182","documentation":"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'.)","triggerScenarios":"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.","commonSituations":"Lambdas, method references, or string concatenation written inside snippet/intrinsic classes; modern javac output reused as snippet bytecode.","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)."],"exampleFix":"// before\nConsumer<Object> sink = o -> record(o); // invokedynamic\n\n// after\nConsumer<Object> sink = new Consumer<>() {\n    public void accept(Object o) { record(o); }\n};","handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":["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."],"tags":["graal","snippet","invokedynamic","method-resolution"],"backgroundTag":null,"analyzedSha":"a66e9ccd1d7bf2552883939aa0788dfd0e294aab","analyzedAt":"2026-08-14T13:58:47.161Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}