Review Request: JDK-8209005: Lookup.unreflectSpecial fails for default methods when Lookup.findSpecial works

Daniel Fuchs daniel.fuchs at
Wed Jul 31 09:57:40 UTC 2019

Hi Peter, Mandy,

On 31/07/2019 08:59, Peter Levart wrote:
> Hi,
> I think Daniel is talking about the "dispatch" semantics of 
> unreflectSpecial here, right Daniel?

Yes, exactly!

> The findSpecial / unreflectSpecial is a MethodHandle equivalent for 
> bytecode instruction invokespecial (sans actual invoking). invokespecial 
> is typically used for implementing the super.method(args) Java 
> invocations. In that case, the superclass method is targeted - this is 
> not a virtual method dispatch like aMethod.invoke(this, arg*) - i.e. the 
> reflective invocation is always a virtual invocation (for non-private 
> methods). Likewise findSpecial and unreflectSpecial produce a 
> MethodHandle that dispatches to the method in the superclass (the 
> aMethod.getDeclatingClass() in case of unreflectSpecial) regardless of 
> whether that method is overridden in the subclass or not.

Thanks Peter, that's exactly what I wanted to say. Apologies for not
being clear enough.

best regards,

-- daniel

> Regards, Peter

More information about the core-libs-dev mailing list