Cleaning up Control codebase - How to deal with StyleableProperty cast

Tom Schindl tom.schindl at
Fri May 2 08:14:52 UTC 2014


Yes if i turn on this unnecessary type cast warning in Eclipse I get
that as well.

Currently the only solution to get around with ANY warning suppression I
found is to use an intermediate variable.


On 28.04.14 23:57, Jonathan Giles wrote:
> 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