Eclipse Photon: no StringJoiner Template for toString()
Published by Benjamin Marwell onEclipse Photon finally ships with a toString() template configurator. Sadly, this dialog has some major limitations: It is not possible to configure the templates as freely as you like. Instead, they will be checked for type safety. This brings along another restriction: The selected builder class needs to have a public constructor with a single object (or string) argument. Yikes! [caption id="attachment_6144" align="aligncenter" width="630"]Eclipse: toString template Dialog[/caption] I have no clue, why someone had the idea that a builder class needs to have a public constructor with a single object argument. Instead, IntelliJ IDEA shows us how it’s done correctly: You can freely insert any Java Code you like, including nested conditions: [caption id="attachment_6145" align="aligncenter" width="908"]IntelliJ StringJoiner Template for toString() method.[/caption] As you can see, IntelliJ has no such restrictions. It is very easy to include such a template. I waited for more than 10 years for eclipse to ship a template configuration dialog for toString() methods. Now it’s here. But it does not help much.