mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-21 11:34:38 +02:00
8249633: doclint reports missing javadoc for JavaFX property methods that have a property description
Reviewed-by: hannesw
This commit is contained in:
parent
eef43be71c
commit
4f914e21c4
3 changed files with 72 additions and 10 deletions
|
@ -46,6 +46,7 @@ import jdk.javadoc.internal.doclets.toolkit.MemberSummaryWriter;
|
||||||
import jdk.javadoc.internal.doclets.toolkit.WriterFactory;
|
import jdk.javadoc.internal.doclets.toolkit.WriterFactory;
|
||||||
import jdk.javadoc.internal.doclets.toolkit.util.CommentHelper;
|
import jdk.javadoc.internal.doclets.toolkit.util.CommentHelper;
|
||||||
import jdk.javadoc.internal.doclets.toolkit.util.DocFinder;
|
import jdk.javadoc.internal.doclets.toolkit.util.DocFinder;
|
||||||
|
import jdk.javadoc.internal.doclets.toolkit.util.Utils;
|
||||||
import jdk.javadoc.internal.doclets.toolkit.util.VisibleMemberTable;
|
import jdk.javadoc.internal.doclets.toolkit.util.VisibleMemberTable;
|
||||||
import jdk.javadoc.internal.doclets.toolkit.CommentUtils;
|
import jdk.javadoc.internal.doclets.toolkit.CommentUtils;
|
||||||
|
|
||||||
|
@ -507,7 +508,10 @@ public abstract class MemberSummaryBuilder extends AbstractMemberBuilder {
|
||||||
if (null == propertyMethod || null == commentSource) {
|
if (null == propertyMethod || null == commentSource) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
DocCommentTree docTree = builder.utils.getDocCommentTree(propertyMethod);
|
Utils utils = builder.utils;
|
||||||
|
DocCommentTree docTree = utils.hasDocCommentTree(propertyMethod)
|
||||||
|
? utils.getDocCommentTree(propertyMethod)
|
||||||
|
: null;
|
||||||
|
|
||||||
/* The second condition is required for the property buckets. In
|
/* The second condition is required for the property buckets. In
|
||||||
* this case the comment is at the property method (not at the field)
|
* this case the comment is at the property method (not at the field)
|
||||||
|
|
|
@ -2637,14 +2637,16 @@ public class Utils {
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasBlockTag(Element element, DocTree.Kind kind, final String tagName) {
|
public boolean hasBlockTag(Element element, DocTree.Kind kind, final String tagName) {
|
||||||
CommentHelper ch = getCommentHelper(element);
|
if (hasDocCommentTree(element)) {
|
||||||
String tname = tagName != null && tagName.startsWith("@")
|
CommentHelper ch = getCommentHelper(element);
|
||||||
? tagName.substring(1)
|
String tname = tagName != null && tagName.startsWith("@")
|
||||||
: tagName;
|
? tagName.substring(1)
|
||||||
for (DocTree dt : getBlockTags(element, kind)) {
|
: tagName;
|
||||||
if (dt.getKind() == kind) {
|
for (DocTree dt : getBlockTags(element, kind)) {
|
||||||
if (tname == null || ch.getTagName(dt).equals(tname)) {
|
if (dt.getKind() == kind) {
|
||||||
return true;
|
if (tname == null || ch.getTagName(dt).equals(tname)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
* @test
|
* @test
|
||||||
* @bug 7112427 8012295 8025633 8026567 8061305 8081854 8150130 8162363
|
* @bug 7112427 8012295 8025633 8026567 8061305 8081854 8150130 8162363
|
||||||
* 8167967 8172528 8175200 8178830 8182257 8186332 8182765 8025091
|
* 8167967 8172528 8175200 8178830 8182257 8186332 8182765 8025091
|
||||||
* 8203791 8184205
|
* 8203791 8184205 8249633
|
||||||
* @summary Test of the JavaFX doclet features.
|
* @summary Test of the JavaFX doclet features.
|
||||||
* @library ../../lib
|
* @library ../../lib
|
||||||
* @modules jdk.javadoc/jdk.javadoc.internal.tool
|
* @modules jdk.javadoc/jdk.javadoc.internal.tool
|
||||||
|
@ -33,6 +33,10 @@
|
||||||
* @run main TestJavaFX
|
* @run main TestJavaFX
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.nio.file.Files;
|
||||||
|
import java.nio.file.Path;
|
||||||
|
|
||||||
import javadoc.tester.JavadocTester;
|
import javadoc.tester.JavadocTester;
|
||||||
|
|
||||||
public class TestJavaFX extends JavadocTester {
|
public class TestJavaFX extends JavadocTester {
|
||||||
|
@ -366,4 +370,56 @@ public class TestJavaFX extends JavadocTester {
|
||||||
// make sure the doclet indeed emits the warning
|
// make sure the doclet indeed emits the warning
|
||||||
checkOutput(Output.OUT, true, "C.java:0: warning - invalid usage of tag <");
|
checkOutput(Output.OUT, true, "C.java:0: warning - invalid usage of tag <");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Verify that no warnings are produced on methods that may have synthesized comments.
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void test5() throws IOException {
|
||||||
|
Path src5 = Files.createDirectories(Path.of("src5").resolve("pkg"));
|
||||||
|
Files.writeString(src5.resolve("MyClass.java"),
|
||||||
|
"""
|
||||||
|
package pkg;
|
||||||
|
|
||||||
|
// The following import not required with --disable-javafx-strict-checks
|
||||||
|
// import javafx.beans.property.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is my class.
|
||||||
|
*/
|
||||||
|
public class MyClass {
|
||||||
|
/**
|
||||||
|
* This is my property that enables something
|
||||||
|
*/
|
||||||
|
private BooleanProperty something = new SimpleBooleanProperty(false);
|
||||||
|
|
||||||
|
public final boolean isSomething() {
|
||||||
|
return something.get();
|
||||||
|
}
|
||||||
|
|
||||||
|
public final void setSomething(boolean val) {
|
||||||
|
something.set(val);
|
||||||
|
}
|
||||||
|
|
||||||
|
public final BooleanProperty somethingProperty() {
|
||||||
|
return something;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Dummy declaration. */
|
||||||
|
public class BooleanProperty { }
|
||||||
|
}
|
||||||
|
""");
|
||||||
|
|
||||||
|
javadoc("-d", "out5",
|
||||||
|
"--javafx",
|
||||||
|
"--disable-javafx-strict-checks",
|
||||||
|
"-Xdoclint:all",
|
||||||
|
"--source-path", "src5",
|
||||||
|
"pkg");
|
||||||
|
checkExit(Exit.OK);
|
||||||
|
|
||||||
|
checkOutput(Output.OUT, false,
|
||||||
|
"warning",
|
||||||
|
"no comment");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue