Uploaded image for project: 'Commons Math'
  1. Commons Math
  2. MATH-188

Make Complex and Fraction classes immutable and thus thread-safe

    XMLWordPrintableJSON

Details

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

    Description

      There are many classes with instance fields that could be made final.

      Two in particular seem like ideal candidates:

      Complex - fields: real, imaginary
      Fraction - fields: numerator, denominator (the private reduce() method also needs to be inlined)

      As far as I can tell, making the above changes makes the classes immutable and therefore threadsafe.

      Attachments

        1. Fraction.patch
          2 kB
          Sebb

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: