commit | 408af4e82093c041e8b0b6c98c96f9cb4fa5d59f | [log] [tgz] |
---|---|---|
author | Nikita Lutsenko <nlutsenko@meta.com> | Wed Nov 08 11:39:44 2023 -0800 |
committer | Facebook GitHub Bot <facebook-github-bot@users.noreply.github.com> | Wed Nov 08 11:39:44 2023 -0800 |
tree | 773ad8a3ca2744795d00c24be28779f046d2455d | |
parent | 12995ec0d27d682ebad4a6986913a303cac1693d [diff] |
fbjni | Fix lints exposed by clang-tidy Differential Revision: D51020426 fbshipit-source-id: 8a872650ed53f6716eed67299aa03b671074723e
The Facebook JNI helpers library is designed to simplify usage of the Java Native Interface. The helpers were implemented to ease the integration of cross-platform mobile code on Android, but there are no Android specifics in the design. It can be used with any Java VM that supports JNI.
struct JMyClass : JavaClass<JMyClass> { static constexpr auto kJavaDescriptor = "Lcom/example/MyClass;"; // Automatic inference of Java method descriptors. static std::string concatenate( alias_ref<JClass> clazz, // Automatic conversion to std::string. std::string prefix) { // Call methods easily. static const auto getSuffix = clazz->getStaticMethod<JString()>("getSuffix"); // Manage JNI references automatically. local_ref<JString> jstr = getSuffix(clazz); // Automatic exception translation between Java and C++ (both ways). // No need to check exception state after each call. result += jstr->toStdString(); // Automatic conversion from std::string. return result; } };
fbjni is Apache-2 licensed, as found in the LICENSE file.