Vampire
09/01/2026, 6:10 AMpaulk_asert
09/01/2026, 7:21 AMVampire
09/01/2026, 8:39 AMmakeDynamic does not make the whole method dynamically compiled, just that one statement?
I had a look at the makeDynamic method in the past and have seen that it does
context.getEnclosingMethod().putNodeMetaData(StaticTypesMarker.DYNAMIC_RESOLUTION, Boolean.TRUE);
I interpreted this as the whole method being compiled dynamically.paulk_asert
10/22/2026, 8:46 AMmakeDynamic set DYNAMIC_RESOLUTION on the enclosing method too, and StaticTypesWriterController.getCallSiteWriter() checked that flag. So any marked expression switched the whole method to the dynamic call-site writer. Not quite "the whole method compiled dynamically", but close enough to matter.
• 5.0.4+, 5.1.x and 6.0.0 (GROOVY-11817): the writer is now picked per expression, via getCallSiteWriterFor(expression), and only the marked expression goes through the regular (indy) call-site writer. The rest of the method stays statically compiled. In 6.0.0 makeDynamic no longer marks the method at all. In the 5.x backport the method-level line is still there, but codegen no longer reads it to choose the writer; it only tells codegen to set up the dynamic writer's state at method entry.
So on current versions only that localValueSet property access is dynamic. On 4.0.x the extension still works, but its effect is roughly the same as a @CompileDynamic helper method.Vampire
10/22/2026, 10:18 PMdoDynamic { ... } helper that marks its contents as dynamically complied targetedly?
Or does something like that already exist in later versions?paulk_asert
10/22/2026, 10:29 PMVampire
10/22/2026, 10:31 PM