8306578: Report error if no label given in @see and {@link} when no default is available
Reviewed-by: jjg
This commit is contained in:
parent
8c9d21e519
commit
db0857ddd8
@ -494,7 +494,7 @@ public class TagletWriterImpl extends TagletWriter {
|
|||||||
if (labelContent.isEmpty()) {
|
if (labelContent.isEmpty()) {
|
||||||
// A non-empty label is required for fragment links as the
|
// A non-empty label is required for fragment links as the
|
||||||
// reference target does not provide a useful default label.
|
// 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"),
|
return invalidTagOutput(resources.getText("doclet.link.see.no_label"),
|
||||||
Optional.of(refSignature));
|
Optional.of(refSignature));
|
||||||
}
|
}
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* @test
|
* @test
|
||||||
* @bug 8200337 8307377
|
* @bug 8200337 8307377 8306578
|
||||||
* @summary Generalize see and link tags for user-defined anchors
|
* @summary Generalize see and link tags for user-defined anchors
|
||||||
* @library /tools/lib ../../lib
|
* @library /tools/lib ../../lib
|
||||||
* @modules
|
* @modules
|
||||||
@ -140,14 +140,14 @@ public class TestSeeLinkAnchor extends JavadocTester {
|
|||||||
"--no-platform-links",
|
"--no-platform-links",
|
||||||
"nolabel");
|
"nolabel");
|
||||||
|
|
||||||
checkExit(Exit.OK);
|
checkExit(Exit.ERROR);
|
||||||
checkOutput(Output.OUT, true, """
|
checkOutput(Output.OUT, true, """
|
||||||
warning: missing reference label
|
error: missing reference label
|
||||||
Link with missing label: {@link ##main}.
|
Link with missing label: {@link ##main}.
|
||||||
^
|
^
|
||||||
""",
|
""",
|
||||||
"""
|
"""
|
||||||
Class1.java:5: warning: missing reference label
|
Class1.java:5: error: missing reference label
|
||||||
@see ##main
|
@see ##main
|
||||||
^
|
^
|
||||||
""");
|
""");
|
||||||
|
Loading…
Reference in New Issue
Block a user