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

8344841: ClassPrinter prints confusing value for null #22316

Closed
wants to merge 2 commits into from

Conversation

asotona
Copy link
Member

@asotona asotona commented Nov 22, 2024

ClassPrinter prints null values as String "null" or as String.valueOf(ConstantDescs.BSM_NULL_CONSTANT), based on context.

This patch unifies handling of null values.
They are now exclusively represented as ConstantDescs.BSM_NULL_CONSTANT.
In Json and Yaml format is null value printed unquoted and in Xml as <null/>.
In Json and Yaml is "null" String printed quoted to distinguish from the null value.

Please review.

Thank you,
Adam


Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue

Issue

  • JDK-8344841: ClassPrinter prints confusing value for null (Bug - P4)

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/22316/head:pull/22316
$ git checkout pull/22316

Update a local copy of the PR:
$ git checkout pull/22316
$ git pull https://git.openjdk.org/jdk.git pull/22316/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 22316

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

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/22316.diff

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Nov 22, 2024

👋 Welcome back asotona! 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 bot commented Nov 22, 2024

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

8344841: ClassPrinter prints confusing value for null

Reviewed-by: liach

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

  • ddc8a9d: 8344366: Remove Security Manager dependencies from javax.net.ssl and sun.security.ssl packages
  • 965aace: 8335468: [XWayland] JavaFX hangs when calling java.awt.Robot.getPixelColor
  • 811d08c: 8340010: Fix vectorization tests with compact headers
  • 519bb26: 8344217: Remove calls to SecurityManager and doPrivileged in java.net.DatagramSocket and java.net.NetMulticastSocket after JEP 486 integration
  • d112f35: 8344855: Remove calls to SecurityManager and doPrivileged in HTTP related implementation classes in the sun.net and sun.net.www.http packages after JEP 486 integration
  • da4b7a8: 8341436: containers/docker/TestJcmdWithSideCar.java takes needlessly long to run
  • 333a997: 8335231: [macos] Test java/awt/print/PrinterJob/Cancel/PrinterJobCancel.java failed on macOS because the case didn't get the expected PrintAbortException
  • 9576546: 8343698: Linux x86_64 lto build gives a lot of warnings and fails lto-wrapper: fatal error: make returned 2 exit status
  • 68ba7ee: 8340205: Native linker allows MemoryLayout consisting of only PaddingLayout
  • 6f622da: 8344923: Problem list on java/awt/Robot/ScreenCaptureRobotTest.java on macOS
  • ... and 30 more: https://git.openjdk.org/jdk/compare/50c099d69e9cef5c38a2624d7c798360eb6c1fba...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 rfr Pull request is ready for review label Nov 22, 2024
@openjdk
Copy link

openjdk bot commented Nov 22, 2024

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

  • core-libs

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.

@mlbridge
Copy link

mlbridge bot commented Nov 22, 2024

Webrevs

@@ -929,9 +947,9 @@ private static Node[] attributesToTree(List<Attribute<?>> attributes, Verbosity
nodes.add(map("enclosing method",
"class", ema.enclosingClass().name().stringValue(),
"method name", ema.enclosingMethodName()
.map(Utf8Entry::stringValue).orElse("null"),
.map((Function<Utf8Entry, ConstantDesc>)Utf8Entry::stringValue).orElse(BSM_NULL_CONSTANT),
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
.map((Function<Utf8Entry, ConstantDesc>)Utf8Entry::stringValue).orElse(BSM_NULL_CONSTANT),
.<ConstantDesc>map(Utf8Entry::stringValue).orElse(BSM_NULL_CONSTANT),

same for other casts.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Nov 25, 2024
@asotona
Copy link
Member Author

asotona commented Nov 25, 2024

Thank you for the review!

/integrate

@openjdk
Copy link

openjdk bot commented Nov 25, 2024

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

  • ddc8a9d: 8344366: Remove Security Manager dependencies from javax.net.ssl and sun.security.ssl packages
  • 965aace: 8335468: [XWayland] JavaFX hangs when calling java.awt.Robot.getPixelColor
  • 811d08c: 8340010: Fix vectorization tests with compact headers
  • 519bb26: 8344217: Remove calls to SecurityManager and doPrivileged in java.net.DatagramSocket and java.net.NetMulticastSocket after JEP 486 integration
  • d112f35: 8344855: Remove calls to SecurityManager and doPrivileged in HTTP related implementation classes in the sun.net and sun.net.www.http packages after JEP 486 integration
  • da4b7a8: 8341436: containers/docker/TestJcmdWithSideCar.java takes needlessly long to run
  • 333a997: 8335231: [macos] Test java/awt/print/PrinterJob/Cancel/PrinterJobCancel.java failed on macOS because the case didn't get the expected PrintAbortException
  • 9576546: 8343698: Linux x86_64 lto build gives a lot of warnings and fails lto-wrapper: fatal error: make returned 2 exit status
  • 68ba7ee: 8340205: Native linker allows MemoryLayout consisting of only PaddingLayout
  • 6f622da: 8344923: Problem list on java/awt/Robot/ScreenCaptureRobotTest.java on macOS
  • ... and 30 more: https://git.openjdk.org/jdk/compare/50c099d69e9cef5c38a2624d7c798360eb6c1fba...master

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated Pull request has been integrated label Nov 25, 2024
@openjdk openjdk bot closed this Nov 25, 2024
@openjdk openjdk bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review labels Nov 25, 2024
@openjdk
Copy link

openjdk bot commented Nov 25, 2024

@asotona Pushed as commit c6b14c6.

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core-libs [email protected] integrated Pull request has been integrated
Development

Successfully merging this pull request may close these issues.

2 participants