Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_langtools
提交
03accfa7
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看板
提交
03accfa7
编写于
10月 14, 2013
作者:
J
jjg
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8026368: doclint does not report empty tags when tag closed implicitly
Reviewed-by: darcy
上级
bc3e3d2e
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
45 addition
and
15 deletion
+45
-15
src/share/classes/com/sun/tools/doclint/Checker.java
src/share/classes/com/sun/tools/doclint/Checker.java
+25
-9
test/tools/doclint/HtmlAttrsTest.java
test/tools/doclint/HtmlAttrsTest.java
+1
-1
test/tools/doclint/HtmlAttrsTest.out
test/tools/doclint/HtmlAttrsTest.out
+1
-1
test/tools/doclint/tidy/BadEnd.out
test/tools/doclint/tidy/BadEnd.out
+4
-1
test/tools/doclint/tidy/TrimmingEmptyTag.java
test/tools/doclint/tidy/TrimmingEmptyTag.java
+7
-2
test/tools/doclint/tidy/TrimmingEmptyTag.out
test/tools/doclint/tidy/TrimmingEmptyTag.out
+7
-1
未找到文件。
src/share/classes/com/sun/tools/doclint/Checker.java
浏览文件 @
03accfa7
...
@@ -213,6 +213,7 @@ public class Checker extends DocTreePathScanner<Void, Void> {
...
@@ -213,6 +213,7 @@ public class Checker extends DocTreePathScanner<Void, Void> {
public
Void
visitDocComment
(
DocCommentTree
tree
,
Void
ignore
)
{
public
Void
visitDocComment
(
DocCommentTree
tree
,
Void
ignore
)
{
super
.
visitDocComment
(
tree
,
ignore
);
super
.
visitDocComment
(
tree
,
ignore
);
for
(
TagStackItem
tsi:
tagStack
)
{
for
(
TagStackItem
tsi:
tagStack
)
{
warnIfEmpty
(
tsi
,
null
);
if
(
tsi
.
tree
.
getKind
()
==
DocTree
.
Kind
.
START_ELEMENT
if
(
tsi
.
tree
.
getKind
()
==
DocTree
.
Kind
.
START_ELEMENT
&&
tsi
.
tag
.
endKind
==
HtmlTag
.
EndKind
.
REQUIRED
)
{
&&
tsi
.
tag
.
endKind
==
HtmlTag
.
EndKind
.
REQUIRED
)
{
StartElementTree
t
=
(
StartElementTree
)
tsi
.
tree
;
StartElementTree
t
=
(
StartElementTree
)
tsi
.
tree
;
...
@@ -270,7 +271,6 @@ public class Checker extends DocTreePathScanner<Void, Void> {
...
@@ -270,7 +271,6 @@ public class Checker extends DocTreePathScanner<Void, Void> {
@Override
@Override
public
Void
visitStartElement
(
StartElementTree
tree
,
Void
ignore
)
{
public
Void
visitStartElement
(
StartElementTree
tree
,
Void
ignore
)
{
markEnclosingTag
(
Flag
.
HAS_ELEMENT
);
final
Name
treeName
=
tree
.
getName
();
final
Name
treeName
=
tree
.
getName
();
final
HtmlTag
t
=
HtmlTag
.
get
(
treeName
);
final
HtmlTag
t
=
HtmlTag
.
get
(
treeName
);
if
(
t
==
null
)
{
if
(
t
==
null
)
{
...
@@ -279,7 +279,10 @@ public class Checker extends DocTreePathScanner<Void, Void> {
...
@@ -279,7 +279,10 @@ public class Checker extends DocTreePathScanner<Void, Void> {
boolean
done
=
false
;
boolean
done
=
false
;
for
(
TagStackItem
tsi:
tagStack
)
{
for
(
TagStackItem
tsi:
tagStack
)
{
if
(
tsi
.
tag
.
accepts
(
t
))
{
if
(
tsi
.
tag
.
accepts
(
t
))
{
while
(
tagStack
.
peek
()
!=
tsi
)
tagStack
.
pop
();
while
(
tagStack
.
peek
()
!=
tsi
)
{
warnIfEmpty
(
tagStack
.
peek
(),
null
);
tagStack
.
pop
();
}
done
=
true
;
done
=
true
;
break
;
break
;
}
else
if
(
tsi
.
tag
.
endKind
!=
HtmlTag
.
EndKind
.
OPTIONAL
)
{
}
else
if
(
tsi
.
tag
.
endKind
!=
HtmlTag
.
EndKind
.
OPTIONAL
)
{
...
@@ -288,9 +291,13 @@ public class Checker extends DocTreePathScanner<Void, Void> {
...
@@ -288,9 +291,13 @@ public class Checker extends DocTreePathScanner<Void, Void> {
}
}
}
}
if
(!
done
&&
HtmlTag
.
BODY
.
accepts
(
t
))
{
if
(!
done
&&
HtmlTag
.
BODY
.
accepts
(
t
))
{
tagStack
.
clear
();
while
(!
tagStack
.
isEmpty
())
{
warnIfEmpty
(
tagStack
.
peek
(),
null
);
tagStack
.
pop
();
}
}
}
markEnclosingTag
(
Flag
.
HAS_ELEMENT
);
checkStructure
(
tree
,
t
);
checkStructure
(
tree
,
t
);
// tag specific checks
// tag specific checks
...
@@ -447,12 +454,7 @@ public class Checker extends DocTreePathScanner<Void, Void> {
...
@@ -447,12 +454,7 @@ public class Checker extends DocTreePathScanner<Void, Void> {
"dc.no.summary.or.caption.for.table"
);
"dc.no.summary.or.caption.for.table"
);
}
}
}
}
if
(
t
.
flags
.
contains
(
HtmlTag
.
Flag
.
EXPECT_CONTENT
)
warnIfEmpty
(
top
,
tree
);
&&
!
top
.
flags
.
contains
(
Flag
.
HAS_TEXT
)
&&
!
top
.
flags
.
contains
(
Flag
.
HAS_ELEMENT
)
&&
!
top
.
flags
.
contains
(
Flag
.
HAS_INLINE_TAG
))
{
env
.
messages
.
warning
(
HTML
,
tree
,
"dc.tag.empty"
,
treeName
);
}
tagStack
.
pop
();
tagStack
.
pop
();
done
=
true
;
done
=
true
;
break
;
break
;
...
@@ -485,6 +487,20 @@ public class Checker extends DocTreePathScanner<Void, Void> {
...
@@ -485,6 +487,20 @@ public class Checker extends DocTreePathScanner<Void, Void> {
return
super
.
visitEndElement
(
tree
,
ignore
);
return
super
.
visitEndElement
(
tree
,
ignore
);
}
}
void
warnIfEmpty
(
TagStackItem
tsi
,
DocTree
endTree
)
{
if
(
tsi
.
tag
!=
null
&&
tsi
.
tree
instanceof
StartElementTree
)
{
if
(
tsi
.
tag
.
flags
.
contains
(
HtmlTag
.
Flag
.
EXPECT_CONTENT
)
&&
!
tsi
.
flags
.
contains
(
Flag
.
HAS_TEXT
)
&&
!
tsi
.
flags
.
contains
(
Flag
.
HAS_ELEMENT
)
&&
!
tsi
.
flags
.
contains
(
Flag
.
HAS_INLINE_TAG
))
{
DocTree
tree
=
(
endTree
!=
null
)
?
endTree
:
tsi
.
tree
;
Name
treeName
=
((
StartElementTree
)
tsi
.
tree
).
getName
();
env
.
messages
.
warning
(
HTML
,
tree
,
"dc.tag.empty"
,
treeName
);
}
}
}
// </editor-fold>
// </editor-fold>
// <editor-fold defaultstate="collapsed" desc="HTML attributes">
// <editor-fold defaultstate="collapsed" desc="HTML attributes">
...
...
test/tools/doclint/HtmlAttrsTest.java
浏览文件 @
03accfa7
...
@@ -10,7 +10,7 @@
...
@@ -10,7 +10,7 @@
/** */
/** */
public
class
HtmlAttrsTest
{
public
class
HtmlAttrsTest
{
/**
/**
* <p xyz>
* <p xyz>
text </p>
*/
*/
public
void
unknown
()
{
}
public
void
unknown
()
{
}
...
...
test/tools/doclint/HtmlAttrsTest.out
浏览文件 @
03accfa7
HtmlAttrsTest.java:13: error: unknown attribute: xyz
HtmlAttrsTest.java:13: error: unknown attribute: xyz
* <p xyz>
* <p xyz>
text </p>
^
^
HtmlAttrsTest.java:18: warning: attribute obsolete: name
HtmlAttrsTest.java:18: warning: attribute obsolete: name
* <img name="x" alt="alt">
* <img name="x" alt="alt">
...
...
test/tools/doclint/tidy/BadEnd.out
浏览文件 @
03accfa7
BadEnd.java:14: warning: nested tag not allowed: <code>
BadEnd.java:14: warning: nested tag not allowed: <code>
* <code> text <code>
* <code> text <code>
^
^
BadEnd.java:14: warning: empty <code> tag
* <code> text <code>
^
BadEnd.java:14: error: element not closed: code
BadEnd.java:14: error: element not closed: code
* <code> text <code>
* <code> text <code>
^
^
...
@@ -14,4 +17,4 @@ BadEnd.java:13: error: element not closed: a
...
@@ -14,4 +17,4 @@ BadEnd.java:13: error: element not closed: a
* <a name="here"> text <a>
* <a name="here"> text <a>
^
^
4 errors
4 errors
1 warning
2 warnings
test/tools/doclint/tidy/TrimmingEmptyTag.java
浏览文件 @
03accfa7
/*
/*
* @test /nodynamiccopyright/
* @test /nodynamiccopyright/
* @bug 8004832
* @bug 8004832
8026368
* @summary Add new doclint package
* @summary Add new doclint package
* @library ..
* @library ..
* @build DocLintTester
* @build DocLintTester
...
@@ -26,4 +26,9 @@
...
@@ -26,4 +26,9 @@
* <ul></ul>
* <ul></ul>
* <ul><li></li></ul>
* <ul><li></li></ul>
*/
*/
public
class
TrimmingEmptyTag
{
}
public
class
TrimmingEmptyTag
{
/** <p> */
public
void
implicitParaEnd_endOfComment
()
{
}
/** <p> <ul><li>text</ul> */
public
void
implicitParaEnd_nextBlockTag
()
{
}
}
test/tools/doclint/tidy/TrimmingEmptyTag.out
浏览文件 @
03accfa7
...
@@ -43,4 +43,10 @@ TrimmingEmptyTag.java:25: warning: empty <tt> tag
...
@@ -43,4 +43,10 @@ TrimmingEmptyTag.java:25: warning: empty <tt> tag
TrimmingEmptyTag.java:26: warning: empty <ul> tag
TrimmingEmptyTag.java:26: warning: empty <ul> tag
* <ul></ul>
* <ul></ul>
^
^
15 warnings
TrimmingEmptyTag.java:30: warning: empty <p> tag
/** <p> */
^
TrimmingEmptyTag.java:32: warning: empty <p> tag
/** <p> <ul><li>text</ul> */
^
17 warnings
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录