Loosening requirements for super() invocation

Archie Cobbs archie.cobbs at gmail.com
Wed Nov 9 16:54:04 UTC 2022


On Wed, Nov 9, 2022 at 10:38 AM Brian Goetz <brian.goetz at oracle.com> wrote:

>
> Agreed... that formulation is simpler. But of course it would need a
> caveat for subclasses within the same compilation unit, e.g.:
>
>
> All these classes are in the same compilation unit, though it's possible
> you may not want to get fancy enough with the analysis to simulate virtual
> dispatch (though you could, since its all in the same file.)
>

OK so it sounds like you're saying that it's not worth bothering trying to
prevent someone from a 'this' escape that is contained within a single
source file, because those cases are relatively easy ones to spot.

Rather, it's in the non-obvious cases, where the problem spans multiple
compilation units, that programmers could really benefit from some extra
help from the compiler.

This defines a clear & straightforward boundary for the warning.

-Archie
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/amber-dev/attachments/20221109/8dcbd2fa/attachment.htm>


More information about the amber-dev mailing list