Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_langtools
提交
7b38321e
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看板
提交
7b38321e
编写于
1月 30, 2013
作者:
J
jjg
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8007096: DocLint parsing problems with some comments
Reviewed-by: mcimadamore
上级
b27d9131
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
108 addition
and
56 deletion
+108
-56
src/share/classes/com/sun/tools/javac/parser/DocCommentParser.java
.../classes/com/sun/tools/javac/parser/DocCommentParser.java
+32
-54
src/share/classes/com/sun/tools/javac/parser/JavadocTokenizer.java
.../classes/com/sun/tools/javac/parser/JavadocTokenizer.java
+2
-2
test/tools/doclint/EndWithIdentifierTest.java
test/tools/doclint/EndWithIdentifierTest.java
+32
-0
test/tools/doclint/EndWithIdentifierTest.out
test/tools/doclint/EndWithIdentifierTest.out
+20
-0
test/tools/doclint/UnfinishedInlineTagTest.java
test/tools/doclint/UnfinishedInlineTagTest.java
+17
-0
test/tools/doclint/UnfinishedInlineTagTest.out
test/tools/doclint/UnfinishedInlineTagTest.out
+5
-0
未找到文件。
src/share/classes/com/sun/tools/javac/parser/DocCommentParser.java
浏览文件 @
7b38321e
/*
* Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
* 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
...
...
@@ -279,13 +279,7 @@ public class DocCommentParser {
try
{
nextChar
();
if
(
isIdentifierStart
(
ch
))
{
int
namePos
=
bp
;
nextChar
();
while
(
isIdentifierPart
(
ch
))
nextChar
();
int
nameLen
=
bp
-
namePos
;
Name
name
=
names
.
fromChars
(
buf
,
namePos
,
nameLen
);
Name
name
=
readIdentifier
();
TagParser
tp
=
tagParsers
.
get
(
name
);
if
(
tp
==
null
)
{
List
<
DCTree
>
content
=
blockContent
();
...
...
@@ -334,14 +328,9 @@ public class DocCommentParser {
try
{
nextChar
();
if
(
isIdentifierStart
(
ch
))
{
int
namePos
=
bp
;
nextChar
();
while
(
isIdentifierPart
(
ch
))
nextChar
();
int
nameLen
=
bp
-
namePos
;
Name
name
=
readIdentifier
();
skipWhitespace
();
Name
name
=
names
.
fromChars
(
buf
,
namePos
,
nameLen
);
TagParser
tp
=
tagParsers
.
get
(
name
);
if
(
tp
==
null
)
{
DCTree
text
=
inlineText
();
...
...
@@ -575,10 +564,8 @@ public class DocCommentParser {
int
pos
=
bp
;
if
(
isJavaIdentifierStart
(
ch
))
{
nextChar
();
while
(
isJavaIdentifierPart
(
ch
))
nextChar
();
return
m
.
at
(
pos
).
Identifier
(
names
.
fromChars
(
buf
,
pos
,
bp
-
pos
));
Name
name
=
readJavaIdentifier
();
return
m
.
at
(
pos
).
Identifier
(
name
);
}
throw
new
ParseException
(
"dc.identifier.expected"
);
...
...
@@ -703,39 +690,36 @@ public class DocCommentParser {
protected
DCTree
entity
()
{
int
p
=
bp
;
nextChar
();
int
namep
=
bp
;
Name
name
=
null
;
boolean
checkSemi
=
false
;
if
(
ch
==
'#'
)
{
int
namep
=
bp
;
nextChar
();
if
(
isDecimalDigit
(
ch
))
{
nextChar
();
while
(
isDecimalDigit
(
ch
))
nextChar
();
checkSemi
=
true
;
name
=
names
.
fromChars
(
buf
,
namep
,
bp
-
namep
)
;
}
else
if
(
ch
==
'x'
||
ch
==
'X'
)
{
nextChar
();
if
(
isHexDigit
(
ch
))
{
nextChar
();
while
(
isHexDigit
(
ch
))
nextChar
();
checkSemi
=
true
;
name
=
names
.
fromChars
(
buf
,
namep
,
bp
-
namep
)
;
}
}
}
else
if
(
isIdentifierStart
(
ch
))
{
nextChar
();
while
(
isIdentifierPart
(
ch
))
nextChar
();
checkSemi
=
true
;
name
=
readIdentifier
();
}
if
(
checkSemi
&&
ch
==
';'
)
{
if
(
name
==
null
)
return
erroneous
(
"dc.bad.entity"
,
p
);
else
{
if
(
ch
!=
';'
)
return
erroneous
(
"dc.missing.semicolon"
,
p
);
nextChar
();
return
m
.
at
(
p
).
Entity
(
names
.
fromChars
(
buf
,
namep
,
bp
-
namep
-
1
));
}
else
{
String
code
=
checkSemi
?
"dc.missing.semicolon"
:
"dc.bad.entity"
;
return
erroneous
(
code
,
p
);
return
m
.
at
(
p
).
Entity
(
name
);
}
}
...
...
@@ -747,11 +731,7 @@ public class DocCommentParser {
int
p
=
bp
;
nextChar
();
if
(
isIdentifierStart
(
ch
))
{
int
namePos
=
bp
;
nextChar
();
while
(
isIdentifierPart
(
ch
))
nextChar
();
int
nameLen
=
bp
-
namePos
;
Name
name
=
readIdentifier
();
List
<
DCTree
>
attrs
=
htmlAttrs
();
if
(
attrs
!=
null
)
{
boolean
selfClosing
=
false
;
...
...
@@ -761,22 +741,16 @@ public class DocCommentParser {
}
if
(
ch
==
'>'
)
{
nextChar
();
Name
name
=
names
.
fromChars
(
buf
,
namePos
,
nameLen
);
return
m
.
at
(
p
).
StartElement
(
name
,
attrs
,
selfClosing
);
}
}
}
else
if
(
ch
==
'/'
)
{
nextChar
();
if
(
isIdentifierStart
(
ch
))
{
int
namePos
=
bp
;
nextChar
();
while
(
isIdentifierPart
(
ch
))
nextChar
();
int
nameLen
=
bp
-
namePos
;
Name
name
=
readIdentifier
();
skipWhitespace
();
if
(
ch
==
'>'
)
{
nextChar
();
Name
name
=
names
.
fromChars
(
buf
,
namePos
,
nameLen
);
return
m
.
at
(
p
).
EndElement
(
name
);
}
}
...
...
@@ -822,10 +796,7 @@ public class DocCommentParser {
loop:
while
(
isIdentifierStart
(
ch
))
{
int
namePos
=
bp
;
nextChar
();
while
(
isIdentifierPart
(
ch
))
nextChar
();
int
nameLen
=
bp
-
namePos
;
Name
name
=
readIdentifier
();
skipWhitespace
();
List
<
DCTree
>
value
=
null
;
ValueKind
vkind
=
ValueKind
.
EMPTY
;
...
...
@@ -862,7 +833,6 @@ public class DocCommentParser {
skipWhitespace
();
value
=
v
.
toList
();
}
Name
name
=
names
.
fromChars
(
buf
,
namePos
,
nameLen
);
DCAttribute
attr
=
m
.
at
(
namePos
).
Attribute
(
name
,
vkind
,
value
);
attrs
.
add
(
attr
);
}
...
...
@@ -897,7 +867,7 @@ public class DocCommentParser {
protected
DCErroneous
erroneous
(
String
code
,
int
pos
)
{
int
i
=
bp
-
1
;
loop:
while
(
i
>
0
)
{
while
(
i
>
pos
)
{
switch
(
buf
[
i
])
{
case
'\f'
:
case
'\n'
:
case
'\r'
:
newline
=
true
;
...
...
@@ -926,16 +896,24 @@ public class DocCommentParser {
return
Character
.
isUnicodeIdentifierStart
(
ch
);
}
protected
boolean
isIdentifierPart
(
char
ch
)
{
return
Character
.
isUnicodeIdentifierPart
(
ch
);
protected
Name
readIdentifier
()
{
int
start
=
bp
;
nextChar
();
while
(
bp
<
buflen
&&
Character
.
isUnicodeIdentifierPart
(
ch
))
nextChar
();
return
names
.
fromChars
(
buf
,
start
,
bp
-
start
);
}
protected
boolean
isJavaIdentifierStart
(
char
ch
)
{
return
Character
.
isJavaIdentifierStart
(
ch
);
}
protected
boolean
isJavaIdentifierPart
(
char
ch
)
{
return
Character
.
isJavaIdentifierPart
(
ch
);
protected
Name
readJavaIdentifier
()
{
int
start
=
bp
;
nextChar
();
while
(
bp
<
buflen
&&
Character
.
isJavaIdentifierPart
(
ch
))
nextChar
();
return
names
.
fromChars
(
buf
,
start
,
bp
-
start
);
}
protected
boolean
isDecimalDigit
(
char
ch
)
{
...
...
src/share/classes/com/sun/tools/javac/parser/JavadocTokenizer.java
浏览文件 @
7b38321e
/*
* Copyright (c) 2004, 201
2
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2004, 201
3
, 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
...
...
@@ -236,7 +236,7 @@ public class JavadocTokenizer extends JavaTokenizer {
// relative to the best match found in the array.
if
(
pos
==
Position
.
NOPOS
)
return
Position
.
NOPOS
;
if
(
pos
<
0
||
pos
>
=
docComment
.
length
())
if
(
pos
<
0
||
pos
>
docComment
.
length
())
throw
new
StringIndexOutOfBoundsException
(
String
.
valueOf
(
pos
));
if
(
docPosns
==
null
)
return
Position
.
NOPOS
;
...
...
test/tools/doclint/EndWithIdentifierTest.java
0 → 100644
浏览文件 @
7b38321e
/*
* @test /nodynamiccopyright/
* @bug 8007096
* @summary DocLint parsing problems with some comments
* @build DocLintTester
* @run main DocLintTester -Xmsgs:-html EndWithIdentifierTest.java
* @run main DocLintTester -Xmsgs -ref EndWithIdentifierTest.out EndWithIdentifierTest.java
* @author jlahoda
*/
/**@deprecated*/
public
class
EndWithIdentifierTest
{
/**{@link*/
private
void
unfinishedInlineTagName
()
{}
/**@see List*/
private
void
endsWithIdentifier
()
{}
/**&*/
private
void
entityName
()
{}
/**<a*/
private
void
tag
()
{}
/**</a*/
private
void
tagEnd
()
{}
/**<a name*/
private
void
attribute
()
{}
}
test/tools/doclint/EndWithIdentifierTest.out
0 → 100644
浏览文件 @
7b38321e
EndWithIdentifierTest.java:14: error: syntax error in reference
/**{@link*/
^
EndWithIdentifierTest.java:17: error: reference not found
/**@see List*/
^
EndWithIdentifierTest.java:20: error: semicolon missing
/**&*/
^
EndWithIdentifierTest.java:23: error: malformed HTML
/**<a*/
^
EndWithIdentifierTest.java:26: error: malformed HTML
/**</a*/
^
EndWithIdentifierTest.java:29: error: malformed HTML
/**<a name*/
^
6 errors
test/tools/doclint/UnfinishedInlineTagTest.java
0 → 100644
浏览文件 @
7b38321e
/*
* @test /nodynamiccopyright/
* @bug 8007096
* @summary DocLint parsing problems with some comments
* @build DocLintTester
* @run main DocLintTester -Xmsgs:-html UnfinishedInlineTagTest.java
* @run main DocLintTester -Xmsgs -ref UnfinishedInlineTagTest.out UnfinishedInlineTagTest.java
* @author jlahoda
*/
import
java.util.List
;
/**{@link List
*/
public
class
UnfinishedInlineTagTest
{
}
test/tools/doclint/UnfinishedInlineTagTest.out
0 → 100644
浏览文件 @
7b38321e
UnfinishedInlineTagTest.java:14: error: unterminated inline tag
*/
^
1 error
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录