HHH-13277 Add a couple of comments

(cherry picked from commit 89f523c87f)
This commit is contained in:
Guillaume Smet 2019-02-22 13:07:22 +01:00 committed by gbadner
parent 635ccbddd4
commit d25d7dc34b
1 changed files with 9 additions and 1 deletions

View File

@ -17,6 +17,13 @@ import java.util.stream.Stream;
import org.hibernate.HibernateException;
/**
* This dispatcher analyzes the stack frames to detect if a particular call should be authorized.
* <p>
* Authorized classes are registered when creating the ByteBuddy proxies.
* <p>
* It should only be used when the Security Manager is enabled.
*/
public class HibernateMethodLookupDispatcher {
/**
@ -93,6 +100,7 @@ public class HibernateMethodLookupDispatcher {
public PrivilegedAction<Class<?>[]> run() {
Class<?> stackWalkerClass = null;
try {
// JDK 9 introduced the StackWalker
stackWalkerClass = Class.forName( "java.lang.StackWalker" );
}
catch (ClassNotFoundException e) {
@ -192,9 +200,9 @@ public class HibernateMethodLookupDispatcher {
}
}
@SuppressWarnings({ "unchecked", "rawtypes" })
private final Function<Stream, Object> stackFrameExtractFunction = new Function<Stream, Object>() {
@Override
@SuppressWarnings({ "unchecked", "rawtypes" })
public Object apply(Stream stream) {
return stream.map( stackFrameGetDeclaringClassFunction )
.limit( MAX_STACK_FRAMES )