Sources read from classpath JARs cause errors during compilation
jonathan.gibbons at oracle.com
Mon Jan 13 18:56:38 UTC 2020
Hmm, interesting case. Thanks for reporting, complete with a description
of the stripped down test-case.
For what it's worth, this looks like a javac issue more than a javadoc
issue, because for the most part, javadoc delegates path handling and
source/class loading to javac.
On 01/13/2020 09:31 AM, Dawid Weiss wrote:
> Here is another gem I discovered while porting an ant build to gradle.
> Applies to Java 11-14. Say you're compiling class Bat like this:
> javadoc -classpath p2.jar -d tmp p3/bat/Bat.java
> p2 contains class Baz which Bat imports. Baz in turn has a reference
> to a class not on classpath (annotation, for example).
> The runtime behavior now forks into two scenarios:
> 1) p2 contains just Baz.class: compilation succeeds, documentation is generated.
> 1) p2 contains Baz.class AND Baz.java (sources inside the archive):
> javadoc fails with something like this:
> Loading source file p3\bat\Bat.java...
> Constructing Javadoc information...
> error: package bar does not exist
> import bar.Bar;
> error: cannot find symbol
> symbol: class Bar
> 2 errors
> Note the error message refers to the source file from classpath (!),
> not javadoc's source path.
> This causes grief when you don't have control over classpath entries.
> In Lucene's case it's this one:
> error: package org.apache.yetus.audience does not exist
> import org.apache.yetus.audience.InterfaceAudience;
> A repro code for the above is attached to the Lucene issue at 
> (can't send attachments from gmail).
>  https://issues.apache.org/jira/browse/LUCENE-9132
More information about the javadoc-dev