Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_langtools
提交
ab779287
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看板
提交
ab779287
编写于
4月 08, 2013
作者:
J
jjg
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8011677: EndPosTables should avoid hidden references to Parser
Reviewed-by: mcimadamore
上级
5c3c98aa
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
26 addition
and
8 deletion
+26
-8
src/share/classes/com/sun/tools/javac/parser/JavacParser.java
...share/classes/com/sun/tools/javac/parser/JavacParser.java
+26
-8
未找到文件。
src/share/classes/com/sun/tools/javac/parser/JavacParser.java
浏览文件 @
ab779287
...
...
@@ -171,8 +171,8 @@ public class JavacParser implements Parser {
protected
AbstractEndPosTable
newEndPosTable
(
boolean
keepEndPositions
)
{
return
keepEndPositions
?
new
SimpleEndPosTable
()
:
new
EmptyEndPosTable
();
?
new
SimpleEndPosTable
(
this
)
:
new
EmptyEndPosTable
(
this
);
}
protected
DocCommentTable
newDocCommentTable
(
boolean
keepDocComments
,
ParserFactory
fac
)
{
...
...
@@ -3088,6 +3088,7 @@ public class JavacParser implements Parser {
toplevel
.
docComments
=
docComments
;
if
(
keepLineMap
)
toplevel
.
lineMap
=
S
.
getLineMap
();
this
.
endPosTable
.
setParser
(
null
);
// remove reference to parser
toplevel
.
endPositions
=
this
.
endPosTable
;
return
toplevel
;
}
...
...
@@ -4003,11 +4004,12 @@ public class JavacParser implements Parser {
/*
* a functional source tree and end position mappings
*/
protected
class
SimpleEndPosTable
extends
AbstractEndPosTable
{
protected
static
class
SimpleEndPosTable
extends
AbstractEndPosTable
{
private
final
Map
<
JCTree
,
Integer
>
endPosMap
;
SimpleEndPosTable
()
{
SimpleEndPosTable
(
JavacParser
parser
)
{
super
(
parser
);
endPosMap
=
new
HashMap
<
JCTree
,
Integer
>();
}
...
...
@@ -4016,12 +4018,12 @@ public class JavacParser implements Parser {
}
protected
<
T
extends
JCTree
>
T
to
(
T
t
)
{
storeEnd
(
t
,
token
.
endPos
);
storeEnd
(
t
,
parser
.
token
.
endPos
);
return
t
;
}
protected
<
T
extends
JCTree
>
T
toP
(
T
t
)
{
storeEnd
(
t
,
S
.
prevToken
().
endPos
);
storeEnd
(
t
,
parser
.
S
.
prevToken
().
endPos
);
return
t
;
}
...
...
@@ -4043,7 +4045,11 @@ public class JavacParser implements Parser {
/*
* a default skeletal implementation without any mapping overhead.
*/
protected
class
EmptyEndPosTable
extends
AbstractEndPosTable
{
protected
static
class
EmptyEndPosTable
extends
AbstractEndPosTable
{
EmptyEndPosTable
(
JavacParser
parser
)
{
super
(
parser
);
}
protected
void
storeEnd
(
JCTree
tree
,
int
endpos
)
{
/* empty */
}
...
...
@@ -4065,13 +4071,21 @@ public class JavacParser implements Parser {
}
protected
abstract
class
AbstractEndPosTable
implements
EndPosTable
{
protected
static
abstract
class
AbstractEndPosTable
implements
EndPosTable
{
/**
* The current parser.
*/
protected
JavacParser
parser
;
/**
* Store the last error position.
*/
protected
int
errorEndPos
;
public
AbstractEndPosTable
(
JavacParser
parser
)
{
this
.
parser
=
parser
;
}
/**
* Store ending position for a tree, the value of which is the greater
* of last error position and the given ending position.
...
...
@@ -4106,5 +4120,9 @@ public class JavacParser implements Parser {
errorEndPos
=
errPos
;
}
}
protected
void
setParser
(
JavacParser
parser
)
{
this
.
parser
=
parser
;
}
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录