Fix initialization of OBJECT_HASHCODE in PrivatelyQueuedListener

This commit is contained in:
0xGrizzly 2024-06-20 12:00:43 -04:00
parent 20702592dd
commit 2fc70183e5

View File

@ -32,16 +32,16 @@ public class PrivatelyQueuedListener<P> {
private ListenerErrorHandler errorHandler =
DataStructureErrorHandlerFactory.createListenerErrorHandler();
protected class ListenerHandler implements InvocationHandler {
private static final Method OBJECT_HASHCODE;
static {
try {
OBJECT_HASHCODE = Object.class.getMethod("hashCode");
}
catch (NoSuchMethodException | SecurityException e) {
throw new AssertionError(e);
}
}
protected class ListenerHandler implements InvocationHandler {
private static final Method OBJECT_HASHCODE = initObjectHashCode();
private static Method initObjectHashCode() {
try {
return Object.class.getMethod("hashCode");
} catch (NoSuchMethodException | SecurityException e) {
throw new AssertionError(e);
}
}
protected final Class<P> iface;
public ListenerHandler(Class<P> iface) {