Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_langtools
提交
5cb4d34f
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看板
提交
5cb4d34f
编写于
6月 27, 2013
作者:
V
vromero
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8016099: Some @SuppressWarnings annotations ignored ( unchecked, rawtypes )
Reviewed-by: jjg
上级
a906d5f6
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
56 addition
and
20 deletion
+56
-20
src/share/classes/com/sun/tools/javac/comp/Attr.java
src/share/classes/com/sun/tools/javac/comp/Attr.java
+11
-20
src/share/classes/com/sun/tools/javac/comp/Check.java
src/share/classes/com/sun/tools/javac/comp/Check.java
+8
-0
test/tools/javac/T8016099/UncheckedWarningRegressionTest.java
.../tools/javac/T8016099/UncheckedWarningRegressionTest.java
+32
-0
test/tools/javac/T8016099/UncheckedWarningRegressionTest.out
test/tools/javac/T8016099/UncheckedWarningRegressionTest.out
+5
-0
未找到文件。
src/share/classes/com/sun/tools/javac/comp/Attr.java
浏览文件 @
5cb4d34f
...
...
@@ -756,25 +756,15 @@ public class Attr extends JCTree.Visitor {
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
// ... but ...
// There's a problem with evaluating annotations in the right order, such that
// env.info.enclVar.attributes_field might not yet have been evaluated, and so might be
// null. In that case, calling augment will throw an NPE. To avoid this, for now we
// revert to the jdk 6 behavior and ignore the (unevaluated) attributes.
if
(
env
.
info
.
enclVar
.
annotationsPendingCompletion
())
{
env
.
info
.
lint
=
lintEnv
.
info
.
lint
;
}
else
{
env
.
info
.
lint
=
lintEnv
.
info
.
lint
.
augment
(
env
.
info
.
enclVar
);
}
/* When this env was created, it didn't have the correct lint nor had
* annotations has been processed.
* But now at this phase we have already processed annotations and the
* correct lint must have been set in chk, so we should use that one to
* attribute the initializer.
*/
Lint
prevLint
=
env
.
info
.
lint
;
env
.
info
.
lint
=
chk
.
getLint
();
Lint
prevLint
=
chk
.
setLint
(
env
.
info
.
lint
);
JavaFileObject
prevSource
=
log
.
useSource
(
env
.
toplevel
.
sourcefile
);
try
{
...
...
@@ -786,10 +776,11 @@ public class Attr extends JCTree.Visitor {
memberEnter
.
typeAnnotate
(
initializer
,
env
,
null
);
annotate
.
flush
();
Type
itype
=
attribExpr
(
initializer
,
env
,
type
);
if
(
itype
.
constValue
()
!=
null
)
if
(
itype
.
constValue
()
!=
null
)
{
return
coerce
(
itype
,
type
).
constValue
();
else
}
else
{
return
null
;
}
}
finally
{
env
.
info
.
lint
=
prevLint
;
log
.
useSource
(
prevSource
);
...
...
src/share/classes/com/sun/tools/javac/comp/Check.java
浏览文件 @
5cb4d34f
...
...
@@ -218,6 +218,14 @@ public class Check {
return
prev
;
}
/* This idiom should be used only in cases when it is needed to set the lint
* of an environment that has been created in a phase previous to annotations
* processing.
*/
Lint
getLint
()
{
return
lint
;
}
DeferredLintHandler
setDeferredLintHandler
(
DeferredLintHandler
newDeferredLintHandler
)
{
DeferredLintHandler
prev
=
deferredLintHandler
;
deferredLintHandler
=
newDeferredLintHandler
;
...
...
test/tools/javac/T8016099/UncheckedWarningRegressionTest.java
0 → 100644
浏览文件 @
5cb4d34f
/*
* @test /nodynamiccopyright/
* @bug 8016099
* @summary Some SuppressWarnings annotations ignored ( unchecked, rawtypes )
* @compile UncheckedWarningRegressionTest.java
* @compile/fail/ref=UncheckedWarningRegressionTest.out -XDrawDiagnostics -Werror -Xlint:unchecked UncheckedWarningRegressionTest.java
*/
public
class
UncheckedWarningRegressionTest
{
<
T
>
void
suppressedWarningsFinalInitializer
()
{
@SuppressWarnings
(
"unchecked"
)
T
[]
tt
=
(
T
[])
FINAL_EMPTY_ARRAY
;
}
final
Object
[]
FINAL_EMPTY_ARRAY
=
{};
<
T
>
void
finalInitializer
()
{
T
[]
tt
=
(
T
[])
FINAL_EMPTY_ARRAY
;
}
<
T
>
void
suppressedWarningsNonFinalInitializer
()
{
@SuppressWarnings
(
"unchecked"
)
T
[]
tt
=
(
T
[])
NON_FINAL_EMPTY_ARRAY
;
}
Object
[]
NON_FINAL_EMPTY_ARRAY
=
{};
<
T
>
void
nonFinalInitializer
()
{
T
[]
tt
=
(
T
[])
NON_FINAL_EMPTY_ARRAY
;
}
}
test/tools/javac/T8016099/UncheckedWarningRegressionTest.out
0 → 100644
浏览文件 @
5cb4d34f
UncheckedWarningRegressionTest.java:18:24: compiler.warn.prob.found.req: (compiler.misc.unchecked.cast.to.type), java.lang.Object[], T[]
UncheckedWarningRegressionTest.java:29:24: compiler.warn.prob.found.req: (compiler.misc.unchecked.cast.to.type), java.lang.Object[], T[]
- compiler.err.warnings.and.werror
1 error
2 warnings
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录