Loosening requirements for super() invocation

Brian Goetz brian.goetz at oracle.com
Tue Nov 1 22:58:02 UTC 2022


>     We can exclude final instance methods declared in the same class
>     if the same analysis of the method (recursively) shows no escape
>     of `this` (this is the * in the first bullet above.)
>
> Neat.
>
> You could also analyze static methods in the class to verify 
> non-escape if they were invoked with 'this' as a parameter... it's 
> more or less the same situation.
>
> Any code in the compilation unit that is directly invoked by the 
> constructor and that can't possibly be overridden could in theory be 
> fair game for this non-escape analysis.

Right, more of the same trick.  The key is not crossing source files, 
since that is over the analysis horizon.


>
>     Inner class creation is a similar story as calling final methods
>     in the same class; we can do a similar analysis of the inner class
>     constructor to verify non-escape.
>
>
> But the inner class Outer.Inner's constructor is going to say this.$0 
> = Outer.this, which is an escape for Outer.this, right?

Only if the inner class instance escapes.  But we're definitely getting 
into the "advanced analysis tricks" territory now.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/amber-dev/attachments/20221101/01f0da7a/attachment.htm>


More information about the amber-dev mailing list