The test definitely looks wrong, but I'd like to understand more why the
code
is allowing the test to pass in agentvm mode. I suspect there's a couple of
bugs that need to be filed here, against jtreg (for the different
behavior of
agentvm and othervm) and against javac (where it would be nice if it warned
about a doc comment on an import statement.)
-- Jon
On 2/25/19 2:09 AM, Nick Gasson (Arm Technology China) wrote:
Hi,
Please review this small patch to fix a failure of the above test when
run with the jtreg -othervm option:
Bug: https://bugs.openjdk.java.net/browse/JDK-8219628
Webrev: http://cr.openjdk.java.net/~ngasson/8219628/webrev.1/
It passes with -agentvm but with -othervm it fails with this error:
/home/nicgas01/jdk/test/langtools/jdk/javadoc/lib/javadoc/tester/JavadocTester.java:99:
error: unknown tag: Test
* @Test
^
The agentvm mode seems to be hiding a bug in the test:
InheritDocForUserTags/DocTest.java has a class SimpleInheritDocDocTest
extends DocTest which uses the javadoc @inheritDoc tag to inherit its
documentation from DocTest. But the javadoc comment for DocTest is
incorrectly placed before the import statement at the top of the file,
rather than directly preceeding the class declaration. DocTest's parent
class JavadocTester then has an error in its doc comment: it has an
unescaped @ in "@Test" in a code sample, which javadoc interprets as a
documentation tag and then errors out on.
This patch escapes the @ and also moves the doc comment for DocTest to
the correct place.
The difference between the two jtreg modes seems to be in the value for
the -sourcepath argument. In agentvm mode I see this line, where it
loads the JavadocTester class file:
[loading
/home/nicgas01/jdk/build/linux-aarch64-server-fastdebug/test-support/jtreg_test_langtools_jdk_javadoc_doclet_InheritDocForUserTags_DocTest_java/classes/0/jdk/javadoc/lib/javadoc/tester/JavadocTester.class]
And in othervm mode it loads and parses the source file:
[loading
/home/nicgas01/jdk/test/langtools/jdk/javadoc/lib/javadoc/tester/JavadocTester.java]
I've attached the two .jtr files to the JBS issue.
Thanks,
Nick