Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_langtools
提交
37314679
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看板
提交
37314679
编写于
8月 20, 2013
作者:
K
kizune
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
7182350: Regression in wording of unchecked warning message
Reviewed-by: mcimadamore, jjg
上级
43829be2
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
52 addition
and
30 deletion
+52
-30
src/share/classes/com/sun/tools/javac/comp/Check.java
src/share/classes/com/sun/tools/javac/comp/Check.java
+21
-17
test/tools/javac/6758789/T6758789b.out
test/tools/javac/6758789/T6758789b.out
+1
-1
test/tools/javac/7182350/T7182350.java
test/tools/javac/7182350/T7182350.java
+14
-0
test/tools/javac/7182350/T7182350.out
test/tools/javac/7182350/T7182350.out
+4
-0
test/tools/javac/generics/7015430/T7015430_1.out
test/tools/javac/generics/7015430/T7015430_1.out
+3
-3
test/tools/javac/generics/7015430/T7015430_2.out
test/tools/javac/generics/7015430/T7015430_2.out
+6
-6
test/tools/javac/generics/7151802/T7151802.out
test/tools/javac/generics/7151802/T7151802.out
+1
-1
test/tools/javac/generics/inference/6718364/T6718364.out
test/tools/javac/generics/inference/6718364/T6718364.out
+1
-1
test/tools/javac/generics/inference/7177306/T7177306a.out
test/tools/javac/generics/inference/7177306/T7177306a.out
+1
-1
未找到文件。
src/share/classes/com/sun/tools/javac/comp/Check.java
浏览文件 @
37314679
...
...
@@ -875,19 +875,23 @@ public class Check {
}
Type
owntype
=
mtype
;
List
<
Type
>
formals
=
owntype
.
getParameterTypes
();
List
<
Type
>
nonInferred
=
sym
.
type
.
getParameterTypes
();
if
(
nonInferred
.
length
()
!=
formals
.
length
())
nonInferred
=
formals
;
Type
last
=
useVarargs
?
formals
.
last
()
:
null
;
if
(
sym
.
name
==
names
.
init
&&
sym
.
owner
==
syms
.
enumSym
)
formals
=
formals
.
tail
.
tail
;
if
(
sym
.
name
==
names
.
init
&&
sym
.
owner
==
syms
.
enumSym
)
{
formals
=
formals
.
tail
.
tail
;
nonInferred
=
nonInferred
.
tail
.
tail
;
}
List
<
JCExpression
>
args
=
argtrees
;
if
(
args
!=
null
)
{
//this is null when type-checking a method reference
while
(
formals
.
head
!=
last
)
{
JCTree
arg
=
args
.
head
;
Warner
warn
=
convertWarner
(
arg
.
pos
(),
arg
.
type
,
formals
.
head
);
Warner
warn
=
convertWarner
(
arg
.
pos
(),
arg
.
type
,
nonInferred
.
head
);
assertConvertible
(
arg
,
arg
.
type
,
formals
.
head
,
warn
);
args
=
args
.
tail
;
formals
=
formals
.
tail
;
nonInferred
=
nonInferred
.
tail
;
}
if
(
useVarargs
)
{
Type
varArg
=
types
.
elemtype
(
last
);
...
...
@@ -903,17 +907,17 @@ public class Check {
Type
varParam
=
owntype
.
getParameterTypes
().
last
();
Type
lastArg
=
argtypes
.
last
();
if
(
types
.
isSubtypeUnchecked
(
lastArg
,
types
.
elemtype
(
varParam
))
&&
!
types
.
isSameType
(
types
.
erasure
(
varParam
),
types
.
erasure
(
lastArg
)))
!
types
.
isSameType
(
types
.
erasure
(
varParam
),
types
.
erasure
(
lastArg
)))
log
.
warning
(
argtrees
.
last
().
pos
(),
"inexact.non-varargs.call"
,
types
.
elemtype
(
varParam
),
varParam
);
types
.
elemtype
(
varParam
),
varParam
);
}
}
if
(
useVarargs
)
{
Type
argtype
=
owntype
.
getParameterTypes
().
last
();
if
(!
types
.
isReifiable
(
argtype
)
&&
(!
allowSimplifiedVarargs
||
sym
.
attribute
(
syms
.
trustMeType
.
tsym
)
==
null
||
!
isTrustMeAllowedOnMethod
(
sym
)))
{
(!
allowSimplifiedVarargs
||
sym
.
attribute
(
syms
.
trustMeType
.
tsym
)
==
null
||
!
isTrustMeAllowedOnMethod
(
sym
)))
{
warnUnchecked
(
env
.
tree
.
pos
(),
"unchecked.generic.array.creation"
,
argtype
);
...
...
@@ -929,15 +933,15 @@ public class Check {
return
owntype
;
}
//where
private
void
assertConvertible
(
JCTree
tree
,
Type
actual
,
Type
formal
,
Warner
warn
)
{
if
(
types
.
isConvertible
(
actual
,
formal
,
warn
))
return
;
private
void
assertConvertible
(
JCTree
tree
,
Type
actual
,
Type
formal
,
Warner
warn
)
{
if
(
types
.
isConvertible
(
actual
,
formal
,
warn
))
return
;
if
(
formal
.
isCompound
()
&&
types
.
isSubtype
(
actual
,
types
.
supertype
(
formal
))
&&
types
.
isSubtypeUnchecked
(
actual
,
types
.
interfaces
(
formal
),
warn
))
return
;
}
if
(
formal
.
isCompound
()
&&
types
.
isSubtype
(
actual
,
types
.
supertype
(
formal
))
&&
types
.
isSubtypeUnchecked
(
actual
,
types
.
interfaces
(
formal
),
warn
))
return
;
}
/**
* Check that type 't' is a valid instantiation of a generic class
...
...
test/tools/javac/6758789/T6758789b.out
浏览文件 @
37314679
T6758789b.java:16:10: compiler.warn.unchecked.meth.invocation.applied: kindname.method, m, T6758789a.Foo<X>, T6758789a.Foo, kindname.class, T6758789a
T6758789b.java:16:11: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), T6758789a.Foo, T6758789a.Foo<
java.lang.Object
>
T6758789b.java:16:11: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), T6758789a.Foo, T6758789a.Foo<
X
>
- compiler.err.warnings.and.werror
1 error
2 warnings
test/tools/javac/7182350/T7182350.java
0 → 100644
浏览文件 @
37314679
/**
* @test /nodynamiccopyright/
* @bug 7182350
* @summary verify correct output of -Xlint:unchecked on methods with unchecked conversations in parameters
* @compile/ref=T7182350.out -XDrawDiagnostics -Xlint:unchecked T7182350.java
*/
import
java.util.*
;
class
T7182350
{
public
static
void
quicksort
(
Vector
vector
,
Comparator
compare
)
{
Collections
.
sort
(
vector
,
compare
);
}
}
test/tools/javac/7182350/T7182350.out
0 → 100644
浏览文件 @
37314679
T7182350.java:12:25: compiler.warn.unchecked.meth.invocation.applied: kindname.method, sort, java.util.List<T>,java.util.Comparator<? super T>, java.util.Vector,java.util.Comparator, kindname.class, java.util.Collections
T7182350.java:12:26: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), java.util.Vector, java.util.List<T>
T7182350.java:12:33: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), java.util.Comparator, java.util.Comparator<? super T>
3 warnings
test/tools/javac/generics/7015430/T7015430_1.out
浏览文件 @
37314679
T7015430.java:42:14: compiler.warn.unchecked.meth.invocation.applied: kindname.method, empty, java.lang.Iterable<E>, java.lang.Iterable, kindname.class, T7015430
T7015430.java:42:15: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), java.lang.Iterable, java.lang.Iterable<E>
T7015430.java:51:41: compiler.warn.unchecked.meth.invocation.applied: kindname.method, empty, java.lang.Iterable<E>, java.lang.Iterable, kindname.class, T7015430
T7015430.java:51:42: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), java.lang.Iterable, java.lang.Iterable<
java.lang.RuntimeException
>
T7015430.java:51:42: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), java.lang.Iterable, java.lang.Iterable<
E
>
T7015430.java:69:9: compiler.warn.unchecked.meth.invocation.applied: kindname.constructor, <init>, java.lang.Iterable<E>, java.lang.Iterable, kindname.class, T7015430
T7015430.java:69:22: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), java.lang.Iterable, java.lang.Iterable<E>
T7015430.java:78:9: compiler.warn.unchecked.meth.invocation.applied: kindname.constructor, <init>, java.lang.Iterable<E>, java.lang.Iterable, kindname.class, T7015430
T7015430.java:78:40: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), java.lang.Iterable, java.lang.Iterable<
java.lang.RuntimeException
>
T7015430.java:78:40: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), java.lang.Iterable, java.lang.Iterable<
E
>
T7015430.java:105:9: compiler.warn.unchecked.meth.invocation.applied: kindname.constructor, <init>, java.lang.Iterable<E>, java.lang.Iterable, kindname.class, T7015430
T7015430.java:105:41: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), java.lang.Iterable, java.lang.Iterable<
java.lang.RuntimeException
>
T7015430.java:105:41: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), java.lang.Iterable, java.lang.Iterable<
E
>
T7015430.java:114:9: compiler.warn.unchecked.meth.invocation.applied: kindname.constructor, <init>, java.lang.Iterable<E>, java.lang.Iterable, kindname.class, T7015430
T7015430.java:114:22: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), java.lang.Iterable, java.lang.Iterable<E>
T7015430.java:42:14: compiler.err.unreported.exception.need.to.catch.or.throw: java.lang.Exception
...
...
test/tools/javac/generics/7015430/T7015430_2.out
浏览文件 @
37314679
T7015430.java:42:14: compiler.warn.unchecked.meth.invocation.applied: kindname.method, empty, java.lang.Iterable<E>, java.lang.Iterable, kindname.class, T7015430
T7015430.java:42:15: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), java.lang.Iterable, java.lang.Iterable<
java.lang.RuntimeException
>
T7015430.java:42:15: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), java.lang.Iterable, java.lang.Iterable<
E
>
T7015430.java:51:41: compiler.warn.unchecked.meth.invocation.applied: kindname.method, empty, java.lang.Iterable<E>, java.lang.Iterable, kindname.class, T7015430
T7015430.java:51:42: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), java.lang.Iterable, java.lang.Iterable<
java.lang.RuntimeException
>
T7015430.java:51:42: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), java.lang.Iterable, java.lang.Iterable<
E
>
T7015430.java:69:9: compiler.warn.unchecked.meth.invocation.applied: kindname.constructor, <init>, java.lang.Iterable<E>, java.lang.Iterable, kindname.class, T7015430
T7015430.java:69:22: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), java.lang.Iterable, java.lang.Iterable<
java.lang.RuntimeException
>
T7015430.java:69:22: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), java.lang.Iterable, java.lang.Iterable<
E
>
T7015430.java:78:9: compiler.warn.unchecked.meth.invocation.applied: kindname.constructor, <init>, java.lang.Iterable<E>, java.lang.Iterable, kindname.class, T7015430
T7015430.java:78:40: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), java.lang.Iterable, java.lang.Iterable<
java.lang.RuntimeException
>
T7015430.java:78:40: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), java.lang.Iterable, java.lang.Iterable<
E
>
T7015430.java:105:9: compiler.warn.unchecked.meth.invocation.applied: kindname.constructor, <init>, java.lang.Iterable<E>, java.lang.Iterable, kindname.class, T7015430
T7015430.java:105:41: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), java.lang.Iterable, java.lang.Iterable<
java.lang.RuntimeException
>
T7015430.java:105:41: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), java.lang.Iterable, java.lang.Iterable<
E
>
T7015430.java:114:9: compiler.warn.unchecked.meth.invocation.applied: kindname.constructor, <init>, java.lang.Iterable<E>, java.lang.Iterable, kindname.class, T7015430
T7015430.java:114:22: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), java.lang.Iterable, java.lang.Iterable<
java.lang.RuntimeException
>
T7015430.java:114:22: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), java.lang.Iterable, java.lang.Iterable<
E
>
T7015430.java:130:9: compiler.err.unreported.exception.need.to.catch.or.throw: java.lang.Exception
1 error
12 warnings
test/tools/javac/generics/7151802/T7151802.out
浏览文件 @
37314679
T7151802.java:14:31: compiler.warn.unchecked.meth.invocation.applied: kindname.method, get1, Z, T7151802.Foo, kindname.class, T7151802
T7151802.java:22:30: compiler.warn.unchecked.meth.invocation.applied: kindname.method, get3, T7151802.Foo<Z>, T7151802.Foo, kindname.class, T7151802
T7151802.java:22:31: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), T7151802.Foo, T7151802.Foo<
java.lang.Object
>
T7151802.java:22:31: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), T7151802.Foo, T7151802.Foo<
Z
>
T7151802.java:30:36: compiler.warn.unchecked.meth.invocation.applied: kindname.method, get5, compiler.misc.no.args, compiler.misc.no.args, kindname.class, T7151802
T7151802.java:38:31: compiler.warn.unchecked.meth.invocation.applied: kindname.method, get7, T7151802.Foo<java.lang.String>, T7151802.Foo, kindname.class, T7151802
T7151802.java:38:32: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), T7151802.Foo, T7151802.Foo<java.lang.String>
...
...
test/tools/javac/generics/inference/6718364/T6718364.out
浏览文件 @
37314679
T6718364.java:13:10: compiler.warn.unchecked.meth.invocation.applied: kindname.method, m, T6718364.X<T>,T, T6718364.X<T6718364.X<java.lang.Integer>>,T6718364.X, kindname.class, T6718364
T6718364.java:13:32: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), T6718364.X, T
6718364.X<java.lang.Integer>
T6718364.java:13:32: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), T6718364.X, T
2 warnings
test/tools/javac/generics/inference/7177306/T7177306a.out
浏览文件 @
37314679
T7177306a.java:13:33: compiler.warn.unchecked.meth.invocation.applied: kindname.method, m, java.util.List<E>, java.util.List, kindname.class, T7177306a
T7177306a.java:13:34: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), java.util.List, java.util.List<
java.lang.Object
>
T7177306a.java:13:34: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), java.util.List, java.util.List<
E
>
T7177306a.java:13:33: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), T7177306a, T7177306a<java.lang.Object>
- compiler.err.warnings.and.werror
1 error
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录