Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_langtools
提交
bd2bcf9e
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看板
提交
bd2bcf9e
编写于
6月 14, 2013
作者:
V
vromero
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8016569: javac, add new flag for polymorphic method signatures
Reviewed-by: jjg Contributed-by: maurizio.cimadamore@oracle.com
上级
0c56bf05
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
31 addition
and
22 deletion
+31
-22
src/share/classes/com/sun/tools/javac/code/Flags.java
src/share/classes/com/sun/tools/javac/code/Flags.java
+5
-0
src/share/classes/com/sun/tools/javac/code/Symbol.java
src/share/classes/com/sun/tools/javac/code/Symbol.java
+0
-19
src/share/classes/com/sun/tools/javac/code/Types.java
src/share/classes/com/sun/tools/javac/code/Types.java
+16
-0
src/share/classes/com/sun/tools/javac/comp/Attr.java
src/share/classes/com/sun/tools/javac/comp/Attr.java
+1
-1
src/share/classes/com/sun/tools/javac/comp/Check.java
src/share/classes/com/sun/tools/javac/comp/Check.java
+1
-1
src/share/classes/com/sun/tools/javac/comp/MemberEnter.java
src/share/classes/com/sun/tools/javac/comp/MemberEnter.java
+4
-0
src/share/classes/com/sun/tools/javac/comp/Resolve.java
src/share/classes/com/sun/tools/javac/comp/Resolve.java
+1
-1
src/share/classes/com/sun/tools/javac/jvm/ClassReader.java
src/share/classes/com/sun/tools/javac/jvm/ClassReader.java
+3
-0
未找到文件。
src/share/classes/com/sun/tools/javac/code/Flags.java
浏览文件 @
bd2bcf9e
...
@@ -278,6 +278,11 @@ public class Flags {
...
@@ -278,6 +278,11 @@ public class Flags {
*/
*/
public
static
final
long
BAD_OVERRIDE
=
1L
<<
45
;
public
static
final
long
BAD_OVERRIDE
=
1L
<<
45
;
/**
* Flag that indicates a signature polymorphic method (292).
*/
public
static
final
long
SIGNATURE_POLYMORPHIC
=
1L
<<
46
;
/** Modifier masks.
/** Modifier masks.
*/
*/
public
static
final
int
public
static
final
int
...
...
src/share/classes/com/sun/tools/javac/code/Symbol.java
浏览文件 @
bd2bcf9e
...
@@ -1537,25 +1537,6 @@ public abstract class Symbol implements Element {
...
@@ -1537,25 +1537,6 @@ public abstract class Symbol implements Element {
getKind
()
==
ElementKind
.
INSTANCE_INIT
;
getKind
()
==
ElementKind
.
INSTANCE_INIT
;
}
}
/**
* A polymorphic signature method (JLS SE 7, 8.4.1) is a method that
* (i) is declared in the java.lang.invoke.MethodHandle class, (ii) takes
* a single variable arity parameter (iii) whose declared type is Object[],
* (iv) has a return type of Object and (v) is native.
*/
public
boolean
isSignaturePolymorphic
(
Types
types
)
{
List
<
Type
>
argtypes
=
type
.
getParameterTypes
();
Type
firstElemType
=
argtypes
.
nonEmpty
()
?
types
.
elemtype
(
argtypes
.
head
)
:
null
;
return
owner
==
types
.
syms
.
methodHandleType
.
tsym
&&
argtypes
.
length
()
==
1
&&
firstElemType
!=
null
&&
types
.
isSameType
(
firstElemType
,
types
.
syms
.
objectType
)
&&
types
.
isSameType
(
type
.
getReturnType
(),
types
.
syms
.
objectType
)
&&
(
flags
()
&
NATIVE
)
!=
0
;
}
public
Attribute
getDefaultValue
()
{
public
Attribute
getDefaultValue
()
{
return
defaultValue
;
return
defaultValue
;
}
}
...
...
src/share/classes/com/sun/tools/javac/code/Types.java
浏览文件 @
bd2bcf9e
...
@@ -950,6 +950,22 @@ public class Types {
...
@@ -950,6 +950,22 @@ public class Types {
/*inlined: ts.isEmpty() && ss.isEmpty();*/
/*inlined: ts.isEmpty() && ss.isEmpty();*/
}
}
/**
* A polymorphic signature method (JLS SE 7, 8.4.1) is a method that
* (i) is declared in the java.lang.invoke.MethodHandle class, (ii) takes
* a single variable arity parameter (iii) whose declared type is Object[],
* (iv) has a return type of Object and (v) is native.
*/
public
boolean
isSignaturePolymorphic
(
MethodSymbol
msym
)
{
List
<
Type
>
argtypes
=
msym
.
type
.
getParameterTypes
();
return
(
msym
.
flags_field
&
NATIVE
)
!=
0
&&
msym
.
owner
==
syms
.
methodHandleType
.
tsym
&&
argtypes
.
tail
.
tail
==
null
&&
argtypes
.
head
.
hasTag
(
TypeTag
.
ARRAY
)
&&
msym
.
type
.
getReturnType
().
tsym
==
syms
.
objectType
.
tsym
&&
((
ArrayType
)
argtypes
.
head
).
elemtype
.
tsym
==
syms
.
objectType
.
tsym
;
}
/**
/**
* Is t the same type as s?
* Is t the same type as s?
*/
*/
...
...
src/share/classes/com/sun/tools/javac/comp/Attr.java
浏览文件 @
bd2bcf9e
...
@@ -3405,7 +3405,7 @@ public class Attr extends JCTree.Visitor {
...
@@ -3405,7 +3405,7 @@ public class Attr extends JCTree.Visitor {
Env
<
AttrContext
>
env
,
Env
<
AttrContext
>
env
,
ResultInfo
resultInfo
)
{
ResultInfo
resultInfo
)
{
boolean
isPolymorhicSignature
=
boolean
isPolymorhicSignature
=
sym
.
kind
==
MTH
&&
((
MethodSymbol
)
sym
.
baseSymbol
()).
isSignaturePolymorphic
(
types
)
;
(
sym
.
baseSymbol
().
flags
()
&
SIGNATURE_POLYMORPHIC
)
!=
0
;
return
isPolymorhicSignature
?
return
isPolymorhicSignature
?
checkSigPolyMethodId
(
tree
,
site
,
sym
,
env
,
resultInfo
)
:
checkSigPolyMethodId
(
tree
,
site
,
sym
,
env
,
resultInfo
)
:
checkMethodIdInternal
(
tree
,
site
,
sym
,
env
,
resultInfo
);
checkMethodIdInternal
(
tree
,
site
,
sym
,
env
,
resultInfo
);
...
...
src/share/classes/com/sun/tools/javac/comp/Check.java
浏览文件 @
bd2bcf9e
...
@@ -909,7 +909,7 @@ public class Check {
...
@@ -909,7 +909,7 @@ public class Check {
"unchecked.generic.array.creation"
,
"unchecked.generic.array.creation"
,
argtype
);
argtype
);
}
}
if
(
!((
MethodSymbol
)
sym
.
baseSymbol
()).
isSignaturePolymorphic
(
types
)
)
{
if
(
(
sym
.
baseSymbol
().
flags
()
&
SIGNATURE_POLYMORPHIC
)
==
0
)
{
TreeInfo
.
setVarargsElement
(
env
.
tree
,
types
.
elemtype
(
argtype
));
TreeInfo
.
setVarargsElement
(
env
.
tree
,
types
.
elemtype
(
argtype
));
}
}
}
}
...
...
src/share/classes/com/sun/tools/javac/comp/MemberEnter.java
浏览文件 @
bd2bcf9e
...
@@ -560,6 +560,10 @@ public class MemberEnter extends JCTree.Visitor implements Completer {
...
@@ -560,6 +560,10 @@ public class MemberEnter extends JCTree.Visitor implements Completer {
chk
.
setDeferredLintHandler
(
prevLintHandler
);
chk
.
setDeferredLintHandler
(
prevLintHandler
);
}
}
if
(
types
.
isSignaturePolymorphic
(
m
))
{
m
.
flags_field
|=
SIGNATURE_POLYMORPHIC
;
}
// Set m.params
// Set m.params
ListBuffer
<
VarSymbol
>
params
=
new
ListBuffer
<
VarSymbol
>();
ListBuffer
<
VarSymbol
>
params
=
new
ListBuffer
<
VarSymbol
>();
JCVariableDecl
lastParam
=
null
;
JCVariableDecl
lastParam
=
null
;
...
...
src/share/classes/com/sun/tools/javac/comp/Resolve.java
浏览文件 @
bd2bcf9e
...
@@ -2267,7 +2267,7 @@ public class Resolve {
...
@@ -2267,7 +2267,7 @@ public class Resolve {
sym
=
super
.
access
(
env
,
pos
,
location
,
sym
);
sym
=
super
.
access
(
env
,
pos
,
location
,
sym
);
}
else
if
(
allowMethodHandles
)
{
}
else
if
(
allowMethodHandles
)
{
MethodSymbol
msym
=
(
MethodSymbol
)
sym
;
MethodSymbol
msym
=
(
MethodSymbol
)
sym
;
if
(
msym
.
isSignaturePolymorphic
(
types
)
)
{
if
(
(
msym
.
flags
()
&
SIGNATURE_POLYMORPHIC
)
!=
0
)
{
return
findPolymorphicSignatureInstance
(
env
,
sym
,
argtypes
);
return
findPolymorphicSignatureInstance
(
env
,
sym
,
argtypes
);
}
}
}
}
...
...
src/share/classes/com/sun/tools/javac/jvm/ClassReader.java
浏览文件 @
bd2bcf9e
...
@@ -1985,6 +1985,9 @@ public class ClassReader implements Completer {
...
@@ -1985,6 +1985,9 @@ public class ClassReader implements Completer {
syms
.
methodClass
);
syms
.
methodClass
);
}
}
MethodSymbol
m
=
new
MethodSymbol
(
flags
,
name
,
type
,
currentOwner
);
MethodSymbol
m
=
new
MethodSymbol
(
flags
,
name
,
type
,
currentOwner
);
if
(
types
.
isSignaturePolymorphic
(
m
))
{
m
.
flags_field
|=
SIGNATURE_POLYMORPHIC
;
}
if
(
saveParameterNames
)
if
(
saveParameterNames
)
initParameterNames
(
m
);
initParameterNames
(
m
);
Symbol
prevOwner
=
currentOwner
;
Symbol
prevOwner
=
currentOwner
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录