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

java.util.logging.Level needs to implement Comparable<Level>

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Unresolved
    • Icon: P4 P4
    • None
    • 1.4.0, 5.0
    • core-libs
    • Cause Known
    • x86
    • windows_2000, windows_xp

      A DESCRIPTION OF THE REQUEST :
      The java.util.logging.Level class has an intrinsic ranking based off of the intValue() associated with any instance.

      In an oversight, however, this class fails to implement Comparable<Level>.

      It would be trivial, just a few lines of code, to modify this class to support that interface. In fact, here is the code:

      public int compareTo(Level other) {
          if (other == null) throw new IllegalArgumentException("other == null");
          
          return this.intValue() - other.intValue();
      }

      This ranking should be used in

      JUSTIFICATION :
      I have an application (a log file reviewer) that needs to prioritize LogRecords for viewing purposes.

      Having Level implement Comparable<Level> would solve all of this.

      By the way, is there a link to the 1.6 (beta at this point) javadocs? Maybe you guys have already fixed this in 1.6 but I can't tell.

            Unassigned Unassigned
            ndcosta Nelson Dcosta (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Imported:
              Indexed: