Cleaning up Control codebase - How to deal with StyleableProperty cast

Jonathan Giles jonathan.giles at oracle.com
Mon Apr 28 21:57:53 UTC 2014


This seems to look fine - IntelliJ still complains about an unnecessary 
cast, but it is better than having an unchecked cast.

I'm happy for this to be done, but I think it would be best to get David 
Grieve's +1 first too.

Thanks for your help so far - it is making the JavaFX code base much 
nicer. I've just switched IntelliJ to make warnings far more obvious to 
me, so I'll be trying to keep on top of them also.

-- Jonathan

On 29/04/2014 9:33 a.m., Tom Schindl wrote:
> Hi,
>
> I've been cleaning up the warnings inside the controls code base and one
> of the warnings left (beside many generic problems in the *View-classes)
> is the casting from *Property to *StyleableProperty.
>
>> final StyleableProperty<Boolean> prop = (StyleableProperty<Boolean>)focusTraversableProperty();
> now I think I found a way to get away with out an unchecked cast warning
> by writing
>
>> final StyleableProperty<Boolean> prop = (StyleableProperty<Boolean>)(WritableValue<Boolean>)focusTraversableProperty();
> Anyone having a better idea?
>
> Tom



More information about the openjfx-dev mailing list