JDK-8324678 : Replace NULL with nullptr in HotSpot gtests
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 23
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2024-01-25
  • Updated: 2025-03-17
  • Resolved: 2024-01-29
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 11 JDK 17 JDK 21 JDK 23
11.0.28-oracleFixed 17.0.16-oracleFixed 21.0.8-oracleFixed 23 b08Fixed
Related Reports
Duplicate :  
Relates :  
Description
Umbrella issue to cover the replacement of NULL with nullptr in the HotSpot gtests.  There are presently about 500 occurrences in about 75 files.

Because of the number of files and occurrences, this should be broken up into more manageable chunks by sub-tasks. 

This addresses a category of NULL uses that wasn't dealt with by JDK-8299837.

Comments
Fix request [21u] I backport this for parity with 21.0.8-oracle. No risk, only a test change Resolves needed, all trivial. Gtests pass. SAP nightly testing passed.
14-03-2025

A pull request was submitted for review. Branch: master URL: https://git.openjdk.org/jdk21u-dev/pull/1476 Date: 2025-03-12 12:52:43 +0000
12-03-2025

Changeset: c1281e6b Author: Coleen Phillimore <coleenp@openjdk.org> Date: 2024-01-29 17:12:13 +0000 URL: https://git.openjdk.org/jdk/commit/c1281e6b45ed167df69d29a6039d81854c145ae6
29-01-2024

I don't like running other people's working scripts that are way too long for me to read. This fixes nullptr in messages back to null. # foreach f (`cat file.list`) sed -e 's/\"\(.*\)nullptr\(.*\)\"/"\1null\2\"/' $f >$f.new diff $f.new $f mv $f.new $f end
26-01-2024

A pull request was submitted for review. URL: https://git.openjdk.org/jdk/pull/17577 Date: 2024-01-25 21:35:29 +0000
26-01-2024

https://gist.github.com/jdksjolen/c2595f9211c85b4fcee10a48b0587ac5 Here's the full script. It expects a GH_TOKEN (generate Classic at https://github.com/settings/tokens ) and GH_AUTHOR (your github username) env var for creating a Github PR for you. You need to change the main call in order to get it to change the occurrences where you want. Coleen has a good heuristic in her script "be nullptr" -> "be null" that I didn't think of, I do handle comments like these // though. It'll ask you for an issue key so that it can create the PR. It updates copyright years automatically also.
26-01-2024

grep -rl NULL >file.list # foreach f (`cat file.list`) sed -e "s/\<NULL\>/nullptr/g" \ -e "s/be nullptr/be null/" $f >$f.new diff $f.new $f mv $f.new $f end
25-01-2024

[~jsjolen] Post your script here. Thanks!
25-01-2024