Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_langtools
提交
c979f97e
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看板
提交
c979f97e
编写于
3月 19, 2013
作者:
J
jjg
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8010317: DocLint incorrectly reports some <pre> tags as empty
Reviewed-by: darcy
上级
de70d3c4
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
71 addition
and
8 deletion
+71
-8
src/share/classes/com/sun/tools/doclint/Checker.java
src/share/classes/com/sun/tools/doclint/Checker.java
+27
-8
test/tools/doclint/EmptyPreTest.java
test/tools/doclint/EmptyPreTest.java
+44
-0
未找到文件。
src/share/classes/com/sun/tools/doclint/Checker.java
浏览文件 @
c979f97e
...
...
@@ -25,20 +25,18 @@
package
com.sun.tools.doclint
;
import
com.sun.source.doctree.LiteralTree
;
import
java.util.regex.Matcher
;
import
com.sun.source.doctree.LinkTree
;
import
java.net.URI
;
import
java.util.regex.Pattern
;
import
java.io.IOException
;
import
com.sun.tools.javac.tree.DocPretty
;
import
java.io.StringWriter
;
import
java.net.URI
;
import
java.net.URISyntaxException
;
import
java.util.Deque
;
import
java.util.EnumSet
;
import
java.util.HashSet
;
import
java.util.LinkedList
;
import
java.util.List
;
import
java.util.Set
;
import
java.util.regex.Matcher
;
import
java.util.regex.Pattern
;
import
javax.lang.model.element.Element
;
import
javax.lang.model.element.ElementKind
;
...
...
@@ -52,12 +50,15 @@ import javax.tools.Diagnostic.Kind;
import
com.sun.source.doctree.AttributeTree
;
import
com.sun.source.doctree.AuthorTree
;
import
com.sun.source.doctree.DocCommentTree
;
import
com.sun.source.doctree.DocRootTree
;
import
com.sun.source.doctree.DocTree
;
import
com.sun.source.doctree.EndElementTree
;
import
com.sun.source.doctree.EntityTree
;
import
com.sun.source.doctree.ErroneousTree
;
import
com.sun.source.doctree.IdentifierTree
;
import
com.sun.source.doctree.InheritDocTree
;
import
com.sun.source.doctree.LinkTree
;
import
com.sun.source.doctree.LiteralTree
;
import
com.sun.source.doctree.ParamTree
;
import
com.sun.source.doctree.ReferenceTree
;
import
com.sun.source.doctree.ReturnTree
;
...
...
@@ -67,11 +68,12 @@ import com.sun.source.doctree.SinceTree;
import
com.sun.source.doctree.StartElementTree
;
import
com.sun.source.doctree.TextTree
;
import
com.sun.source.doctree.ThrowsTree
;
import
com.sun.source.doctree.ValueTree
;
import
com.sun.source.doctree.VersionTree
;
import
com.sun.source.util.DocTreeScanner
;
import
com.sun.source.util.TreePath
;
import
com.sun.tools.doclint.HtmlTag.AttrKind
;
import
java.net.URISyntaxException
;
import
com.sun.tools.javac.tree.DocPretty
;
import
static
com
.
sun
.
tools
.
doclint
.
Messages
.
Group
.*;
...
...
@@ -95,6 +97,7 @@ public class Checker extends DocTreeScanner<Void, Void> {
public
enum
Flag
{
TABLE_HAS_CAPTION
,
HAS_ELEMENT
,
HAS_INLINE_TAG
,
HAS_TEXT
,
REPORTED_BAD_INLINE
}
...
...
@@ -418,7 +421,8 @@ public class Checker extends DocTreeScanner<Void, Void> {
}
if
(
t
.
flags
.
contains
(
HtmlTag
.
Flag
.
EXPECT_CONTENT
)
&&
!
top
.
flags
.
contains
(
Flag
.
HAS_TEXT
)
&&
!
top
.
flags
.
contains
(
Flag
.
HAS_ELEMENT
))
{
&&
!
top
.
flags
.
contains
(
Flag
.
HAS_ELEMENT
)
&&
!
top
.
flags
.
contains
(
Flag
.
HAS_INLINE_TAG
))
{
env
.
messages
.
warning
(
HTML
,
tree
,
"dc.tag.empty"
,
treeName
);
}
tagStack
.
pop
();
...
...
@@ -570,8 +574,15 @@ public class Checker extends DocTreeScanner<Void, Void> {
return
super
.
visitAuthor
(
tree
,
ignore
);
}
@Override
public
Void
visitDocRoot
(
DocRootTree
tree
,
Void
ignore
)
{
markEnclosingTag
(
Flag
.
HAS_INLINE_TAG
);
return
super
.
visitDocRoot
(
tree
,
ignore
);
}
@Override
public
Void
visitInheritDoc
(
InheritDocTree
tree
,
Void
ignore
)
{
markEnclosingTag
(
Flag
.
HAS_INLINE_TAG
);
// TODO: verify on overridden method
foundInheritDoc
=
true
;
return
super
.
visitInheritDoc
(
tree
,
ignore
);
...
...
@@ -579,6 +590,7 @@ public class Checker extends DocTreeScanner<Void, Void> {
@Override
public
Void
visitLink
(
LinkTree
tree
,
Void
ignore
)
{
markEnclosingTag
(
Flag
.
HAS_INLINE_TAG
);
// simulate inline context on tag stack
HtmlTag
t
=
(
tree
.
getKind
()
==
DocTree
.
Kind
.
LINK
)
?
HtmlTag
.
CODE
:
HtmlTag
.
SPAN
;
...
...
@@ -592,6 +604,7 @@ public class Checker extends DocTreeScanner<Void, Void> {
@Override
public
Void
visitLiteral
(
LiteralTree
tree
,
Void
ignore
)
{
markEnclosingTag
(
Flag
.
HAS_INLINE_TAG
);
if
(
tree
.
getKind
()
==
DocTree
.
Kind
.
CODE
)
{
for
(
TagStackItem
tsi:
tagStack
)
{
if
(
tsi
.
tag
==
HtmlTag
.
CODE
)
{
...
...
@@ -745,6 +758,12 @@ public class Checker extends DocTreeScanner<Void, Void> {
}
}
@Override
public
Void
visitValue
(
ValueTree
tree
,
Void
ignore
)
{
markEnclosingTag
(
Flag
.
HAS_INLINE_TAG
);
return
super
.
visitValue
(
tree
,
ignore
);
}
@Override
public
Void
visitVersion
(
VersionTree
tree
,
Void
ignore
)
{
warnIfEmpty
(
tree
,
tree
.
getBody
());
...
...
test/tools/doclint/EmptyPreTest.java
0 → 100644
浏览文件 @
c979f97e
/*
* 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
* @bug 8010317
* @summary DocLint incorrectly reports some <pre> tags as empty
* @build DocLintTester
* @run main DocLintTester -Xmsgs:html EmptyPreTest.java
*/
public
class
EmptyPreTest
{
/** <pre> {@code xyzzy} </pre> */
public
void
m1
()
{
}
/** <pre> {@docRoot} </pre> */
public
void
m2
()
{
}
/** <pre> {@link java.lang.String} </pre> */
public
void
m3
()
{
}
/** <pre> {@value} </pre> */
public
static
final
int
v1
=
1
;
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录