Uploaded image for project: 'Accumulo'
  1. Accumulo
  2. ACCUMULO-1382

Pair incorrectly assumes its components are Comparable

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 1.6.0
    • None

    Description

      In trunk (for 1.6.0), Pair<A,B> was made Comparable, but makes assumptions that A and B are Comparable. This should either be checked in its compareTo method explicitly, or should be enforced in the generic parameters. This assumption is a runtime bug-in-waiting.

      It looks like this was added to support some of the new Lexicoders.

      I did a rough check to see the implications of enforcing the parameters to be Comparable (changing it from Pair<A,B> to Pair<A extends Comparable<A>,B extends Comparable<B>>), and it looks like there's a problem because we use this class with generated thrift code, which are not Comparable objects.

      It might be better to make a ComparablePair that extends Pair, for use in the Lexicoders, instead of making Pair itself Comparable.

      Attachments

        Issue Links

          Activity

            People

              ctubbsii Christopher Tubbs
              ctubbsii Christopher Tubbs
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: