native icon indicating copy to clipboard operation
native copied to clipboard

[jnigen] ☂️ General refactorings

Open HosseinYousefi opened this issue 1 year ago • 0 comments

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 Jni with basically only static fields and members, Jni.spawn can simply be spawnJvm
  • [ ] 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 Foo is called $Foo instead of $FooImpl they can theoretically collide with another interface called FooType, where the type class of Foo is $FooType, and the implementation class of FooType is also $FooType. If we make the type class to be Foo$Type instead, it can collide with an inner class of Foo named Type. So maybe$Foo$Type?
  • [x] Possibly make type classes @internal, users should instead use Foo.type.
  • [x] Change T extends JObject's late final $type to be final $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

HosseinYousefi avatar Sep 18 '24 18:09 HosseinYousefi