mirror of
https://github.com/openjdk/jdk.git
synced 2026-02-02 06:28:23 +00:00
8028318: [doclint] doclint will reject existing user-written doc comments using custom tags that follow the recommended rules
Reviewed-by: darcy
This commit is contained in:
parent
78520efca9
commit
7f2246bbef
@ -280,7 +280,7 @@ public class DocCommentParser {
|
||||
try {
|
||||
nextChar();
|
||||
if (isIdentifierStart(ch)) {
|
||||
Name name = readIdentifier();
|
||||
Name name = readTagName();
|
||||
TagParser tp = tagParsers.get(name);
|
||||
if (tp == null) {
|
||||
List<DCTree> content = blockContent();
|
||||
@ -329,7 +329,7 @@ public class DocCommentParser {
|
||||
try {
|
||||
nextChar();
|
||||
if (isIdentifierStart(ch)) {
|
||||
Name name = readIdentifier();
|
||||
Name name = readTagName();
|
||||
skipWhitespace();
|
||||
|
||||
TagParser tp = tagParsers.get(name);
|
||||
@ -905,6 +905,14 @@ public class DocCommentParser {
|
||||
return names.fromChars(buf, start, bp - start);
|
||||
}
|
||||
|
||||
protected Name readTagName() {
|
||||
int start = bp;
|
||||
nextChar();
|
||||
while (bp < buflen && (Character.isUnicodeIdentifierPart(ch) || ch == '.'))
|
||||
nextChar();
|
||||
return names.fromChars(buf, start, bp - start);
|
||||
}
|
||||
|
||||
protected boolean isJavaIdentifierStart(char ch) {
|
||||
return Character.isJavaIdentifierStart(ch);
|
||||
}
|
||||
|
||||
@ -1,17 +1,18 @@
|
||||
/*
|
||||
* @test /nodynamiccopyright/
|
||||
* @bug 8006248
|
||||
* @bug 8006248 8028318
|
||||
* @summary DocLint should report unknown tags
|
||||
* @build DocLintTester
|
||||
* @run main DocLintTester CustomTagTest.java
|
||||
* @run main DocLintTester -XcustomTags: -ref CustomTagTest.out CustomTagTest.java
|
||||
* @run main DocLintTester -XcustomTags:customTag -ref CustomTagTestWithOption.out CustomTagTest.java
|
||||
* @run main DocLintTester -XcustomTags:customTag,anotherCustomTag -ref CustomTagTestWithOption.out CustomTagTest.java
|
||||
* @run main DocLintTester -XcustomTags:customTag,custom.tag -ref CustomTagTestWithOption.out CustomTagTest.java
|
||||
* @run main DocLintTester -XcustomTags:customTag,custom.tag,anotherCustomTag -ref CustomTagTestWithOption.out CustomTagTest.java
|
||||
* @author bpatel
|
||||
*/
|
||||
|
||||
/**
|
||||
* @customTag Text for a custom tag.
|
||||
* @custom.tag Text for another custom tag.
|
||||
* @unknownTag Text for an unknown tag.
|
||||
*/
|
||||
public class CustomTagTest {
|
||||
|
||||
@ -1,8 +1,11 @@
|
||||
CustomTagTest.java:14: error: unknown tag: customTag
|
||||
* @customTag Text for a custom tag.
|
||||
^
|
||||
CustomTagTest.java:15: error: unknown tag: unknownTag
|
||||
CustomTagTest.java:15: error: unknown tag: custom.tag
|
||||
* @custom.tag Text for another custom tag.
|
||||
^
|
||||
CustomTagTest.java:16: error: unknown tag: unknownTag
|
||||
* @unknownTag Text for an unknown tag.
|
||||
^
|
||||
2 errors
|
||||
3 errors
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
CustomTagTest.java:15: error: unknown tag: unknownTag
|
||||
CustomTagTest.java:16: error: unknown tag: unknownTag
|
||||
* @unknownTag Text for an unknown tag.
|
||||
^
|
||||
1 error
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user