javadoc-coverage icon indicating copy to clipboard operation
javadoc-coverage copied to clipboard

Support Java 9+

Open kicasta opened this issue 5 years ago • 2 comments

Hi, calling "site" with Java 9+ fails with the attached exception, with java 8 however works fine. Is there a workaround?

Thanks in advance

Attachment

Stacktrace.txt

kicasta avatar Jan 21 '19 11:01 kicasta

Hello @kicasta, thanks for reporting the issue. I've been checking how to fix that but it's a very complicated one since the tools.jar that provides the Doclet API (package com.sun.javadoc) was removed in Java 9 (jigsaw).

A completely new API that doesn't rely on this tools.jar was introduced. The Doclet API was moved from package com.sun.javadoc to jdk.javadoc.doclet in Java 9+. Furthermore, now we have different classes and interfaces, making this new Doclet API completely incompatible with the Java 8 one.

So, to support Java 9+ it would be required to branch the source tree in two different projects that are difficult and time-consuming to maintain. Another approach is to change the sources to create a single project compatible with Java 8 and Java 9+, using the multi-release jar feature [1] [2]. However, this would require a complete redesign of the project.

In this particular case, it's not just a matter of configuration (as pointed here), because the public interface of the Doclet API was completely redesigned.

The pre-Java 9 Doclet API was a complete mess and needed to be redesigned. But unfortunately, I won't be able to perform such changes in the short term. Anyway, even if you have a Java 9+ project, you should be able to run the Coverage Doclet using JDK 8. The best way to switch the JDK version is using sdkman, so that you can use a specific JDK at the command line to build the project. This is useful when you want to achieve a defined goal such as computing the JavaDoc coverage.

manoelcampos avatar Jan 26 '19 19:01 manoelcampos

Hi @manoelcampos ,

thanks for the repply and meaningful explanation.

kicasta avatar Jan 29 '19 11:01 kicasta