Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_langtools
提交
305a3361
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看板
提交
305a3361
编写于
7月 23, 2013
作者:
J
jjg
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8021215: javac gives incorrect doclint warnings on normal package statements
Reviewed-by: darcy
上级
82c8d34d
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
45 addition
and
24 deletion
+45
-24
src/share/classes/com/sun/tools/doclint/Checker.java
src/share/classes/com/sun/tools/doclint/Checker.java
+25
-4
src/share/classes/com/sun/tools/doclint/DocLint.java
src/share/classes/com/sun/tools/doclint/DocLint.java
+0
-14
test/tools/doclint/packageTests/bad/Test.java
test/tools/doclint/packageTests/bad/Test.java
+3
-1
test/tools/doclint/packageTests/bad/Test.javac.out
test/tools/doclint/packageTests/bad/Test.javac.out
+4
-0
test/tools/doclint/packageTests/bad/Test.out
test/tools/doclint/packageTests/bad/Test.out
+1
-1
test/tools/doclint/packageTests/bad/package-info.java
test/tools/doclint/packageTests/bad/package-info.java
+2
-1
test/tools/doclint/packageTests/bad/package-info.javac.out
test/tools/doclint/packageTests/bad/package-info.javac.out
+4
-0
test/tools/doclint/packageTests/bad/package-info.out
test/tools/doclint/packageTests/bad/package-info.out
+1
-1
test/tools/doclint/packageTests/good/Test.java
test/tools/doclint/packageTests/good/Test.java
+3
-1
test/tools/doclint/packageTests/good/package-info.java
test/tools/doclint/packageTests/good/package-info.java
+2
-1
未找到文件。
src/share/classes/com/sun/tools/doclint/Checker.java
浏览文件 @
305a3361
...
@@ -141,10 +141,27 @@ public class Checker extends DocTreePathScanner<Void, Void> {
...
@@ -141,10 +141,27 @@ public class Checker extends DocTreePathScanner<Void, Void> {
boolean
isOverridingMethod
=
!
env
.
currOverriddenMethods
.
isEmpty
();
boolean
isOverridingMethod
=
!
env
.
currOverriddenMethods
.
isEmpty
();
if
(
tree
==
null
)
{
if
(
p
.
getLeaf
()
==
p
.
getCompilationUnit
())
{
if
(!
isSynthetic
()
&&
!
isOverridingMethod
)
// If p points to a compilation unit, the implied declaration is the
reportMissing
(
"dc.missing.comment"
);
// package declaration (if any) for the compilation unit.
return
null
;
// Handle this case specially, because doc comments are only
// expected in package-info files.
JavaFileObject
fo
=
p
.
getCompilationUnit
().
getSourceFile
();
boolean
isPkgInfo
=
fo
.
isNameCompatible
(
"package-info"
,
JavaFileObject
.
Kind
.
SOURCE
);
if
(
tree
==
null
)
{
if
(
isPkgInfo
)
reportMissing
(
"dc.missing.comment"
);
return
null
;
}
else
{
if
(!
isPkgInfo
)
reportReference
(
"dc.unexpected.comment"
);
}
}
else
{
if
(
tree
==
null
)
{
if
(!
isSynthetic
()
&&
!
isOverridingMethod
)
reportMissing
(
"dc.missing.comment"
);
return
null
;
}
}
}
tagStack
.
clear
();
tagStack
.
clear
();
...
@@ -187,6 +204,10 @@ public class Checker extends DocTreePathScanner<Void, Void> {
...
@@ -187,6 +204,10 @@ public class Checker extends DocTreePathScanner<Void, Void> {
env
.
messages
.
report
(
MISSING
,
Kind
.
WARNING
,
env
.
currPath
.
getLeaf
(),
code
,
args
);
env
.
messages
.
report
(
MISSING
,
Kind
.
WARNING
,
env
.
currPath
.
getLeaf
(),
code
,
args
);
}
}
private
void
reportReference
(
String
code
,
Object
...
args
)
{
env
.
messages
.
report
(
REFERENCE
,
Kind
.
WARNING
,
env
.
currPath
.
getLeaf
(),
code
,
args
);
}
@Override
@Override
public
Void
visitDocComment
(
DocCommentTree
tree
,
Void
ignore
)
{
public
Void
visitDocComment
(
DocCommentTree
tree
,
Void
ignore
)
{
super
.
visitDocComment
(
tree
,
ignore
);
super
.
visitDocComment
(
tree
,
ignore
);
...
...
src/share/classes/com/sun/tools/doclint/DocLint.java
浏览文件 @
305a3361
...
@@ -32,8 +32,6 @@ import java.util.ArrayList;
...
@@ -32,8 +32,6 @@ import java.util.ArrayList;
import
java.util.List
;
import
java.util.List
;
import
javax.lang.model.element.Name
;
import
javax.lang.model.element.Name
;
import
javax.tools.Diagnostic
;
import
javax.tools.JavaFileObject
;
import
javax.tools.StandardLocation
;
import
javax.tools.StandardLocation
;
import
com.sun.source.doctree.DocCommentTree
;
import
com.sun.source.doctree.DocCommentTree
;
...
@@ -152,18 +150,6 @@ public class DocLint implements Plugin {
...
@@ -152,18 +150,6 @@ public class DocLint implements Plugin {
TreePath
p
=
getCurrentPath
();
TreePath
p
=
getCurrentPath
();
DocCommentTree
dc
=
env
.
trees
.
getDocCommentTree
(
p
);
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
);
checker
.
scan
(
dc
,
p
);
}
}
};
};
...
...
test/tools/doclint/packageTests/bad/Test.java
浏览文件 @
305a3361
/*
/*
* @test /nodynamiccopyright/
* @test /nodynamiccopyright/
* @bug 8020664
* @bug 8020664
8021215
* @summary doclint gives incorrect warnings on normal package statements
* @summary doclint gives incorrect warnings on normal package statements
* @library ../..
* @library ../..
* @build DocLintTester
* @build DocLintTester
* @run main DocLintTester -ref Test.out Test.java
* @run main DocLintTester -ref Test.out Test.java
* @compile/fail/ref=Test.javac.out -XDrawDiagnostics -Werror -Xdoclint:all Test.java
*/
*/
/** Unexpected comment */
/** Unexpected comment */
package
bad
;
package
bad
;
/** */
class
Test
{
}
class
Test
{
}
test/tools/doclint/packageTests/bad/Test.javac.out
0 → 100644
浏览文件 @
305a3361
Test.java:12:1: compiler.warn.proc.messager: documentation comment not expected here
- compiler.err.warnings.and.werror
1 error
1 warning
test/tools/doclint/packageTests/bad/Test.out
浏览文件 @
305a3361
Test
.
java
:
1
1
:
warning
:
documentation
comment
not
expected
here
Test
.
java
:
1
2
:
warning
:
documentation
comment
not
expected
here
package
bad
;
package
bad
;
^
^
1
warning
1
warning
test/tools/doclint/packageTests/bad/package-info.java
浏览文件 @
305a3361
/*
/*
* @test /nodynamiccopyright/
* @test /nodynamiccopyright/
* @bug 8020664
* @bug 8020664
8021215
* @summary doclint gives incorrect warnings on normal package statements
* @summary doclint gives incorrect warnings on normal package statements
* @library ../..
* @library ../..
* @build DocLintTester
* @build DocLintTester
* @run main DocLintTester -ref package-info.out package-info.java
* @run main DocLintTester -ref package-info.out package-info.java
* @compile/fail/ref=package-info.javac.out -XDrawDiagnostics -Werror -Xdoclint:all package-info.java
*/
*/
// missing comment
// missing comment
...
...
test/tools/doclint/packageTests/bad/package-info.javac.out
0 → 100644
浏览文件 @
305a3361
package-info.java:12:1: compiler.warn.proc.messager: no comment
- compiler.err.warnings.and.werror
1 error
1 warning
test/tools/doclint/packageTests/bad/package-info.out
浏览文件 @
305a3361
package
-
info
.
java
:
1
1
:
warning
:
no
comment
package
-
info
.
java
:
1
2
:
warning
:
no
comment
package
bad
;
package
bad
;
^
^
1
warning
1
warning
test/tools/doclint/packageTests/good/Test.java
浏览文件 @
305a3361
...
@@ -23,15 +23,17 @@
...
@@ -23,15 +23,17 @@
/*
/*
* @test /nodynamiccopyright/
* @test /nodynamiccopyright/
* @bug 8020664
* @bug 8020664
8021215
* @summary doclint gives incorrect warnings on normal package statements
* @summary doclint gives incorrect warnings on normal package statements
* @library ../..
* @library ../..
* @build DocLintTester
* @build DocLintTester
* @run main DocLintTester Test.java
* @run main DocLintTester Test.java
* @compile -Xdoclint:all Test.java
*/
*/
// no doc comment
// no doc comment
package
good
;
package
good
;
/** */
class
Test
{
}
class
Test
{
}
test/tools/doclint/packageTests/good/package-info.java
浏览文件 @
305a3361
...
@@ -23,11 +23,12 @@
...
@@ -23,11 +23,12 @@
/*
/*
* @test /nodynamiccopyright/
* @test /nodynamiccopyright/
* @bug 8020664
* @bug 8020664
8021215
* @summary doclint gives incorrect warnings on normal package statements
* @summary doclint gives incorrect warnings on normal package statements
* @library ../..
* @library ../..
* @build DocLintTester
* @build DocLintTester
* @run main DocLintTester package-info.java
* @run main DocLintTester package-info.java
* @compile -Xdoclint:all package-info.java
*/
*/
/** Description. */
/** Description. */
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录