Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_langtools
提交
2d6a890d
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看板
提交
2d6a890d
编写于
10月 23, 2013
作者:
K
ksrini
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8026936: Initialize LamdbaToMethod lazily and as required
Reviewed-by: jjg, rfield Contributed-by: jan.lahoda@oracle.com
上级
2ee2a0ae
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
25 addition
and
9 deletion
+25
-9
src/share/classes/com/sun/tools/javac/main/JavaCompiler.java
src/share/classes/com/sun/tools/javac/main/JavaCompiler.java
+25
-9
未找到文件。
src/share/classes/com/sun/tools/javac/main/JavaCompiler.java
浏览文件 @
2d6a890d
...
...
@@ -271,10 +271,6 @@ public class JavaCompiler {
*/
protected
TransTypes
transTypes
;
/** The lambda translator.
*/
protected
LambdaToMethod
lambdaToMethod
;
/** The syntactic sugar desweetener.
*/
protected
Lower
lower
;
...
...
@@ -388,8 +384,6 @@ public class JavaCompiler {
options
=
Options
.
instance
(
context
);
lambdaToMethod
=
LambdaToMethod
.
instance
(
context
);
verbose
=
options
.
isSet
(
VERBOSE
);
sourceOutput
=
options
.
isSet
(
PRINTSOURCE
);
// used to be -s
stubOutput
=
options
.
isSet
(
"-stubs"
);
...
...
@@ -1393,6 +1387,7 @@ public class JavaCompiler {
*/
class
ScanNested
extends
TreeScanner
{
Set
<
Env
<
AttrContext
>>
dependencies
=
new
LinkedHashSet
<
Env
<
AttrContext
>>();
protected
boolean
hasLambdas
;
@Override
public
void
visitClassDef
(
JCClassDecl
node
)
{
Type
st
=
types
.
supertype
(
node
.
sym
.
type
);
...
...
@@ -1402,7 +1397,18 @@ public class JavaCompiler {
Env
<
AttrContext
>
stEnv
=
enter
.
getEnv
(
c
);
if
(
stEnv
!=
null
&&
env
!=
stEnv
)
{
if
(
dependencies
.
add
(
stEnv
))
{
scan
(
stEnv
.
tree
);
boolean
prevHasLambdas
=
hasLambdas
;
try
{
scan
(
stEnv
.
tree
);
}
finally
{
/*
* ignore any updates to hasLambdas made during
* the nested scan, this ensures an initalized
* LambdaToMethod is available only to those
* classes that contain lambdas
*/
hasLambdas
=
prevHasLambdas
;
}
}
envForSuperTypeFound
=
true
;
}
...
...
@@ -1410,6 +1416,16 @@ public class JavaCompiler {
}
super
.
visitClassDef
(
node
);
}
@Override
public
void
visitLambda
(
JCLambda
tree
)
{
hasLambdas
=
true
;
super
.
visitLambda
(
tree
);
}
@Override
public
void
visitReference
(
JCMemberReference
tree
)
{
hasLambdas
=
true
;
super
.
visitReference
(
tree
);
}
}
ScanNested
scanner
=
new
ScanNested
();
scanner
.
scan
(
env
.
tree
);
...
...
@@ -1468,11 +1484,11 @@ public class JavaCompiler {
env
.
tree
=
transTypes
.
translateTopLevelClass
(
env
.
tree
,
localMake
);
compileStates
.
put
(
env
,
CompileState
.
TRANSTYPES
);
if
(
source
.
allowLambda
())
{
if
(
source
.
allowLambda
()
&&
scanner
.
hasLambdas
)
{
if
(
shouldStop
(
CompileState
.
UNLAMBDA
))
return
;
env
.
tree
=
lambdaToMethod
.
translateTopLevelClass
(
env
,
env
.
tree
,
localMake
);
env
.
tree
=
LambdaToMethod
.
instance
(
context
)
.
translateTopLevelClass
(
env
,
env
.
tree
,
localMake
);
compileStates
.
put
(
env
,
CompileState
.
UNLAMBDA
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录