RFR: 8276337: Use override specifier in HeapDumper [v2]

David Holmes dholmes at openjdk.java.net
Fri Nov 5 22:52:39 UTC 2021


On Fri, 5 Nov 2021 14:14:43 GMT, Leo Korinth <lkorinth at openjdk.org> wrote:

>> Use override specifier in HeapDumper. It is safer.
>
> Leo Korinth has updated the pull request incrementally with one additional commit since the last revision:
> 
>   restart failed github tests

Marked as reviewed by dholmes (Reviewer).

The only "downside" to using `override` is that if you use it on one method then you must use it on all applicable methods in a class, so it can tend to have a viral affect in terms of the scope of changes needed just to add the case(s) you're really interested in.

My experience with `override` in Java is a negative one as I often fail to add the annotation and then get chastised by the compiler for my oversight. It might be useful when writing larger libraries with class hierarchies but I find it a hinderence when writing simple code like tests.

For C++ I find the placement of override awkward and less visible than virtual.

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

PR: https://git.openjdk.java.net/jdk/pull/6274


More information about the serviceability-dev mailing list