Hi Steve Loughran,
Ah, sorry, thanks for your comments, I did not see until now,
About the method name, detailsForCLI(), do we have any other occasion that we want a "frozen" output then CLI? For example, one day we need to call the frozen version for webui? If CLI is the only situation, I can change the new method name per your suggestion.
here subclasses would need to know to not call super.toString() and instead call some other method
Derived class may have new field to print on top of the base class'. If we don't call super.toString(), we probably introduce a new method to be called by both the base class' and child class' toString()?
In this case, all the info printed by the base toString() is applicable to child class. And in my rev 2, I added getKind() which is overriden by child classes. Basically we are in full control of what the output looks like. Would you please explain why calling super.toString() is a bad idea (especially we do define our own base class' toString())? I can see a problem when we don't define toString() class for the base, in which case the java base Object's toString() would be called.