<div style="font-family: arial, helvetica, sans-serif; font-size: 10pt; color: #000000;">Dear javadoc devs,</div>
<div style="font-family: arial, helvetica, sans-serif; font-size: 10pt; color: #000000;"> </div>
<div style="font-family: arial, helvetica, sans-serif; font-size: 10pt; color: #000000;">first please excuse that I am asking (maybe) a usage question on this list, but I wasn't able to find an answer online, including a stack overflow question pending at <a href="https://stackoverflow.com/questions/77098070/javadoc-fails-in-presence-of-imports-in-module-info-java" target="_blank" rel="noopener">https://stackoverflow.com/questions/77098070/javadoc-fails-in-presence-of-imports-in-module-info-java</a>.</div>
<div style="font-family: arial, helvetica, sans-serif; font-size: 10pt; color: #000000;">The issue:</div>
<div style="font-family: arial, helvetica, sans-serif; font-size: 10pt; color: #000000;">Sometimes I generate my "own" javadoc of the standard library to supply my favorite settings to the javadoc tool. Thereby I encounter strange module-not-found errors for modules where import statements are present in the module-info.java file. Minimal example, e.g. for java.management, using JDK 20:</div>
<div style="font-family: arial, helvetica, sans-serif; font-size: 10pt; color: #000000;"> </div>
<div style="font-family: arial, helvetica, sans-serif; font-size: 10pt; color: #000000;"><code class="hljs language-java">.../jdk-<span class="hljs-number">20.0</span><span class="hljs-number">.2</span>/bin/javadoc -sourcepath .../jdk-jdk-<span class="hljs-number">20</span>-ga/src/java.management/share/classes -subpackages com:java:javax:sun --<span class="hljs-keyword">module</span> java.management -verbose</code></div>
<div style="font-family: arial, helvetica, sans-serif; font-size: 10pt; color: #000000;"> </div>
<div style="font-family: arial, helvetica, sans-serif; font-size: 10pt; color: #000000;">results in:</div>
<div style="font-family: arial, helvetica, sans-serif; font-size: 10pt; color: #000000;"> </div>
<div style="font-family: arial, helvetica, sans-serif; font-size: 10pt; color: #000000;">
<pre class="lang-java s-code-block"><code class="hljs language-java">[parsing started SimpleFileObject[.../jdk-jdk-<span class="hljs-number">20</span>-ga/src/java.management/share/classes/<span class="hljs-keyword">module</span>-info.java]]
[parsing completed 22ms]
error: <span class="hljs-keyword">module</span> java.management not found on source path
<span class="hljs-number">1</span> error</code></pre>
</div>
<div style="font-family: arial, helvetica, sans-serif; font-size: 10pt; color: #000000;"> </div>
<div style="font-family: arial, helvetica, sans-serif; font-size: 10pt; color: #000000;">If I remove the import statement in <code class="hljs language-java">java.management/share/classes/<span class="hljs-keyword">module</span>-info.java</code> the command works as expected. I tried adding the module hosting the imported package (jdk.compiler) to the sourcepath or module path in various ways (also consulting <a href="https://docs.oracle.com/en/java/javase/17/docs/specs/man/javadoc.html" target="_blank" rel="noopener">https://docs.oracle.com/en/java/javase/17/docs/specs/man/javadoc.html</a> and the corresponding page for javac) but was not able to solve this issue (I work around it by out-commenting the import statements). If this is considered off-topic as a usage question, please point me to a better location to ask the question, or (if you don't mind) I would be glad about a proper command line snippet that does the trick.</div>
<div style="font-family: arial, helvetica, sans-serif; font-size: 10pt; color: #000000;">However, even if this is just a usage issue I would recommend to improve the error message. At very least it should point out that an imported package was not found, rather than the module as a whole and without further information.</div>
<div style="font-family: arial, helvetica, sans-serif; font-size: 10pt; color: #000000;"> </div>
<div style="font-family: arial, helvetica, sans-serif; font-size: 10pt; color: #000000;">Kind regards</div>
<div style="font-family: arial, helvetica, sans-serif; font-size: 10pt; color: #000000;"> </div>
<div style="font-family: arial, helvetica, sans-serif; font-size: 10pt; color: #000000;">Stefan</div>
<div style="font-family: arial, helvetica, sans-serif; font-size: 10pt; color: #000000;"> </div>
                    <br/><hr>FreeMail powered by <a href="https://mail.de" target="_blank">mail.de</a> - <strong>mehr Sicherheit, Seriosität und Komfort</strong>