Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_langtools
提交
5c99f602
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看板
提交
5c99f602
编写于
9月 27, 2010
作者:
J
jjg
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
6986246: Trees object is round-specific
Reviewed-by: darcy
上级
bd1900ef
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
33 addition
and
15 deletion
+33
-15
src/share/classes/com/sun/tools/javac/api/JavacTrees.java
src/share/classes/com/sun/tools/javac/api/JavacTrees.java
+19
-10
src/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java
...un/tools/javac/processing/JavacProcessingEnvironment.java
+8
-1
test/tools/javac/processing/model/util/elements/doccomments/TestDocComments.java
...sing/model/util/elements/doccomments/TestDocComments.java
+3
-2
test/tools/javac/tree/TreePosRoundsTest.java
test/tools/javac/tree/TreePosRoundsTest.java
+3
-2
未找到文件。
src/share/classes/com/sun/tools/javac/api/JavacTrees.java
浏览文件 @
5c99f602
/*
* Copyright (c) 2005, 20
08
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 20
10
, 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
...
...
@@ -56,7 +56,6 @@ import com.sun.tools.javac.comp.Env;
import
com.sun.tools.javac.comp.MemberEnter
;
import
com.sun.tools.javac.comp.Resolve
;
import
com.sun.tools.javac.model.JavacElements
;
import
com.sun.tools.javac.processing.JavacMessager
;
import
com.sun.tools.javac.processing.JavacProcessingEnvironment
;
import
com.sun.tools.javac.tree.JCTree.*
;
import
com.sun.tools.javac.tree.JCTree
;
...
...
@@ -81,14 +80,15 @@ import com.sun.tools.javac.util.Pair;
*/
public
class
JavacTrees
extends
Trees
{
private
final
Resolve
resolve
;
private
final
Enter
enter
;
private
final
Log
log
;
private
final
MemberEnter
memberEnter
;
private
final
Attr
attr
;
private
final
TreeMaker
treeMaker
;
private
final
JavacElements
elements
;
private
final
JavacTaskImpl
javacTaskImpl
;
// in a world of a single context per compilation, these would all be final
private
Resolve
resolve
;
private
Enter
enter
;
private
Log
log
;
private
MemberEnter
memberEnter
;
private
Attr
attr
;
private
TreeMaker
treeMaker
;
private
JavacElements
elements
;
private
JavacTaskImpl
javacTaskImpl
;
public
static
JavacTrees
instance
(
JavaCompiler
.
CompilationTask
task
)
{
if
(!(
task
instanceof
JavacTaskImpl
))
...
...
@@ -111,6 +111,14 @@ public class JavacTrees extends Trees {
private
JavacTrees
(
Context
context
)
{
context
.
put
(
JavacTrees
.
class
,
this
);
init
(
context
);
}
public
void
updateContext
(
Context
context
)
{
init
(
context
);
}
private
void
init
(
Context
context
)
{
attr
=
Attr
.
instance
(
context
);
enter
=
Enter
.
instance
(
context
);
elements
=
JavacElements
.
instance
(
context
);
...
...
@@ -337,6 +345,7 @@ public class JavacTrees extends Trees {
super
(
M
);
}
@Override
public
<
T
extends
JCTree
>
T
copy
(
T
t
,
JCTree
leaf
)
{
T
t2
=
super
.
copy
(
t
,
leaf
);
if
(
t
==
leaf
)
...
...
src/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java
浏览文件 @
5c99f602
/*
* Copyright (c) 2005, 20
09
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 20
10
, 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
...
...
@@ -49,6 +49,7 @@ import javax.tools.StandardJavaFileManager;
import
javax.tools.JavaFileObject
;
import
javax.tools.DiagnosticListener
;
import
com.sun.tools.javac.api.JavacTrees
;
import
com.sun.source.util.AbstractTypeProcessor
;
import
com.sun.source.util.TaskEvent
;
import
com.sun.source.util.TaskListener
;
...
...
@@ -1104,6 +1105,12 @@ public class JavacProcessingEnvironment implements ProcessingEnvironment, Closea
task
.
updateContext
(
next
);
}
JavacTrees
trees
=
context
.
get
(
JavacTrees
.
class
);
if
(
trees
!=
null
)
{
next
.
put
(
JavacTrees
.
class
,
trees
);
trees
.
updateContext
(
next
);
}
context
.
clear
();
return
next
;
}
...
...
test/tools/javac/processing/model/util/elements/doccomments/TestDocComments.java
浏览文件 @
5c99f602
...
...
@@ -23,7 +23,7 @@
/*
* @test
* @bug 6877202
* @bug 6877202
6986246
* @summary Elements.getDocComment() is not getting JavaDocComments
*/
...
...
@@ -139,6 +139,7 @@ public class TestDocComments extends AbstractProcessor {
Filer
filer
;
Messager
messager
;
Elements
elements
;
Trees
trees
;
ScanKind
skind
;
int
round
=
0
;
...
...
@@ -155,6 +156,7 @@ public class TestDocComments extends AbstractProcessor {
filer
=
pEnv
.
getFiler
();
messager
=
pEnv
.
getMessager
();
elements
=
pEnv
.
getElementUtils
();
trees
=
Trees
.
instance
(
processingEnv
);
skind
=
ScanKind
.
valueOf
(
options
.
get
(
"scan"
));
}
...
...
@@ -167,7 +169,6 @@ public class TestDocComments extends AbstractProcessor {
for
(
Element
e:
roundEnv
.
getRootElements
())
{
System
.
err
.
println
(
"scan "
+
skind
+
" "
+
e
.
getKind
()
+
" "
+
e
.
getSimpleName
());
if
(
skind
==
ScanKind
.
TREE
)
{
Trees
trees
=
Trees
.
instance
(
processingEnv
);
// cannot cache this across rounds
new
TestTreeScanner
().
scan
(
trees
.
getPath
(
e
),
trees
);
}
else
new
TestElementScanner
().
scan
(
e
);
...
...
test/tools/javac/tree/TreePosRoundsTest.java
浏览文件 @
5c99f602
...
...
@@ -23,7 +23,7 @@
/*
* @test
* @bug 6985205
* @bug 6985205
6986246
* @summary access to tree positions and doc comments may be lost across annotation processing rounds
* @build TreePosRoundsTest
* @compile -proc:only -processor TreePosRoundsTest TreePosRoundsTest.java
...
...
@@ -70,6 +70,7 @@ public class TreePosRoundsTest extends AbstractProcessor {
Filer
filer
;
Messager
messager
;
Trees
trees
;
@Override
public
SourceVersion
getSupportedSourceVersion
()
{
...
...
@@ -81,6 +82,7 @@ public class TreePosRoundsTest extends AbstractProcessor {
super
.
init
(
pEnv
);
filer
=
pEnv
.
getFiler
();
messager
=
pEnv
.
getMessager
();
trees
=
Trees
.
instance
(
pEnv
);
}
int
round
=
0
;
...
...
@@ -92,7 +94,6 @@ public class TreePosRoundsTest extends AbstractProcessor {
// Scan trees for elements, verifying source tree positions
for
(
Element
e:
roundEnv
.
getRootElements
())
{
try
{
Trees
trees
=
Trees
.
instance
(
processingEnv
);
// cannot cache this across rounds
TreePath
p
=
trees
.
getPath
(
e
);
new
TestTreeScanner
(
p
.
getCompilationUnit
(),
trees
).
scan
(
trees
.
getPath
(
e
),
null
);
}
catch
(
IOException
ex
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录