8373507: [lworld] Add override keyword to *Klass classes #1787
+138
−143
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is a enhancement which should also go into mainline, however since lworld is changing a lot of the Klass type hierarchy it seems more important to just get this into this repo.
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.
It catches when the virtual hierarchy is different for different build configurations (like
is_flatArray_klass_slowwhich is on theKlassin debug and onFlatArrayKlassin release. This is obviously a bug andis_flatArray_klass_slowshould not be available in a release build) or suspicious virtual functions (likeInstanceKlass::restore_unshareable_info(ClassLoaderData*,Handle,PackageEntry*, JavaThread*)which is only overridden byInlineKlassand only delegates toInstanceKlass, so it could just not have overridden this function).We should aim to migrate all our C++ classes to use
overrideorfinalrather than virtual to catch more bugs and have more expressive header files. But it seems extra prudent here as lworld is moving around a lot of things in this area.Progress
Issue
Reviewing
Using
gitCheckout this PR locally:
$ git fetch https://git.openjdk.org/valhalla.git pull/1787/head:pull/1787$ git checkout pull/1787Update a local copy of the PR:
$ git checkout pull/1787$ git pull https://git.openjdk.org/valhalla.git pull/1787/headUsing Skara CLI tools
Checkout this PR locally:
$ git pr checkout 1787View PR using the GUI difftool:
$ git pr show -t 1787Using diff file
Download this PR as a diff file:
https://git.openjdk.org/valhalla/pull/1787.diff
Using Webrev
Link to Webrev Comment