Skip to content

JNI clean up#3010

Merged
beeender merged 3 commits intoreleasesfrom
mc/jni-declaration-fix
Jun 16, 2016
Merged

JNI clean up#3010
beeender merged 3 commits intoreleasesfrom
mc/jni-declaration-fix

Conversation

@beeender
Copy link
Copy Markdown
Contributor

  • Enable -Wmissing-declarations and -Werror to ensure all global
    functions are defined with a proper declaration. JNI function not
    found problem can only be seen at run time, thus we need to do so.
  • Add static keyword for local functions.
  • Fix wrong JNI function declaration.
  • Remove useless functions.

* Enable -Wmissing-declarations and -Werror to ensure all global
  functions are defined with a proper declaration. JNI function not
  found problem can only be seen at run time, thus we need to do so.
* Add static keyword for local functions.
* Fix wrong JNI function declaration.
* Remove useless functions.
return 0;
}

JNIEXPORT jboolean JNICALL Java_io_realm_internal_Group_nativeEquals(
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this useless? Seems more like Group.equals() should actually use it instead?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we ever need to call Group.equals()?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't right now at least, and Group might go away with the object store, so yeah, ¯_(ツ)_/¯

@cmelchior
Copy link
Copy Markdown
Contributor

I would think a lot more methods needs to be static, but maybe they already are? Except from that 👍

@beeender
Copy link
Copy Markdown
Contributor Author

Yeah, created an issue to track the static problem #3011

@stk1m1
Copy link
Copy Markdown
Contributor

stk1m1 commented Jun 16, 2016

Could you also rename following two filenames according to the naming convention? It always bugs me.

  • io_realm_internal_tableview.cpp
  • io_realm_internal_table.cpp

Other than that + what @cmelchior pointed, you have a 👍 from my heart. Also, I'd ask @kneth's review as well.

return myClass;
}

void jprint(JNIEnv *env, char *txt)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This has been useful for debugging in the past. But I assume we have another way now?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no idea, didn't spend time to check. No one is calling them so instead of making them static, I just removed them. They would be easily back by checking git history if needed.

Copy link
Copy Markdown
Contributor

@stk1m1 stk1m1 Jun 16, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also saw this function was removed, but thought it was ok as we'd be able to put a breakpoint after @beeender's #2960 completed. Relying printf for JNI debugging has been pain in the neck, tbh.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are the TR macros.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are using the TR macros for logging. It will make it easier to support non-Android.

@kneth
Copy link
Copy Markdown
Contributor

kneth commented Jun 16, 2016

👍

@beeender beeender merged commit b0e1881 into releases Jun 16, 2016
@beeender beeender deleted the mc/jni-declaration-fix branch June 16, 2016 08:21
@beeender beeender removed the S:Review label Jun 16, 2016
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 16, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants