atom feed22 messages in net.java.dev.rococoa.usersRe: BOOL mapping issues
FromSent OnAttachments
Harald KuhrFeb 9, 2010 11:58 am 
Duncan McGregorFeb 9, 2010 12:04 pm 
Harald KuhrFeb 9, 2010 12:27 pm 
Harald KuhrFeb 9, 2010 12:37 pm.java
Duncan McGregorFeb 10, 2010 12:37 am 
Harald KuhrFeb 10, 2010 2:39 am.java
Harald KuhrFeb 17, 2010 7:25 am 
Duncan McGregorFeb 18, 2010 1:56 am 
Andrew ThompsonFeb 18, 2010 6:52 pm 
Harald KuhrFeb 19, 2010 6:49 am 
Harald KuhrFeb 19, 2010 7:23 am 
Harald KuhrFeb 19, 2010 10:37 am 
Harald KuhrFeb 19, 2010 12:13 pm 
Duncan McGregorFeb 19, 2010 2:04 pm 
Harald KuhrFeb 19, 2010 3:06 pm 
Andrew ThompsonFeb 20, 2010 8:02 am 
Harald KuhrFeb 20, 2010 1:12 pm 
Andrew ThompsonFeb 20, 2010 5:22 pm 
Duncan McGregorFeb 21, 2010 2:55 am 
Harald KuhrFeb 21, 2010 8:14 am 
Duncan McGregorFeb 21, 2010 8:40 am 
Duncan McGregorFeb 21, 2010 9:01 am 
Subject:Re: BOOL mapping issues
From:Harald Kuhr (hara@gmail.com)
Date:Feb 9, 2010 12:27:23 pm
List:net.java.dev.rococoa.users

Hi Duncan,

Hmm... There are plenty other methods on NSView that has the exact same void
foo(BOOL b) signature.. And they all work as expected. That probably explains
why no one noticed this before.. And makes the issue even stranger... I guess
updating test.m won't work then. :-(

Thanks for a very quick response, btw! :-)

On 9. feb. 2010, at 21.05, Duncan McGregor wrote:

Odd, JNA is responsible for that marshalling. A failing test case would be good,
especially if it involved updating test.m so that didn't depend on NSView...

On 9 Feb 2010, at 19:58, Harald Kuhr wrote:

Hi guys,

I just came across some very odd mapping behavior... There seems to be a problem
mapping (ObjC) BOOL to (Java) boolean in method parameters.

Given:

@RunOnMainThread public interface NSView extends NSObject { void setHidden(boolean hidden); // What I want. void setHidden(int hidden); // My workaround... boolean isHidden();

// ... }

And the following code snippet:

NSView view;

view.setHidden(false); System.out.println(view.isHidden());

view.setHidden(0); System.out.println(view.isHidden());

view.setHidden(true); System.out.println(view.isHidden());

view.setHidden(1); System.out.println(view.isHidden());

The output is as follows:

false false false true

While the expected would be false, false, true, true... It would be trivial to
convert this code into a failing test case, if anyone's interested.

Has anyone else stumbled across this? Is this a known issue? Am I doing anything
wrong?

Best regards,