RFR: 8354508: JFR: Strengthen metadata checks for labels

Erik Gahlin egahlin at openjdk.org
Mon Apr 14 13:15:11 UTC 2025


On Mon, 14 Apr 2025 08:37:32 GMT, Aleksey Shipilev <shade at openjdk.org> wrote:

>> Could I have a review of a PR that improves the checks for label metadata? When running TestEventMetadata, I found some fields with incorrect capitalization. I fixed those, as well as some typos, and updated the filename from trace.xml to metadata.xml.
>> 
>> Testing: jdk/jdk/jfr
>> 
>> Thanks
>> Erik
>
> test/jdk/jdk/jfr/event/metadata/TestEventMetadata.java line 177:
> 
>> 175:         Asserts.assertTrue(isCapitalized(firstWord), "Label should capitalize first word");
>> 176:         if (!isNumeric(lastWord)) {
>> 177:             Asserts.assertTrue(isCapitalized(lastWord), "Label should capitalize last word");
> 
> This looks like a heuristic that last word is very likely a noun, and should be capitalized then? Just curious.

The last word should always be capitalized, but Character.isUpperCase in isCapitalized() returns false for numbers. As a result, a label like "GC Phase Level 1" fails. The isNumeric check avoids that. I will add a comment.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/24616#discussion_r2041732863


More information about the hotspot-jfr-dev mailing list