Closed
Description
Right now, an initializer of an @JavaClass
type requires an environment parameter, e.g.,
@JavaClass("org.swift.javakit.examples.MyClass")
struct MyClass {
@JavaMethod
init(environment: JNIEnvironment)
}
We could allow this to be:
@JavaClass("org.swift.javakit.examples.MyClass")
struct MyClass {
@JavaMethod
init(environment: JNIEnvironment? = nil)
}
And, if nil
is passed, use JavaVirtualMachine.shared().environment()
(introduced in #69) as the default value. This requires some work on the @JavaMethod
macro implementation, and collapsing JavaKitVM
down into JavaKit
, but should otherwise be straightforward.