Proposal: Deprecate Builders
tbee at tbee.org
Sat Apr 6 00:14:38 PDT 2013
On 2013-03-26 08:07, Richard Bair wrote:
> The way to try out the compatibility issues is to just have two projects -- one with a minimal hierarchy (A and B is sufficient where B extends A). The other project just has a main method which creates an instance of B and initializes it. Then make various changes to the A / B API and try running the main project unmodified (i.e.: not recompiled) and see what happens! Richard
Ok, attached is exactly such a project. Project JavaApplication1 contains LeafNode -> AbstractNodeA<T> -> AbstractNodeB<T>. Each one has get/set/withName, where only one should be commented in.
The setter prints the class name where it is in so it is clear with setter is being used.
LeafNode also has a special method that is called on the return value of the wither, to test it is LeafNode that is returned.
The second project JavaApplication2 holds only a main which:
- creates LeafNode,
- calls withName,
- call the LeafNode method on the returned value
Just for test JavaApplication1 has exactly the same main.
In the directory root there is a test.cmd with sets the classpath and calls the mains in both applications. You can now easily comment in/out the get/set/with and only rebuild JavaApplication1. JavaApplication2 keeps on running without problems.
I also have tried to see if the wither can be moved out to an interface (using default) but that is giving me troubles. I need to figure out why it doesn't accept the default body.
So far so good.
More information about the openjfx-dev