Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_langtools
提交
99e664af
D
dragonwell8_langtools
项目概览
openanolis
/
dragonwell8_langtools
通知
0
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
dragonwell8_langtools
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
99e664af
编写于
7月 17, 2013
作者:
J
jjg
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8020664: doclint gives incorrect warnings on normal package statements
Reviewed-by: mcimadamore
上级
211a67e6
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
127 addition
and
6 deletion
+127
-6
src/share/classes/com/sun/tools/doclint/DocLint.java
src/share/classes/com/sun/tools/doclint/DocLint.java
+17
-5
src/share/classes/com/sun/tools/doclint/resources/doclint.properties
...lasses/com/sun/tools/doclint/resources/doclint.properties
+1
-0
test/tools/doclint/BadPackageCommentTest.out
test/tools/doclint/BadPackageCommentTest.out
+4
-0
test/tools/doclint/DocLintTester.java
test/tools/doclint/DocLintTester.java
+1
-1
test/tools/doclint/packageTests/bad/Test.java
test/tools/doclint/packageTests/bad/Test.java
+14
-0
test/tools/doclint/packageTests/bad/Test.out
test/tools/doclint/packageTests/bad/Test.out
+4
-0
test/tools/doclint/packageTests/bad/package-info.java
test/tools/doclint/packageTests/bad/package-info.java
+11
-0
test/tools/doclint/packageTests/bad/package-info.out
test/tools/doclint/packageTests/bad/package-info.out
+4
-0
test/tools/doclint/packageTests/good/Test.java
test/tools/doclint/packageTests/good/Test.java
+37
-0
test/tools/doclint/packageTests/good/package-info.java
test/tools/doclint/packageTests/good/package-info.java
+34
-0
未找到文件。
src/share/classes/com/sun/tools/doclint/DocLint.java
浏览文件 @
99e664af
...
...
@@ -30,9 +30,10 @@ import java.io.IOException;
import
java.io.PrintWriter
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.regex.Pattern
;
import
javax.lang.model.element.Name
;
import
javax.tools.Diagnostic
;
import
javax.tools.JavaFileObject
;
import
javax.tools.StandardLocation
;
import
com.sun.source.doctree.DocCommentTree
;
...
...
@@ -151,6 +152,18 @@ public class DocLint implements Plugin {
TreePath
p
=
getCurrentPath
();
DocCommentTree
dc
=
env
.
trees
.
getDocCommentTree
(
p
);
if
(
p
.
getLeaf
()
==
p
.
getCompilationUnit
())
{
JavaFileObject
fo
=
p
.
getCompilationUnit
().
getSourceFile
();
boolean
pkgInfo
=
fo
.
isNameCompatible
(
"package-info"
,
JavaFileObject
.
Kind
.
SOURCE
);
if
(!
pkgInfo
)
{
if
(
dc
==
null
)
return
;
env
.
setCurrent
(
p
,
dc
);
env
.
messages
.
report
(
Messages
.
Group
.
REFERENCE
,
Diagnostic
.
Kind
.
WARNING
,
p
.
getLeaf
(),
"dc.unexpected.comment"
);
}
}
checker
.
scan
(
dc
,
p
);
}
};
...
...
@@ -166,8 +179,8 @@ public class DocLint implements Plugin {
}
void
processArgs
(
String
...
args
)
throws
BadArgs
{
javacOpts
=
new
ArrayList
<
String
>();
javacFiles
=
new
ArrayList
<
File
>();
javacOpts
=
new
ArrayList
<>();
javacFiles
=
new
ArrayList
<>();
if
(
args
.
length
==
0
)
needHelp
=
true
;
...
...
@@ -214,7 +227,7 @@ public class DocLint implements Plugin {
}
List
<
File
>
splitPath
(
String
path
)
{
List
<
File
>
files
=
new
ArrayList
<
File
>();
List
<
File
>
files
=
new
ArrayList
<>();
for
(
String
f:
path
.
split
(
File
.
pathSeparator
))
{
if
(
f
.
length
()
>
0
)
files
.
add
(
new
File
(
f
));
...
...
@@ -279,7 +292,6 @@ public class DocLint implements Plugin {
TaskListener
tl
=
new
TaskListener
()
{
@Override
public
void
started
(
TaskEvent
e
)
{
return
;
}
@Override
...
...
src/share/classes/com/sun/tools/doclint/resources/doclint.properties
浏览文件 @
99e664af
...
...
@@ -67,6 +67,7 @@ dc.tag.self.closing = self-closing element not allowed
dc.tag.start.unmatched
=
end tag missing: </{0}>
dc.tag.unknown
=
unknown tag: {0}
dc.text.not.allowed
=
text not allowed in <{0}> element
dc.unexpected.comment
=
documentation comment not expected here
dc.main.ioerror
=
IO error: {0}
dc.main.no.files.given
=
No files given
...
...
test/tools/doclint/BadPackageCommentTest.out
浏览文件 @
99e664af
BadPackageCommentTest
.
java
:
13
:
warning
:
documentation
comment
not
expected
here
package
p
;
^
BadPackageCommentTest
.
java
:
11
:
error
:
no
tag
name
after
@
*
@@@
^
...
...
@@ -8,3 +11,4 @@ BadPackageCommentTest.java:11: error: no tag name after @
*
@@@
^
3
errors
1
warning
test/tools/doclint/DocLintTester.java
浏览文件 @
99e664af
...
...
@@ -123,7 +123,7 @@ public class DocLintTester {
private
static
final
Pattern
dirFileLine
=
Pattern
.
compile
(
"(?m)"
// multi-line mode
+
"^(.*?)"
// directory part of file name
+
"([
A-Za-z0-9.]+:[0-9]+:)"
);
// file name and line number
+
"([
-A-Za-z0-9.]+:[0-9]+:)"
);
// file name and line number
String
removeFileNames
(
String
s
)
{
Matcher
m
=
dirFileLine
.
matcher
(
s
);
...
...
test/tools/doclint/packageTests/bad/Test.java
0 → 100644
浏览文件 @
99e664af
/*
* @test /nodynamiccopyright/
* @bug 8020664
* @summary doclint gives incorrect warnings on normal package statements
* @library ../..
* @build DocLintTester
* @run main DocLintTester -ref Test.out Test.java
*/
/** Unexpected comment */
package
bad
;
class
Test
{
}
test/tools/doclint/packageTests/bad/Test.out
0 → 100644
浏览文件 @
99e664af
Test
.
java
:
11
:
warning
:
documentation
comment
not
expected
here
package
bad
;
^
1
warning
test/tools/doclint/packageTests/bad/package-info.java
0 → 100644
浏览文件 @
99e664af
/*
* @test /nodynamiccopyright/
* @bug 8020664
* @summary doclint gives incorrect warnings on normal package statements
* @library ../..
* @build DocLintTester
* @run main DocLintTester -ref package-info.out package-info.java
*/
// missing comment
package
bad
;
test/tools/doclint/packageTests/bad/package-info.out
0 → 100644
浏览文件 @
99e664af
package
-
info
.
java
:
11
:
warning
:
no
comment
package
bad
;
^
1
warning
test/tools/doclint/packageTests/good/Test.java
0 → 100644
浏览文件 @
99e664af
/*
* Copyright (c) 2012, 2013, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test /nodynamiccopyright/
* @bug 8020664
* @summary doclint gives incorrect warnings on normal package statements
* @library ../..
* @build DocLintTester
* @run main DocLintTester Test.java
*/
// no doc comment
package
good
;
class
Test
{
}
test/tools/doclint/packageTests/good/package-info.java
0 → 100644
浏览文件 @
99e664af
/*
* Copyright (c) 2012, 2013, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test /nodynamiccopyright/
* @bug 8020664
* @summary doclint gives incorrect warnings on normal package statements
* @library ../..
* @build DocLintTester
* @run main DocLintTester package-info.java
*/
/** Description. */
package
good
;
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录