On Wed, 4 Jun 2025 04:08:36 GMT, Joe Darcy <da...@openjdk.org> wrote:

>> The `@Override` annotation has been inconsistently applied in the 
>> collections implementations. In practice since so many methods are 
>> overridden, and some test would likely fail if a method weren't overridden 
>> properly, the annotation would mostly add clutter. Indeed I'm considering 
>> pulling out all uses of `@Override` in certain areas because they're just 
>> clutter.
>
> It would be helpful in situations like this to have the inverse annotation -- 
> "All methods should be overridden, except the ones marked `@NoOverride`".

Interesting. This `@NoOverride` idea could be useful on a subclass that wants 
to make sure it overrides everything. (Maybe `@NoInherit` would be a better 
name.) Meanwhile for JDK-8357272 (PR https://github.com/openjdk/jdk/pull/25478) 
we're implementing similar policy checking in a test, though the exact policy 
is "no inheritance of default methods."

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/25515#discussion_r2126988299

Reply via email to