RFR: 8373668: Add override keyword to *Klass classes
Kim Barrett
kbarrett at openjdk.org
Mon Dec 15 11:44:19 UTC 2025
On Mon, 15 Dec 2025 10:08:18 GMT, Axel Boldt-Christmas <aboldtch at openjdk.org> wrote:
> Using override provides better visibility and compiler support for suspicious virtual methods. It makes it clears when reading a class header file if a new virtual interface is introduced or if it simply overridden.
>
> Testing
> * GHA
> * Running tier1 on Oracle supported platforms
Looks good.
A couple of pre-existing whitespace issues that you can fix or ignore.
I wonder if there would be any measurable benefit to using `final` instead in some
cases? But that should be looked at separately. It might be simpler to declare some
classes to be `final`.
src/hotspot/share/oops/instanceKlass.hpp line 906:
> 904: Array<InstanceKlass*>* transitive_interfaces) override;
> 905: bool can_be_primary_super_slow() const override;
> 906: size_t oop_size(oop obj) const override { return size_helper(); }
[pre-existing] Extra space before `const`.
src/hotspot/share/oops/instanceKlass.hpp line 952:
> 950: }
> 951:
> 952: int size() const override { return size(vtable_length(),
[pre-existing] Weird and confusing indentation for the arguments to `size(...)`.
-------------
Marked as reviewed by kbarrett (Reviewer).
PR Review: https://git.openjdk.org/jdk/pull/28820#pullrequestreview-3577725050
PR Review Comment: https://git.openjdk.org/jdk/pull/28820#discussion_r2619059748
PR Review Comment: https://git.openjdk.org/jdk/pull/28820#discussion_r2619057335
More information about the hotspot-dev
mailing list