Uploaded image for project: 'Commons Lang'
  1. Commons Lang
  2. LANG-495

Possible implementation of max/min using generics

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • None
    • None
    • None

    Description

      Attached is a patch to add generics to max and min.
      It seems to work OK with the current tests.

      It causes a compile-time error if one tries to code e.g. ObjectUtils.max(String,Integer).
      Previously that was allowed, but would cause a class cast exception at run time.

      Can anyone review please?

      BTW, the tests for max/min use Comparable instead of Date - is there a good reason for this? User code is likely to use the actual type in this case.
      Changing Comparable to Date fixes various raw type warnings.

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            Unassigned Unassigned
            sebb Sebb
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment