API Review: ImagePattern

Richard Bair richard.bair at oracle.com
Wed May 9 17:07:05 PDT 2012


getRed, etc are all final, but getHue, etc are not (!!). I actually don't mind Color being non final if the getters are all final. The problem is that non-final getters means somebody could subclass and make mutable color objects (like Jasper and I did for Nimbus, ahem).

Kevin, I'm ok either way, but let's make sure the getters on all paints are final in case we later make them non-final classes we don't accidentally make it possible for mutable variants.

On May 9, 2012, at 10:37 AM, Joshua Marinacci <joshua at marinacci.org> wrote:

> Yep. A longstanding bug from the awt days.  Ocassionally used to do some evil things. 
> 
> Sent from my iPhone
> 
> On May 9, 2012, at 9:39 AM, Kevin Rushforth <kevin.rushforth at oracle.com> wrote:
> 
>> Btw, I just checked and LinearGradient and RadialGradient are final classes, but Color is not final, and apparently never has been. Seems like an oversight and Color should be final, too (although it would techincally be an incompatible change to make it final now).
>> 
>> -- Kevin
>> 
>> 
>> joe andresen wrote:
>>> Hey Rich,
>>> 
>>>> Looks good. I hope there are javadocs for the class&  constructors as well :-).
>>> Agreed.
>>> 
>>>> The class should probably be final, like RadialGradient, LinearGradient, and Color.
>>> Agreed.
>>> 
>>> Thanks for the feedback.
>>> 
>>> -J


More information about the openjfx-dev mailing list