Revisiting default values
Dan Smith
daniel.smith at oracle.com
Mon Aug 3 20:21:14 UTC 2020
> On Aug 2, 2020, at 10:08 AM, Peter Levart <peter.levart at gmail.com> wrote:
>
> In either case I think it is a matter of the inline class bytecode and not the code doing invocation (the call site). So it is safe by itself. Or am I missing something?
You're describing Option F. Yes, we can have javac generate checks in the bytecode of inline class method bodies.
Some awkwardness remains whenever default methods or Object methods are invoked. It would be difficult and expensive to implement any checks in these method bodies; and while bridge methods generated in the inline class's class file help, they don't guard against new methods declared after compilation (the motivating use case for the default methods feature). So we're left with one of:
- Permit superclass/superinterface code to run, only throwing (or at least only guaranteeing a throw) when one of the declared instance methods of the class are invoked; or
- Option G: implement the checks in the JVM, where we can see the entire set of inherited member methods as the inline class is loaded/linked
More information about the valhalla-spec-observers
mailing list