8283041: [javadoc] Crashes using {@return} with @param
Reviewed-by: jjg
This commit is contained in:
parent
0fd09d383b
commit
374193b6d2
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2012, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2012, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -985,8 +985,8 @@ public class Checker extends DocTreePathScanner<Void, Void> {
|
||||
}
|
||||
if (tree.isInline()) {
|
||||
DocCommentTree dct = getCurrentPath().getDocComment();
|
||||
if (tree != dct.getFirstSentence().get(0)) {
|
||||
env.messages.warning(REFERENCE, tree, "dc.return.not.first");
|
||||
if (dct.getFirstSentence().isEmpty() || tree != dct.getFirstSentence().get(0)) {
|
||||
env.messages.warning(SYNTAX, tree, "dc.return.not.first");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -23,7 +23,7 @@
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 4490068 8075778
|
||||
* @bug 4490068 8075778 8283041
|
||||
* @summary General tests for inline or block at-return tag
|
||||
* @library /tools/lib ../../lib
|
||||
* @modules jdk.javadoc/jdk.javadoc.internal.tool
|
||||
@ -265,16 +265,30 @@ public class TestReturnTag extends JavadocTester {
|
||||
*/
|
||||
public int m() { return 0; }
|
||||
}
|
||||
""",
|
||||
"""
|
||||
/** Comment. */
|
||||
public class X {
|
||||
/**
|
||||
* @author Jim
|
||||
* {@return the result}
|
||||
*/
|
||||
public int m() { return 0; }
|
||||
}
|
||||
""");
|
||||
|
||||
javadoc("-d", base.resolve("out").toString(),
|
||||
"-sourcepath", src.toString(),
|
||||
src.resolve("C.java").toString());
|
||||
src.resolve("C.java").toString(),
|
||||
src.resolve("X.java").toString());
|
||||
checkExit(Exit.OK);
|
||||
|
||||
checkOutput(Output.OUT, true,
|
||||
"C.java:4: warning: {@return} not at beginning of description");
|
||||
|
||||
checkOutput(Output.OUT, true,
|
||||
"X.java:5: warning: {@return} not at beginning of description");
|
||||
|
||||
checkOutput("C.html", true,
|
||||
"""
|
||||
<div class="block">Some text. Returns the result. More text.</div>
|
||||
|
Loading…
Reference in New Issue
Block a user