Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_langtools
提交
a992416d
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看板
提交
a992416d
编写于
1月 24, 2012
作者:
L
lana
浏览文件
操作
浏览文件
下载
差异文件
Merge
上级
7f30a825
a6f06347
变更
18
隐藏空白更改
内联
并排
Showing
18 changed file
with
179 addition
and
46 deletion
+179
-46
src/share/classes/com/sun/tools/javac/code/Types.java
src/share/classes/com/sun/tools/javac/code/Types.java
+28
-23
src/share/classes/com/sun/tools/javac/comp/Infer.java
src/share/classes/com/sun/tools/javac/comp/Infer.java
+9
-5
src/share/classes/javax/lang/model/element/Element.java
src/share/classes/javax/lang/model/element/Element.java
+9
-8
src/share/classes/javax/lang/model/element/PackageElement.java
...hare/classes/javax/lang/model/element/PackageElement.java
+16
-2
src/share/classes/javax/lang/model/element/TypeElement.java
src/share/classes/javax/lang/model/element/TypeElement.java
+8
-2
test/tools/javac/cast/7123100/T7123100a.java
test/tools/javac/cast/7123100/T7123100a.java
+16
-0
test/tools/javac/cast/7123100/T7123100a.out
test/tools/javac/cast/7123100/T7123100a.out
+4
-0
test/tools/javac/cast/7123100/T7123100b.java
test/tools/javac/cast/7123100/T7123100b.java
+12
-0
test/tools/javac/cast/7123100/T7123100b.out
test/tools/javac/cast/7123100/T7123100b.out
+4
-0
test/tools/javac/cast/7123100/T7123100c.java
test/tools/javac/cast/7123100/T7123100c.java
+16
-0
test/tools/javac/cast/7123100/T7123100c.out
test/tools/javac/cast/7123100/T7123100c.out
+4
-0
test/tools/javac/cast/7123100/T7123100d.java
test/tools/javac/cast/7123100/T7123100d.java
+16
-0
test/tools/javac/cast/7123100/T7123100d.out
test/tools/javac/cast/7123100/T7123100d.out
+4
-0
test/tools/javac/cast/7126754/T7126754.java
test/tools/javac/cast/7126754/T7126754.java
+14
-0
test/tools/javac/cast/7126754/T7126754.out
test/tools/javac/cast/7126754/T7126754.out
+4
-0
test/tools/javac/diags/CheckExamples.java
test/tools/javac/diags/CheckExamples.java
+5
-2
test/tools/javac/diags/MessageInfo.java
test/tools/javac/diags/MessageInfo.java
+5
-2
test/tools/javac/diags/RunExamples.java
test/tools/javac/diags/RunExamples.java
+5
-2
未找到文件。
src/share/classes/com/sun/tools/javac/code/Types.java
浏览文件 @
a992416d
/*
* Copyright (c) 2003, 201
1
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 201
2
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
...
...
@@ -3600,39 +3600,44 @@ public class Types {
@Override
public
Type
visitCapturedType
(
CapturedType
t
,
Void
s
)
{
Type
bound
=
visitWildcardType
(
t
.
wildcard
,
null
);
return
(
bound
.
contains
(
t
))
?
erasure
(
bound
)
:
bound
;
Type
w_bound
=
t
.
wildcard
.
type
;
Type
bound
=
w_bound
.
contains
(
t
)
?
erasure
(
w_bound
)
:
visit
(
w_bound
);
return
rewriteAsWildcardType
(
visit
(
bound
),
t
.
wildcard
.
bound
,
t
.
wildcard
.
kind
);
}
@Override
public
Type
visitTypeVar
(
TypeVar
t
,
Void
s
)
{
if
(
rewriteTypeVars
)
{
Type
bound
=
high
?
(
t
.
bound
.
contains
(
t
)
?
Type
bound
=
t
.
bound
.
contains
(
t
)
?
erasure
(
t
.
bound
)
:
visit
(
t
.
bound
))
:
syms
.
botType
;
return
rewriteAsWildcardType
(
bound
,
t
);
}
else
visit
(
t
.
bound
);
return
rewriteAsWildcardType
(
bound
,
t
,
EXTENDS
);
}
else
{
return
t
;
}
}
@Override
public
Type
visitWildcardType
(
WildcardType
t
,
Void
s
)
{
Type
bound
=
high
?
t
.
getExtendsBound
()
:
t
.
getSuperBound
();
if
(
bound
==
null
)
bound
=
high
?
syms
.
objectType
:
syms
.
botType
;
return
rewriteAsWildcardType
(
visit
(
bound
),
t
.
bound
);
}
private
Type
rewriteAsWildcardType
(
Type
bound
,
TypeVar
formal
)
{
return
high
?
makeExtendsWildcard
(
B
(
bound
),
formal
)
:
makeSuperWildcard
(
B
(
bound
),
formal
);
Type
bound2
=
visit
(
t
.
type
);
return
t
.
type
==
bound2
?
t
:
rewriteAsWildcardType
(
bound2
,
t
.
bound
,
t
.
kind
);
}
private
Type
rewriteAsWildcardType
(
Type
bound
,
TypeVar
formal
,
BoundKind
bk
)
{
switch
(
bk
)
{
case
EXTENDS:
return
high
?
makeExtendsWildcard
(
B
(
bound
),
formal
)
:
makeExtendsWildcard
(
syms
.
objectType
,
formal
);
case
SUPER:
return
high
?
makeSuperWildcard
(
syms
.
botType
,
formal
)
:
makeSuperWildcard
(
B
(
bound
),
formal
);
case
UNBOUND:
return
makeExtendsWildcard
(
syms
.
objectType
,
formal
);
default
:
Assert
.
error
(
"Invalid bound kind "
+
bk
);
return
null
;
}
}
Type
B
(
Type
t
)
{
...
...
src/share/classes/com/sun/tools/javac/comp/Infer.java
浏览文件 @
a992416d
/*
* Copyright (c) 1999, 201
1
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 201
2
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
...
...
@@ -332,25 +332,29 @@ public class Infer {
//replace uninferred type-vars
targs
=
types
.
subst
(
targs
,
that
.
tvars
,
instaniateAsUninferredVars
(
undetvars
,
that
.
tvars
));
instan
t
iateAsUninferredVars
(
undetvars
,
that
.
tvars
));
}
return
chk
.
checkType
(
warn
.
pos
(),
that
.
inst
(
targs
,
types
),
to
);
}
//where
private
List
<
Type
>
instaniateAsUninferredVars
(
List
<
Type
>
undetvars
,
List
<
Type
>
tvars
)
{
private
List
<
Type
>
instantiateAsUninferredVars
(
List
<
Type
>
undetvars
,
List
<
Type
>
tvars
)
{
Assert
.
check
(
undetvars
.
length
()
==
tvars
.
length
());
ListBuffer
<
Type
>
new_targs
=
ListBuffer
.
lb
();
//step 1 - create synt
eth
ic captured vars
//step 1 - create synt
het
ic captured vars
for
(
Type
t
:
undetvars
)
{
UndetVar
uv
=
(
UndetVar
)
t
;
Type
newArg
=
new
CapturedType
(
t
.
tsym
.
name
,
t
.
tsym
,
uv
.
inst
,
syms
.
botType
,
null
);
new_targs
=
new_targs
.
append
(
newArg
);
}
//step 2 - replace synthetic vars in their bounds
List
<
Type
>
formals
=
tvars
;
for
(
Type
t
:
new_targs
.
toList
())
{
CapturedType
ct
=
(
CapturedType
)
t
;
ct
.
bound
=
types
.
subst
(
ct
.
bound
,
tvars
,
new_targs
.
toList
());
WildcardType
wt
=
new
WildcardType
(
ct
.
bound
,
BoundKind
.
EXTENDS
,
syms
.
boundClass
);
WildcardType
wt
=
new
WildcardType
(
syms
.
objectType
,
BoundKind
.
UNBOUND
,
syms
.
boundClass
);
wt
.
bound
=
(
TypeVar
)
formals
.
head
;
ct
.
wildcard
=
wt
;
formals
=
formals
.
tail
;
}
return
new_targs
.
toList
();
}
...
...
src/share/classes/javax/lang/model/element/Element.java
浏览文件 @
a992416d
/*
* Copyright (c) 2005, 201
1
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 201
2
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
...
...
@@ -214,14 +214,13 @@ public interface Element {
* Returns the elements that are, loosely speaking, directly
* enclosed by this element.
*
* A class or interface is considered to enclose the fields,
* methods, constructors, and member types that it directly
* declares. This includes any (implicit) default constructor and
* the implicit {@code values} and {@code valueOf} methods of an
* enum type.
* A {@linkplain TypeElement#getEnclosedElements class or
* interface} is considered to enclose the fields, methods,
* constructors, and member types that it directly declares.
*
* A package encloses the top-level classes and interfaces within
* it, but is not considered to enclose subpackages.
* A {@linkplain PackageElement#getEnclosedElements package}
* encloses the top-level classes and interfaces within it, but is
* not considered to enclose subpackages.
*
* Other kinds of elements are not currently considered to enclose
* any elements; however, that may change as this API or the
...
...
@@ -231,6 +230,8 @@ public interface Element {
* methods in {@link ElementFilter}.
*
* @return the enclosed elements, or an empty list if none
* @see PackageElement#getEnclosedElements
* @see TypeElement#getEnclosedElements
* @see Elements#getAllMembers
* @jls 8.8.9 Default Constructor
* @jls 8.9 Enums
...
...
src/share/classes/javax/lang/model/element/PackageElement.java
浏览文件 @
a992416d
/*
* Copyright (c) 2005, 201
1
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 201
2
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
...
...
@@ -25,6 +25,8 @@
package
javax.lang.model.element
;
import
java.util.List
;
/**
* Represents a package program element. Provides access to information
* about the package and its members.
...
...
@@ -49,7 +51,7 @@ public interface PackageElement extends Element, QualifiedNameable {
/**
* Returns the simple name of this package. For an unnamed
* package, an empty name is returned
* package, an empty name is returned
.
*
* @return the simple name of this package or an empty name if
* this is an unnamed package
...
...
@@ -57,6 +59,18 @@ public interface PackageElement extends Element, QualifiedNameable {
@Override
Name
getSimpleName
();
/**
* Returns the {@linkplain NestingKind#TOP_LEVEL top-level}
* classes and interfaces within this package. Note that
* subpackages are <em>not</em> considered to be enclosed by a
* package.
*
* @return the top-level classes and interfaces within this
* package
*/
@Override
List
<?
extends
Element
>
getEnclosedElements
();
/**
* Returns {@code true} is this is an unnamed package and {@code
* false} otherwise.
...
...
src/share/classes/javax/lang/model/element/TypeElement.java
浏览文件 @
a992416d
/*
* Copyright (c) 2005, 201
1
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 201
2
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
...
...
@@ -61,7 +61,12 @@ import javax.lang.model.util.*;
*/
public
interface
TypeElement
extends
Element
,
Parameterizable
,
QualifiedNameable
{
/**
* {@inheritDoc}
* Returns the fields, methods, constructors, and member types
* that are directly declared in this class or interface.
*
* This includes any (implicit) default constructor and
* the implicit {@code values} and {@code valueOf} methods of an
* enum type.
*
* <p> Note that as a particular instance of the {@linkplain
* javax.lang.model.element general accuracy requirements} and the
...
...
@@ -75,6 +80,7 @@ public interface TypeElement extends Element, Parameterizable, QualifiedNameable
*
* @return the enclosed elements in proper order, or an empty list if none
*/
@Override
List
<?
extends
Element
>
getEnclosedElements
();
/**
...
...
test/tools/javac/cast/7123100/T7123100a.java
0 → 100644
浏览文件 @
a992416d
/*
* @test /nodynamiccopyright/
* @bug 7123100
* @summary javac fails with java.lang.StackOverflowError
* @compile/fail/ref=T7123100a.out -Werror -Xlint:unchecked -XDrawDiagnostics T7123100a.java
*/
class
T7123100a
{
<
E
extends
Enum
<
E
>>
E
m
()
{
return
null
;
}
<
Z
>
void
test
()
{
Z
z
=
(
Z
)
m
();
}
}
test/tools/javac/cast/7123100/T7123100a.out
0 → 100644
浏览文件 @
a992416d
T7123100a.java:14:19: compiler.warn.prob.found.req: (compiler.misc.unchecked.cast.to.type), compiler.misc.type.captureof: 1, ?, Z
- compiler.err.warnings.and.werror
1 error
1 warning
test/tools/javac/cast/7123100/T7123100b.java
0 → 100644
浏览文件 @
a992416d
/*
* @test /nodynamiccopyright/
* @bug 7123100
* @summary javac fails with java.lang.StackOverflowError
* @compile/fail/ref=T7123100b.out -Werror -Xlint:unchecked -XDrawDiagnostics T7123100b.java
*/
class
T7123100b
{
<
Z
>
void
test
(
Enum
<?>
e
)
{
Z
z
=
(
Z
)
e
;
}
}
test/tools/javac/cast/7123100/T7123100b.out
0 → 100644
浏览文件 @
a992416d
T7123100b.java:10:18: compiler.warn.prob.found.req: (compiler.misc.unchecked.cast.to.type), java.lang.Enum<compiler.misc.type.captureof: 1, ?>, Z
- compiler.err.warnings.and.werror
1 error
1 warning
test/tools/javac/cast/7123100/T7123100c.java
0 → 100644
浏览文件 @
a992416d
/*
* @test /nodynamiccopyright/
* @bug 7123100
* @summary javac fails with java.lang.StackOverflowError
* @compile/fail/ref=T7123100c.out -Werror -Xlint:unchecked -XDrawDiagnostics T7123100c.java
*/
class
T7123100c
{
<
E
>
E
m
(
E
e
)
{
return
null
;
}
<
Z
>
void
test
(
Enum
<?>
e
)
{
Z
z
=
(
Z
)
m
(
e
);
}
}
test/tools/javac/cast/7123100/T7123100c.out
0 → 100644
浏览文件 @
a992416d
T7123100c.java:14:19: compiler.warn.prob.found.req: (compiler.misc.unchecked.cast.to.type), java.lang.Enum<compiler.misc.type.captureof: 1, ?>, Z
- compiler.err.warnings.and.werror
1 error
1 warning
test/tools/javac/cast/7123100/T7123100d.java
0 → 100644
浏览文件 @
a992416d
/*
* @test /nodynamiccopyright/
* @bug 7123100
* @summary javac fails with java.lang.StackOverflowError
* @compile/fail/ref=T7123100d.out -Werror -Xlint:unchecked -XDrawDiagnostics T7123100d.java
*/
class
T7123100d
{
<
E
extends
Enum
<
E
>>
E
m
(
Enum
<
E
>
e
)
{
return
null
;
}
<
Z
>
void
test
(
Enum
<?>
e
)
{
Z
z
=
(
Z
)
m
(
e
);
}
}
test/tools/javac/cast/7123100/T7123100d.out
0 → 100644
浏览文件 @
a992416d
T7123100d.java:14:19: compiler.warn.prob.found.req: (compiler.misc.unchecked.cast.to.type), compiler.misc.type.captureof: 1, ?, Z
- compiler.err.warnings.and.werror
1 error
1 warning
test/tools/javac/cast/7126754/T7126754.java
0 → 100644
浏览文件 @
a992416d
/*
* @test /nodynamiccopyright/
* @author mcimadamore
* @bug 7005671
* @summary Generics compilation failure casting List<? extends Set...> to List<Set...>
* @compile/fail/ref=T7126754.out -Xlint:unchecked -Werror -XDrawDiagnostics T7126754.java
*/
import
java.util.List
;
class
T7126754
{
List
<?
extends
List
<?
extends
String
>>
c
=
null
;
List
<
List
<?
extends
String
>>
d
=
(
List
<
List
<?
extends
String
>>)
c
;
}
test/tools/javac/cast/7126754/T7126754.out
0 → 100644
浏览文件 @
a992416d
T7126754.java:13:68: compiler.warn.prob.found.req: (compiler.misc.unchecked.cast.to.type), java.util.List<compiler.misc.type.captureof: 1, ? extends java.util.List<? extends java.lang.String>>, java.util.List<java.util.List<? extends java.lang.String>>
- compiler.err.warnings.and.werror
1 error
1 warning
test/tools/javac/diags/CheckExamples.java
浏览文件 @
a992416d
...
...
@@ -23,10 +23,13 @@
/*
* @test
* @bug 6968063
* @bug 6968063
7127924
* @summary provide examples of code that generate diagnostics
* @build Example CheckExamples
* @run main CheckExamples
* @run main/othervm CheckExamples
*/
/*
* See CR 7127924 for info on why othervm is used.
*/
import
java.io.*
;
...
...
test/tools/javac/diags/MessageInfo.java
浏览文件 @
a992416d
...
...
@@ -23,10 +23,13 @@
/**
* @test
* @bug 7013272
* @bug 7013272
7127924
* @summary Automatically generate info about how compiler resource keys are used
* @build Example ArgTypeCompilerFactory MessageFile MessageInfo
* @run main MessageInfo
* @run main/othervm MessageInfo
*/
/*
* See CR 7127924 for info on why othervm is used.
*/
import
java.io.*
;
...
...
test/tools/javac/diags/RunExamples.java
浏览文件 @
a992416d
...
...
@@ -23,10 +23,13 @@
/**
* @test
* @bug 6968063
* @bug 6968063
7127924
* @summary provide examples of code that generate diagnostics
* @build ArgTypeCompilerFactory Example HTMLWriter RunExamples
* @run main RunExamples
* @run main/othervm RunExamples
*/
/*
* See CR 7127924 for info on why othervm is used.
*/
import
java.io.*
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录