Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_langtools
提交
9a5746a9
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看板
提交
9a5746a9
编写于
6月 03, 2013
作者:
J
jjg
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8006615: [doclint] move remaining messages into resource bundle
Reviewed-by: mcimadamore, vromero
上级
771569ad
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
143 addition
and
48 deletion
+143
-48
src/share/classes/com/sun/tools/doclint/DocLint.java
src/share/classes/com/sun/tools/doclint/DocLint.java
+14
-47
src/share/classes/com/sun/tools/doclint/resources/doclint.properties
...lasses/com/sun/tools/doclint/resources/doclint.properties
+47
-0
test/tools/doclint/ResourceTest.java
test/tools/doclint/ResourceTest.java
+81
-0
test/tools/doclint/tool/RunTest.java
test/tools/doclint/tool/RunTest.java
+1
-1
未找到文件。
src/share/classes/com/sun/tools/doclint/DocLint.java
浏览文件 @
9a5746a9
...
...
@@ -77,13 +77,14 @@ public class DocLint implements Plugin {
// <editor-fold defaultstate="collapsed" desc="Command-line entry point">
public
static
void
main
(
String
...
args
)
{
DocLint
dl
=
new
DocLint
();
try
{
new
DocLint
()
.
run
(
args
);
dl
.
run
(
args
);
}
catch
(
BadArgs
e
)
{
System
.
err
.
println
(
e
.
getMessage
());
System
.
exit
(
1
);
}
catch
(
IOException
e
)
{
System
.
err
.
println
(
e
);
System
.
err
.
println
(
dl
.
localize
(
"dc.main.ioerror"
,
e
.
getLocalizedMessage
())
);
System
.
exit
(
2
);
}
}
...
...
@@ -92,9 +93,10 @@ public class DocLint implements Plugin {
// <editor-fold defaultstate="collapsed" desc="Simple API">
public
static
class
BadArgs
extends
Exception
{
public
class
BadArgs
extends
Exception
{
private
static
final
long
serialVersionUID
=
0
;
BadArgs
(
String
code
,
Object
...
args
)
{
super
(
localize
(
code
,
args
));
this
.
code
=
code
;
this
.
args
=
args
;
}
...
...
@@ -124,7 +126,7 @@ public class DocLint implements Plugin {
if
(
javacFiles
.
isEmpty
())
{
if
(!
needHelp
)
out
.
println
(
"no files given"
);
out
.
println
(
localize
(
"dc.main.no.files.given"
)
);
}
JavacTool
tool
=
JavacTool
.
create
();
...
...
@@ -204,49 +206,9 @@ public class DocLint implements Plugin {
}
void
showHelp
(
PrintWriter
out
)
{
out
.
println
(
"Usage:"
);
out
.
println
(
" doclint [options] source-files..."
);
out
.
println
(
""
);
out
.
println
(
"Options:"
);
out
.
println
(
" -Xmsgs "
);
out
.
println
(
" Same as -Xmsgs:all"
);
out
.
println
(
" -Xmsgs:values"
);
out
.
println
(
" Specify categories of issues to be checked, where 'values'"
);
out
.
println
(
" is a comma-separated list of any of the following:"
);
out
.
println
(
" reference show places where comments contain incorrect"
);
out
.
println
(
" references to Java source code elements"
);
out
.
println
(
" syntax show basic syntax errors within comments"
);
out
.
println
(
" html show issues with HTML tags and attributes"
);
out
.
println
(
" accessibility show issues for accessibility"
);
out
.
println
(
" missing show issues with missing documentation"
);
out
.
println
(
" all all of the above"
);
out
.
println
(
" Precede a value with '-' to negate it"
);
out
.
println
(
" Categories may be qualified by one of:"
);
out
.
println
(
" /public /protected /package /private"
);
out
.
println
(
" For positive categories (not beginning with '-')"
);
out
.
println
(
" the qualifier applies to that access level and above."
);
out
.
println
(
" For negative categories (beginning with '-')"
);
out
.
println
(
" the qualifier applies to that access level and below."
);
out
.
println
(
" If a qualifier is missing, the category applies to"
);
out
.
println
(
" all access levels."
);
out
.
println
(
" For example, -Xmsgs:all,-syntax/private"
);
out
.
println
(
" This will enable all messages, except syntax errors"
);
out
.
println
(
" in the doc comments of private methods."
);
out
.
println
(
" If no -Xmsgs options are provided, the default is"
);
out
.
println
(
" equivalent to -Xmsgs:all/protected, meaning that"
);
out
.
println
(
" all messages are reported for protected and public"
);
out
.
println
(
" declarations only. "
);
out
.
println
(
" -stats"
);
out
.
println
(
" Report statistics on the reported issues."
);
out
.
println
(
" -h -help --help -usage -?"
);
out
.
println
(
" Show this message."
);
out
.
println
(
""
);
out
.
println
(
"The following javac options are also supported"
);
out
.
println
(
" -bootclasspath, -classpath, -sourcepath, -Xmaxerrs, -Xmaxwarns"
);
out
.
println
(
""
);
out
.
println
(
"To run doclint on part of a project, put the compiled classes for your"
);
out
.
println
(
"project on the classpath (or bootclasspath), then specify the source files"
);
out
.
println
(
"to be checked on the command line."
);
String
msg
=
localize
(
"dc.main.usage"
);
for
(
String
line:
msg
.
split
(
"\n"
))
out
.
println
(
line
);
}
List
<
File
>
splitPath
(
String
path
)
{
...
...
@@ -353,6 +315,11 @@ public class DocLint implements Plugin {
return
false
;
}
private
String
localize
(
String
code
,
Object
...
args
)
{
Messages
m
=
(
env
!=
null
)
?
env
.
messages
:
new
Messages
(
null
);
return
m
.
localize
(
code
,
args
);
}
// <editor-fold defaultstate="collapsed" desc="DeclScanner">
static
abstract
class
DeclScanner
extends
TreePathScanner
<
Void
,
Void
>
{
...
...
src/share/classes/com/sun/tools/doclint/resources/doclint.properties
浏览文件 @
9a5746a9
...
...
@@ -67,3 +67,50 @@ 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.main.ioerror
=
IO error: {0}
dc.main.no.files.given
=
No files given
dc.main.usage
=
\
Usage:
\n\
\
doclint [options] source-files...
\n\
\n\
Options:
\n\
\
-Xmsgs
\n\
\
Same as -Xmsgs:all
\n\
\
-Xmsgs:values
\n\
\
Specify categories of issues to be checked, where ''values''
\n\
\
is a comma-separated list of any of the following:
\n\
\
reference show places where comments contain incorrect
\n\
\
references to Java source code elements
\n\
\
syntax show basic syntax errors within comments
\n\
\
html show issues with HTML tags and attributes
\n\
\
accessibility show issues for accessibility
\n\
\
missing show issues with missing documentation
\n\
\
all all of the above
\n\
\
Precede a value with ''-'' to negate it
\n\
\
Categories may be qualified by one of:
\n\
\
/public /protected /package /private
\n\
\
For positive categories (not beginning with ''-'')
\n\
\
the qualifier applies to that access level and above.
\n\
\
For negative categories (beginning with ''-'')
\n\
\
the qualifier applies to that access level and below.
\n\
\
If a qualifier is missing, the category applies to
\n\
\
all access levels.
\n\
\
For example, -Xmsgs:all,-syntax/private
\n\
\
This will enable all messages, except syntax errors
\n\
\
in the doc comments of private methods.
\n\
\
If no -Xmsgs options are provided, the default is
\n\
\
equivalent to -Xmsgs:all/protected, meaning that
\n\
\
all messages are reported for protected and public
\n\
\
declarations only.
\n\
\
-stats
\n\
\
Report statistics on the reported issues.
\n\
\
-h -help --help -usage -?
\n\
\
Show this message.
\n\
\n\
The following javac options are also supported
\n\
\
-bootclasspath, -classpath, -sourcepath, -Xmaxerrs, -Xmaxwarns
\n\
\n\
To run doclint on part of a project, put the compiled classes for your
\n\
project on the classpath (or bootclasspath), then specify the source files
\n\
to be checked on the command line.
test/tools/doclint/ResourceTest.java
0 → 100644
浏览文件 @
9a5746a9
/*
* Copyright (c) 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 8006615
* @summary move remaining messages into resource bundle
*/
import
java.io.IOException
;
import
java.io.PrintWriter
;
import
java.io.StringWriter
;
import
java.util.Arrays
;
import
java.util.List
;
import
java.util.Locale
;
import
com.sun.tools.doclint.DocLint
;
public
class
ResourceTest
{
public
static
void
main
(
String
...
args
)
throws
Exception
{
Locale
prev
=
Locale
.
getDefault
();
Locale
.
setDefault
(
Locale
.
ENGLISH
);
try
{
new
ResourceTest
().
run
();
}
finally
{
Locale
.
setDefault
(
prev
);
}
}
public
void
run
()
throws
Exception
{
test
(
Arrays
.
asList
(
"-help"
),
Arrays
.
asList
(
"Usage:"
,
"Options"
));
test
(
Arrays
.
asList
(
"-foo"
),
Arrays
.
asList
(
"bad option: -foo"
));
}
void
test
(
List
<
String
>
opts
,
List
<
String
>
expects
)
throws
Exception
{
StringWriter
sw
=
new
StringWriter
();
PrintWriter
pw
=
new
PrintWriter
(
sw
);
try
{
new
DocLint
().
run
(
pw
,
opts
.
toArray
(
new
String
[
opts
.
size
()]));
}
catch
(
DocLint
.
BadArgs
e
)
{
pw
.
println
(
"BadArgs: "
+
e
.
getMessage
());
}
catch
(
IOException
e
)
{
pw
.
println
(
"IOException: "
+
e
.
getMessage
());
}
finally
{
pw
.
close
();
}
String
out
=
sw
.
toString
();
if
(!
out
.
isEmpty
())
{
System
.
err
.
println
(
out
);
}
for
(
String
e:
expects
)
{
if
(!
out
.
contains
(
e
))
throw
new
Exception
(
"expected string not found: "
+
e
);
}
}
}
test/tools/doclint/tool/RunTest.java
浏览文件 @
9a5746a9
...
...
@@ -173,7 +173,7 @@ public class RunTest {
pw
.
close
();
String
out
=
sw
.
toString
();
String
expect
=
"
n
o files given"
;
String
expect
=
"
N
o files given"
;
if
(!
Objects
.
equals
(
out
.
trim
(),
expect
))
{
error
(
"unexpected output"
);
System
.
err
.
println
(
"EXPECT>>"
+
expect
+
"<<"
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录