RFR: 8311895: CSS Transitions [v2]
John Hendrikx
jhendrikx at openjdk.org
Tue Aug 1 10:52:51 UTC 2023
On Mon, 31 Jul 2023 18:29:19 GMT, Michael Strauß <mstrauss at openjdk.org> wrote:
>> modules/javafx.graphics/src/main/java/com/sun/javafx/css/TransitionDefinition.java line 54:
>>
>>> 52: */
>>> 53: public TransitionDefinition(String propertyName, Duration duration,
>>> 54: Duration delay, Interpolator interpolator) {
>>
>> I think you should not repeat the parameters here, just use:
>>
>> Suggestion:
>>
>> public TransitionDefinition {
>>
>>
>> I would also move the "@throws" documentation tags to the record class definition
>
> The constructor ensures that any spelling of "ALL" is converted to the interned constant "all", which is important as we would otherwise need a more computationally expensive case-insensitive string comparison in `Node.Transitions.find()`.
> Removing the constructor would mean that some unrelated piece of code would need to do this conversion.
>
> The `@throws` tag is not allowed at the class level.
I meant that you can use the short form of the constructor (without repeating the parameters):
public record TransitionDefinition(String propertyName, Duration duration,
Duration delay, Interpolator interpolator) {
public TransitionDefinition { // no parameters necessary (short form constructor)
// do checks and assignments here
}
}
-------------
PR Review Comment: https://git.openjdk.org/jfx/pull/870#discussion_r1280452828
More information about the openjfx-dev
mailing list