New candidate JEP: 371: Hidden Classes

David Lloyd david.lloyd at redhat.com
Mon Jan 27 19:58:25 UTC 2020


On Mon, Jan 27, 2020 at 12:30 PM Mandy Chung <mandy.chung at oracle.com> wrote:
>
>
>
> 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

This is very helpful, thanks!
-- 
- DML



More information about the core-libs-dev mailing list