in src/main/java/org/apache/commons/jexl3/introspection/JexlSandbox.java [644:685]
public Permissions get(final Class<?> clazz) {
Permissions permissions = clazz == null ? BLOCK_ALL : sandbox.get(clazz.getName());
if (permissions == null) {
if (inherit) {
// find first inherited interface that defines permissions
for (final Class<?> inter : clazz.getInterfaces()) {
permissions = sandbox.get(inter.getName());
if (permissions != null) {
if (permissions.isInheritable()) {
break;
}
permissions = null;
}
}
// nothing defined yet, find first superclass that defines permissions
if (permissions == null) {
// lets walk all super classes
Class<?> zuper = clazz.getSuperclass();
// walk all superclasses
while (zuper != null) {
permissions = sandbox.get(zuper.getName());
if (permissions != null) {
if (permissions.isInheritable()) {
break;
}
permissions = null;
}
zuper = zuper.getSuperclass();
}
}
// nothing was inheritable
if (permissions == null) {
permissions = allow ? ALLOW_ALL : BLOCK_ALL;
}
// store the info to avoid doing this costly look up
sandbox.put(clazz.getName(), permissions);
} else {
permissions = allow ? ALLOW_ALL : BLOCK_ALL;
}
}
return permissions;
}