Thursday, 18 January 2018

An error has occurred in JavaDocs report generation

Well, it turns out that this blog1 is an almost word-for-word mirror of an article2 about using Maven and Java 8 to generate the JavaDocs.

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 12.431 s
[INFO] Finished at: 2017-05-17T21:13:32+02:00
[INFO] Final Memory: 21M/157M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-javadoc-plugin:2.9.1:javadoc (default-cli) on project mrbear: An error has occurred in JavaDocs report generation:
[ERROR] Exit code: 1 - /home/mrbear/beargame/src/main/java/awesomeness/vaadin/editor/Buttons.java:56: warning: no description for @return
[ERROR] * @return
[ERROR] ^

Turns out Malformed HTML is now a thing that bombs your javadoc generation. Add "-Xdoclint:none" somewhere to turn this off.

References

[1] Stephen Colebourne's blog - Turning off doclint in JDK 8 Javadoc
http://blog.joda.org/2014/02/turning-off-doclint-in-jdk-8-javadoc.html
[2] NLJUG Java Magazine
http://www.nljug.org/

Friday, 12 January 2018

Using Optional.map

I found the following example of code in our code base, it was in a method that got called with a model which is a collection of ModelNodes.

Optional<ModelNode> node = model.stream().findFirst();
Optional<String> detailCode = node.isPresent() ?
  Optional.of(node.get().getValue()) : Optional.empty();

Luckily it can be rewritten a deal more concisely with the .map function available in the Optional class.

Optional<String> aangifteDetCode = model.stream().findFirst().map(ModelNode::getValue);

The codebase just got a little better.

Tuesday, 2 January 2018

All the Best Wishes for 2018!

For those of you who read my blog, my sincerest best wishes for 2018 for you.

Let me leave you now with one of my favorite quotes (from Kung fu Panda, but it's been around for some time):

“Yesterday is history, tomorrow is a mystery, but today is a gift. That is why it is called the “present.” .”
- Oogway, Kung Fu Panda