|
| 1 | +# Remove Lombok from code base |
| 2 | + |
| 3 | +## Decision |
| 4 | + |
| 5 | +The Lombok library will be removed from the code base. |
| 6 | + |
| 7 | +## Rationale |
| 8 | + |
| 9 | +Lombok uses byte-code modification to achieve its goal. That is dangerous for a number of reasons. |
| 10 | + |
| 11 | +First and foremost, to achieve its goal, it relies on internal APIs of the JVM, which are not intended for public |
| 12 | +consumption, thus they can and will get removed, refactored or made otherwise unavailable. This has been discussed at |
| 13 | +length in the [project's GitHub page](https://github.com/projectlombok/lombok/issues/2681). |
| 14 | +This is especially problematic for an OSS project such as TractusX. |
| 15 | + |
| 16 | +Second, many of the features that are currently used by TractusX-EDC are experimental (e.g. `@UtilityClass`) and are |
| 17 | +known to break some Java standard features, such as static imports. |
| 18 | + |
| 19 | +Third, the value that Lombok offers is questionable at best (e.g. various constructor |
| 20 | +annotations, `@Builder`, `@Value`), because modern IDEs have ample features to generate boilerplate code. Further, it |
| 21 | +makes the code arguably less readable and less debuggable, very non-resilient against |
| 22 | +refactoring (`@ToString(of = <FIELDNAME>)`) and more dangerous (`@SneakyThrows`) at runtime. |
| 23 | + |
| 24 | +Fourth and finally bytecode modification could conceivably cause problems in use cases where audited/certified code is |
| 25 | +required. Since the code gets modified during compilation in a way not covered by any spec, technically the runtime code |
| 26 | +could be significantly different from the source code. Although this problem is admittedly theoretical at the moment, we |
| 27 | +should not build those obstructions into the code base. |
| 28 | + |
| 29 | +## Approach |
| 30 | + |
| 31 | +- Remove the lombok library from the version catalog |
| 32 | +- replace all annotations with actual code |
| 33 | +- [optional] add an entry to our coding principles to forbid byte-code modification (lombok, aspectJ,...) |
| 34 | + |
| 35 | +## Further consideration |
| 36 | + |
| 37 | +We can even expect a slightly faster build, because "delomboking" will become unnecessary. |
0 commit comments