@OverrideShouldInvoke
Archie Cobbs
archie.cobbs at gmail.com
Thu Feb 9 18:42:56 UTC 2023
On Thu, Feb 9, 2023 at 12:09 PM Robbe Pincket <robbepincket at live.be> wrote:
> > The rough proposal is:
>
> > - Add a new annotation @OverrideShouldInvoke. If a method Sub.foo()
>
> > overrides a superclass method Sup.foo() that has an
> @OverrideShouldInvoke
>
> > annotation, and nowhere in Sub.foo() does it invoke Sup.foo() (via a
>
> > super.foo() expression), then an error occurs.
>
> > - Add a new property boolean withoutInvokingSuper default false to the
>
> > @Overrides annotation that allows Sub.foo() to suppress this error if
> it
>
> > "really knows what it's doing".
>
>
>
> Having 'Should' in the annotation name, and then making it produce
>
> an error instead of a warning annoys greatly. It doesn't feel like
>
> that agrees with RFC 2119.
>
>
>
> If it's a warning it could also be suppressed by a simple
>
> `@SuppressWarnings` instead of a new argument on `@Override`
>
Yes - a warning would work also. I wrote "error" because that's what the
@Override annotation generates when tripped and figured it should be
consistent.
Or, you could change the name to @OverrideMustInvoke :)
-Archie
--
Archie L. Cobbs
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/amber-dev/attachments/20230209/bbf29b3d/attachment.htm>
More information about the amber-dev
mailing list