Bytecode transformation investigation
Dan Heidinga
heidinga at redhat.com
Thu Aug 4 12:57:01 UTC 2022
Hi Brian,
Glad we're on the same page regarding isHidden being an implementation
detail. Do the ::getNestHost & ::getNestMembers calls and stacktrace
differences fall into the same implementation detail bucket in your
mind?
I'd be happy for the nest mates cases to be implementation details
but would need to look closer at the intersection of stacktraces,
@callerSensitive methods, and the SecurityManager to be certain
stacktrace differences aren't making bigger problems. Any other areas
concern with this kind of approach?
--Dan
On Wed, Aug 3, 2022 at 7:26 PM Brian Goetz <brian.goetz at oracle.com> wrote:
>
>
> > 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