JDK-8312187 : C++ compiler warnings when trying to print ArchiveHeapTestClass
  • Type: Bug
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 21
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • Submitted: 2023-07-17
  • Updated: 2024-04-17
  • Resolved: 2024-04-17
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 23
23Resolved
Related Reports
Duplicate :  
Description
In product builds, ArchiveHeapTestClass is a constant, hard coded to null.

It's used in unreachable code in product builds:

https://github.com/openjdk/jdk/blob/e73796879299c6170b63edb998439db4764ceae0/src/hotspot/share/cds/heapShared.cpp#L1428-L1437

#ifndef PRODUCT
   ...
#else
    bool is_test_class = false;
#endif

    if (is_test_class) {
      log_warning(cds)("Loading ArchiveHeapTestClass %s ...", ArchiveHeapTestClass);
    }

Nevertheless, sometimes gcc will warn that ArchiveHeapTestClass is a null pointer.
Comments
Reclosing as "Duplicate" instead of Resolving as...
17-04-2024

This has been fixed as a part of JDK-8251330 https://github.com/openjdk/jdk/blame/064628471b83616b4463baa78618d1b7a66d0c7c/src/hotspot/share/cds/heapShared.cpp#L1488
17-04-2024