New candidate JEP: 371: Hidden Classes

Mandy Chung mandy.chung at oracle.com
Mon Jan 27 18:29:51 UTC 2020



On 1/27/20 6:31 AM, Remi Forax wrote:
>> I'm a bit curious about this:
>>
>>> To invoke private nestmate instance methods from code in the hidden class, use
>>> invokevirtual or invokeinterface instead of invokespecial. Generated bytecode
>>> that uses invokespecial to invoke a private nestmate instance method will fail
>>> verification. invokespecial should only be used to invoke private nestmate
>>> constructors.
>> This seems pretty unusual.  Don't we normally use invokespecial for
>> private method invocations?  What is the reasoning for this?
> It's the new usual since 11 and the introduction of nestmates,
> before javac was generating an accessor method (the access$000 methods).
>
> :
>

As Remi said, this feature has been there since 11.  You can reference 
JEP 181 for more details.

Mandy
[1] https://openjdk.java.net/jeps/181



More information about the core-libs-dev mailing list