You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@groovy.apache.org by Jochen Theodorou <bl...@gmx.org> on 2026/07/01 04:45:54 UTC

Adding bytecode interfacing methods

Hi,

GROOVY-9848 and the PR for it, that I missed to look at just reminded me 
of something I would like to discuss.

If we add a method that we compile against, like for example in 
ScriptBytecodeAdapter, then we have to maintain that method almost for 
eternity or we break binary compatibility of older Groovy versions that 
make use of that in precompiled code. That is why when I initially 
started with invokedynamic I gave it some kind of operator (method call, 
cast, property access) that controls what this invokedynamic call is 
for. That is because a bootstrap method is such a binary interface as well.

My proposal is therefore not adding new methods to ScriptBytecodeAdapter 
at all and instead to make use of the existing bootstrap method or we 
define a new bootstrap method for such cases as "in" and "!in". Though a 
new bootstrap method is something I would only consider for cases where 
we can determine the outcome without having to inspect the dynamic 
types. So for example isCase depends on the receiver more or less, thus 
it makes no sense to put it into a new bootstrap method in my opinion.

thoughts?

bye Jochen