Search code examples
javamavenmaven-pluginlomboktype-annotation

Delombok Java 8 Type Annotations


I am working on a Java 8 Spring project and wanted to use Lombok to reduce boilerplate code. Since I need a Javadoc, I set up the lombok-maven-plugin and the maven-javadoc-plugin.

After running the lombok:delombok goal the source is generated to target/generated-sources/delombok, as I specified it. But the code is messed up. For validation I used Java 8s type annotation, for example:

import edu.umd.cs.findbugs.annotations.NonNull;
....
Set<@NonNull PredictedConsumption> consumptions

This will result in:

Set<(UNKNOWN[JCAnnotatedType]: @NonNull() PredictedConsumption)> consumptions;

Which of course does not work for javadoc generation. I believe that the code generator does not know how to interpret those type annotations.

Is there a way to make delombok work with type annotations and if so, how?

Thanks in advance


Solution

  • This looks like a bug. You should probably file an issue or post to the Lombok mailing list (the lombok authors answer on SO too, but I'm unsure of how often).

    I'd bet it gets produced by this line and you could try to fix it yourself.