views:

216

answers:

4

Does Project Lombok offer any benefit compared to code templates / code generation in Eclipse? Are there any downsides (apart from including the .jar)?.

+3  A: 

Very few come to mind:

  • it is based on annotation, so no good for legacy project still in pre-Java5 (delombok can help). Actually, it requires using the javac v1.6 compiler.
  • it still have limitations regarding multiple constructors

The dependency issue is not to be overlooked though, but you have excluded it from your question.

VonC
+3  A: 

The advantage of Lombok is that the code isn't actually there - i.e. classes are much more readable and are not cluttered.

Bozho
+4  A: 

One advantage of Lombok is that once you've annotated a class with, say, the @Data annotation, you never need to regenerate the code when you make changes. For example, if you add a new field, @Data would automatically include that field in the equals, hashCode and toString methods. You'd need to manually make that change when using Eclipse generated methods. Some of the time, you may prefer the manual control but for most cases, I expect not.

GaryF