Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files
8240532: heap inspection prints trailing @ after name of module witho…
…ut version

Reviewed-by: lfoltan
  • Loading branch information
stefank committed Mar 4, 2020
1 parent 43e0fc0 commit 534331f0a126a2eb4c00e04a13ee783e8bbbffa6
Showing with 7 additions and 4 deletions.
  1. +2 −1 src/hotspot/share/memory/heapInspection.cpp
  2. +5 −3 test/hotspot/jtreg/serviceability/dcmd/gc/ClassHistogramTest.java
@@ -101,11 +101,12 @@ void KlassInfoEntry::print_on(outputStream* st) const {
// simplify the formatting (ILP32 vs LP64) - always cast the numbers to 64-bit
ModuleEntry* module = _klass->module();
if (module->is_named()) {
st->print_cr(INT64_FORMAT_W(13) " " UINT64_FORMAT_W(13) " %s (%s@%s)",
st->print_cr(INT64_FORMAT_W(13) " " UINT64_FORMAT_W(13) " %s (%s%s%s)",
(int64_t)_instance_count,
(uint64_t)_instance_words * HeapWordSize,
name(),
module->name()->as_C_string(),
module->version() != NULL ? "@" : "",
module->version() != NULL ? module->version()->as_C_string() : "");
} else {
st->print_cr(INT64_FORMAT_W(13) " " UINT64_FORMAT_W(13) " %s",
@@ -67,14 +67,16 @@ public void run(CommandExecutor executor) {
* ...
*/

String moduleRegex = "\\(java.base(?:@\\S*)?\\)";

/* Require at least one java.lang.Class */
output.shouldMatch("^\\s+\\d+:\\s+\\d+\\s+\\d+\\s+java.lang.Class \\(java.base@\\S*\\)\\s*$");
output.shouldMatch("^\\s+\\d+:\\s+\\d+\\s+\\d+\\s+java.lang.Class " + moduleRegex + "\\s*$");

/* Require at least one java.lang.String */
output.shouldMatch("^\\s+\\d+:\\s+\\d+\\s+\\d+\\s+java.lang.String \\(java.base@\\S*\\)\\s*$");
output.shouldMatch("^\\s+\\d+:\\s+\\d+\\s+\\d+\\s+java.lang.String " + moduleRegex + "\\s*$");

/* Require at least one java.lang.Object */
output.shouldMatch("^\\s+\\d+:\\s+\\d+\\s+\\d+\\s+java.lang.Object \\(java.base@\\S*\\)\\s*$");
output.shouldMatch("^\\s+\\d+:\\s+\\d+\\s+\\d+\\s+java.lang.Object " + moduleRegex + "\\s*$");

/* Require at exactly one TestClass[] */
output.shouldMatch("^\\s+\\d+:\\s+1\\s+\\d+\\s+" +

0 comments on commit 534331f

Please sign in to comment.