Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_langtools
提交
7ca46252
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看板
提交
7ca46252
编写于
12月 18, 2009
作者:
D
darcy
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
6911854: Update TestElementsAnnotatedWith.java to use @compile/proc
Reviewed-by: jjg
上级
62cc4611
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
8 addition
and
45 deletion
+8
-45
test/tools/javac/processing/environment/round/TestElementsAnnotatedWith.java
...ocessing/environment/round/TestElementsAnnotatedWith.java
+8
-45
未找到文件。
test/tools/javac/processing/environment/round/TestElementsAnnotatedWith.java
浏览文件 @
7ca46252
...
@@ -23,7 +23,7 @@
...
@@ -23,7 +23,7 @@
/*
/*
* @test
* @test
* @bug 6397298 6400986 6425592 6449798 6453386 6508401 6498938
* @bug 6397298 6400986 6425592 6449798 6453386 6508401 6498938
6911854
* @summary Tests that getElementsAnnotatedWith works properly.
* @summary Tests that getElementsAnnotatedWith works properly.
* @author Joseph D. Darcy
* @author Joseph D. Darcy
* @compile TestElementsAnnotatedWith.java
* @compile TestElementsAnnotatedWith.java
...
@@ -33,8 +33,8 @@
...
@@ -33,8 +33,8 @@
* @compile -processor TestElementsAnnotatedWith -proc:only Part1.java Part2.java
* @compile -processor TestElementsAnnotatedWith -proc:only Part1.java Part2.java
* @compile -processor TestElementsAnnotatedWith -proc:only C2.java
* @compile -processor TestElementsAnnotatedWith -proc:only C2.java
* @compile -processor TestElementsAnnotatedWith -proc:only Foo.java
* @compile -processor TestElementsAnnotatedWith -proc:only Foo.java
* @compile
-XD-d=.
Foo.java
* @compile Foo.java
* @compile
-processor TestElementsAnnotatedWith -proc:only TestElementsAnnotatedWith.java
* @compile
/process -processor TestElementsAnnotatedWith -proc:only Foo
*/
*/
import
java.lang.annotation.Annotation
;
import
java.lang.annotation.Annotation
;
...
@@ -89,7 +89,7 @@ public class TestElementsAnnotatedWith extends AbstractProcessor {
...
@@ -89,7 +89,7 @@ public class TestElementsAnnotatedWith extends AbstractProcessor {
// Verify that the annotation information is as
// Verify that the annotation information is as
// expected.
// expected.
Set
<
String
>
expectedNames
=
new
HashSet
<
String
>(
Arrays
.
asList
(
annotatedElementInfo
.
names
()));
Set
<
String
>
expectedNames
=
new
HashSet
<>(
Arrays
.
asList
(
annotatedElementInfo
.
names
()));
resultsMeta
=
resultsMeta
=
roundEnvironment
.
roundEnvironment
.
...
@@ -126,9 +126,6 @@ public class TestElementsAnnotatedWith extends AbstractProcessor {
...
@@ -126,9 +126,6 @@ public class TestElementsAnnotatedWith extends AbstractProcessor {
System
.
err
.
println
(
"AnnotatedElementInfo: "
+
annotatedElementInfo
);
System
.
err
.
println
(
"AnnotatedElementInfo: "
+
annotatedElementInfo
);
throw
new
RuntimeException
();
throw
new
RuntimeException
();
}
}
if
(
"TestElementsAnnotatedWith"
.
equals
(
firstType
.
getSimpleName
().
toString
()))
writeClassFile
();
// Start another round to test class file input
}
else
{
}
else
{
// If processing is over without an error, the specified
// If processing is over without an error, the specified
// elements should be empty so an empty set should be returned.
// elements should be empty so an empty set should be returned.
...
@@ -163,48 +160,14 @@ public class TestElementsAnnotatedWith extends AbstractProcessor {
...
@@ -163,48 +160,14 @@ public class TestElementsAnnotatedWith extends AbstractProcessor {
}
catch
(
IllegalArgumentException
iae
)
{}
}
catch
(
IllegalArgumentException
iae
)
{}
try
{
try
{
Set
<?
extends
Element
>
elements
=
roundEnvironment
.
getElementsAnnotatedWith
(
processingEnv
.
Set
<?
extends
Element
>
elements
=
getElementUtils
().
roundEnvironment
.
getElementsAnnotatedWith
(
processingEnv
.
getTypeElement
(
"java.lang.Object"
)
);
getElementUtils
().
getTypeElement
(
"java.lang.Object"
)
);
throw
new
RuntimeException
(
"Illegal argument exception not thrown"
);
throw
new
RuntimeException
(
"Illegal argument exception not thrown"
);
}
catch
(
IllegalArgumentException
iae
)
{}
}
catch
(
IllegalArgumentException
iae
)
{}
}
}
/*
* Hack alert! The class file read below is generated by the
* "@compile -XD-d=. Foo.java" directive above. This sneakily
* overrides the output location to the current directory where a
* subsequent @compile can read the file. This could be improved
* if either a new directive like @process accepted class file
* arguments (the javac command accepts such arguments but
* @compile does not) or the test.src and test.classes properties
* were set to be read with @compile jobs.
*/
private
void
writeClassFile
()
{
try
{
Filer
filer
=
processingEnv
.
getFiler
();
JavaFileObject
jfo
=
filer
.
createClassFile
(
"Foo"
);
OutputStream
os
=
jfo
.
openOutputStream
();
// Copy the bytes over
System
.
out
.
println
((
new
File
(
"."
)).
getAbsolutePath
());
InputStream
io
=
new
BufferedInputStream
(
new
FileInputStream
(
new
File
(
"."
,
"Foo.class"
)));
try
{
int
datum
=
io
.
read
();
while
(
datum
!=
-
1
)
{
os
.
write
(
datum
);
datum
=
io
.
read
();
}
}
finally
{
io
.
close
();
}
os
.
close
();
}
catch
(
IOException
ioe
)
{
throw
new
RuntimeException
(
ioe
);
}
}
@Override
@Override
public
SourceVersion
getSupportedSourceVersion
()
{
public
SourceVersion
getSupportedSourceVersion
()
{
return
SourceVersion
.
latest
();
return
SourceVersion
.
latest
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录