Adding bytecode interfacing methods

Jochen Theodorou <[email protected]> Wed, 1 Jul 2026 06:45:54 +0200
Newsgroups gmane.comp.lang.groovy.devel
Message-ID <[email protected]>
Hi,

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

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

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

thoughts?

bye Jochen