New candidate JEP: 371: Hidden Classes

Claes Redestad claes.redestad at oracle.com
Mon Jan 27 09:07:36 UTC 2020



On 2020-01-26 13:18, Michael Paus wrote:
> Am 26.01.20 um 13:00 schrieb core-libs-dev-request at openjdk.java.net:
>> Message: 1
>> Date: Sat, 25 Jan 2020 09:07:23 -0800
>> From: Mandy Chung <mandy.chung at oracle.com>
>>
>> This would help the reflective support for inline classes and
>> new VM/language feature such that adding support in MethodHandle
>> will work both both.
> 
> In that case watch out for GraalVM. Native-image does not fully support 
> MethodHandles.
> 
> See: 
> https://github.com/oracle/graal/blob/master/substratevm/LIMITATIONS.md#invokedynamic-bytecode-and-method-handles 
> 
> 

I think the issue for native-image is to add generic support for
indy/MH, since you can combine these to do all manner of dynamic things,
which makes them very hard to statically reason about in the general
case.

For specific things, like lambdas and this reflection proposal, they can
(and in the case of lambdas already do) desugar the simple and
straightforward indy/MH usage into something that can be statically
compiled.

Their reflection implementation is probably already implemented
differently from the OpenJDK, though, so my guess is that if something
along the lines of Peter's prototype is brought in, they likely won't
need to pick up the changes and native-image users wouldn't notice
anything's changed.

/Claes


More information about the core-libs-dev mailing list