| commit | 1071b86eeb1af8d79992db13b1e3f883314aeb7f | [log] [tgz] |
|---|---|---|
| author | Xin Li <[email protected]> | Fri Dec 20 13:39:37 2024 -0800 |
| committer | Xin Li <[email protected]> | Fri Dec 20 13:39:37 2024 -0800 |
| tree | aaeeb5255dd3204f6c5241ef3d419c7d597651ff | |
| parent | 10ab3d5684d607e4639dd7949074d31e874a2ad4 [diff] | |
| parent | 65c59e023c5336bbd4a23be7af78407e3d80e7e7 [diff] |
Empty merge ab/12770256 into aosp-main-future Merged-In: I51ff75cdc990dd43d8c6f6c939fed2134080acae Change-Id: I5d54fd82fcdbd5e2da21aff2f36c77d8d966d7cb
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.