RFR: 8343802: Prevent NULL usage backsliding [v2]

Nizar Benalla nbenalla at openjdk.org
Wed Feb 5 20:16:57 UTC 2025


> Please review this patch to add a test that checks the hotspot sources and test files for usages of NULL.
> It scans files in those directories, filtering out certain files as well as all `.c`, `.java` and `.jar` files in test sources. 
> 
> Before adding line 86 and excluding `os_windows.cpp`, the test failed with:
> 
> 
> Error: 'NULL' found in /w/jdk/src/hotspot/os/windows/os_windows.cpp at line 4436:
>     HMODULE hModule = NULL;
> Error: 'NULL' found in /w/jdk/src/hotspot/os/windows/os_windows.cpp at line 4437:
>     GetModuleHandleEx(GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT, NULL, &hModule);
> java.lang.RuntimeException: Found usage of 'NULL' in source files. See errors above.
> 	at TestNoNULL.main(TestNoNULL.java:73)
> 	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
> 	at java.base/java.lang.reflect.Method.invoke(Method.java:565)
> 	at com.sun.javatest.regtest.agent.MainActionHelper$AgentVMRunnable.run(MainActionHelper.java:333)
> 	at java.base/java.lang.Thread.run(Thread.java:1447)

Nizar Benalla has updated the pull request incrementally with one additional commit since the last revision:

  update based on feedback

-------------

Changes:
  - all: https://git.openjdk.org/jdk/pull/23466/files
  - new: https://git.openjdk.org/jdk/pull/23466/files/25b8610d..ae3c9eba

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=23466&range=01
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=23466&range=00-01

  Stats: 34 lines in 2 files changed: 7 ins; 15 del; 12 mod
  Patch: https://git.openjdk.org/jdk/pull/23466.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/23466/head:pull/23466

PR: https://git.openjdk.org/jdk/pull/23466


More information about the hotspot-dev mailing list