Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_langtools
提交
4ae97c68
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看板
提交
4ae97c68
编写于
4月 15, 2008
作者:
T
tbell
浏览文件
操作
浏览文件
下载
差异文件
Merge
上级
18ba2ad5
3dfecceb
变更
18
隐藏空白更改
内联
并排
Showing
18 changed file
with
425 addition
and
47 deletion
+425
-47
src/share/classes/com/sun/tools/javac/code/Type.java
src/share/classes/com/sun/tools/javac/code/Type.java
+15
-0
src/share/classes/com/sun/tools/javac/code/Types.java
src/share/classes/com/sun/tools/javac/code/Types.java
+44
-27
src/share/classes/com/sun/tools/javac/comp/Attr.java
src/share/classes/com/sun/tools/javac/comp/Attr.java
+5
-3
src/share/classes/com/sun/tools/javac/comp/Check.java
src/share/classes/com/sun/tools/javac/comp/Check.java
+11
-1
src/share/classes/com/sun/tools/javac/comp/TransTypes.java
src/share/classes/com/sun/tools/javac/comp/TransTypes.java
+4
-2
src/share/classes/com/sun/tools/javac/parser/Parser.java
src/share/classes/com/sun/tools/javac/parser/Parser.java
+3
-0
test/tools/javac/generics/5009937/T5009937.java
test/tools/javac/generics/5009937/T5009937.java
+41
-0
test/tools/javac/generics/5009937/T5009937.out
test/tools/javac/generics/5009937/T5009937.out
+2
-0
test/tools/javac/generics/6531075/T6531075.java
test/tools/javac/generics/6531075/T6531075.java
+66
-0
test/tools/javac/generics/Casting5.java
test/tools/javac/generics/Casting5.java
+45
-0
test/tools/javac/generics/InheritanceConflict.java
test/tools/javac/generics/InheritanceConflict.java
+5
-2
test/tools/javac/generics/InheritanceConflict2.java
test/tools/javac/generics/InheritanceConflict2.java
+5
-2
test/tools/javac/generics/T6481655.java
test/tools/javac/generics/T6481655.java
+41
-0
test/tools/javac/generics/T6657499.java
test/tools/javac/generics/T6657499.java
+44
-0
test/tools/javac/generics/inference/6356673/T6365166.java
test/tools/javac/generics/inference/6356673/T6365166.java
+40
-0
test/tools/javac/generics/inference/6611449/T6611449.java
test/tools/javac/generics/inference/6611449/T6611449.java
+6
-6
test/tools/javac/generics/inference/6611449/T6611449.out
test/tools/javac/generics/inference/6611449/T6611449.out
+4
-4
test/tools/javac/generics/wildcards/T6450290.java
test/tools/javac/generics/wildcards/T6450290.java
+44
-0
未找到文件。
src/share/classes/com/sun/tools/javac/code/Type.java
浏览文件 @
4ae97c68
...
...
@@ -640,6 +640,10 @@ public class Type implements PrimitiveType {
return
typarams_field
;
}
public
boolean
hasErasedSupertypes
()
{
return
isRaw
();
}
public
Type
getEnclosingType
()
{
return
outer_field
;
}
...
...
@@ -711,6 +715,17 @@ public class Type implements PrimitiveType {
}
}
public
static
class
ErasedClassType
extends
ClassType
{
public
ErasedClassType
(
Type
outer
,
TypeSymbol
tsym
)
{
super
(
outer
,
List
.<
Type
>
nil
(),
tsym
);
}
@Override
public
boolean
hasErasedSupertypes
()
{
return
true
;
}
}
public
static
class
ArrayType
extends
Type
implements
javax
.
lang
.
model
.
type
.
ArrayType
{
...
...
src/share/classes/com/sun/tools/javac/code/Types.java
浏览文件 @
4ae97c68
...
...
@@ -1499,47 +1499,68 @@ public class Types {
* type parameters in t are deleted.
*/
public
Type
erasure
(
Type
t
)
{
return
erasure
(
t
,
false
);
}
//where
private
Type
erasure
(
Type
t
,
boolean
recurse
)
{
if
(
t
.
tag
<=
lastBaseTag
)
return
t
;
/* fast special case */
else
return
erasure
.
visit
(
t
);
return
erasure
.
visit
(
t
,
recurse
);
}
// where
private
UnaryVisitor
<
Type
>
erasure
=
new
UnaryVisitor
<
Type
>()
{
public
Type
visitType
(
Type
t
,
Void
ignored
)
{
private
SimpleVisitor
<
Type
,
Boolean
>
erasure
=
new
SimpleVisitor
<
Type
,
Boolean
>()
{
public
Type
visitType
(
Type
t
,
Boolean
recurse
)
{
if
(
t
.
tag
<=
lastBaseTag
)
return
t
;
/*fast special case*/
else
return
t
.
map
(
erasureFun
);
return
t
.
map
(
recurse
?
erasureRecFun
:
erasureFun
);
}
@Override
public
Type
visitWildcardType
(
WildcardType
t
,
Void
ignored
)
{
return
erasure
(
upperBound
(
t
));
public
Type
visitWildcardType
(
WildcardType
t
,
Boolean
recurse
)
{
return
erasure
(
upperBound
(
t
)
,
recurse
);
}
@Override
public
Type
visitClassType
(
ClassType
t
,
Void
ignored
)
{
return
t
.
tsym
.
erasure
(
Types
.
this
);
public
Type
visitClassType
(
ClassType
t
,
Boolean
recurse
)
{
Type
erased
=
t
.
tsym
.
erasure
(
Types
.
this
);
if
(
recurse
)
{
erased
=
new
ErasedClassType
(
erased
.
getEnclosingType
(),
erased
.
tsym
);
}
return
erased
;
}
@Override
public
Type
visitTypeVar
(
TypeVar
t
,
Void
ignored
)
{
return
erasure
(
t
.
bound
);
public
Type
visitTypeVar
(
TypeVar
t
,
Boolean
recurse
)
{
return
erasure
(
t
.
bound
,
recurse
);
}
@Override
public
Type
visitErrorType
(
ErrorType
t
,
Void
ignored
)
{
public
Type
visitErrorType
(
ErrorType
t
,
Boolean
recurse
)
{
return
t
;
}
};
private
Mapping
erasureFun
=
new
Mapping
(
"erasure"
)
{
public
Type
apply
(
Type
t
)
{
return
erasure
(
t
);
}
};
private
Mapping
erasureRecFun
=
new
Mapping
(
"erasureRecursive"
)
{
public
Type
apply
(
Type
t
)
{
return
erasureRecursive
(
t
);
}
};
public
List
<
Type
>
erasure
(
List
<
Type
>
ts
)
{
return
Type
.
map
(
ts
,
erasureFun
);
}
public
Type
erasureRecursive
(
Type
t
)
{
return
erasure
(
t
,
true
);
}
public
List
<
Type
>
erasureRecursive
(
List
<
Type
>
ts
)
{
return
Type
.
map
(
ts
,
erasureRecFun
);
}
// </editor-fold>
// <editor-fold defaultstate="collapsed" desc="makeCompoundType">
...
...
@@ -1626,15 +1647,14 @@ public class Types {
if
(
t
.
supertype_field
==
null
)
{
List
<
Type
>
actuals
=
classBound
(
t
).
allparams
();
List
<
Type
>
formals
=
t
.
tsym
.
type
.
allparams
();
if
(
actuals
.
isEmpty
())
{
if
(
formals
.
isEmpty
())
// Should not happen. See comments below in interfaces
t
.
supertype_field
=
supertype
;
else
t
.
supertype_field
=
erasure
(
supertype
);
}
else
{
if
(
t
.
hasErasedSupertypes
())
{
t
.
supertype_field
=
erasureRecursive
(
supertype
);
}
else
if
(
formals
.
nonEmpty
())
{
t
.
supertype_field
=
subst
(
supertype
,
formals
,
actuals
);
}
else
{
t
.
supertype_field
=
supertype
;
}
}
}
return
t
.
supertype_field
;
...
...
@@ -1708,18 +1728,15 @@ public class Types {
assert
t
!=
t
.
tsym
.
type
:
t
.
toString
();
List
<
Type
>
actuals
=
t
.
allparams
();
List
<
Type
>
formals
=
t
.
tsym
.
type
.
allparams
();
if
(
actuals
.
isEmpty
())
{
if
(
formals
.
isEmpty
())
{
// In this case t is not generic (nor raw).
// So this should not happen.
t
.
interfaces_field
=
interfaces
;
}
else
{
t
.
interfaces_field
=
erasure
(
interfaces
);
}
}
else
{
if
(
t
.
hasErasedSupertypes
())
{
t
.
interfaces_field
=
erasureRecursive
(
interfaces
);
}
else
if
(
formals
.
nonEmpty
())
{
t
.
interfaces_field
=
upperBounds
(
subst
(
interfaces
,
formals
,
actuals
));
}
else
{
t
.
interfaces_field
=
interfaces
;
}
}
}
return
t
.
interfaces_field
;
...
...
src/share/classes/com/sun/tools/javac/comp/Attr.java
浏览文件 @
4ae97c68
...
...
@@ -1810,7 +1810,7 @@ public class Attr extends JCTree.Visitor {
chk
.
earlyRefError
(
tree
.
pos
(),
sym
.
kind
==
VAR
?
sym
:
thisSym
(
tree
.
pos
(),
env
));
}
Env
<
AttrContext
>
env1
=
env
;
if
(
sym
.
kind
!=
ERR
&&
sym
.
owner
!=
null
&&
sym
.
owner
!=
env1
.
enclClass
.
sym
)
{
if
(
sym
.
kind
!=
ERR
&&
sym
.
kind
!=
TYP
&&
sym
.
owner
!=
null
&&
sym
.
owner
!=
env1
.
enclClass
.
sym
)
{
// If the found symbol is inaccessible, then it is
// accessed through an enclosing instance. Locate this
// enclosing instance:
...
...
@@ -1878,8 +1878,10 @@ public class Attr extends JCTree.Visitor {
boolean
varArgs
=
env
.
info
.
varArgs
;
tree
.
sym
=
sym
;
if
(
site
.
tag
==
TYPEVAR
&&
!
isType
(
sym
)
&&
sym
.
kind
!=
ERR
)
site
=
capture
(
site
.
getUpperBound
());
if
(
site
.
tag
==
TYPEVAR
&&
!
isType
(
sym
)
&&
sym
.
kind
!=
ERR
)
{
while
(
site
.
tag
==
TYPEVAR
)
site
=
site
.
getUpperBound
();
site
=
capture
(
site
);
}
// If that symbol is a variable, ...
if
(
sym
.
kind
==
VAR
)
{
...
...
src/share/classes/com/sun/tools/javac/comp/Check.java
浏览文件 @
4ae97c68
...
...
@@ -1247,7 +1247,7 @@ public class Check {
for
(
Type
t2
=
sup
;
t2
.
tag
==
CLASS
;
t2
=
types
.
supertype
(
t2
))
{
for
(
Scope
.
Entry
e2
=
t
1
.
tsym
.
members
().
lookup
(
s1
.
name
);
for
(
Scope
.
Entry
e2
=
t
2
.
tsym
.
members
().
lookup
(
s1
.
name
);
e2
.
scope
!=
null
;
e2
=
e2
.
next
())
{
Symbol
s2
=
e2
.
sym
;
...
...
@@ -1394,6 +1394,16 @@ public class Check {
while
(
e
.
scope
!=
null
)
{
if
(
m
.
overrides
(
e
.
sym
,
origin
,
types
,
false
))
checkOverride
(
tree
,
m
,
(
MethodSymbol
)
e
.
sym
,
origin
);
else
if
(
e
.
sym
.
isInheritedIn
(
origin
,
types
)
&&
!
m
.
isConstructor
())
{
Type
er1
=
m
.
erasure
(
types
);
Type
er2
=
e
.
sym
.
erasure
(
types
);
if
(
types
.
isSameType
(
er1
,
er2
))
{
log
.
error
(
TreeInfo
.
diagnosticPositionFor
(
m
,
tree
),
"name.clash.same.erasure.no.override"
,
m
,
m
.
location
(),
e
.
sym
,
e
.
sym
.
location
());
}
}
e
=
e
.
next
();
}
}
...
...
src/share/classes/com/sun/tools/javac/comp/TransTypes.java
浏览文件 @
4ae97c68
...
...
@@ -690,13 +690,15 @@ public class TransTypes extends TreeTranslator {
public
void
visitSelect
(
JCFieldAccess
tree
)
{
Type
t
=
tree
.
selected
.
type
;
if
(
t
.
isCompound
()
||
(
t
.
tag
==
TYPEVAR
&&
t
.
getUpperBound
().
isCompound
()))
{
while
(
t
.
tag
==
TYPEVAR
)
t
=
t
.
getUpperBound
();
if
(
t
.
isCompound
())
{
if
((
tree
.
sym
.
flags
()
&
IPROXY
)
!=
0
)
{
tree
.
sym
=
((
MethodSymbol
)
tree
.
sym
).
implemented
((
TypeSymbol
)
tree
.
sym
.
owner
,
types
);
}
tree
.
selected
=
cast
(
translate
(
tree
.
selected
,
erasure
(
t
)),
translate
(
tree
.
selected
,
erasure
(
t
ree
.
selected
.
type
)),
erasure
(
tree
.
sym
.
owner
.
type
));
}
else
tree
.
selected
=
translate
(
tree
.
selected
,
erasure
(
t
));
...
...
src/share/classes/com/sun/tools/javac/parser/Parser.java
浏览文件 @
4ae97c68
...
...
@@ -1006,7 +1006,10 @@ public class Parser {
break
loop
;
case
DOT:
S
.
nextToken
();
int
oldmode
=
mode
;
mode
&=
~
NOPARAMS
;
typeArgs
=
typeArgumentsOpt
(
EXPR
);
mode
=
oldmode
;
if
((
mode
&
EXPR
)
!=
0
)
{
switch
(
S
.
token
())
{
case
CLASS:
...
...
test/tools/javac/generics/5009937/T5009937.java
0 → 100644
浏览文件 @
4ae97c68
/*
* Copyright 2008 Sun Microsystems, Inc. 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
/*
* @test
* @bug 5009937
* @summary hiding versus generics versus binary compatibility
* @author Maurizio Cimadamore
*
* @compile/fail/ref=T5009937.out -XDstdout -XDrawDiagnostics T5009937.java
*/
public
class
T5009937
<
X
>
{
static
class
A
{
static
void
m
(
T5009937
<
String
>
l
)
{}
}
static
class
B
extends
A
{
static
void
m
(
T5009937
<
Integer
>
l
)
{}
}
}
test/tools/javac/generics/5009937/T5009937.out
0 → 100644
浏览文件 @
4ae97c68
T5009937.java:39:21: compiler.err.name.clash.same.erasure.no.override: m(T5009937<java.lang.Integer>), T5009937.B, m(T5009937<java.lang.String>), T5009937.A
1 error
test/tools/javac/generics/6531075/T6531075.java
0 → 100644
浏览文件 @
4ae97c68
/*
* Copyright 2008 Sun Microsystems, Inc. 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
/*
* @test
* @bug 6531075
*
* @summary Missing synthetic casts when accessing fields/methods of intersection types including type variables
* @author Maurizio Cimadamore
*
*/
public
class
T6531075
{
static
class
A
{
void
a
()
{}
}
static
interface
I
{
void
i
();
}
static
class
E
extends
A
implements
I
{
public
void
i
()
{}
}
static
class
C
<
W
extends
A
&
I
,
T
extends
W
>{
T
t
;
W
w
;
C
(
W
w
,
T
t
)
{
this
.
w
=
w
;
this
.
t
=
t
;
}
}
public
static
void
main
(
String
...
args
)
{
C
<
E
,
E
>
c
=
new
C
<
E
,
E
>(
new
E
(),
new
E
());
testMemberMethods
(
c
);
}
static
void
testMemberMethods
(
C
<?,
?>
arg
)
{
arg
.
t
.
a
();
arg
.
t
.
i
();
}
}
test/tools/javac/generics/Casting5.java
0 → 100644
浏览文件 @
4ae97c68
/*
* Copyright 2004 Sun Microsystems, Inc. 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
/*
* @test
* @bug 6559182
* @summary Cast from a raw type with non-generic supertype to a raw type fails unexpectedly
* @author Maurizio Cimadamore
*
* @compile Casting5.java
*/
class
Casting5
{
static
interface
Super
<
P
>
{}
static
class
Y
implements
Super
<
Integer
>{}
static
interface
X
extends
Super
<
Double
>{}
static
class
S
<
L
>
extends
Y
{}
static
interface
T
<
L
>
extends
X
{}
public
static
void
main
(
String
...
args
)
{
S
s
=
null
;
// same if I use S<Byte>
T
t
=
null
;
// same if I use T<Byte>
t
=
(
T
)
s
;
}
}
test/tools/javac/generics/InheritanceConflict.java
浏览文件 @
4ae97c68
...
...
@@ -25,7 +25,7 @@
* @test
* @bug 4984158
* @summary two inherited methods with same signature
* @author gafter
* @author gafter
, Maurizio Cimadamore
*
* @compile/fail -source 1.5 InheritanceConflict.java
*/
...
...
@@ -34,8 +34,11 @@ package inheritance.conflict;
class
A
<
T
>
{
void
f
(
String
s
)
{}
}
class
B
<
T
>
extends
A
<
T
>
{
void
f
(
T
t
)
{}
}
class
B
extends
A
<
String
>
{
class
C
extends
B
<
String
>
{
}
test/tools/javac/generics/InheritanceConflict2.java
浏览文件 @
4ae97c68
...
...
@@ -25,7 +25,7 @@
* @test
* @bug 4984158
* @summary two inherited methods with same signature
* @author gafter
* @author gafter
, Maurizio Cimadamore
*
* @compile -source 1.5 InheritanceConflict2.java
*/
...
...
@@ -34,9 +34,12 @@ package inheritance.conflict2;
class
A
<
T
>
{
void
f
(
String
s
)
{}
}
class
B
<
T
>
extends
A
<
T
>
{
void
f
(
T
t
)
{}
}
class
B
extends
A
<
String
>
{
class
C
extends
B
<
String
>
{
void
f
(
String
s
)
{}
}
test/tools/javac/generics/T6481655.java
0 → 100644
浏览文件 @
4ae97c68
/*
* Copyright 2008 Sun Microsystems, Inc. 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
/*
* @test
* @bug 6481655
* @summary Parser confused by combination of parens and explicit type args
* @author Maurizio Cimadamore
*/
public
class
T6481655
{
public
static
<
T
>
T
getT
(
T
t
)
{
return
t
;
}
public
static
void
main
(
String
...
s
)
{
T6481655
.<
String
>
getT
(
""
);
(
T6481655
.<
String
>
getT
(
""
)).
getClass
();
}
}
test/tools/javac/generics/T6657499.java
0 → 100644
浏览文件 @
4ae97c68
/*
* Copyright 2008 Sun Microsystems, Inc. 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
/*
* @test
*
* @bug 6657499
* @summary generics: javac 1.6.0 fails to compile class with inner class
* @author Maurizio Cimadamore
*
*/
public
class
T6657499
<
T
>
{
T
t
;
public
T
test
()
{
class
Local
{
private
T
t
;};
class
Local2
{
T
m
()
{
return
t
;}};
T
t3
=
new
Local
().
t
;
return
new
Local2
().
m
();
}
public
static
void
main
(
String
[]
args
)
{
String
s
=
new
T6657499
<
String
>().
test
();
}
}
test/tools/javac/generics/inference/6356673/T6365166.java
0 → 100644
浏览文件 @
4ae97c68
/*
* Copyright 2008 Sun Microsystems, Inc. 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
/**
* @test
* @bug 6365166
* @summary javac (generic) unable to resolve methods
* @author Maurizio Cimadamore
*
* @compile T6365166.java
*/
import
java.util.*
;
public
class
T6365166
{
static
<
A
>
void
add
(
List
<?
super
A
>
l
,
List
<
A
>
la
)
{
l
.
addAll
(
la
);
//doesn't compile - but it should
}
}
test/tools/javac/generics/inference/6611449/T6611449.java
浏览文件 @
4ae97c68
...
...
@@ -29,18 +29,18 @@
*/
public
class
T6611449
<
S
>
{
T6611449
()
{
this
(
1
);}
<
T
extends
S
>
T6611449
(
T
t1
)
{
this
(
t1
,
1
);}
<
T
extends
S
>
T6611449
(
T
t1
)
{}
<
T
extends
S
>
T6611449
(
T
t1
,
T
t2
)
{}
<
T
extends
S
>
void
m
(
T
t1
)
{}
<
T
extends
S
>
void
m
1
(
T
t1
)
{}
<
T
extends
S
>
void
m
(
T
t1
,
T
t2
)
{}
<
T
extends
S
>
void
m
2
(
T
t1
,
T
t2
)
{}
void
test
()
{
new
T6611449
<
S
>(
1
);
new
T6611449
<
S
>(
1
,
1
);
//internal error: lub is erroneously applied to primitive types
m1
(
1
);
m2
(
1
,
1
);
m2
(
1
,
1
);
//internal error: lub is erroneously applied to primitive types
}
}
test/tools/javac/generics/inference/6611449/T6611449.out
浏览文件 @
4ae97c68
T6611449.java:
32:17
: compiler.err.cant.resolve.location: (- compiler.misc.kindname.constructor), T6611449, (int), , (- compiler.misc.kindname.class), T6611449<S>
T6611449.java:
34:35: compiler.err.cant.resolve.location: (- compiler.misc.kindname.constructor), T6611449, (T
,int), , (- compiler.misc.kindname.class), T6611449<S>
T6611449.java:43:9: compiler.err.cant.
resolve.location: (- compiler.misc.kindname.method), m1, (int), , (- compiler.misc.kindname.class), T6611449<S>
T6611449.java:44:9: compiler.err.cant.
resolve.location: (- compiler.misc.kindname.method), m2, (int,int), , (- compiler.misc.kindname.class), T6611449<S>
T6611449.java:
41:9
: compiler.err.cant.resolve.location: (- compiler.misc.kindname.constructor), T6611449, (int), , (- compiler.misc.kindname.class), T6611449<S>
T6611449.java:
42:9: compiler.err.cant.resolve.location: (- compiler.misc.kindname.constructor), T6611449, (int
,int), , (- compiler.misc.kindname.class), T6611449<S>
T6611449.java:43:9: compiler.err.cant.
apply.symbol: <T>m1(T), T6611449<S>, , int, null
T6611449.java:44:9: compiler.err.cant.
apply.symbol: <T>m2(T,T), T6611449<S>, , int,int, null
4 errors
test/tools/javac/generics/wildcards/T6450290.java
0 → 100644
浏览文件 @
4ae97c68
/*
* Copyright 2004-2006 Sun Microsystems, Inc. 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
/*
* @test
* @bug 6450290
* @summary Capture of nested wildcards causes type error
* @author Maurizio Cimadamore
* @compile/fail T6450290.java
*/
public
class
T6450290
{
static
class
Box
<
X
extends
Box
<?,?>,
T
extends
X
>
{
T
value
;
Box
<
X
,
T
>
same
;
}
static
class
A
extends
Box
<
A
,
A
>
{}
static
class
B
extends
Box
<
B
,
B
>
{}
public
static
void
main
(
String
[]
args
)
{
Box
<?,?>
b
=
new
Box
<
Box
<
A
,
A
>,
Box
<
A
,
A
>>();
b
.
value
.
same
=
new
Box
<
B
,
B
>();
//javac misses this bad assignment
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录