Proposal: Deprecate Builders
Tom Eugelink
tbee at tbee.org
Mon Mar 25 14:08:35 PDT 2013
LOL. Than I won't mention that I've been using this casting-generic approach for years without problems. I also won't mention that you can pretty much generate withers from setters using a bit of regexp pattern matching. The only thing real step are the abstract classes.
To react to the points Michael makes in the issue:
1. Inherited properties are solved by the casting-generics thingy.
2. Setting readonly properties... Interesting concept. I figure that's what constructors are for?
3. Well, it's not like lamba's or anonymous constructors are examples of insightful coding ;-) I think there are far more confusing concepts in Java than dual setter methods. Usually people catch on pretty fast.
Tom
On 2013-03-25 21:31, Richard Bair wrote:
> Ya it was a good read (thanks Ali). I think Michael does a good job recounting the problems with this approach. I wouldn't use generics for it (I don't trust them for this kind of thing -- stay in the mainstream usage and generics are great, start getting clever and we've been burned over and over. I don't believe anybody when they tell me it will work any more :-)). Instead override with covariant return types.
>
> I think that is possible, but it would be painful to add all the withers to all the properties for the entire public API. But I do think that once we've got the builders deprecated, we can then take a long look at what to do instead -- using lambdas for example. There might be other ways to get what we want that are much less intrusive. Or maybe just have an annotation processor that will auto-generate the builders of your choice and let it be a 3rd party thing.
>
> Richard
>
More information about the openjfx-dev
mailing list