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

8274894: Use Optional.empty() instead of ofNullable(null) in HttpResponse.BodySubscribers.discarding #5159

Conversation

turbanoff
Copy link
Member

@turbanoff turbanoff commented Aug 18, 2021

Usage of Optional.ofNullable is unnecessary when value is known. If it's null value Optional.empty() should be preferred, as it doesn't perform redundant null check.


Progress

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

Issue

  • JDK-8274894: Use Optional.empty() instead of ofNullable(null) in HttpResponse.BodySubscribers.discarding

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 5159

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

Using diff file

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

@bridgekeeper
Copy link

@bridgekeeper bridgekeeper bot commented Aug 18, 2021

👋 Welcome back turbanoff! 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
Copy link

@openjdk openjdk bot commented Aug 18, 2021

@turbanoff The following label will be automatically applied to this pull request:

  • net

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command.

@openjdk openjdk bot added the net label Aug 18, 2021
@bridgekeeper
Copy link

@bridgekeeper bridgekeeper bot commented Sep 15, 2021

@turbanoff This pull request has been inactive for more than 4 weeks and will be automatically closed if another 4 weeks passes without any activity. To avoid this, simply add a new comment to the pull request. Feel free to ask for assistance if you need help with progressing this pull request towards integration!

@turbanoff
Copy link
Member Author

@turbanoff turbanoff commented Sep 15, 2021

Not sure if it worth separate issue. But this this is small improvement in http client code.

@turbanoff turbanoff changed the title [PATCH] Cleanup Optional usage in HttpResponse.BodySubscribers.discarding 8274894: Use Optional.empty() instead of ofNullable(null) in HttpResponse.BodySubscribers.discarding Oct 7, 2021
@openjdk openjdk bot added the rfr label Oct 7, 2021
@mlbridge
Copy link

@mlbridge mlbridge bot commented Oct 7, 2021

Webrevs

dfuch
dfuch approved these changes Oct 7, 2021
Copy link
Member

@dfuch dfuch left a comment

LGTM

@dfuch
Copy link
Member

@dfuch dfuch commented Oct 7, 2021

If you integrate I will sponsor.

@openjdk
Copy link

@openjdk openjdk bot commented Oct 7, 2021

@turbanoff 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:

8274894: Use Optional.empty() instead of ofNullable(null) in HttpResponse.BodySubscribers.discarding

Reviewed-by: dfuchs

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 578 new commits pushed to the master branch:

  • 7de2cf8: 8273910: Redundant condition and assignment in java.net.URI
  • 8ca0846: 8274407: (tz) Update Timezone Data to 2021c
  • 4ab274a: 8274858: Remove unused dictionary_classes_do functions
  • 03a8d34: 8273826: Correct Manifest file name and NPE checks
  • 722d639: 8274838: runtime/cds/appcds/TestSerialGCWithCDS.java fails on Windows
  • 340c715: 8273929: Remove GzipRandomAccess in heap dump test
  • 8319836: 8274546: Shenandoah: Remove unused ShenandoahUpdateRootsTask copy
  • d5ccfa2: 8274755: Replace 'while' cycles with iterator with enhanced-for in jdk.jdi
  • 29dcbb7: 8274716: JDWP Spec: the description for the Dispose command confuses suspend with resume.
  • 5762ec2: 8274780: ChannelInputStream.readNBytes(int) incorrectly calls readAllBytes()
  • ... and 568 more: https://git.openjdk.java.net/jdk/compare/79a06df8113ba1da55db5c38fe34608c3507c223...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.

As you do not have Committer status in this project an existing Committer must agree to sponsor your change. Possible candidates are the reviewers of this PR (@dfuch) but any other Committer may sponsor as well.

➡️ To flag this PR as ready for integration with the above commit message, type /integrate in a new comment. (Afterwards, your sponsor types /sponsor in a new comment to perform the integration).

@openjdk openjdk bot added the ready label Oct 7, 2021
@turbanoff
Copy link
Member Author

@turbanoff turbanoff commented Oct 7, 2021

/integrate

@openjdk
Copy link

@openjdk openjdk bot commented Oct 7, 2021

@turbanoff This pull request has not yet been marked as ready for integration.

@dfuch
Copy link
Member

@dfuch dfuch commented Oct 7, 2021

hmm... looks like something went wrong. Maybe you should /integrate again?

@turbanoff
Copy link
Member Author

@turbanoff turbanoff commented Oct 7, 2021

/integrate

@openjdk openjdk bot added the sponsor label Oct 7, 2021
@openjdk
Copy link

@openjdk openjdk bot commented Oct 7, 2021

@turbanoff
Your change (at version 3626552) is now ready to be sponsored by a Committer.

@dfuch
Copy link
Member

@dfuch dfuch commented Oct 12, 2021

/sponsor

@openjdk
Copy link

@openjdk openjdk bot commented Oct 12, 2021

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

  • 33050f8: 8274986: max code printed in hs-err logs should be configurable
  • 8de2636: 8274615: Support relaxed atomic add for linux-aarch64
  • 7d2633f: 8275002: Remove unused AbstractStringBuilder.MAX_ARRAY_SIZE
  • cfe7471: 8177814: jdk/editpad is not in jdk TEST.groups
  • a5f09d1: 8275031: runtime/ErrorHandling/MachCodeFramesInErrorFile.java fails when hsdis is present
  • ef0922e: 8274560: JFR: Add test for OldObjectSample event when using Shenandoah
  • 1e30695: 8274466: G1: use field directly rather than method in G1CollectorState::in_mixed_phase
  • dd93c6e: 8272167: AbsPathsInImage.java should skip *.dSYM directories
  • 829dea4: 8274945: Cleanup unnecessary calls to Throwable.initCause() in java.desktop
  • 75f5145: 8274925: Shenandoah: shenandoah/TestAllocHumongousFragment.java test failed on lock rank check
  • ... and 610 more: https://git.openjdk.java.net/jdk/compare/79a06df8113ba1da55db5c38fe34608c3507c223...master

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot closed this Oct 12, 2021
@openjdk openjdk bot added integrated and removed ready rfr sponsor labels Oct 12, 2021
@openjdk
Copy link

@openjdk openjdk bot commented Oct 12, 2021

@dfuch @turbanoff Pushed as commit d04d4ee.

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

@turbanoff turbanoff deleted the cleanup_optional_usage_in_httpresponse branch Feb 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
integrated net
2 participants