Open
Description
If a callback is implemented through a CallbackProxy, it is probably a bad idea to allow it being called directly (bypassing the proxy).
diff --git a/src/com/sun/jna/CallbackReference.java b/src/com/sun/jna/CallbackReference.java index bcf5568..5b15301 100644 --- a/src/com/sun/jna/CallbackReference.java +++ b/src/com/sun/jna/CallbackReference.java @@ -150,6 +150,7 @@ // Check whether direct mapping may be used, or whether // we need to fall back to conventional mapping boolean ppc = Platform.isPPC(); + if (callback instanceof CallbackProxy) direct = false; if (direct) { Method m = getCallbackMethod(callback); Class[] ptypes = m.getParameterTypes();
Also "boolean ppc = ...;" can be put into the "if (direct) {" block