Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-2001

NumberMath.getMath(Number) behaves differently from NumberMath.getMath(Number,Number) for Byte and Short

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.0, 1.1-beta-2
    • 1.5.1
    • groovy-jdk
    • None
    • Groovy 1.0, Windows XP/Pro

    Description

      The NumberMath.getMath(Number) treats Byte and Short values as unexpected Number subclasses. Whereas, NumberMath.getMath(Number,Number) handles Byte and Short using IntegerMath.instance.

      It would be desirable if NumberMath.getMath(Number) would behave like NumberMath.getMath(Number,Number), so that single Number argument methods were behaved consistently with the two Number argument methods.

      For example, NumberMath.negate( Byte.valueOf("1") ) and NumberMath.negate( Short.valueOf("1") ) fail with an IllegalArgumentException.

      Attachments

        1. NumberMath.patch
          1 kB
          Tobias Hientzsch

        Activity

          People

            paulk Paul King
            shanmann Steve Hanmann
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: