Bytecode transformation investigation

Brian Goetz brian.goetz at oracle.com
Wed Aug 3 23:26:38 UTC 2022


> isHidden() returning false is a compatibility issue because i've seen it used has an equivalent of isALambda() (like isAnonymous() was used before isHidden()), GraalVM emulates isHidden() for this reason.

I'm not very sympathetic here.  Code that interprets isHidden in this 
way is just wrong.  There were extensive discussions about "how do I 
detect whether an object is a lambda" and the answer has consistently 
been "don't try, you don't need to know, and none of the mechanisms 
answer the question you are asking."

> For me, instead of trying to emulate those differences, i think it's easier here to provide a method Class.isLambdaProxy() and adds an empty classfile attribute LambdaProxy in the VM spec so both the lambda proxy generated using invokedynamic or pre-generated will mostly behave the same way.

We made a very clear decision in the JSR 335 EG -- that at runtime, 
lambdas are not a thing.  The question of "are you a lambda proxy" is no 
more interesting than "was it a tuesday when the source file for this 
class was last changed", and it was a deliberate choice to not provide 
any sort of reflection support here.  So I would not want to expose 
this; it's an implementation detail.



More information about the leyden-dev mailing list