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

Interpolatable's contract should be reexamined

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Fixed
    • Icon: P4 P4
    • jfx24
    • jfx13
    • javafx
    • None
    • b12

       javafx.animation.Interpolatable does not specify:

      1. If the returned object is always a new one or if it can be an existing one, as is done with 'if t<=0 return this'.
      2. What happens with double values that are out of the [0, 1] range.

      I suggest that 1 is defined in the implementing class docs because it depends on the mutability of the class, the cost to create a new one etc. Interpolatable can mention that the decision on what to return is class-specific.

      As for 2, it's possible to either clamp the values to [0, 1], or throw an IllegalArgumentException. However, because double values are not exact, it's risky to throw an exception on t<0. Maybe a safety delta is needed.

            mstrauss Michael Strauß
            nlisker Nir Lisker
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: