[sealed] @SafeVarargs on the methods of sealed class/interface
brian.goetz at oracle.com
Sun Oct 25 21:22:03 UTC 2020
I think this is a great idea for IDEs to have as an inspection :)
Inheritance of annotations, or anything that even smells like it, is a
siren song (e.g., what happens when something is inherited from two
interfaces, differently annotated?) And further, I cannot recall a
single tweak to annotations that has not given rise to "but you do X
here, surely you have to do Y there." So it's a double whammy -- we
don't get a good return, plus we encourage more demand for doing more of
the same kind of bad investment.
To me, the return on this investment _in the language_ seems
dramatically negative. (But for IDEs, it might be great.)
On 10/24/2020 9:29 PM, Tagir Valeev wrote:
> 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.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the amber-spec-experts