On Mon, 2 Mar 2026 18:02:34 GMT, Joe Darcy <[email protected]> wrote:
>> After talking with Jan, this seemed the better option. >> What would the Filer API have simplified here? > >> After talking with Jan, this seemed the better option. What would the Filer >> API have simplified here? > > After some further consideration, I could give better guidance if I > understood more about the overall architecture about how the annotation > processor was being used in the build process and how the Valhalla build > would be sequenced with this change. > > I have not attempted to research how the Valhalla build differs from a > mainline build, but I'm generally aware there is some kind of post-processing > of classes in java.base to make them value classes in the Valhalla images > output. > > I think two basic approaches to running an annotation processor to aid the > post processing would be: > > 1) As an integrated part of the "base build", have the annotation processor > run and generate the new source files in the chosen directory. (Is these were > completely new files and new not meant to replace existing files in the > output, the compilation of the new files could be handled as part of the > built-in annotation processing compilation machinery). > > 2) As a post-pass after the base build, scan over the source (or class files) > in question and find the annotated classes to have replacements be generated. > > For something closer to 1) the Filer has a few facilities to do extra > checking and some infrastructure for concepts like the SOURCE_OUTPUT location. My understanding (possibly wrong) here was and is that the goal here is to take the existing primary (non-preview) source for e.g. `java.lang.Byte`, and produce a new source for the same class that adds the `value` keyword. This new source is then compiled in a different/separate compilation. So that there are two separate classfiles produced, one for the original source, and one for the newly generated source. Filer didn't seem like a very good fit for this task. In a sense, the annotation processing here is used mostly as a vehicle to get the source code model. Of course, there can be a question whether AP is the right way to do it - we could simply run a Java-based generation task in the Makefiles, like e.g. here: https://github.com/openjdk/jdk/pull/30072 ------------- PR Review Comment: https://git.openjdk.org/valhalla/pull/2180#discussion_r2894366735
