On Fri, 7 Aug 2026 09:47:38 GMT, Axel Boldt-Christmas <[email protected]> 
wrote:

>> What about handling at the ENTER stage? I don't think tweaking 
>> `tree.mods.flags` must happen right after initial parsing.
>
> After digging deeper into what javac does. We both consume `tree.mods.flags` 
> and produce `annotationType.type` in ENTER.  So we would need to plugin at 
> the back edge of ENTER.
> 
> I may be that the `tree.mods.flags` consumption in `Enter::visitClassDef` can 
> handle us changing state efter ENTER. I think what we miss is the guard 
> against implicit addition of `IDENTITY_TYPE` in `Check::checkFlags`. 
> 
> I think someone with greater javac knowledge has to convince me that it would 
> be fine to do this after we have read out the state. 
> 
> But currently there is no point where we can hook in a plugin where it has 
> `annotationType.type` and the state we want to modify has not already been 
> read.
> 
> javac enter order of operations:
> 
>   tree.mods.flags consumed
>           ↓
>   imports resolved
>           ↓
>   annotationType.type populated

Explicit removal of `IDENTITY_TYPE` flag should be ok. 
https://github.com/openjdk/jdk/blob/9bbc1128ff70be842b0272f3067dfaa42220ac3c/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassReader.java#L3353-L3354

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/32214#discussion_r3735597674

Reply via email to