Class invoking method which exists as default on interface and private on super

Michael Rasmussen Michael.Rasmussen at roguewave.com
Tue Feb 13 23:43:04 UTC 2018


> (I'm assuming the 8.0.5.5 version string indicates an implementation of SE 8.)
Yes. SE 8.

> - For the invokevirtual, the method to be resolved is Test::foo, and the 
> first matching method found is C::foo, and thus resolution fails because 
> C::foo is inaccessible to Test. Nothing more to say.

A follow-up question to that.

If I change C::foo to be static instead, it still compiles to the same (invokeinterface and invokevirtual).
When running, invokeinterface now calls I::foo, but the invokevirtual tries to call the static C::foo, and gets access error because it's private.
(tested on 10-ea+43)

so the static C::foo is now no longer a valid candidate for invokeinterface, but still is for invokevirtual?

/Michael


More information about the compiler-dev mailing list