Skip to content

Commit 075ed8a

Browse files
author
duke
committedMar 11, 2022
Automatic merge of jdk:master into master
2 parents e1414a4 + 374193b commit 075ed8a

File tree

2 files changed

+20
-6
lines changed

2 files changed

+20
-6
lines changed
 

‎src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclint/Checker.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2012, 2021, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2012, 2022, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -985,8 +985,8 @@ public Void visitReturn(ReturnTree tree, Void ignore) {
985985
}
986986
if (tree.isInline()) {
987987
DocCommentTree dct = getCurrentPath().getDocComment();
988-
if (tree != dct.getFirstSentence().get(0)) {
989-
env.messages.warning(REFERENCE, tree, "dc.return.not.first");
988+
if (dct.getFirstSentence().isEmpty() || tree != dct.getFirstSentence().get(0)) {
989+
env.messages.warning(SYNTAX, tree, "dc.return.not.first");
990990
}
991991
}
992992

‎test/langtools/jdk/javadoc/doclet/testReturnTag/TestReturnTag.java

+17-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2003, 2021, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -23,7 +23,7 @@
2323

2424
/*
2525
* @test
26-
* @bug 4490068 8075778
26+
* @bug 4490068 8075778 8283041
2727
* @summary General tests for inline or block at-return tag
2828
* @library /tools/lib ../../lib
2929
* @modules jdk.javadoc/jdk.javadoc.internal.tool
@@ -265,16 +265,30 @@ public class C {
265265
*/
266266
public int m() { return 0; }
267267
}
268+
""",
269+
"""
270+
/** Comment. */
271+
public class X {
272+
/**
273+
* @author Jim
274+
* {@return the result}
275+
*/
276+
public int m() { return 0; }
277+
}
268278
""");
269279

270280
javadoc("-d", base.resolve("out").toString(),
271281
"-sourcepath", src.toString(),
272-
src.resolve("C.java").toString());
282+
src.resolve("C.java").toString(),
283+
src.resolve("X.java").toString());
273284
checkExit(Exit.OK);
274285

275286
checkOutput(Output.OUT, true,
276287
"C.java:4: warning: {@return} not at beginning of description");
277288

289+
checkOutput(Output.OUT, true,
290+
"X.java:5: warning: {@return} not at beginning of description");
291+
278292
checkOutput("C.html", true,
279293
"""
280294
<div class="block">Some text. Returns the result. More text.</div>

0 commit comments

Comments
 (0)
Please sign in to comment.