Skip to content

Conversation

@pconcannon
Copy link
Contributor

@pconcannon pconcannon commented Apr 26, 2021

Hi,

Could someone please review my code for updating the code in the java.security package to make use of the instanceof pattern variable?

Kind regards,
Patrick


Progress

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

Issue

  • JDK-8265426: Update java.security to use instanceof pattern variable

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 3687

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

Using diff file

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

@bridgekeeper
Copy link

bridgekeeper bot commented Apr 26, 2021

👋 Welcome back pconcannon! 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 the rfr Pull request is ready for review label Apr 26, 2021
@openjdk
Copy link

openjdk bot commented Apr 26, 2021

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

  • security

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 security security-dev@openjdk.org label Apr 26, 2021
@mlbridge
Copy link

mlbridge bot commented Apr 26, 2021

Webrevs

Copy link

@jespersm jespersm left a comment

Choose a reason for hiding this comment

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

Changes look good, except for the unneeded parenthesis?

(but I'm not a committer, so it's less useful)

@openjdk
Copy link

openjdk bot commented Apr 26, 2021

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

8265426: Update java.security to use instanceof pattern variable

Reviewed-by: rriggs, weijun, 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 19 new commits pushed to the master branch:

  • 9a19a0c: 8264760: JVM crashes when two threads encounter the same resolution error
  • 14f0afe: 8214237: Join parallel phases post evacuation
  • 2798b0d: 8266349: Pass down requested page size to reserve_memory_special
  • e0c8688: 8262992: Improve @see output
  • d2b5350: 8263507: Improve structure of package summary pages
  • a65021e: 8266618: Remove broken -XX:-OptoRemoveUseless
  • 94c6177: 8266536: Provide a variant of os::iso8601_time which works with arbitrary timestamps
  • 71b8ad4: 8266609: AArch64: include FP/LR space in LIR_Assembler::initial_frame_size_in_bytes()
  • ebb68d2: 8049700: Deprecate obsolete classes and methods in javax/swing/plaf/basic
  • 3a474d9: 8265612: revise the help info for jmap histo command
  • ... and 9 more: https://git.openjdk.java.net/jdk/compare/e8405970b9998ff8f77bcf196f1456713a98c47f...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 Pull request is ready to be integrated label Apr 26, 2021
Copy link
Contributor

@wangweij wangweij left a comment

Choose a reason for hiding this comment

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

Two comments:

  1. Why not reuse the existing variable name (Ex: t in Type t = (Type)obj) as much as possible to avoid unnecessary renames?
  2. I'm not sure if modifying argument name in a public API is a good idea. This leads to unnecessary javadoc changes.

Copy link

@Punikekk Punikekk left a comment

Choose a reason for hiding this comment

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

Hi @Punikekk, thanks for making a comment in an OpenJDK project!

All comments and discussions in the OpenJDK Community must be made available under the OpenJDK Terms of Use. If you already are an OpenJDK Author, Committer or Reviewer, please click here to open a new issue so that we can record that fact. Please Use "Add GitHub user Punikekk for the summary.

If you are not an OpenJDK Author, Committer or Reviewer, simply check the box below to accept the OpenJDK Terms of Use for your comments.

Your comment will be automatically restored once you have accepted the OpenJDK Terms of Use.

Comment on lines 342 to 345
if (obj instanceof Identity other) {
if (this.fullName().equals(other.fullName())) {
return true;
} else {
Copy link

@Punikekk Punikekk Apr 27, 2021

Choose a reason for hiding this comment

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

Suggested change
if (obj instanceof Identity other) {
if (this.fullName().equals(other.fullName())) {
return true;
} else {

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not really sure what you are suggesting here. Could you clarify?

@pconcannon
Copy link
Contributor Author

Two comments:

1. Why not reuse the existing variable name (Ex: `t` in `Type t = (Type)obj`) as much as possible to avoid unnecessary renames?

2. I'm not sure if modifying argument name in a public API is a good idea. This leads to unnecessary javadoc changes.
  1. I initially took the approach you suggested, but the general feedback from previous PRs (on similar work in other areas of java.base) has been to use more descriptive names for the pattern variables where possible. However, if you feel strongly about it please let me know which ones you would like me to change and we can discuss it further.

  2. OK, I thought it might be an opportunity to add in some consistency for parameter names for the equals() methods. But, point taken. I've reverted these changes. Please see commit 9e9f9fb

Copy link
Contributor

@wangweij wangweij left a comment

Choose a reason for hiding this comment

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

Approved. Just some tiny comments. The other suggestion from @Punikekk also looks fine. Thanks.

@pconcannon
Copy link
Contributor Author

Changes look good, except for the unneeded parenthesis?

(but I'm not a committer, so it's less useful)

Hi Jesper, thanks for your suggestions and well spotted. I've addressed the issues and responded to your comments with the commit id where the changes were made

@pconcannon
Copy link
Contributor Author

/integrate

@openjdk openjdk bot closed this May 7, 2021
@openjdk openjdk bot added integrated Pull request has been integrated and removed ready Pull request is ready to be integrated rfr Pull request is ready for review labels May 7, 2021
@openjdk
Copy link

openjdk bot commented May 7, 2021

@pconcannon Since your change was applied there have been 20 commits pushed to the master branch:

Your commit was automatically rebased without conflicts.

Pushed as commit 86b8dc9.

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

@pconcannon pconcannon deleted the JDK-8265426 branch May 25, 2021 09:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

integrated Pull request has been integrated security security-dev@openjdk.org

Development

Successfully merging this pull request may close these issues.

6 participants