8306578: Report error if no label given in @see and {@link} when no default is available

Reviewed-by: jjg
This commit is contained in:
Hannes Wallnöfer 2023-06-05 09:39:19 +00:00
parent 8c9d21e519
commit db0857ddd8
2 changed files with 5 additions and 5 deletions

View File

@ -494,7 +494,7 @@ public class TagletWriterImpl extends TagletWriter {
if (labelContent.isEmpty()) {
// A non-empty label is required for fragment links as the
// reference target does not provide a useful default label.
reportWarning.accept("doclet.link.see.no_label", null);
htmlWriter.messages.error(ch.getDocTreePath(refTree), "doclet.link.see.no_label");
return invalidTagOutput(resources.getText("doclet.link.see.no_label"),
Optional.of(refSignature));
}

View File

@ -23,7 +23,7 @@
/*
* @test
* @bug 8200337 8307377
* @bug 8200337 8307377 8306578
* @summary Generalize see and link tags for user-defined anchors
* @library /tools/lib ../../lib
* @modules
@ -140,14 +140,14 @@ public class TestSeeLinkAnchor extends JavadocTester {
"--no-platform-links",
"nolabel");
checkExit(Exit.OK);
checkExit(Exit.ERROR);
checkOutput(Output.OUT, true, """
warning: missing reference label
error: missing reference label
Link with missing label: {@link ##main}.
^
""",
"""
Class1.java:5: warning: missing reference label
Class1.java:5: error: missing reference label
@see ##main
^
""");