Hey @Martin_Roucek,
After investigation, it seems that we won’t be able to do anything about this issue on our side at short term.
It took me quite a lot of time to figure it out the change of behavior between and JDK8 and JDK11, and in order to understand the root causes, I had to dig into the dependencies of your reproducing project.
To me, the issue is unfortunately on your side, as your project is hitting the problem of “split package”. More concretely, starting with JDK9 and introduction of modules, it is now forbidden to declare partial packages, or to enrich a package from another dependencies with your own. This kind of issues appears exactly when moving from Java 8 to the next LTS, aka Java 11.
Now, the problem is that you might be affected by some of your dependencies doing it, even if you are not using it yourself directly in your code.
In your case, the faulty dependency is OpenHFT/Java Thread Affinity/affinity (affinity-3.2.2.jar). It declares two classes in the java.lang
package. When exploring dependencies and building the corresponding classpath, ECJ follows restrictions which forbid splitting packages and “lose” track of the rest of java.lang
. This does not happen when using java 8, as it is allowed (or more explicitly, not forbidden).
Some links which might help you to figure it more:
- On OpenHFT side, it seems they are aware of the issue, but are not going to fix it:
[OpenHFT] Split packages cause error with Java 9 - Another split-package issue, with a clear answer on the WHY it might not be detected in your case:
[StackOverflow] Eclipse can’t find XML related classes after switching build path to jdk10
This part is particularly important:- Alex Buckley confirmed that the given situation is illegal, despite what javac says. Bug against javac has been raised as JDK-8215739. This bug has been acknowledged months before the release of Java 12. As of 2019-06 it has been decided that also Java 13 will ship without a fix. Similarly for Java 14.
While we agree that the current way our analyzer is failing due to this issue is not nice, I’m however afraid we can not provide any easy solution for the time being.
Hope this helps,
Michael