I wanted to write a simple eclipse plugin to “Lombok classes”
Motivations
Lombok is a great project.
It allow java developper to write simpler code (small is beautifull), as in C#, Groovy, Kotlin BUT without switching to C#, Groovy, Kotlin…
As as additional motivation, it is a subject I have just proposed to Devoxx France 2017 "Call For Paper".
Steps for using the magic "Lomboker eclipse plugin"
Images worth thousands words.
Here is how to use it.
Select either Java Project(s), Java Package(s) or Java class(es), and right click for refactoring menu action: "recursive Lomboker"
Choose some settings (currently supports only @Getter / @Setter refactoring)
Click on Preview, then Ok
And here you are!
How it work
Come to Devoxx France 2017, if hopefully this talk will be selected.
Source code is extremely simple...
It is open-source, see here: https://github.com/Arnaud-Nauwynck/mytoolbox .. fr.an.eclipse.tools.lombok
There is some boiler-plate... not very interresting to detail. (dependency to other plugins fr.an.eclipse.pattern, etc.)
Basically, it allows to handle user selection and recurse on each *.java file, then call the magic Lomboker transformation on each parsed AST, and save it back to java file.
The first code I wrote took me ~2 hours, for detecting getter/setter methods and changing them to @Getter and @Setter.
It is very simple, representing ~90 lines of AST tree manipulation in eclipse.
Here is and extract of the code: