Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
d4639193
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看板
提交
d4639193
编写于
5月 10, 2013
作者:
D
darcy
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8014357: Minor refactorings to sun.reflect.generics.reflectiveObjects.*
Reviewed-by: mchung
上级
2ff3b4e4
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
16 addition
and
40 deletion
+16
-40
src/share/classes/sun/reflect/generics/reflectiveObjects/GenericArrayTypeImpl.java
...lect/generics/reflectiveObjects/GenericArrayTypeImpl.java
+4
-9
src/share/classes/sun/reflect/generics/reflectiveObjects/ParameterizedTypeImpl.java
...ect/generics/reflectiveObjects/ParameterizedTypeImpl.java
+8
-19
src/share/classes/sun/reflect/generics/reflectiveObjects/TypeVariableImpl.java
.../reflect/generics/reflectiveObjects/TypeVariableImpl.java
+2
-7
src/share/classes/sun/reflect/generics/reflectiveObjects/WildcardTypeImpl.java
.../reflect/generics/reflectiveObjects/WildcardTypeImpl.java
+2
-5
未找到文件。
src/share/classes/sun/reflect/generics/reflectiveObjects/GenericArrayTypeImpl.java
浏览文件 @
d4639193
/*
* Copyright (c) 2003, 20
04
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 20
13
, 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
...
...
@@ -27,7 +27,7 @@ package sun.reflect.generics.reflectiveObjects;
import
java.lang.reflect.GenericArrayType
;
import
java.lang.reflect.Type
;
import
java.util.Objects
;
/**
* Implementation of GenericArrayType interface for core reflection.
...
...
@@ -81,18 +81,13 @@ public class GenericArrayTypeImpl
if
(
o
instanceof
GenericArrayType
)
{
GenericArrayType
that
=
(
GenericArrayType
)
o
;
Type
thatComponentType
=
that
.
getGenericComponentType
();
return
genericComponentType
==
null
?
thatComponentType
==
null
:
genericComponentType
.
equals
(
thatComponentType
);
return
Objects
.
equals
(
genericComponentType
,
that
.
getGenericComponentType
());
}
else
return
false
;
}
@Override
public
int
hashCode
()
{
return
(
genericComponentType
==
null
)
?
0
:
genericComponentType
.
hashCode
();
return
Objects
.
hashCode
(
genericComponentType
);
}
}
src/share/classes/sun/reflect/generics/reflectiveObjects/ParameterizedTypeImpl.java
浏览文件 @
d4639193
/*
* Copyright (c) 2003, 20
04
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 20
13
, 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
...
...
@@ -33,7 +33,7 @@ import java.lang.reflect.ParameterizedType;
import
java.lang.reflect.Type
;
import
java.lang.reflect.TypeVariable
;
import
java.util.Arrays
;
import
java.util.Objects
;
/** Implementing class for ParameterizedType interface. */
...
...
@@ -47,9 +47,7 @@ public class ParameterizedTypeImpl implements ParameterizedType {
Type
ownerType
)
{
this
.
actualTypeArguments
=
actualTypeArguments
;
this
.
rawType
=
rawType
;
if
(
ownerType
!=
null
)
{
this
.
ownerType
=
ownerType
;
}
else
{
this
.
ownerType
=
rawType
.
getDeclaringClass
();}
this
.
ownerType
=
(
ownerType
!=
null
)
?
ownerType
:
rawType
.
getDeclaringClass
();
validateConstructorArguments
();
}
...
...
@@ -62,7 +60,6 @@ public class ParameterizedTypeImpl implements ParameterizedType {
for
(
int
i
=
0
;
i
<
actualTypeArguments
.
length
;
i
++)
{
// check actuals against formals' bounds
}
}
/**
...
...
@@ -189,14 +186,9 @@ public class ParameterizedTypeImpl implements ParameterizedType {
return
ownerEquality
&&
rawEquality
&&
typeArgEquality
;
}
return
(
ownerType
==
null
?
thatOwner
==
null
:
ownerType
.
equals
(
thatOwner
))
&&
(
rawType
==
null
?
thatRawType
==
null
:
rawType
.
equals
(
thatRawType
))
&&
Objects
.
equals
(
ownerType
,
thatOwner
)
&&
Objects
.
equals
(
rawType
,
thatRawType
)
&&
Arrays
.
equals
(
actualTypeArguments
,
// avoid clone
that
.
getActualTypeArguments
());
}
else
...
...
@@ -207,8 +199,8 @@ public class ParameterizedTypeImpl implements ParameterizedType {
public
int
hashCode
()
{
return
Arrays
.
hashCode
(
actualTypeArguments
)
^
(
ownerType
==
null
?
0
:
ownerType
.
hashCode
()
)
^
(
rawType
==
null
?
0
:
rawType
.
hashCode
()
);
Objects
.
hashCode
(
ownerType
)
^
Objects
.
hashCode
(
rawType
);
}
public
String
toString
()
{
...
...
@@ -239,10 +231,7 @@ public class ParameterizedTypeImpl implements ParameterizedType {
for
(
Type
t:
actualTypeArguments
)
{
if
(!
first
)
sb
.
append
(
", "
);
if
(
t
instanceof
Class
)
sb
.
append
(((
Class
)
t
).
getName
());
else
sb
.
append
(
t
.
toString
());
sb
.
append
(
t
.
getTypeName
());
first
=
false
;
}
sb
.
append
(
">"
);
...
...
src/share/classes/sun/reflect/generics/reflectiveObjects/TypeVariableImpl.java
浏览文件 @
d4639193
...
...
@@ -170,13 +170,8 @@ public class TypeVariableImpl<D extends GenericDeclaration>
GenericDeclaration
thatDecl
=
that
.
getGenericDeclaration
();
String
thatName
=
that
.
getName
();
return
(
genericDeclaration
==
null
?
thatDecl
==
null
:
genericDeclaration
.
equals
(
thatDecl
))
&&
(
name
==
null
?
thatName
==
null
:
name
.
equals
(
thatName
));
return
Objects
.
equals
(
genericDeclaration
,
thatDecl
)
&&
Objects
.
equals
(
name
,
thatName
);
}
else
return
false
;
...
...
src/share/classes/sun/reflect/generics/reflectiveObjects/WildcardTypeImpl.java
浏览文件 @
d4639193
/*
* Copyright (c) 2003, 20
04
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 20
13
, 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
...
...
@@ -203,10 +203,7 @@ public class WildcardTypeImpl extends LazyReflectiveObjectGenerator
sb
.
append
(
" & "
);
first
=
false
;
if
(
bound
instanceof
Class
)
sb
.
append
(((
Class
)
bound
).
getName
()
);
else
sb
.
append
(
bound
.
toString
());
sb
.
append
(
bound
.
getTypeName
());
}
return
sb
.
toString
();
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录