< prev index next >
src/java.base/share/classes/java/lang/Class.java
Print this page
*** 435,445 ****
// Disable accessibility checks on the constructor
// since we have to do the security check here anyway
// (the stack depth is wrong for the Constructor's
// security check to work)
java.security.AccessController.doPrivileged(
! new java.security.PrivilegedAction<Void>() {
public Void run() {
c.setAccessible(true);
return null;
}
});
--- 435,445 ----
// Disable accessibility checks on the constructor
// since we have to do the security check here anyway
// (the stack depth is wrong for the Constructor's
// security check to work)
java.security.AccessController.doPrivileged(
! new java.security.PrivilegedAction<>() {
public Void run() {
c.setAccessible(true);
return null;
}
});
*** 1066,1076 ****
final Class<?> enclosingCandidate = enclosingInfo.getEnclosingClass();
enclosingCandidate.checkMemberAccess(Member.DECLARED,
Reflection.getCallerClass(), true);
// Client is ok to access declared methods but j.l.Class might not be.
Method[] candidates = AccessController.doPrivileged(
! new PrivilegedAction<Method[]>() {
@Override
public Method[] run() {
return enclosingCandidate.getDeclaredMethods();
}
});
--- 1066,1076 ----
final Class<?> enclosingCandidate = enclosingInfo.getEnclosingClass();
enclosingCandidate.checkMemberAccess(Member.DECLARED,
Reflection.getCallerClass(), true);
// Client is ok to access declared methods but j.l.Class might not be.
Method[] candidates = AccessController.doPrivileged(
! new PrivilegedAction<>() {
@Override
public Method[] run() {
return enclosingCandidate.getDeclaredMethods();
}
});
*** 1226,1236 ****
final Class<?> enclosingCandidate = enclosingInfo.getEnclosingClass();
enclosingCandidate.checkMemberAccess(Member.DECLARED,
Reflection.getCallerClass(), true);
// Client is ok to access declared methods but j.l.Class might not be.
Constructor<?>[] candidates = AccessController.doPrivileged(
! new PrivilegedAction<Constructor<?>[]>() {
@Override
public Constructor<?>[] run() {
return enclosingCandidate.getDeclaredConstructors();
}
});
--- 1226,1236 ----
final Class<?> enclosingCandidate = enclosingInfo.getEnclosingClass();
enclosingCandidate.checkMemberAccess(Member.DECLARED,
Reflection.getCallerClass(), true);
// Client is ok to access declared methods but j.l.Class might not be.
Constructor<?>[] candidates = AccessController.doPrivileged(
! new PrivilegedAction<>() {
@Override
public Constructor<?>[] run() {
return enclosingCandidate.getDeclaredConstructors();
}
});
*** 1540,1550 ****
// is allowed to look at DECLARED classes because (1) it does not hand
// out anything other than public members and (2) public member access
// has already been ok'd by the SecurityManager.
return java.security.AccessController.doPrivileged(
! new java.security.PrivilegedAction<Class<?>[]>() {
public Class<?>[] run() {
List<Class<?>> list = new ArrayList<>();
Class<?> currentClass = Class.this;
while (currentClass != null) {
for (Class<?> m : currentClass.getDeclaredClasses()) {
--- 1540,1550 ----
// is allowed to look at DECLARED classes because (1) it does not hand
// out anything other than public members and (2) public member access
// has already been ok'd by the SecurityManager.
return java.security.AccessController.doPrivileged(
! new java.security.PrivilegedAction<>() {
public Class<?>[] run() {
List<Class<?>> list = new ArrayList<>();
Class<?> currentClass = Class.this;
while (currentClass != null) {
for (Class<?> m : currentClass.getDeclaredClasses()) {
*** 3291,3301 ****
// To be able to query system properties as soon as they're available
private static boolean initted = false;
private static void checkInitted() {
if (initted) return;
! AccessController.doPrivileged(new PrivilegedAction<Void>() {
public Void run() {
// Tests to ensure the system properties table is fully
// initialized. This is needed because reflection code is
// called very early in the initialization process (before
// command-line arguments have been parsed and therefore
--- 3291,3301 ----
// To be able to query system properties as soon as they're available
private static boolean initted = false;
private static void checkInitted() {
if (initted) return;
! AccessController.doPrivileged(new PrivilegedAction<>() {
public Void run() {
// Tests to ensure the system properties table is fully
// initialized. This is needed because reflection code is
// called very early in the initialization process (before
// command-line arguments have been parsed and therefore
*** 3347,3357 ****
if (enumConstants == null) {
if (!isEnum()) return null;
try {
final Method values = getMethod("values");
java.security.AccessController.doPrivileged(
! new java.security.PrivilegedAction<Void>() {
public Void run() {
values.setAccessible(true);
return null;
}
});
--- 3347,3357 ----
if (enumConstants == null) {
if (!isEnum()) return null;
try {
final Method values = getMethod("values");
java.security.AccessController.doPrivileged(
! new java.security.PrivilegedAction<>() {
public Void run() {
values.setAccessible(true);
return null;
}
});
< prev index next >