Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8253762

JFR: getField(String) should be able to access subfields

    XMLWordPrintable

    Details

    • Type: Enhancement
    • Status: Resolved
    • Priority: P3
    • Resolution: Fixed
    • Affects Version/s: 16
    • Fix Version/s: 16
    • Component/s: hotspot
    • Subcomponent:
      jfr
    • Resolved In Build:
      b28

      Description

      The method RecordedEvent:getField(String) allows a user to get a field for an event type, for example eventType.getField("monitorClass").

      The value of an event can be obtained by invoking event.getValue("monitorClass"), but it's also possible to index into a nested value by using ".", for example getValue("monitorClass.modifiers"). The latter can't be done when using getField(String). It is inconsistent and inconvenient as it to forces users to traverse the fields manually:

      for (ValueDescriptor v : eventType.getField("monitorClass").getFields()) {
          if ("modifiers".equals(v.getName()) {
            return v;
          }
      }

      instead of doing getField("monitorClass.modifiers")

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              egahlin Erik Gahlin
              Reporter:
              egahlin Erik Gahlin
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: