RFR: 8043275 Interface initialization for default methods
Karen Kinnear
karen.kinnear at oracle.com
Tue Oct 21 14:26:17 UTC 2014
Keith,
Thank you so much for looking at this.
Let me see if I can explain this clearly.
In the "before" code has_default_methods only counted public non-abstract instance methods - i.e. the methods
that could be inherited from an interface. The has_default_methods flag, as you know, is used in reducing the default method
inheritance calculations.
In the updated specification, it was determined that we should initialize superinterfaces that contain non-abstract instance methods,
regardless of their access. Invocation of static methods triggers initialization, so that case is already covered. The concern with
only initializing superinterfaces containing public non-abstract instance methods was that there might be a way to do an invokespecial
on a private interface method and if there were a bug, possibly circumvent the access check (I was not able to create a test case for
that despite bytecode patching). Should we ever extend interface methods to allow additional access flags, this would naturally extend
with the minimum of surprise for folks.
So the initialization loop follows the has_default_methods (which I could rename could_inherit_default_methods but that got a little long and
complicated) and explicitly initializes any interface that declares_default_methods.
hope that makes sense,
thanks,
Karen
p.s. does that mean I can count you as a reviewer :-) ?
On Oct 16, 2014, at 9:13 AM, Keith McGuigan wrote:
> Hi Karen,
>
> Why in classFileParser.cpp does the check for 'has_default_methods' check for a method not being private, but the 'declares_default_methods' check omits that check?
>
> On Thu, Oct 16, 2014 at 2:01 AM, Karen Kinnear <karen.kinnear at oracle.com> wrote:
>
> Please review for 9 (8u40 back port will follow):
>
> webrev: http://cr.openjdk.java.net/~acorn/8043275/webrev/
> bug: https://bugs.openjdk.java.net/browse/JDK-8043275
>
> Summary:
> Fix superinterface initialization to be based on declaring a non-static instance method rather than on declaring or inheriting one
>
> Tested (linux-x64):
> defmeth - enhanced
> jtreg TestInterfaceInit and TestInterfaceOrder
> jtreg hotspot, jdk.lambda, java.util, java.lang
> jck vm, lang
> nsk: vm.defmeth (added 2 tests), vm.mlvm, vm.fast.quick
>
> Thanks to Dan Smith, Alex Buckley, John Rose for specification clarification.
>
> thanks,
> Karen
>
>
>
>
> --
>
> Keith McGuigan
> @kamggg
> kmcguigan at twitter.com
More information about the hotspot-dev
mailing list