native
native copied to clipboard
[jnigen] ☂️ General refactorings
Before 1.0 I would like to do some general quality of life clean ups, this is the umbrella issue of it.
- [ ] Format the test descriptions correctly
- [ ] Remove
abstract class Jniwith basically only static fields and members,Jni.spawncan simply bespawnJvm - [ ] Remove
ProtectedJniExtensions, have all members as global internal methods - [ ] Use consistent cases for the C API
- [ ] Improve the folder structure of jnigen
- [ ] Dramatically reduce the amount of exported symbols from
package:jni - [x] Rename
$MethodInvocation, instead use import prefixes to prevent name collision - [x] Now that the implementation class for an interface called
Foois called$Fooinstead of$FooImplthey can theoretically collide with another interface calledFooType, where the type class ofFoois$FooType, and the implementation class ofFooTypeis also$FooType. If we make the type class to beFoo$Typeinstead, it can collide with an inner class ofFoonamedType. So maybe$Foo$Type? - [x] Possibly make type classes
@internal, users should instead useFoo.type. - [x] Change
T extends JObject'slate final $typeto befinal $type. It's not a big deal to possibly create an extra type object as the level of generics are not that deep so the type is usually just a const anyway. - [ ] From a naming collision perspective, there is no reason to prepend every parameter and local variable with
$s. It's not necessary to read the generated code, but we also shouldn't go out of our way to make both the generator and the generated code uglier. - [ ] Make all multiline strings use
''' - [ ] Separate the API and implementation of JNIgen generated files to make the bindings look cleaner
More to be added