Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Print warning if NatJ creates a binding object based on a super class #185

Open
Berstanio opened this issue Sep 24, 2022 · 0 comments
Open

Comments

@Berstanio
Copy link

I had the following issue:
I had a abstract super class A with subclass B and subclass C. Than I had a block callback that got a object of type A as a parameter. But type A was never actually passed, only either B or C.
Than in the callback I had something like:

if (paramA instanceof B) {
     // Do x
} else if (paramA instanceof C) {
    // Do y
}

The problem was now, that I have never referenced class B or C directly, so their static init block with NatJ.register() was never executed.
When now the callback was called NatJ created a binding java object A for the ObjC classes B and C, so my "instanceof" code wasn't working correctly.
It would be probably good to have NatJ print a warning in such cases, something like "No binding class for ObjC class B/C was registered, falling back to superclass binding A".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant