提交 b9154101 编写于 作者: J jjg

8028318: [doclint] doclint will reject existing user-written doc comments...

8028318: [doclint] doclint will reject existing user-written doc comments using custom tags that follow the recommended rules
Reviewed-by: darcy
上级 9a4d25f4
......@@ -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);
}
......
/*
* @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 {
......
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
CustomTagTest.java:15: error: unknown tag: unknownTag
CustomTagTest.java:16: error: unknown tag: unknownTag
* @unknownTag Text for an unknown tag.
^
1 error
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册