Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_langtools
提交
44d7c58e
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看板
提交
44d7c58e
编写于
1月 26, 2011
作者:
J
jjg
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
6554097: "final" confuses @SuppressWarnings
Reviewed-by: mcimadamore
上级
29ab714c
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
71 addition
and
12 deletion
+71
-12
src/share/classes/com/sun/tools/javac/code/Symbol.java
src/share/classes/com/sun/tools/javac/code/Symbol.java
+2
-11
src/share/classes/com/sun/tools/javac/comp/Attr.java
src/share/classes/com/sun/tools/javac/comp/Attr.java
+35
-0
src/share/classes/com/sun/tools/javac/comp/MemberEnter.java
src/share/classes/com/sun/tools/javac/comp/MemberEnter.java
+1
-1
test/tools/javac/T6554097.java
test/tools/javac/T6554097.java
+26
-0
test/tools/javac/T6554097.out
test/tools/javac/T6554097.out
+7
-0
未找到文件。
src/share/classes/com/sun/tools/javac/code/Symbol.java
浏览文件 @
44d7c58e
...
...
@@ -961,22 +961,12 @@ public abstract class Symbol implements Element {
}
public
void
setLazyConstValue
(
final
Env
<
AttrContext
>
env
,
final
Log
log
,
final
Attr
attr
,
final
JCTree
.
JCExpression
initializer
)
{
setData
(
new
Callable
<
Object
>()
{
public
Object
call
()
{
JavaFileObject
source
=
log
.
useSource
(
env
.
toplevel
.
sourcefile
);
try
{
Type
itype
=
attr
.
attribExpr
(
initializer
,
env
,
type
);
if
(
itype
.
constValue
()
!=
null
)
return
attr
.
coerce
(
itype
,
type
).
constValue
();
else
return
null
;
}
finally
{
log
.
useSource
(
source
);
}
return
attr
.
attribLazyConstantValue
(
env
,
initializer
,
type
);
}
});
}
...
...
@@ -1010,6 +1000,7 @@ public abstract class Symbol implements Element {
try
{
data
=
eval
.
call
();
}
catch
(
Exception
ex
)
{
ex
.
printStackTrace
();
throw
new
AssertionError
(
ex
);
}
}
...
...
src/share/classes/com/sun/tools/javac/comp/Attr.java
浏览文件 @
44d7c58e
...
...
@@ -581,6 +581,41 @@ public class Attr extends JCTree.Visitor {
}
}
/**
* Attribute a "lazy constant value".
* @param env The env for the const value
* @param initializer The initializer for the const value
* @param type The expected type, or null
* @see VarSymbol#setlazyConstValue
*/
public
Object
attribLazyConstantValue
(
Env
<
AttrContext
>
env
,
JCTree
.
JCExpression
initializer
,
Type
type
)
{
// in case no lint value has been set up for this env, scan up
// env stack looking for smallest enclosing env for which it is set.
Env
<
AttrContext
>
lintEnv
=
env
;
while
(
lintEnv
.
info
.
lint
==
null
)
lintEnv
=
lintEnv
.
next
;
// Having found the enclosing lint value, we can initialize the lint value for this class
env
.
info
.
lint
=
lintEnv
.
info
.
lint
.
augment
(
env
.
info
.
enclVar
.
attributes_field
,
env
.
info
.
enclVar
.
flags
());
Lint
prevLint
=
chk
.
setLint
(
env
.
info
.
lint
);
JavaFileObject
prevSource
=
log
.
useSource
(
env
.
toplevel
.
sourcefile
);
try
{
Type
itype
=
attribExpr
(
initializer
,
env
,
type
);
if
(
itype
.
constValue
()
!=
null
)
return
coerce
(
itype
,
type
).
constValue
();
else
return
null
;
}
finally
{
env
.
info
.
lint
=
prevLint
;
log
.
useSource
(
prevSource
);
}
}
/** Attribute type reference in an `extends' or `implements' clause.
* Supertypes of anonymous inner classes are usually already attributed.
*
...
...
src/share/classes/com/sun/tools/javac/comp/MemberEnter.java
浏览文件 @
44d7c58e
...
...
@@ -637,7 +637,7 @@ public class MemberEnter extends JCTree.Visitor implements Completer {
if
((
v
.
flags_field
&
FINAL
)
!=
0
&&
tree
.
init
.
getTag
()
!=
JCTree
.
NEWCLASS
)
{
Env
<
AttrContext
>
initEnv
=
getInitEnv
(
tree
,
env
);
initEnv
.
info
.
enclVar
=
v
;
v
.
setLazyConstValue
(
initEnv
(
tree
,
initEnv
),
log
,
attr
,
tree
.
init
);
v
.
setLazyConstValue
(
initEnv
(
tree
,
initEnv
),
attr
,
tree
.
init
);
}
}
if
(
chk
.
checkUnique
(
tree
.
pos
(),
v
,
enclScope
))
{
...
...
test/tools/javac/T6554097.java
0 → 100644
浏览文件 @
44d7c58e
/*
* @test /nodynamiccopyright/
* @bug 6554097
* @summary "final" confuses at-SuppressWarnings
* @compile T6554097.java
* @compile/fail/ref=T6554097.out -XDrawDiagnostics -Werror -Xlint:serial T6554097.java
*/
class
T6554097
{
@SuppressWarnings
(
"serial"
)
final
Throwable
[]
v1
=
{
new
Throwable
()
{}
};
@SuppressWarnings
(
"serial"
)
Throwable
[]
v2
=
{
new
Throwable
()
{}
};
public
static
void
m1
()
throws
Throwable
{
@SuppressWarnings
(
"serial"
)
final
Throwable
[]
v3
=
{
new
Throwable
()
{}
};
@SuppressWarnings
(
"serial"
)
Throwable
[]
v4
=
{
new
Throwable
()
{}
};
}
final
Throwable
[]
v5
=
{
new
Throwable
()
{}
};
Throwable
[]
v6
=
{
new
Throwable
()
{}
};
public
static
void
m2
()
throws
Throwable
{
final
Throwable
[]
v7
=
{
new
Throwable
()
{}
};
Throwable
[]
v8
=
{
new
Throwable
()
{}
};
}
}
test/tools/javac/T6554097.out
0 → 100644
浏览文件 @
44d7c58e
T6554097.java:18:46: compiler.warn.missing.SVUID: compiler.misc.anonymous.class: T6554097$5
T6554097.java:19:46: compiler.warn.missing.SVUID: compiler.misc.anonymous.class: T6554097$6
T6554097.java:22:50: compiler.warn.missing.SVUID: compiler.misc.anonymous.class: T6554097$7
T6554097.java:23:54: compiler.warn.missing.SVUID: compiler.misc.anonymous.class: T6554097$8
- compiler.err.warnings.and.werror
1 error
4 warnings
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录