提交 8a19ace4 编写于 作者: D dfuchs

8012243: about 30% regression on specjvm2008.serial on 7u25 comparing 7u21

Reviewed-by: alanb, skoivu, smarks, mchung
上级 3ecdf18d
...@@ -266,10 +266,12 @@ public class ObjectStreamClass implements Serializable { ...@@ -266,10 +266,12 @@ public class ObjectStreamClass implements Serializable {
if (cl == null) { if (cl == null) {
return null; return null;
} }
if (System.getSecurityManager() != null) {
Class<?> caller = Reflection.getCallerClass(); Class<?> caller = Reflection.getCallerClass();
if (ReflectUtil.needsPackageAccessCheck(caller.getClassLoader(), cl.getClassLoader())) { if (ReflectUtil.needsPackageAccessCheck(caller.getClassLoader(), cl.getClassLoader())) {
ReflectUtil.checkPackageAccess(cl); ReflectUtil.checkPackageAccess(cl);
} }
}
return cl; return cl;
} }
......
...@@ -162,10 +162,12 @@ public class ObjectStreamField ...@@ -162,10 +162,12 @@ public class ObjectStreamField
*/ */
@CallerSensitive @CallerSensitive
public Class<?> getType() { public Class<?> getType() {
if (System.getSecurityManager() != null) {
Class<?> caller = Reflection.getCallerClass(); Class<?> caller = Reflection.getCallerClass();
if (ReflectUtil.needsPackageAccessCheck(caller.getClassLoader(), type.getClassLoader())) { if (ReflectUtil.needsPackageAccessCheck(caller.getClassLoader(), type.getClassLoader())) {
ReflectUtil.checkPackageAccess(type); ReflectUtil.checkPackageAccess(type);
} }
}
return type; return type;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册