Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
43e7cb30
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看板
提交
43e7cb30
编写于
10月 17, 2013
作者:
M
mchung
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8025799: Restore sun.reflect.Reflection.getCallerClass(int) until a replacement API is provided
Reviewed-by: alanb, forax, dholmes, twisti
上级
885bf602
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
117 addition
and
7 deletion
+117
-7
makefiles/mapfiles/libjava/mapfile-vers
makefiles/mapfiles/libjava/mapfile-vers
+2
-1
makefiles/mapfiles/libjava/reorder-sparc
makefiles/mapfiles/libjava/reorder-sparc
+2
-1
makefiles/mapfiles/libjava/reorder-sparcv9
makefiles/mapfiles/libjava/reorder-sparcv9
+2
-1
makefiles/mapfiles/libjava/reorder-x86
makefiles/mapfiles/libjava/reorder-x86
+2
-1
src/share/classes/sun/reflect/Reflection.java
src/share/classes/sun/reflect/Reflection.java
+8
-0
src/share/javavm/export/jvm.h
src/share/javavm/export/jvm.h
+1
-1
src/share/native/sun/reflect/Reflection.c
src/share/native/sun/reflect/Reflection.c
+8
-2
test/sun/reflect/Reflection/GetCallerClassWithDepth.java
test/sun/reflect/Reflection/GetCallerClassWithDepth.java
+92
-0
未找到文件。
makefiles/mapfiles/libjava/mapfile-vers
浏览文件 @
43e7cb30
...
...
@@ -267,7 +267,8 @@ SUNWprivate_1.1 {
Java_sun_misc_GC_maxObjectInspectionAge;
Java_sun_reflect_NativeConstructorAccessorImpl_newInstance0;
Java_sun_reflect_NativeMethodAccessorImpl_invoke0;
Java_sun_reflect_Reflection_getCallerClass;
Java_sun_reflect_Reflection_getCallerClass__;
Java_sun_reflect_Reflection_getCallerClass__I;
Java_sun_reflect_Reflection_getClassAccessFlags;
Java_sun_misc_Version_getJdkVersionInfo;
Java_sun_misc_Version_getJdkSpecialVersion;
...
...
makefiles/mapfiles/libjava/reorder-sparc
浏览文件 @
43e7cb30
...
...
@@ -27,7 +27,8 @@ text: .text%Java_java_io_FileInputStream_initIDs;
text: .text%Java_java_io_FileDescriptor_initIDs;
text: .text%Java_java_io_FileOutputStream_initIDs;
text: .text%Java_java_lang_System_setIn0;
text: .text%Java_sun_reflect_Reflection_getCallerClass;
text: .text%Java_sun_reflect_Reflection_getCallerClass__;
text: .text%Java_sun_reflect_Reflection_getCallerClass__I;
text: .text%Java_java_lang_Class_forName0;
text: .text%Java_java_lang_Object_getClass;
text: .text%Java_sun_reflect_Reflection_getClassAccessFlags;
...
...
makefiles/mapfiles/libjava/reorder-sparcv9
浏览文件 @
43e7cb30
...
...
@@ -26,7 +26,8 @@ text: .text%Java_java_io_FileInputStream_initIDs;
text: .text%Java_java_io_FileDescriptor_initIDs;
text: .text%Java_java_io_FileOutputStream_initIDs;
text: .text%Java_java_lang_System_setIn0;
text: .text%Java_sun_reflect_Reflection_getCallerClass;
text: .text%Java_sun_reflect_Reflection_getCallerClass__;
text: .text%Java_sun_reflect_Reflection_getCallerClass__I;
text: .text%Java_java_lang_Class_forName0;
text: .text%Java_java_lang_String_intern;
text: .text%Java_java_lang_Float_floatToIntBits;
...
...
makefiles/mapfiles/libjava/reorder-x86
浏览文件 @
43e7cb30
...
...
@@ -28,7 +28,8 @@ text: .text%Java_java_io_FileInputStream_initIDs;
text: .text%Java_java_io_FileDescriptor_initIDs;
text: .text%Java_java_io_FileOutputStream_initIDs;
text: .text%Java_java_lang_System_setIn0;
text: .text%Java_sun_reflect_Reflection_getCallerClass;
text: .text%Java_sun_reflect_Reflection_getCallerClass__;
text: .text%Java_sun_reflect_Reflection_getCallerClass__I;
text: .text%Java_java_lang_Class_forName0;
text: .text%Java_java_lang_String_intern;
text: .text%Java_sun_reflect_NativeConstructorAccessorImpl_newInstance0;
...
...
src/share/classes/sun/reflect/Reflection.java
浏览文件 @
43e7cb30
...
...
@@ -57,6 +57,14 @@ public class Reflection {
@CallerSensitive
public
static
native
Class
<?>
getCallerClass
();
/**
* @deprecated This method will be removed in JDK 9.
* This method is a private JDK API and retained temporarily for
* existing code to run until a replacement API is defined.
*/
@Deprecated
public
static
native
Class
<?>
getCallerClass
(
int
depth
);
/** Retrieves the access flags written to the class file. For
inner classes these flags may differ from those returned by
Class.getModifiers(), which searches the InnerClasses
...
...
src/share/javavm/export/jvm.h
浏览文件 @
43e7cb30
...
...
@@ -351,7 +351,7 @@ JVM_NewMultiArray(JNIEnv *env, jclass eltClass, jintArray dim);
* java.lang.Class and java.lang.ClassLoader
*/
#define JVM_DEPTH -1
#define JVM_
CALLER_
DEPTH -1
/*
* Returns the immediate caller class of the native method invoking
...
...
src/share/native/sun/reflect/Reflection.c
浏览文件 @
43e7cb30
...
...
@@ -26,10 +26,16 @@
#include "jvm.h"
#include "sun_reflect_Reflection.h"
JNIEXPORT
jclass
JNICALL
Java_sun_reflect_Reflection_getCallerClass
JNIEXPORT
jclass
JNICALL
Java_sun_reflect_Reflection_getCallerClass
__
(
JNIEnv
*
env
,
jclass
unused
)
{
return
JVM_GetCallerClass
(
env
,
JVM_DEPTH
);
// JVM_DEPTH is only the expected value
return
JVM_GetCallerClass
(
env
,
JVM_CALLER_DEPTH
);
}
JNIEXPORT
jclass
JNICALL
Java_sun_reflect_Reflection_getCallerClass__I
(
JNIEnv
*
env
,
jclass
unused
,
jint
depth
)
{
return
JVM_GetCallerClass
(
env
,
depth
);
}
JNIEXPORT
jint
JNICALL
Java_sun_reflect_Reflection_getClassAccessFlags
...
...
test/sun/reflect/Reflection/GetCallerClassWithDepth.java
0 → 100644
浏览文件 @
43e7cb30
/*
* Copyright (c) 2013, 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 8025799
* @summary sun.reflect.Reflection.getCallerClass(int)
* @run main GetCallerClassWithDepth
*/
public
class
GetCallerClassWithDepth
{
public
static
void
main
(
String
[]
args
)
throws
Exception
{
Class
<?>
c
=
Test
.
test
();
assertEquals
(
c
,
GetCallerClassWithDepth
.
class
);
Class
<?>
caller
=
Test
.
caller
();
assertEquals
(
caller
,
GetCallerClassWithDepth
.
class
);
Test
.
selfTest
();
try
{
sun
.
reflect
.
Reflection
.
getCallerClass
(-
1
);
throw
new
RuntimeException
(
"getCallerClass(-1) should fail"
);
}
catch
(
Error
e
)
{
System
.
out
.
println
(
"Expected: "
+
e
.
getMessage
());
}
}
public
Class
<?>
getCallerClass
()
{
// 0: Reflection 1: getCallerClass 2: Test.test 3: main
return
sun
.
reflect
.
Reflection
.
getCallerClass
(
3
);
}
static
void
assertEquals
(
Class
<?>
c
,
Class
<?>
expected
)
{
if
(
c
!=
expected
)
{
throw
new
RuntimeException
(
"Incorrect caller: "
+
c
);
}
}
static
class
Test
{
// Returns the caller of this method
public
static
Class
<?>
test
()
{
return
new
GetCallerClassWithDepth
().
getCallerClass
();
}
// Returns the caller of this method
public
static
Class
<?>
caller
()
{
// 0: Reflection 1: Test.caller 2: main
return
sun
.
reflect
.
Reflection
.
getCallerClass
(
2
);
}
public
static
void
selfTest
()
{
// 0: Reflection 1: Test.selfTest
Class
<?>
c
=
sun
.
reflect
.
Reflection
.
getCallerClass
(
1
);
assertEquals
(
c
,
Test
.
class
);
Inner1
.
deep
();
}
static
class
Inner1
{
static
void
deep
()
{
deeper
();
}
static
void
deeper
()
{
Inner2
.
deepest
();
}
static
class
Inner2
{
static
void
deepest
()
{
// 0: Reflection 1: deepest 2: deeper 3: deep 4: Test.selfTest
Class
<?>
c
=
sun
.
reflect
.
Reflection
.
getCallerClass
(
4
);
assertEquals
(
c
,
Test
.
class
);
}
}
}
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录