The JNI Generator generates a RegisterNativesImpl method for every JNI-enabled Java class. Sometimes these do nothing at all, for example:
static bool RegisterNativesImpl(JNIEnv* env) {
if (base::android::IsManualJniRegistrationDisabled()) return true;
return true;
}
Yet these must still be called, or clang complains:
error: unused function 'RegisterNativesImpl' [-Werror,-Wunused-function]
This is particularly awkward for test support classes used by multiple test suites, as each test suite ends up having to separately call the RegisterNativesImpl method from their run_all_unittests.cc. See for example:
https://code.google.com/p/chromium/codesearch#search/&q=RegisterContentUriTestUtils
Instead, the JNI Generator should stop generating RegisterNativesImpl when it would be a no-op. This may require removing unused command line flags like --eager_called_by_natives.
Comment 1 by siev...@chromium.org
, Jul 13 2016