Skip to content

Map basic objects like NSRect #7

Open

Description

@mojo2012

I'm trying to show a simple empty window on screen - but right now I'm totally stuck calling NSWindow.initWithContentRect:styleMask:backing:defer:. I think the problem is my NSRect implementation:

public class NSRect extends Structure implements Structure.ByValue {
    public NSPoint origin;
    public NSSize size;

    ...

    @Override
	protected List<String> getFieldOrder() {
		return Arrays.asList("origin", "size");
	}
}

I have no clue what goes wrong here, but this is the stack:

2019-06-02 22:03:22.641 java[53279:2512944] *** +[WLJavaProxy restorableStateKeyPaths]: unrecognized selector sent to class 0x1143803b8
2019-06-02 22:03:22.645 java[53279:2512944] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** +[WLJavaProxy restorableStateKeyPaths]: unrecognized selector sent to class 0x1143803b8'
*** First throw call stack:
(
	0   CoreFoundation                      0x00007fff41da9cfd __exceptionPreprocess + 256
	1   libobjc.A.dylib                     0x00007fff6c44fa17 objc_exception_throw + 48
	2   Foundation                          0x00007fff44123639 +[NSProxy init] + 0
	3   CoreFoundation                      0x00007fff41d4bb8f ___forwarding___ + 1485
	4   CoreFoundation                      0x00007fff41d4b538 _CF_forwarding_prep_0 + 120
	5   AppKit                              0x00007fff3f3629e8 -[NSResponder(NSPersistentUISupport) _changePersistentKeyPathObservationTo:] + 48
	6   jna17962736570655425700.tmp         0x000000011443de74 ffi_call_unix64 + 76
	7   ???                                 0x00007ffee8311758 0x0 + 140732793952088
)
libc++abi.dylib: terminating with uncaught exception of type NSException

It would be nice to have basic types already mapped!

Furthermore, it would be awesome to have better logging in case something goes wrong, like what are the selector arguments that were passed (on the objc-side).

Thanks for any help.

Activity

  1. shannah commented on Jun 3, 2019

    @shannah
    Owner

    Struct parameters are not well supported right now. I'd like to add support for them, but currently it isn't on my radar. Handling shortcomings like this, I usually handle by writing a small library in Objective-C that wraps the things I need, in a way that is easier for the bridge to work with. Then call that wrapper via the Objective-C bridge.

  2. mojo2012 commented on Jun 3, 2019

    @mojo2012
    CollaboratorAuthor

    Well for now I copied some files from rococoa and adapted them a bit. It seems to work quite well.
    I prefer not to write objective-c :-D

  3. shannah commented on Jun 3, 2019

    @shannah
    Owner

    Do you use the rococoa stuff in conjunction with the objective-c bridge (this library), or on its own? e.g. is there any thing you can share that might help others facing the same issue?

  4. mojo2012 commented on Jun 4, 2019

    @mojo2012
    CollaboratorAuthor

    This is what I'm currently working on: https://github.com/mojo2012/kakao
    It's a basic macOS cocoa UI framework. It was born from the dissatisfaction of the current Java IDEs (and I've tried them all) - UI-wise. I plan it to use as the UI foundation for a new Java IDE based on Eclipse Compiler/Editor/LSP infrastructure :-D (if my children give me enough time hehe)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions