RFR: 8358015: Fix SequencedMap sequenced view method specifications [v2]

Joe Darcy darcy at openjdk.org
Wed Jun 4 04:11:17 UTC 2025


On Tue, 3 Jun 2025 20:14:13 GMT, Stuart Marks <smarks at openjdk.org> wrote:

>> src/java.base/share/classes/java/util/SequencedMap.java line 296:
>> 
>>> 294:                 return view().hashCode();
>>> 295:             }
>>> 296:             public void addFirst(K k) { throw new UnsupportedOperationException(); }
>> 
>> Any utility in adding `@Override` annotations to the methods to document intent?
>
> 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`".

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

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


More information about the core-libs-dev mailing list