The open source OpenXR runtime
1# About these JNI Wrappers
2
3<!--
4Copyright 2020, Collabora, Ltd.
5SPDX-License-Identifier: BSL-1.0
6-->
7
8These are fairly simple wrappers around Java classes, using JNI and JNIPP to allow relatively-painless use of Java classes from C++. They are populated as-needed: if you need a method/property that's missing, add it!
9
10## Conventions
11
12All classes derive from ObjectWrapperBase or one of its subclasses. (Yes, you
13can directly mirror inheritance in Java with inheritance in these wrappers.)
14
15All should have a public internal struct called `Meta` that derives publicly
16from either `MetaBase` or `MetaBaseDroppable` (the more common option, when you
17don't often need the class object itself), with a member for each method ID.
18Only the `Meta()` constructor should be in the `.cpp` file for a given wrapper:
19the rest lives in the header so it may be inlined and thus optimized away.
20
21## Finding signatures
22
23A command like the following can help you get the JNI signatures of methods:
24
25```sh
26javap -s -classpath ~/Android/Sdk/platforms/android-26/android.jar android.service.vr.VrListenerService
27```
28
29Adjust the location of the SDK and the class under investigation as needed.