8240532: heap inspection prints trailing @ after name of module without version

Reviewed-by: lfoltan
This commit is contained in:
Stefan Karlsson 2020-03-04 18:08:09 +01:00
parent 43e0fc04b0
commit 534331f0a1
2 changed files with 7 additions and 4 deletions

View File

@ -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",

View File

@ -67,14 +67,16 @@ public class ClassHistogramTest {
* ...
*/
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+" +