Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
e4d2cb09
D
dragonwell8_jdk
项目概览
openanolis
/
dragonwell8_jdk
通知
4
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
dragonwell8_jdk
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
e4d2cb09
编写于
2月 20, 2020
作者:
A
avoitylov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8235274: Enhance typing of methods
Reviewed-by: andrew
上级
2949a4ed
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
14 addition
and
24 deletion
+14
-24
src/share/classes/java/lang/invoke/MethodType.java
src/share/classes/java/lang/invoke/MethodType.java
+14
-24
未找到文件。
src/share/classes/java/lang/invoke/MethodType.java
浏览文件 @
e4d2cb09
...
...
@@ -97,7 +97,8 @@ class MethodType implements java.io.Serializable {
// The remaining fields are caches of various sorts:
private
@Stable
MethodTypeForm
form
;
// erased form, plus cached data about primitives
private
@Stable
MethodType
wrapAlt
;
// alternative wrapped/unwrapped version
private
@Stable
Object
wrapAlt
;
// alternative wrapped/unwrapped version and
// private communication for readObject and readResolve
private
@Stable
Invokers
invokers
;
// cache of handy higher-order adapters
private
@Stable
String
methodDescriptor
;
// cache for toMethodDescriptorString
...
...
@@ -673,7 +674,7 @@ class MethodType implements java.io.Serializable {
private
static
MethodType
wrapWithPrims
(
MethodType
pt
)
{
assert
(
pt
.
hasPrimitives
());
MethodType
wt
=
pt
.
wrapAlt
;
MethodType
wt
=
(
MethodType
)
pt
.
wrapAlt
;
if
(
wt
==
null
)
{
// fill in lazily
wt
=
MethodTypeForm
.
canonicalize
(
pt
,
MethodTypeForm
.
WRAP
,
MethodTypeForm
.
WRAP
);
...
...
@@ -685,7 +686,7 @@ class MethodType implements java.io.Serializable {
private
static
MethodType
unwrapWithNoPrims
(
MethodType
wt
)
{
assert
(!
wt
.
hasPrimitives
());
MethodType
uwt
=
wt
.
wrapAlt
;
MethodType
uwt
=
(
MethodType
)
wt
.
wrapAlt
;
if
(
uwt
==
null
)
{
// fill in lazily
uwt
=
MethodTypeForm
.
canonicalize
(
wt
,
MethodTypeForm
.
UNWRAP
,
MethodTypeForm
.
UNWRAP
);
...
...
@@ -1144,27 +1145,18 @@ s.writeObject(this.parameterArray());
* @see #writeObject
*/
private
void
readObject
(
java
.
io
.
ObjectInputStream
s
)
throws
java
.
io
.
IOException
,
ClassNotFoundException
{
// Assign temporary defaults in case this object escapes
MethodType_init
(
void
.
class
,
NO_PTYPES
);
// Assign defaults in case this object escapes
UNSAFE
.
putObject
(
this
,
rtypeOffset
,
void
.
class
);
UNSAFE
.
putObject
(
this
,
ptypesOffset
,
NO_PTYPES
);
s
.
defaultReadObject
();
// requires serialPersistentFields to be an empty array
Class
<?>
returnType
=
(
Class
<?>)
s
.
readObject
();
Class
<?>[]
parameterArray
=
(
Class
<?>[])
s
.
readObject
();
parameterArray
=
parameterArray
.
clone
();
// make sure it is unshared
// Assign deserialized values
MethodType_init
(
returnType
,
parameterArray
);
}
// Initialization of state for deserialization only
private
void
MethodType_init
(
Class
<?>
rtype
,
Class
<?>[]
ptypes
)
{
// In order to communicate these values to readResolve, we must
// store them into the implementation-specific final fields.
checkRtype
(
rtype
);
checkPtypes
(
ptypes
);
UNSAFE
.
putObject
(
this
,
rtypeOffset
,
rtype
);
UNSAFE
.
putObject
(
this
,
ptypesOffset
,
ptypes
);
// Verify all operands, and make sure ptypes is unshared
// Cache the new MethodType for readResolve
wrapAlt
=
new
MethodType
[]{
MethodType
.
methodType
(
returnType
,
parameterArray
)};
}
// Support for resetting final fields while deserializing
...
...
@@ -1189,12 +1181,10 @@ s.writeObject(this.parameterArray());
// Do not use a trusted path for deserialization:
// return makeImpl(rtype, ptypes, true);
// Verify all operands, and make sure ptypes is unshared:
try
{
return
methodType
(
rtype
,
ptypes
);
}
finally
{
// Re-assign defaults in case this object escapes
MethodType_init
(
void
.
class
,
NO_PTYPES
);
}
// Return a new validated MethodType for the rtype and ptypes passed from readObject.
MethodType
mt
=
((
MethodType
[])
wrapAlt
)[
0
];
wrapAlt
=
null
;
return
mt
;
}
/**
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录