Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_langtools
提交
6930343f
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看板
提交
6930343f
编写于
7月 13, 2010
作者:
J
jjg
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
6966732: replace use of static Log.getLocalizedString with non-static alternative where possible
Reviewed-by: darcy
上级
a97f8703
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
50 addition
and
32 deletion
+50
-32
src/share/classes/com/sun/tools/javac/jvm/ClassReader.java
src/share/classes/com/sun/tools/javac/jvm/ClassReader.java
+2
-2
src/share/classes/com/sun/tools/javac/jvm/ClassWriter.java
src/share/classes/com/sun/tools/javac/jvm/ClassWriter.java
+1
-1
src/share/classes/com/sun/tools/javac/main/JavaCompiler.java
src/share/classes/com/sun/tools/javac/main/JavaCompiler.java
+6
-6
src/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java
...un/tools/javac/processing/JavacProcessingEnvironment.java
+14
-21
src/share/classes/com/sun/tools/javac/util/Log.java
src/share/classes/com/sun/tools/javac/util/Log.java
+27
-2
未找到文件。
src/share/classes/com/sun/tools/javac/jvm/ClassReader.java
浏览文件 @
6930343f
...
...
@@ -2628,7 +2628,7 @@ public class ClassReader implements Completer {
* @param arg An argument for substitution into the output string.
*/
private
void
printVerbose
(
String
key
,
CharSequence
arg
)
{
Log
.
printLines
(
log
.
noticeWriter
,
Log
.
getLocalizedString
(
"verbose."
+
key
,
arg
)
);
log
.
printNoteLines
(
"verbose."
+
key
,
arg
);
}
/** Output for "-checkclassfile" option.
...
...
@@ -2636,7 +2636,7 @@ public class ClassReader implements Completer {
* @param arg An argument for substitution into the output string.
*/
private
void
printCCF
(
String
key
,
Object
arg
)
{
Log
.
printLines
(
log
.
noticeWriter
,
Log
.
getLocalizedString
(
key
,
arg
)
);
log
.
printNoteLines
(
key
,
arg
);
}
...
...
src/share/classes/com/sun/tools/javac/jvm/ClassWriter.java
浏览文件 @
6930343f
...
...
@@ -1604,7 +1604,7 @@ public class ClassWriter extends ClassFile {
try
{
writeClassFile
(
out
,
c
);
if
(
verbose
)
log
.
errWriter
.
println
(
Log
.
getLocalizedString
(
"verbose.wrote.file"
,
outFile
)
);
log
.
printErrLines
(
"verbose.wrote.file"
,
outFile
);
out
.
close
();
out
=
null
;
}
finally
{
...
...
src/share/classes/com/sun/tools/javac/main/JavaCompiler.java
浏览文件 @
6930343f
...
...
@@ -1105,7 +1105,7 @@ public class JavaCompiler implements ClassReader.SourceCompleter {
return
env
;
if
(
verboseCompilePolicy
)
Log
.
printLines
(
log
.
noticeWriter
,
"[attribute "
+
env
.
enclClass
.
sym
+
"]"
);
printNote
(
"[attribute "
+
env
.
enclClass
.
sym
+
"]"
);
if
(
verbose
)
printVerbose
(
"checking.attribution"
,
env
.
enclClass
.
sym
);
...
...
@@ -1527,19 +1527,19 @@ public class JavaCompiler implements ClassReader.SourceCompleter {
* @param arg An argument for substitution into the output string.
*/
protected
void
printVerbose
(
String
key
,
Object
arg
)
{
Log
.
printLines
(
log
.
noticeWriter
,
Log
.
getLocalizedString
(
"verbose."
+
key
,
arg
)
);
log
.
printNoteLines
(
"verbose."
+
key
,
arg
);
}
/** Print numbers of errors and warnings.
*/
protected
void
printCount
(
String
kind
,
int
count
)
{
if
(
count
!=
0
)
{
String
text
;
String
key
;
if
(
count
==
1
)
text
=
Log
.
getLocalizedString
(
"count."
+
kind
,
String
.
valueOf
(
count
))
;
key
=
"count."
+
kind
;
else
text
=
Log
.
getLocalizedString
(
"count."
+
kind
+
".plural"
,
String
.
valueOf
(
count
))
;
Log
.
printLines
(
log
.
errWriter
,
text
);
key
=
"count."
+
kind
+
".plural"
;
log
.
printErrLines
(
key
,
String
.
valueOf
(
count
)
);
log
.
errWriter
.
flush
();
}
}
...
...
src/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java
浏览文件 @
6930343f
...
...
@@ -654,9 +654,6 @@ public class JavacProcessingEnvironment implements ProcessingEnvironment, Closea
Set
<
TypeElement
>
annotationsPresent
,
List
<
ClassSymbol
>
topLevelClasses
,
List
<
PackageSymbol
>
packageInfoFiles
)
{
// Writer for -XprintRounds and -XprintProcessorInfo data
PrintWriter
xout
=
context
.
get
(
Log
.
outKey
);
Map
<
String
,
TypeElement
>
unmatchedAnnotations
=
new
HashMap
<
String
,
TypeElement
>(
annotationsPresent
.
size
());
...
...
@@ -708,10 +705,10 @@ public class JavacProcessingEnvironment implements ProcessingEnvironment, Closea
ps
.
removeSupportedOptions
(
unmatchedProcessorOptions
);
if
(
printProcessorInfo
||
verbose
)
{
xout
.
println
(
Log
.
getLocalizedString
(
"x.print.processor.info"
,
ps
.
processor
.
getClass
().
getName
(),
matchedNames
.
toString
(),
processingResult
)
);
log
.
printNoteLines
(
"x.print.processor.info"
,
ps
.
processor
.
getClass
().
getName
(),
matchedNames
.
toString
(),
processingResult
);
}
if
(
processingResult
)
{
...
...
@@ -795,8 +792,6 @@ public class JavacProcessingEnvironment implements ProcessingEnvironment, Closea
throws
IOException
{
log
=
Log
.
instance
(
context
);
// Writer for -XprintRounds and -XprintProcessorInfo data
PrintWriter
xout
=
context
.
get
(
Log
.
outKey
);
TaskListener
taskListener
=
context
.
get
(
TaskListener
.
class
);
JavaCompiler
compiler
=
JavaCompiler
.
instance
(
context
);
...
...
@@ -839,7 +834,7 @@ public class JavacProcessingEnvironment implements ProcessingEnvironment, Closea
this
.
context
=
currentContext
;
roundNumber
++;
printRoundInfo
(
xout
,
roundNumber
,
topLevelClasses
,
annotationsPresent
,
false
);
printRoundInfo
(
roundNumber
,
topLevelClasses
,
annotationsPresent
,
false
);
if
(
taskListener
!=
null
)
taskListener
.
started
(
new
TaskEvent
(
TaskEvent
.
Kind
.
ANNOTATION_PROCESSING_ROUND
));
...
...
@@ -908,7 +903,7 @@ public class JavacProcessingEnvironment implements ProcessingEnvironment, Closea
break
runAround
;
// No new files
}
}
roots
=
runLastRound
(
xout
,
roundNumber
,
errorStatus
,
compiler
,
roots
,
taskListener
);
roots
=
runLastRound
(
roundNumber
,
errorStatus
,
compiler
,
roots
,
taskListener
);
// Set error status for any files compiled and generated in
// the last round
if
(
log
.
unrecoverableError
)
...
...
@@ -982,8 +977,7 @@ public class JavacProcessingEnvironment implements ProcessingEnvironment, Closea
}
// Call the last round of annotation processing
private
List
<
JCCompilationUnit
>
runLastRound
(
PrintWriter
xout
,
int
roundNumber
,
private
List
<
JCCompilationUnit
>
runLastRound
(
int
roundNumber
,
boolean
errorStatus
,
JavaCompiler
compiler
,
List
<
JCCompilationUnit
>
roots
,
...
...
@@ -991,7 +985,7 @@ public class JavacProcessingEnvironment implements ProcessingEnvironment, Closea
roundNumber
++;
List
<
ClassSymbol
>
noTopLevelClasses
=
List
.
nil
();
Set
<
TypeElement
>
noAnnotations
=
Collections
.
emptySet
();
printRoundInfo
(
xout
,
roundNumber
,
noTopLevelClasses
,
noAnnotations
,
true
);
printRoundInfo
(
roundNumber
,
noTopLevelClasses
,
noAnnotations
,
true
);
Set
<
Element
>
emptyRootElements
=
Collections
.
emptySet
();
// immutable
RoundEnvironment
renv
=
new
JavacRoundEnvironment
(
true
,
...
...
@@ -1032,17 +1026,16 @@ public class JavacProcessingEnvironment implements ProcessingEnvironment, Closea
}
}
private
void
printRoundInfo
(
PrintWriter
xout
,
int
roundNumber
,
private
void
printRoundInfo
(
int
roundNumber
,
List
<
ClassSymbol
>
topLevelClasses
,
Set
<
TypeElement
>
annotationsPresent
,
boolean
lastRound
)
{
if
(
printRounds
||
verbose
)
{
xout
.
println
(
Log
.
getLocalizedString
(
"x.print.rounds"
,
roundNumber
,
"{"
+
topLevelClasses
.
toString
(
", "
)
+
"}"
,
annotationsPresent
,
lastRound
)
);
log
.
printNoteLines
(
"x.print.rounds"
,
roundNumber
,
"{"
+
topLevelClasses
.
toString
(
", "
)
+
"}"
,
annotationsPresent
,
lastRound
);
}
}
...
...
src/share/classes/com/sun/tools/javac/util/Log.java
浏览文件 @
6930343f
...
...
@@ -269,7 +269,7 @@ public class Log extends AbstractLog {
*/
public
void
prompt
()
{
if
(
promptOnError
)
{
System
.
err
.
println
(
getLocalizedString
(
"resume.abort"
));
System
.
err
.
println
(
localize
(
"resume.abort"
));
char
ch
;
try
{
while
(
true
)
{
...
...
@@ -317,8 +317,23 @@ public class Log extends AbstractLog {
if
(
msg
.
length
()
!=
0
)
writer
.
println
(
msg
);
}
/** Print the text of a message to the errWriter stream,
* translating newlines appropriately for the platform.
*/
public
void
printErrLines
(
String
key
,
Object
...
args
)
{
printLines
(
errWriter
,
localize
(
key
,
args
));
}
/** Print the text of a message to the noticeWriter stream,
* translating newlines appropriately for the platform.
*/
public
void
printNoteLines
(
String
key
,
Object
...
args
)
{
printLines
(
noticeWriter
,
localize
(
key
,
args
));
}
protected
void
directError
(
String
key
,
Object
...
args
)
{
print
Lines
(
errWriter
,
getLocalizedString
(
key
,
args
)
);
print
ErrLines
(
key
,
args
);
errWriter
.
flush
();
}
...
...
@@ -426,6 +441,8 @@ public class Log extends AbstractLog {
}
/** Find a localized string in the resource bundle.
* Because this method is static, it ignores the locale.
* Use localize(key, args) when possible.
* @param key The key for the localized string.
* @param args Fields to substitute into the string.
*/
...
...
@@ -433,6 +450,14 @@ public class Log extends AbstractLog {
return
JavacMessages
.
getDefaultLocalizedString
(
"compiler.misc."
+
key
,
args
);
}
/** Find a localized string in the resource bundle.
* @param key The key for the localized string.
* @param args Fields to substitute into the string.
*/
public
String
localize
(
String
key
,
Object
...
args
)
{
return
messages
.
getLocalizedString
(
"compiler.misc."
+
key
,
args
);
}
/***************************************************************************
* raw error messages without internationalization; used for experimentation
* and quick prototyping
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录