Skip to content

Commit

Permalink
8306578: Report error if no label given in @see and {@link} when no d…
Browse files Browse the repository at this point in the history
…efault is available

Reviewed-by: jjg
  • Loading branch information
hns committed Jun 5, 2023
1 parent 8c9d21e commit db0857d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,7 @@ private Content linkSeeReferenceOutput(Element holder,
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));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -140,14 +140,14 @@ public void testMissingLabel(Path base) throws Exception {
"--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
^
""");
Expand Down

1 comment on commit db0857d

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.