Skip to content

[jnigen] ☂️ General refactorings #1581

Open

Description

@HosseinYousefi

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
  • Rename $MethodInvocation, instead use import prefixes to prevent name collision
  • 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?
  • Possibly make type classes @internal, users should instead use Foo.type.
  • 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

Activity

  1. added this to the milestone on Sep 18, 2024
  2. moved this from Todo to In Progress in JNIgen trackeron Sep 24, 2024
  3. removed this from the milestone on Oct 23, 2024
  4. moved this from In Progress to Backlog in JNIgen trackeron Oct 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions