JEP draft: Low-level classfile reflection

OwnerJohn Rose
Componenthotspot / runtime
Created2020/06/24 18:45
Updated2024/07/10 00:03


The idea here is for the JDK and JVM to have a private API for reflecting what’s in the class file (except what was discarded during loading) in a uniform manner. There are existing mechanisms for that which are API driven and bespoke for reflection and for annotation expansion (CP reflection) and (more ambitiously) JVMCI for external JITs.

Those don’t scale well, and we don’t want to define a similar API for species data flows at the same time we are refining those data flows: So it’s time for a low-level reflector, something more like the JVMTI classfile reconstitutor, but less hacky and more “alive” (i.e., reflecting current CP linkage state, and not claiming to generate a whole classfile).

I have a working prototype for this one. It will serve us for prototyping species data flows (including reading whatever attributes we need to add to classifies). Also I expect it to serve as a basis, later on, for putting more of the previous APIs in Java code.