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

Interpolatable's contract should be reexamined

    Details

    • Type: Enhancement
    • Status: Open
    • Priority: P4
    • Resolution: Unresolved
    • Affects Version/s: openjfx13
    • Fix Version/s: openjfx14
    • Component/s: javafx
    • Labels:
      None

      Description

       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.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                nlisker Nir Lisker
                Reporter:
                nlisker Nir Lisker
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated: