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

Redundant condition in Metadata.TypeComparator.compare

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P5
    • 18
    • 17, 18
    • hotspot
    • None
    • jfr
    • b17

    Description

      In method jdk.jfr.internal.tool.Metadata.TypeComparator#compare
      https://github.com/openjdk/jdk/blob/master/src/jdk.jfr/share/classes/jdk/jfr/internal/tool/Metadata.java#L67
      ```
      if (package1.equals(package2)) {
          return n1.compareTo(n2);
      } else {
          // Ensure that jdk.* are printed first
          // This makes it easier to find user defined events at the end.
          if (Type.SUPER_TYPE_EVENT.equals(t1.getSuperType()) && !package1.equals(package2)) {
              if (package1.equals("jdk.jfr")) {
                  return -1;
              }
              if (package2.equals("jdk.jfr")) {
                  return 1;
              }
          }
          return package1.compareTo(package2);
      }
      ```
      Equality of 'package1' and 'package2' is already checked first. No need to recheck it again.

      Attachments

        Issue Links

          Activity

            People

              aturbanov Andrey Turbanov
              aturbanov Andrey Turbanov
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: