Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8276337: Use override specifier in HeapDumper #6274

Closed
wants to merge 2 commits into from

Conversation

lkorinth
Copy link
Contributor

@lkorinth lkorinth commented Nov 5, 2021

Use override specifier in HeapDumper. It is safer.

/label add serviceability


Progress

  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue
  • Change must be properly reviewed

Issue

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.java.net/jdk pull/6274/head:pull/6274
$ git checkout pull/6274

Update a local copy of the PR:
$ git checkout pull/6274
$ git pull https://git.openjdk.java.net/jdk pull/6274/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 6274

View PR using the GUI difftool:
$ git pr show -t 6274

Using diff file

Download this PR as a diff file:
https://git.openjdk.java.net/jdk/pull/6274.diff

@bridgekeeper
Copy link

@bridgekeeper bridgekeeper bot commented Nov 5, 2021

👋 Welcome back lkorinth! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk openjdk bot added rfr serviceability labels Nov 5, 2021
@openjdk
Copy link

@openjdk openjdk bot commented Nov 5, 2021

@lkorinth
The serviceability label was successfully added.

@mlbridge
Copy link

@mlbridge mlbridge bot commented Nov 5, 2021

Webrevs

@dholmes-ora
Copy link
Member

@dholmes-ora dholmes-ora commented Nov 5, 2021

In what way is it "safer" ?? What are you trying to guard against?

@lkorinth
Copy link
Contributor Author

@lkorinth lkorinth commented Nov 5, 2021

In what way is it "safer" ?? What are you trying to guard against?

If you use override, you can not forget to update a method signature if you change the method signature in the base class. You can also not by mistake change the method signature in this class without realizing you should change the base class. There is no downside of using override that I know of.

@lkorinth
Copy link
Contributor Author

@lkorinth lkorinth commented Nov 5, 2021

I have some new code in the pipe, and I want to use override in that code without changing unrelated code in heapDumper.cpp. Thus I first make this change so that my future change can keep the "style" of the file.

tstuefe
tstuefe approved these changes Nov 5, 2021
Copy link
Member

@tstuefe tstuefe left a comment

Hi Leo, seems fine.

..Thomas

// Get the backend pointer, used by parallel dump writer.
CompressionBackend* backend_ptr() { return &_backend; }
CompressionBackend* backend_ptr() { return &_backend; }
Copy link
Member

@tstuefe tstuefe Nov 5, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unrelated, but could be a const method, no?

Copy link
Contributor Author

@lkorinth lkorinth Nov 5, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not easily I think, if I make the method const, I would have to return a const pointer, and then I need to do const operations on the backend etc.

@openjdk
Copy link

@openjdk openjdk bot commented Nov 5, 2021

@lkorinth This change now passes all automated pre-integration checks.

ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details.

After integration, the commit message for the final commit will be:

8276337: Use override specifier in HeapDumper

Reviewed-by: stuefe, dholmes

You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed.

At the time when this comment was updated there had been 11 new commits pushed to the master branch:

  • 59c3dcc: 8276746: Add section on reproducible builds in building.md
  • 0e0dd33: 8276129: PretouchTask should page-align the chunk size
  • a472433: 8276572: Fake libsyslookup.so library causes tooling issues
  • b01f107: 8276252: java/nio/channels/Channels/TransferTo.java failed with OOM java heap space error
  • 92d2176: 8273967: gtest os.dll_address_to_function_and_library_name_vm fails on macOS12
  • a74a839: 8276571: C2: pass compilation options as structure
  • c393ee8: 8276632: Use blessed modifier order in security-libs code
  • 7023b3f: 8276628: Use blessed modifier order in serviceability code
  • b933136: 8276641: Use blessed modifier order in jshell
  • 0616d86: 8276635: Use blessed modifier order in compiler code
  • ... and 1 more: https://git.openjdk.java.net/jdk/compare/3c0faa73522bd004b66cb9e477f43e15a29842e6...master

As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details.

➡️ To integrate this PR with the above commit message to the master branch, type /integrate in a new comment.

@openjdk openjdk bot added the ready label Nov 5, 2021
@tstuefe
Copy link
Member

@tstuefe tstuefe commented Nov 5, 2021

In what way is it "safer" ?? What are you trying to guard against?

If you use override, you can not forget to update a method signature if you change the method signature in the base class. You can also not by mistake change the method signature in this class without realizing you should change the base class. There is no downside of using override that I know of.

In addition to that, its a helpful documentation for the code reader.

@dholmes-ora
Copy link
Member

@dholmes-ora dholmes-ora commented Nov 5, 2021

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.

@lkorinth
Copy link
Contributor Author

@lkorinth lkorinth commented Nov 9, 2021

Thanks Thomas and David!
/integrate

@openjdk
Copy link

@openjdk openjdk bot commented Nov 9, 2021

Going to push as commit daf77eb.
Since your change was applied there have been 46 commits pushed to the master branch:

  • 93692ea: 8274395: Use enhanced-for instead of plain 'for' in jdk.internal.jvmstat
  • e35abe3: 8256208: Javadoc's generated overview does not show classes of unnamed package
  • f65db88: 8276841: Add support for Visual Studio 2022
  • c27afb3: 8276863: Remove test/jdk/sun/security/ec/ECDSAJavaVerify.java
  • e198594: 8250678: ModuleDescriptor.Version parsing treats empty segments inconsistently
  • 4bd5bfd: 8276731: Metaspace chunks are uncommitted twice
  • 5c7f77c: 8276850: Remove outdated comment in HeapRegionManager::par_iterate
  • 945f408: 8276098: Do precise BOT updates in G1 evacuation phase
  • 8747882: 8276790: Rename GenericCDSFileMapHeader::_base_archive_path_offset
  • 38e6d5d: 8276677: Malformed Javadoc inline tags in JDK source in javax/net/ssl
  • ... and 36 more: https://git.openjdk.java.net/jdk/compare/3c0faa73522bd004b66cb9e477f43e15a29842e6...master

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot closed this Nov 9, 2021
@openjdk openjdk bot added integrated and removed ready rfr labels Nov 9, 2021
@openjdk
Copy link

@openjdk openjdk bot commented Nov 9, 2021

@lkorinth Pushed as commit daf77eb.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

@lkorinth lkorinth deleted the _8276337 branch Mar 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
integrated serviceability
3 participants