Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_langtools
提交
6c3e30ee
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看板
提交
6c3e30ee
编写于
4月 23, 2015
作者:
L
lana
浏览文件
操作
浏览文件
下载
差异文件
Merge
上级
19a687f4
eb42817c
变更
12
隐藏空白更改
内联
并排
Showing
12 changed file
with
287 addition
and
12 deletion
+287
-12
src/share/classes/com/sun/tools/javac/comp/Lower.java
src/share/classes/com/sun/tools/javac/comp/Lower.java
+1
-1
src/share/classes/com/sun/tools/javac/comp/Resolve.java
src/share/classes/com/sun/tools/javac/comp/Resolve.java
+9
-10
src/share/classes/com/sun/tools/javac/jvm/Gen.java
src/share/classes/com/sun/tools/javac/jvm/Gen.java
+1
-1
test/tools/javac/linenumbers/NestedLineNumberTest.java
test/tools/javac/linenumbers/NestedLineNumberTest.java
+81
-0
test/tools/javac/varargs/access/OtherPackage.java
test/tools/javac/varargs/access/OtherPackage.java
+36
-0
test/tools/javac/varargs/access/VarargsAndWildcardParameterizedTypeTest.java
...rargs/access/VarargsAndWildcardParameterizedTypeTest.java
+2
-0
test/tools/javac/varargs/access/VarargsAndWildcardParameterizedTypeTest2.java
...args/access/VarargsAndWildcardParameterizedTypeTest2.java
+45
-0
test/tools/javac/varargs/access/VarargsAndWildcardParameterizedTypeTest3.java
...args/access/VarargsAndWildcardParameterizedTypeTest3.java
+43
-0
test/tools/javac/varargs/access/VarargsAndWildcardParameterizedTypeTest4.java
...args/access/VarargsAndWildcardParameterizedTypeTest4.java
+43
-0
test/tools/javac/varargs/access/VarargsInferredPrivateType-source7.out
...vac/varargs/access/VarargsInferredPrivateType-source7.out
+4
-0
test/tools/javac/varargs/access/VarargsInferredPrivateType.java
...ools/javac/varargs/access/VarargsInferredPrivateType.java
+18
-0
test/tools/javac/varargs/access/VarargsInferredPrivateType.out
...tools/javac/varargs/access/VarargsInferredPrivateType.out
+4
-0
未找到文件。
src/share/classes/com/sun/tools/javac/comp/Lower.java
浏览文件 @
6c3e30ee
...
@@ -2540,7 +2540,7 @@ public class Lower extends TreeTranslator {
...
@@ -2540,7 +2540,7 @@ public class Lower extends TreeTranslator {
currentMethodSym
=
currentMethodSymPrev
;
currentMethodSym
=
currentMethodSymPrev
;
// Return empty block {} as a placeholder for an inner class.
// Return empty block {} as a placeholder for an inner class.
result
=
make_at
(
tree
.
pos
()).
Block
(
0
,
List
.<
JCStatement
>
nil
());
result
=
make_at
(
tree
.
pos
()).
Block
(
SYNTHETIC
,
List
.<
JCStatement
>
nil
());
}
}
/** Translate an enum class. */
/** Translate an enum class. */
...
...
src/share/classes/com/sun/tools/javac/comp/Resolve.java
浏览文件 @
6c3e30ee
...
@@ -836,20 +836,19 @@ public class Resolve {
...
@@ -836,20 +836,19 @@ public class Resolve {
List
<
Type
>
formals
,
List
<
Type
>
formals
,
Warner
warn
)
{
Warner
warn
)
{
super
.
argumentsAcceptable
(
env
,
deferredAttrContext
,
argtypes
,
formals
,
warn
);
super
.
argumentsAcceptable
(
env
,
deferredAttrContext
,
argtypes
,
formals
,
warn
);
//
should we expand formals
?
//
should we check varargs element type accessibility
?
if
(
deferredAttrContext
.
phase
.
isVarargsRequired
())
{
if
(
deferredAttrContext
.
phase
.
isVarargsRequired
())
{
Type
typeToCheck
=
null
;
if
(
deferredAttrContext
.
mode
==
AttrMode
.
CHECK
||
!
checkVarargsAccessAfterResolution
)
{
if
(!
checkVarargsAccessAfterResolution
)
{
varargsAccessible
(
env
,
types
.
elemtype
(
formals
.
last
()),
deferredAttrContext
.
inferenceContext
);
typeToCheck
=
types
.
elemtype
(
formals
.
last
());
}
else
if
(
deferredAttrContext
.
mode
==
AttrMode
.
CHECK
)
{
typeToCheck
=
types
.
erasure
(
types
.
elemtype
(
formals
.
last
()));
}
if
(
typeToCheck
!=
null
)
{
varargsAccessible
(
env
,
typeToCheck
,
deferredAttrContext
.
inferenceContext
);
}
}
}
}
}
}
/**
* Test that the runtime array element type corresponding to 't' is accessible. 't' should be the
* varargs element type of either the method invocation type signature (after inference completes)
* or the method declaration signature (before inference completes).
*/
private
void
varargsAccessible
(
final
Env
<
AttrContext
>
env
,
final
Type
t
,
final
InferenceContext
inferenceContext
)
{
private
void
varargsAccessible
(
final
Env
<
AttrContext
>
env
,
final
Type
t
,
final
InferenceContext
inferenceContext
)
{
if
(
inferenceContext
.
free
(
t
))
{
if
(
inferenceContext
.
free
(
t
))
{
inferenceContext
.
addFreeTypeListener
(
List
.
of
(
t
),
new
FreeTypeListener
()
{
inferenceContext
.
addFreeTypeListener
(
List
.
of
(
t
),
new
FreeTypeListener
()
{
...
@@ -859,7 +858,7 @@ public class Resolve {
...
@@ -859,7 +858,7 @@ public class Resolve {
}
}
});
});
}
else
{
}
else
{
if
(!
isAccessible
(
env
,
t
))
{
if
(!
isAccessible
(
env
,
t
ypes
.
erasure
(
t
)
))
{
Symbol
location
=
env
.
enclClass
.
sym
;
Symbol
location
=
env
.
enclClass
.
sym
;
reportMC
(
env
.
tree
,
MethodCheckDiag
.
INACCESSIBLE_VARARGS
,
inferenceContext
,
t
,
Kinds
.
kindName
(
location
),
location
);
reportMC
(
env
.
tree
,
MethodCheckDiag
.
INACCESSIBLE_VARARGS
,
inferenceContext
,
t
,
Kinds
.
kindName
(
location
),
location
);
}
}
...
...
src/share/classes/com/sun/tools/javac/jvm/Gen.java
浏览文件 @
6c3e30ee
...
@@ -486,7 +486,7 @@ public class Gen extends JCTree.Visitor {
...
@@ -486,7 +486,7 @@ public class Gen extends JCTree.Visitor {
JCBlock
block
=
(
JCBlock
)
def
;
JCBlock
block
=
(
JCBlock
)
def
;
if
((
block
.
flags
&
STATIC
)
!=
0
)
if
((
block
.
flags
&
STATIC
)
!=
0
)
clinitCode
.
append
(
block
);
clinitCode
.
append
(
block
);
else
else
if
((
block
.
flags
&
SYNTHETIC
)
==
0
)
initCode
.
append
(
block
);
initCode
.
append
(
block
);
break
;
break
;
case
METHODDEF:
case
METHODDEF:
...
...
test/tools/javac/linenumbers/NestedLineNumberTest.java
0 → 100644
浏览文件 @
6c3e30ee
/*
* Copyright (c) 2014, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 8061778
* @summary Wrong LineNumberTable for default constructors
*/
import
com.sun.tools.classfile.ClassFile
;
import
com.sun.tools.classfile.ConstantPoolException
;
import
com.sun.tools.classfile.Method
;
import
com.sun.tools.classfile.Attribute
;
import
com.sun.tools.classfile.Code_attribute
;
import
com.sun.tools.classfile.LineNumberTable_attribute
;
import
com.sun.tools.classfile.LineNumberTable_attribute.Entry
;
import
java.io.IOException
;
public
class
NestedLineNumberTest
{
public
static
void
main
(
String
[]
args
)
throws
Exception
{
Entry
[]
lines
=
findEntries
();
if
(
lines
==
null
||
lines
.
length
!=
1
)
{
int
found
=
lines
==
null
?
0
:
lines
.
length
;
error
(
String
.
format
(
"LineNumberTable contains wrong number of entries - expected %d, found %d"
,
1
,
found
));
}
int
line
=
lines
[
0
].
line_number
;
if
(
line
!=
78
)
{
error
(
String
.
format
(
"LineNumberTable contains wrong line number - expected %d, found %d"
,
78
,
line
));
}
}
static
Entry
[]
findEntries
()
throws
IOException
,
ConstantPoolException
{
ClassFile
self
=
ClassFile
.
read
(
NestedLineNumberTest
.
Test
.
class
.
getResourceAsStream
(
"NestedLineNumberTest$Test.class"
));
for
(
Method
m
:
self
.
methods
)
{
if
(
"<init>"
.
equals
(
m
.
getName
(
self
.
constant_pool
)))
{
Code_attribute
code_attribute
=
(
Code_attribute
)
m
.
attributes
.
get
(
Attribute
.
Code
);
for
(
Attribute
at
:
code_attribute
.
attributes
)
{
if
(
Attribute
.
LineNumberTable
.
equals
(
at
.
getName
(
self
.
constant_pool
)))
{
return
((
LineNumberTable_attribute
)
at
).
line_number_table
;
}
}
}
}
return
null
;
}
static
void
error
(
String
msg
)
{
throw
new
AssertionError
(
msg
);
}
// The default constructor in this class should get only one LineNumberTable entry,
// pointing to the first line of the declaration of class Test.
static
class
Test
{
static
class
Empty
{
}
}
}
test/tools/javac/varargs/access/OtherPackage.java
0 → 100644
浏览文件 @
6c3e30ee
/*
* Copyright (c) 2015, 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
* 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* Auxiliary file for VarargsInferredPrivateType
*/
package
otherpackage
;
public
class
OtherPackage
{
public
static
Private
getPrivate
()
{
return
new
Private
();
}
private
static
class
Private
{}
}
\ No newline at end of file
test/tools/javac/varargs/
T8049075
/VarargsAndWildcardParameterizedTypeTest.java
→
test/tools/javac/varargs/
access
/VarargsAndWildcardParameterizedTypeTest.java
浏览文件 @
6c3e30ee
...
@@ -26,6 +26,8 @@
...
@@ -26,6 +26,8 @@
* @bug 8049075
* @bug 8049075
* @summary javac, wildcards and generic vararg method invocation not accepted
* @summary javac, wildcards and generic vararg method invocation not accepted
* @compile VarargsAndWildcardParameterizedTypeTest.java
* @compile VarargsAndWildcardParameterizedTypeTest.java
* @compile -source 8 VarargsAndWildcardParameterizedTypeTest.java
* @compile -source 7 VarargsAndWildcardParameterizedTypeTest.java
*/
*/
class
VarargsAndWildcardParameterizedTypeTest
{
class
VarargsAndWildcardParameterizedTypeTest
{
...
...
test/tools/javac/varargs/access/VarargsAndWildcardParameterizedTypeTest2.java
0 → 100644
浏览文件 @
6c3e30ee
/*
* Copyright (c) 2015, 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
* 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 8075520
* @summary Varargs access check mishandles capture variables
* @compile VarargsAndWildcardParameterizedTypeTest2.java
* @compile -source 8 VarargsAndWildcardParameterizedTypeTest2.java
* @compile -source 7 VarargsAndWildcardParameterizedTypeTest2.java
*/
class
VarargsAndWildcardParameterizedTypeTest2
{
interface
I
{
<
T
>
void
m
(
T
...
t
);
}
interface
Box
<
T
>
{
T
get
();
}
void
m
(
I
i
,
Box
<?
extends
Number
>
b
)
{
i
.
m
(
b
.
get
());
}
}
test/tools/javac/varargs/access/VarargsAndWildcardParameterizedTypeTest3.java
0 → 100644
浏览文件 @
6c3e30ee
/*
* Copyright (c) 2015, 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
* 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 8075520
* @summary Varargs access check mishandles capture variables
* @compile VarargsAndWildcardParameterizedTypeTest3.java
* @compile -source 8 VarargsAndWildcardParameterizedTypeTest3.java
* @compile -source 7 VarargsAndWildcardParameterizedTypeTest3.java
*/
class
VarargsAndWildcardParameterizedTypeTest2
{
interface
I
{
<
T
>
void
m
(
Box
<?
extends
T
>
iter
,
T
...
t
);
}
interface
Box
<
T
>
{}
void
m
(
I
i
,
Box
<?
extends
Number
>
b
)
{
i
.
m
(
b
);
}
}
test/tools/javac/varargs/access/VarargsAndWildcardParameterizedTypeTest4.java
0 → 100644
浏览文件 @
6c3e30ee
/*
* Copyright (c) 2015, 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
* 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 8075520
* @summary Varargs access check mishandles capture variables
* @compile VarargsAndWildcardParameterizedTypeTest4.java
* @compile -source 8 VarargsAndWildcardParameterizedTypeTest4.java
* @compile -source 7 VarargsAndWildcardParameterizedTypeTest4.java
*/
class
VarargsAndWildcardParameterizedTypeTest2
{
interface
I
{
<
T
>
void
m
(
Box
<
T
>
iter
,
T
...
t
);
}
interface
Box
<
T
>
{}
void
m
(
I
i
,
Box
<?
extends
Number
>
b
)
{
i
.
m
(
b
);
}
}
test/tools/javac/varargs/access/VarargsInferredPrivateType-source7.out
0 → 100644
浏览文件 @
6c3e30ee
VarargsInferredPrivateType.java:16:10: compiler.err.cant.apply.symbol: kindname.method, m, T[], otherpackage.OtherPackage.Private, kindname.interface, VarargsInferredPrivateType.I, (compiler.misc.inaccessible.varargs.type: otherpackage.OtherPackage.Private, kindname.class, VarargsInferredPrivateType)
- compiler.note.unchecked.filename: VarargsInferredPrivateType.java
- compiler.note.unchecked.recompile
1 error
test/tools/javac/varargs/access/VarargsInferredPrivateType.java
0 → 100644
浏览文件 @
6c3e30ee
/*
* @test /nodynamiccopyright/
* @bug 8077786
* @summary Check varargs access against inferred signature
* @compile/fail/ref=VarargsInferredPrivateType.out -nowarn -XDrawDiagnostics VarargsInferredPrivateType.java OtherPackage.java
* @compile/fail/ref=VarargsInferredPrivateType.out -source 8 -nowarn -XDrawDiagnostics VarargsInferredPrivateType.java OtherPackage.java
* @compile/fail/ref=VarargsInferredPrivateType-source7.out -source 7 -nowarn -XDrawDiagnostics VarargsInferredPrivateType.java OtherPackage.java
*/
class
VarargsInferredPrivateType
{
interface
I
{
<
T
>
void
m
(
T
...
t
);
}
void
m
(
I
i
)
{
i
.
m
(
otherpackage
.
OtherPackage
.
getPrivate
());
}
}
test/tools/javac/varargs/access/VarargsInferredPrivateType.out
0 → 100644
浏览文件 @
6c3e30ee
VarargsInferredPrivateType.java:16:12: compiler.err.prob.found.req: (compiler.misc.inaccessible.varargs.type: otherpackage.OtherPackage.Private, kindname.class, VarargsInferredPrivateType)
- compiler.note.unchecked.filename: VarargsInferredPrivateType.java
- compiler.note.unchecked.recompile
1 error
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录