Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
dbd16ef0
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看板
提交
dbd16ef0
编写于
8月 28, 2009
作者:
D
darcy
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
6261502: (reflect) Add the functionality to screen out the "inappropriate" modifier bits
Reviewed-by: alanb
上级
f7ac9fd8
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
115 addition
and
16 deletion
+115
-16
src/share/classes/java/lang/reflect/Constructor.java
src/share/classes/java/lang/reflect/Constructor.java
+2
-6
src/share/classes/java/lang/reflect/Method.java
src/share/classes/java/lang/reflect/Method.java
+4
-10
src/share/classes/java/lang/reflect/Modifier.java
src/share/classes/java/lang/reflect/Modifier.java
+109
-0
未找到文件。
src/share/classes/java/lang/reflect/Constructor.java
浏览文件 @
dbd16ef0
...
...
@@ -82,10 +82,6 @@ public final
// remembering the last Class for which the check succeeded.
private
volatile
Class
securityCheckCache
;
// Modifiers that can be applied to a constructor in source code
private
static
final
int
LANGUAGE_MODIFIERS
=
Modifier
.
PUBLIC
|
Modifier
.
PROTECTED
|
Modifier
.
PRIVATE
;
// Generics infrastructure
// Accessor for factory
private
GenericsFactory
getFactory
()
{
...
...
@@ -359,7 +355,7 @@ public final
public
String
toString
()
{
try
{
StringBuffer
sb
=
new
StringBuffer
();
int
mod
=
getModifiers
()
&
LANGUAGE_MODIFIERS
;
int
mod
=
getModifiers
()
&
Modifier
.
constructorModifiers
()
;
if
(
mod
!=
0
)
{
sb
.
append
(
Modifier
.
toString
(
mod
)
+
" "
);
}
...
...
@@ -423,7 +419,7 @@ public final
public
String
toGenericString
()
{
try
{
StringBuilder
sb
=
new
StringBuilder
();
int
mod
=
getModifiers
()
&
LANGUAGE_MODIFIERS
;
int
mod
=
getModifiers
()
&
Modifier
.
constructorModifiers
()
;
if
(
mod
!=
0
)
{
sb
.
append
(
Modifier
.
toString
(
mod
)
+
" "
);
}
...
...
src/share/classes/java/lang/reflect/Method.java
浏览文件 @
dbd16ef0
...
...
@@ -88,12 +88,6 @@ public final
private
Class
securityCheckCache
;
private
Class
securityCheckTargetClassCache
;
// Modifiers that can be applied to a method in source code
private
static
final
int
LANGUAGE_MODIFIERS
=
Modifier
.
PUBLIC
|
Modifier
.
PROTECTED
|
Modifier
.
PRIVATE
|
Modifier
.
ABSTRACT
|
Modifier
.
STATIC
|
Modifier
.
FINAL
|
Modifier
.
SYNCHRONIZED
|
Modifier
.
NATIVE
;
// Generics infrastructure
private
String
getGenericSignature
()
{
return
signature
;}
...
...
@@ -408,12 +402,12 @@ public final
* {@code public}, {@code protected} or {@code private} first,
* and then other modifiers in the following order:
* {@code abstract}, {@code static}, {@code final},
* {@code synchronized}, {@code native}.
* {@code synchronized}, {@code native}
, {@code strictfp}
.
*/
public
String
toString
()
{
try
{
StringBuffer
sb
=
new
StringBuffer
();
int
mod
=
getModifiers
()
&
LANGUAGE_MODIFIERS
;
int
mod
=
getModifiers
()
&
Modifier
.
methodModifiers
()
;
if
(
mod
!=
0
)
{
sb
.
append
(
Modifier
.
toString
(
mod
)
+
" "
);
}
...
...
@@ -473,7 +467,7 @@ public final
* {@code public}, {@code protected} or {@code private} first,
* and then other modifiers in the following order:
* {@code abstract}, {@code static}, {@code final},
* {@code synchronized}
{@code native
}.
* {@code synchronized}
, {@code native}, {@code strictfp
}.
*
* @return a string describing this {@code Method},
* include type parameters
...
...
@@ -483,7 +477,7 @@ public final
public
String
toGenericString
()
{
try
{
StringBuilder
sb
=
new
StringBuilder
();
int
mod
=
getModifiers
()
&
LANGUAGE_MODIFIERS
;
int
mod
=
getModifiers
()
&
Modifier
.
methodModifiers
()
;
if
(
mod
!=
0
)
{
sb
.
append
(
Modifier
.
toString
(
mod
)
+
" "
);
}
...
...
src/share/classes/java/lang/reflect/Modifier.java
浏览文件 @
dbd16ef0
...
...
@@ -235,6 +235,11 @@ class Modifier {
* possible validity of the combination of modifiers represented
* by the input.
*
* Note that to perform such checking for a known kind of entity,
* such as a constructor or method, first AND the argument of
* {@code toString} with the appropriate mask from a method like
* {@link #constructorModifiers} or {@link #methodModifiers}.
*
* @param mod a set of modifiers
* @return a string representation of the set of modifiers
* represented by {@code mod}
...
...
@@ -353,4 +358,108 @@ class Modifier {
static
boolean
isSynthetic
(
int
mod
)
{
return
(
mod
&
SYNTHETIC
)
!=
0
;
}
/**
* See JLSv3 section 8.1.1.
*/
private
static
final
int
CLASS_MODIFIERS
=
Modifier
.
PUBLIC
|
Modifier
.
PROTECTED
|
Modifier
.
PRIVATE
|
Modifier
.
ABSTRACT
|
Modifier
.
STATIC
|
Modifier
.
FINAL
|
Modifier
.
STRICT
;
/**
* See JLSv3 section 9.1.1.
*/
private
static
final
int
INTERFACE_MODIFIERS
=
Modifier
.
PUBLIC
|
Modifier
.
PROTECTED
|
Modifier
.
PRIVATE
|
Modifier
.
ABSTRACT
|
Modifier
.
STATIC
|
Modifier
.
STRICT
;
/**
* See JLSv3 section 8.8.3.
*/
private
static
final
int
CONSTRUCTOR_MODIFIERS
=
Modifier
.
PUBLIC
|
Modifier
.
PROTECTED
|
Modifier
.
PRIVATE
;
/**
* See JLSv3 section 8.4.3.
*/
private
static
final
int
METHOD_MODIFIERS
=
Modifier
.
PUBLIC
|
Modifier
.
PROTECTED
|
Modifier
.
PRIVATE
|
Modifier
.
ABSTRACT
|
Modifier
.
STATIC
|
Modifier
.
FINAL
|
Modifier
.
SYNCHRONIZED
|
Modifier
.
NATIVE
|
Modifier
.
STRICT
;
/**
* See JLSv3 section 8.3.1.
*/
private
static
final
int
FIELD_MODIFIERS
=
Modifier
.
PUBLIC
|
Modifier
.
PROTECTED
|
Modifier
.
PRIVATE
|
Modifier
.
STATIC
|
Modifier
.
FINAL
|
Modifier
.
TRANSIENT
|
Modifier
.
VOLATILE
;
/**
* Return an {@code int} value OR-ing together the source language
* modifiers that can be applied to a class.
* @return an {@code int} value OR-ing together the source language
* modifiers that can be applied to a class.
*
* @jls3 8.1.1 Class Modifiers
* @since 1.7
*/
public
static
int
classModifiers
()
{
return
CLASS_MODIFIERS
;
}
/**
* Return an {@code int} value OR-ing together the source language
* modifiers that can be applied to an interface.
* @return an {@code int} value OR-ing together the source language
* modifiers that can be applied to an inteface.
*
* @jls3 9.1.1 Interface Modifiers
* @since 1.7
*/
public
static
int
interfaceModifiers
()
{
return
INTERFACE_MODIFIERS
;
}
/**
* Return an {@code int} value OR-ing together the source language
* modifiers that can be applied to a constructor.
* @return an {@code int} value OR-ing together the source language
* modifiers that can be applied to a constructor.
*
* @jls3 8.8.3 Constructor Modifiers
* @since 1.7
*/
public
static
int
constructorModifiers
()
{
return
CONSTRUCTOR_MODIFIERS
;
}
/**
* Return an {@code int} value OR-ing together the source language
* modifiers that can be applied to a method.
* @return an {@code int} value OR-ing together the source language
* modifiers that can be applied to a method.
*
* @jls3 8.4.3 Method Modifiers
* @since 1.7
*/
public
static
int
methodModifiers
()
{
return
METHOD_MODIFIERS
;
}
/**
* Return an {@code int} value OR-ing together the source language
* modifiers that can be applied to a field.
* @return an {@code int} value OR-ing together the source language
* modifiers that can be applied to a field.
*
* @jls3 8.3.1 Field Modifiers
* @since 1.7
*/
public
static
int
fieldModifiers
()
{
return
FIELD_MODIFIERS
;
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录