[sealed] @SafeVarargs on the methods of sealed class/interface

Tagir Valeev amaembo at gmail.com
Sun Oct 25 01:29:17 UTC 2020


As suggested by Lukas Eder on Twitter (
https://mobile.twitter.com/lukaseder/status/1318890756250193920 ), it
looks a good idea to allow SafeVarargs on the methods of sealed
classes/interfaces. The rules could be the following:
Check all the permitted subtypes. For every permitted subtype:
- If it has this method overridden/implemented, then it must also be
annotated as SafeVarargs
- Otherwise, if the subtype is non-sealed, it's an error
- Otherwise, the procedure is repeated for all the permitted subtypes
of this subtype.

What do you think?

With best regards,
Tagir Valeev.

More information about the amber-spec-experts mailing list