Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_langtools
提交
fcde5bf5
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看板
提交
fcde5bf5
编写于
6月 07, 2010
作者:
L
lana
浏览文件
操作
浏览文件
下载
差异文件
Merge
上级
c072bdde
acc99d3c
变更
15
隐藏空白更改
内联
并排
Showing
15 changed file
with
280 addition
and
18 deletion
+280
-18
src/share/classes/com/sun/tools/javac/code/Types.java
src/share/classes/com/sun/tools/javac/code/Types.java
+21
-7
src/share/classes/com/sun/tools/javac/comp/Attr.java
src/share/classes/com/sun/tools/javac/comp/Attr.java
+11
-5
src/share/classes/com/sun/tools/javac/comp/Check.java
src/share/classes/com/sun/tools/javac/comp/Check.java
+8
-4
test/Makefile
test/Makefile
+14
-2
test/tools/javac/6948381/T6948381.java
test/tools/javac/6948381/T6948381.java
+29
-0
test/tools/javac/6948381/npe/A.java
test/tools/javac/6948381/npe/A.java
+28
-0
test/tools/javac/6948381/npe/B.java
test/tools/javac/6948381/npe/B.java
+26
-0
test/tools/javac/generics/6946618/T6946618a.java
test/tools/javac/generics/6946618/T6946618a.java
+21
-0
test/tools/javac/generics/6946618/T6946618a.out
test/tools/javac/generics/6946618/T6946618a.out
+2
-0
test/tools/javac/generics/6946618/T6946618b.java
test/tools/javac/generics/6946618/T6946618b.java
+21
-0
test/tools/javac/generics/6946618/T6946618b.out
test/tools/javac/generics/6946618/T6946618b.out
+2
-0
test/tools/javac/generics/6946618/T6946618c.java
test/tools/javac/generics/6946618/T6946618c.java
+17
-0
test/tools/javac/generics/6946618/T6946618c.out
test/tools/javac/generics/6946618/T6946618c.out
+4
-0
test/tools/javac/generics/diamond/T6951833.java
test/tools/javac/generics/diamond/T6951833.java
+36
-0
test/tools/javac/generics/typevars/T6880344.java
test/tools/javac/generics/typevars/T6880344.java
+40
-0
未找到文件。
src/share/classes/com/sun/tools/javac/code/Types.java
浏览文件 @
fcde5bf5
...
...
@@ -588,10 +588,21 @@ public class Types {
case
BYTE:
case
CHAR:
case
SHORT:
case
INT:
case
LONG:
case
FLOAT:
case
DOUBLE:
case
BOOLEAN:
case
VOID:
case
BOT:
case
NONE:
return
t
.
tag
==
s
.
tag
;
case
TYPEVAR:
return
s
.
isSuperBound
()
&&
!
s
.
isExtendsBound
()
&&
visit
(
t
,
upperBound
(
s
));
case
TYPEVAR:
{
if
(
s
.
tag
==
TYPEVAR
)
{
//type-substitution does not preserve type-var types
//check that type var symbols and bounds are indeed the same
return
t
.
tsym
==
s
.
tsym
&&
visit
(
t
.
getUpperBound
(),
s
.
getUpperBound
());
}
else
{
//special case for s == ? super X, where upper(s) = u
//check that u == t, where u has been set by Type.withTypeVar
return
s
.
isSuperBound
()
&&
!
s
.
isExtendsBound
()
&&
visit
(
t
,
upperBound
(
s
));
}
}
default
:
throw
new
AssertionError
(
"isSameType "
+
t
.
tag
);
}
...
...
@@ -1850,13 +1861,16 @@ public class Types {
/**
* Same as {@link #setBounds(Type.TypeVar,List,Type)}, except that
* third parameter is computed directly. Note that this test
* might cause a symbol completion. Hence, this version of
* third parameter is computed directly, as follows: if all
* all bounds are interface types, the computed supertype is Object,
* otherwise the supertype is simply left null (in this case, the supertype
* is assumed to be the head of the bound list passed as second argument).
* Note that this check might cause a symbol completion. Hence, this version of
* setBounds may not be called during a classfile read.
*/
public
void
setBounds
(
TypeVar
t
,
List
<
Type
>
bounds
)
{
Type
supertype
=
(
bounds
.
head
.
tsym
.
flags
()
&
INTERFACE
)
!=
0
?
s
upertype
(
bounds
.
head
)
:
null
;
s
yms
.
objectType
:
null
;
setBounds
(
t
,
bounds
,
supertype
);
t
.
rank_field
=
-
1
;
}
...
...
src/share/classes/com/sun/tools/javac/comp/Attr.java
浏览文件 @
fcde5bf5
...
...
@@ -1472,7 +1472,7 @@ public class Attr extends JCTree.Visitor {
// Attribute clazz expression and store
// symbol + type back into the attributed tree.
Type
clazztype
=
attribType
(
clazz
,
env
);
Pair
<
Scope
,
Scope
>
mapping
=
getSyntheticScopeMapping
(
(
ClassType
)
clazztype
);
Pair
<
Scope
,
Scope
>
mapping
=
getSyntheticScopeMapping
(
clazztype
);
if
(!
TreeInfo
.
isDiamond
(
tree
))
{
clazztype
=
chk
.
checkClassType
(
tree
.
clazz
.
pos
(),
clazztype
,
true
);
...
...
@@ -1640,9 +1640,10 @@ public class Attr extends JCTree.Visitor {
List
<
Type
>
argtypes
,
List
<
Type
>
typeargtypes
,
boolean
reportErrors
)
{
if
(
clazztype
.
isErroneous
())
{
//if the type of the instance creation expression is erroneous
//return the erroneous type itself
if
(
clazztype
.
isErroneous
()
||
mapping
==
erroneousMapping
)
{
//if the type of the instance creation expression is erroneous,
//or something prevented us to form a valid mapping, return the
//(possibly erroneous) type unchanged
return
clazztype
;
}
else
if
(
clazztype
.
isInterface
())
{
...
...
@@ -1740,7 +1741,10 @@ public class Attr extends JCTree.Visitor {
* inference. The inferred return type of the synthetic constructor IS
* the inferred type for the diamond operator.
*/
private
Pair
<
Scope
,
Scope
>
getSyntheticScopeMapping
(
ClassType
ctype
)
{
private
Pair
<
Scope
,
Scope
>
getSyntheticScopeMapping
(
Type
ctype
)
{
if
(
ctype
.
tag
!=
CLASS
)
{
return
erroneousMapping
;
}
Pair
<
Scope
,
Scope
>
mapping
=
new
Pair
<
Scope
,
Scope
>(
ctype
.
tsym
.
members
(),
new
Scope
(
ctype
.
tsym
));
List
<
Type
>
typevars
=
ctype
.
tsym
.
type
.
getTypeArguments
();
...
...
@@ -1763,6 +1767,8 @@ public class Attr extends JCTree.Visitor {
return
mapping
;
}
private
final
Pair
<
Scope
,
Scope
>
erroneousMapping
=
new
Pair
<
Scope
,
Scope
>(
null
,
null
);
/** Make an attributed null check tree.
*/
public
JCExpression
makeNullCheck
(
JCExpression
arg
)
{
...
...
src/share/classes/com/sun/tools/javac/comp/Check.java
浏览文件 @
fcde5bf5
...
...
@@ -886,6 +886,7 @@ public class Check {
void
checkRaw
(
JCTree
tree
,
Env
<
AttrContext
>
env
)
{
if
(
lint
.
isEnabled
(
Lint
.
LintCategory
.
RAW
)
&&
tree
.
type
.
tag
==
CLASS
&&
!
TreeInfo
.
isDiamond
(
tree
)
&&
!
env
.
enclClass
.
name
.
isEmpty
()
&&
//anonymous or intersection
tree
.
type
.
isRaw
())
{
log
.
warning
(
tree
.
pos
(),
"raw.class.use"
,
tree
.
type
,
tree
.
type
.
tsym
.
type
);
...
...
@@ -915,7 +916,7 @@ public class Check {
List
<
Type
>
actuals
=
tree
.
type
.
allparams
();
List
<
JCExpression
>
args
=
tree
.
arguments
;
List
<
Type
>
forms
=
tree
.
type
.
tsym
.
type
.
getTypeArguments
();
ListBuffer
<
Type
Var
>
tvars_buf
=
new
ListBuffer
<
TypeVar
>();
ListBuffer
<
Type
>
tvars_buf
=
new
ListBuffer
<
Type
>();
// For matching pairs of actual argument types `a' and
// formal type parameters with declared bound `b' ...
...
...
@@ -946,12 +947,15 @@ public class Check {
}
args
=
tree
.
arguments
;
List
<
Type
Var
>
tvars
=
tvars_buf
.
toList
();
List
<
Type
>
tvars
=
tvars_buf
.
toList
();
while
(
args
.
nonEmpty
()
&&
tvars
.
nonEmpty
())
{
Type
actual
=
types
.
subst
(
args
.
head
.
type
,
tree
.
type
.
tsym
.
type
.
getTypeArguments
(),
tvars_buf
.
toList
());
checkExtends
(
args
.
head
.
pos
(),
a
rgs
.
head
.
type
,
tvars
.
head
);
a
ctual
,
(
TypeVar
)
tvars
.
head
);
args
=
args
.
tail
;
tvars
=
tvars
.
tail
;
}
...
...
test/Makefile
浏览文件 @
fcde5bf5
...
...
@@ -50,6 +50,7 @@ ifeq ($(OSNAME), Windows_NT)
endif
endif
endif
EXE_SUFFIX
=
.exe
endif
# Root of this test area (important to use full paths in some places)
...
...
@@ -105,12 +106,13 @@ endif
# PRODUCT_HOME is a JPRT variable pointing to a directory containing the output from
# make/Makefile
# For langtools, this is a directory containing build and dist
# For a control build, this is build/$(PRODUCT)-$(ARCH)/j2sdk-image
# For a control build, this is build/$(PRODUCT)-$(ARCH)/XYZ-image
# (i.e, j2sdk-image or jdk-module-image)
ifdef
PRODUCT_HOME
ifeq
($(shell [ -r $(PRODUCT_HOME)/dist/lib/classes.jar ]; echo $$?),0)
TESTBOOTCLASSPATH
=
$(PRODUCT_HOME)
/dist/lib/classes.jar
endif
ifeq
($(shell [ -r $(PRODUCT_HOME)/
lib/tools.jar
]; echo $$?),0)
ifeq
($(shell [ -r $(PRODUCT_HOME)/
bin/javac$(EXE_SUFFIX)
]; echo $$?),0)
TESTJAVA
=
$(PRODUCT_HOME)
endif
endif
...
...
@@ -150,6 +152,16 @@ ifdef JCK_GROUP_SIZE
### -jtoptions:-Ejck.env.runtime.testCompile.groupMode.groupSize=$(JCK_GROUP_SIZE)
endif
# Timeouts -- by default, increase test timeouts when running on JPRT
ifdef
JPRT_JOB_ID
ifndef
JTREG_TIMEOUT_FACTOR
JTREG_TIMEOUT_FACTOR
=
3
endif
endif
ifdef
JTREG_TIMEOUT_FACTOR
JTREG_OPTIONS
+=
-timeoutFactor
:
$(JTREG_TIMEOUT_FACTOR)
endif
# Assertions: some tests show failures when assertions are enabled.
# Since javac is typically loaded via the bootclassloader (either via TESTJAVA
# or TESTBOOTCLASSPATH), you may need -esa to enable assertions in javac.
...
...
test/tools/javac/6948381/T6948381.java
0 → 100644
浏览文件 @
fcde5bf5
/*
* Copyright 2010 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 6948381
* @summary javac Null Pointer Exception in Types.makeCompoundType
* @compile npe/A.java npe/B.java
*/
test/tools/javac/6948381/npe/A.java
0 → 100644
浏览文件 @
fcde5bf5
/*
* Copyright 2010 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.
*/
package
npe
;
import
npe.B.*
;
public
interface
A
{}
test/tools/javac/6948381/npe/B.java
0 → 100644
浏览文件 @
fcde5bf5
/*
* Copyright 2010 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.
*/
package
npe
;
public
interface
B
<
T
extends
A
&
java
.
io
.
Serializable
>
{}
test/tools/javac/generics/6946618/T6946618a.java
0 → 100644
浏览文件 @
fcde5bf5
/*
* @test /nodynamiccopyright/
* @bug 6946618
* @summary sqe test fails: javac/generics/NewOnTypeParm in pit jdk7 b91 in all platforms.
* @author mcimadamore
* @compile/fail/ref=T6946618a.out -XDrawDiagnostics T6946618a.java
*/
class
T6946618a
{
static
class
C
<
T
>
{
T
makeT
()
{
return
new
T
();
//error
}
}
static
class
D
<
S
>
{
C
<
S
>
makeC
()
{
return
new
C
<
S
>();
//ok
}
}
}
test/tools/javac/generics/6946618/T6946618a.out
0 → 100644
浏览文件 @
fcde5bf5
T6946618a.java:12:20: compiler.err.type.found.req: (compiler.misc.type.parameter: T), (compiler.misc.type.req.class)
1 error
test/tools/javac/generics/6946618/T6946618b.java
0 → 100644
浏览文件 @
fcde5bf5
/*
* @test /nodynamiccopyright/
* @bug 6946618
* @summary sqe test fails: javac/generics/NewOnTypeParm in pit jdk7 b91 in all platforms.
* @author mcimadamore
* @compile/fail/ref=T6946618b.out -XDrawDiagnostics T6946618b.java
*/
class
T6946618b
{
static
class
C
<
T
>
{
T
makeT
()
{
return
new
T
<>();
//error
}
}
static
class
D
<
S
>
{
C
<
S
>
makeC
()
{
return
new
C
<>();
//ok
}
}
}
test/tools/javac/generics/6946618/T6946618b.out
0 → 100644
浏览文件 @
fcde5bf5
T6946618b.java:12:20: compiler.err.type.found.req: (compiler.misc.type.parameter: T), (compiler.misc.type.req.class)
1 error
test/tools/javac/generics/6946618/T6946618c.java
0 → 100644
浏览文件 @
fcde5bf5
/*
* @test /nodynamiccopyright/
* @bug 6946618
* @summary sqe test fails: javac/generics/NewOnTypeParm in pit jdk7 b91 in all platforms.
* @author mcimadamore
* @compile/fail/ref=T6946618c.out -XDrawDiagnostics T6946618c.java
*/
class
T6946618c
{
static
class
C
<
T
>
{
}
void
test
()
{
C
<?>
c1
=
new
C
<?
extends
String
>();
C
<?>
c2
=
new
C
<?
super
String
>();
C
<?>
c3
=
new
C
<?>();
}
}
test/tools/javac/generics/6946618/T6946618c.out
0 → 100644
浏览文件 @
fcde5bf5
T6946618c.java:13:24: compiler.err.type.found.req: ? extends java.lang.String, class or interface without bounds
T6946618c.java:14:24: compiler.err.type.found.req: ? super java.lang.String, class or interface without bounds
T6946618c.java:15:24: compiler.err.type.found.req: ?, class or interface without bounds
3 errors
test/tools/javac/generics/diamond/T6951833.java
0 → 100644
浏览文件 @
fcde5bf5
/*
* Copyright 2010 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 6951833
*
* @summary latest diamond implementation generates spurious raw type warnings
* @author mcimadamore
* @compile -Xlint:rawtypes -Werror T6951833.java
*
*/
class
T6951833
<
X
>
{
T6951833
<
String
>
bug
=
new
T6951833
<>();
}
test/tools/javac/generics/typevars/T6880344.java
0 → 100644
浏览文件 @
fcde5bf5
/*
* Copyright 2009 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 6880344
* @summary Recursive type parameters do not compile
* @author mcimadamore
* @compile T6880344.java
*/
class
T6880344
{
static
class
A
<
X1
extends
G
<
X1
>>
{
public
A
<
N
<
X1
>>
xyz
;
}
static
class
N
<
X2
extends
G
<
X2
>>
implements
G
<
N
<
X2
>>
{
}
interface
G
<
X3
extends
G
<
X3
>>
{
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录