RFR: 8373668: Add override keyword to *Klass classes [v2]
Axel Boldt-Christmas
aboldtch at openjdk.org
Mon Dec 15 13:27:13 UTC 2025
On Mon, 15 Dec 2025 11:41:55 GMT, Kim Barrett <kbarrett at openjdk.org> wrote:
> 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`.
I know that I experimented with this at some point for the oop iterator. The result then was that it was not a reliable way to guarantee de-virtualisation. I also remember reading some blog post somewhere which explored different compilers and the benefits of final. I think it ultimately was not reliable enough to replace doing hand rolling things for where it matters, but got some improvements in some cases. However this was a few years ago so things might have improved.
Regardless of performance improvements, I think the final keyword makes the intended inheritance more clear and would be a worthwhile future RFE.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/28820#issuecomment-3655629666
More information about the hotspot-dev
mailing list