Swift.String should be translated to an imported String type instead of java.lang.String, just like Foundation.Data.
In JExtract/FFM, String is currently translated to java.lang.String and lowered to C-string (UnsafePointer<Int8>).
That works for parameters, but is making passing String value between Swift and Java more expensive than it should be. Also it does not work well for API returning String because the client has to manually free the memory.
For example, using this interface,
public func getSomeString() -> String
public func receiveString(str: String)
In Java:
var str = MyLib.getSomeString()
receiveString(str)
This receiving and passing string value should not cause copy.
Swift.Stringshould be translated to an importedStringtype instead ofjava.lang.String, just likeFoundation.Data.In JExtract/FFM,
Stringis currently translated tojava.lang.Stringand lowered to C-string (UnsafePointer<Int8>).That works for parameters, but is making passing
Stringvalue between Swift and Java more expensive than it should be. Also it does not work well for API returningStringbecause the client has to manuallyfreethe memory.For example, using this interface,
In Java:
This receiving and passing string value should not cause copy.