Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_langtools
提交
538ebcac
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看板
提交
538ebcac
编写于
6月 22, 2011
作者:
D
darcy
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
6449184: Provide JavacProcessingEnvironment.getWriter
Reviewed-by: jjg
上级
091cc452
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
22 addition
and
6 deletion
+22
-6
src/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java
...un/tools/javac/processing/JavacProcessingEnvironment.java
+8
-0
test/tools/javac/util/T6597678.java
test/tools/javac/util/T6597678.java
+14
-6
未找到文件。
src/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java
浏览文件 @
538ebcac
...
...
@@ -1516,6 +1516,14 @@ public class JavacProcessingEnvironment implements ProcessingEnvironment, Closea
return
context
;
}
/**
* Internal use method to return the writer being used by the
* processing environment.
*/
public
PrintWriter
getWriter
()
{
return
context
.
get
(
Log
.
outKey
);
}
public
String
toString
()
{
return
"javac ProcessingEnvironment"
;
}
...
...
test/tools/javac/util/T6597678.java
浏览文件 @
538ebcac
...
...
@@ -23,7 +23,7 @@
/**
* @test
* @bug 6597678
* @bug 6597678
6449184
* @summary Ensure Messages propogated between rounds
* @library ../lib
* @build JavacTestingAbstractProcessor T6597678
...
...
@@ -42,26 +42,28 @@ import com.sun.tools.javac.processing.JavacProcessingEnvironment;
import
com.sun.tools.javac.util.Context
;
import
com.sun.tools.javac.util.JavacMessages
;
@SupportedOptions
(
"WriterString"
)
public
class
T6597678
extends
JavacTestingAbstractProcessor
{
public
static
void
main
(
String
...
args
)
throws
Exception
{
new
T6597678
().
run
();
}
void
run
()
throws
Exception
{
String
myName
=
T6597678
.
class
.
getSimpleName
();
File
testSrc
=
new
File
(
System
.
getProperty
(
"test.src"
));
File
file
=
new
File
(
testSrc
,
myName
+
".java"
);
compile
(
StringWriter
sw
=
new
StringWriter
();
PrintWriter
pw
=
new
PrintWriter
(
sw
);
compile
(
sw
,
pw
,
"-proc:only"
,
"-processor"
,
myName
,
"-AWriterString="
+
pw
.
toString
(),
file
.
getPath
());
}
void
compile
(
String
...
args
)
throws
Exception
{
StringWriter
sw
=
new
StringWriter
();
PrintWriter
pw
=
new
PrintWriter
(
sw
);
void
compile
(
StringWriter
sw
,
PrintWriter
pw
,
String
...
args
)
throws
Exception
{
int
rc
=
com
.
sun
.
tools
.
javac
.
Main
.
compile
(
args
,
pw
);
pw
.
close
();
String
out
=
sw
.
toString
();
...
...
@@ -76,6 +78,7 @@ public class T6597678 extends JavacTestingAbstractProcessor {
@Override
public
boolean
process
(
Set
<?
extends
TypeElement
>
annotations
,
RoundEnvironment
roundEnv
)
{
Context
context
=
((
JavacProcessingEnvironment
)
processingEnv
).
getContext
();
PrintWriter
out
=
((
JavacProcessingEnvironment
)
processingEnv
).
getWriter
();
Locale
locale
=
context
.
get
(
Locale
.
class
);
JavacMessages
messages
=
context
.
get
(
JavacMessages
.
messagesKey
);
...
...
@@ -83,9 +86,13 @@ public class T6597678 extends JavacTestingAbstractProcessor {
if
(
round
==
1
)
{
initialLocale
=
locale
;
initialMessages
=
messages
;
initialWriter
=
out
;
checkEqual
(
"writerString"
,
out
.
toString
().
intern
(),
options
.
get
(
"WriterString"
).
intern
());
}
else
{
checkEqual
(
"locale"
,
locale
,
initialLocale
);
checkEqual
(
"messages"
,
messages
,
initialMessages
);
checkEqual
(
"writer"
,
out
,
initialWriter
);
}
return
true
;
...
...
@@ -102,4 +109,5 @@ public class T6597678 extends JavacTestingAbstractProcessor {
int
round
=
0
;
Locale
initialLocale
;
JavacMessages
initialMessages
;
PrintWriter
initialWriter
;
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录