Issue
This Kotlin function
@JvmStatic external fun registerNativeWindowFromSurface(): Integer;
is found by with return type java/lang/Integer
but when I add a Long:
@JvmStatic external fun registerNativeWindowFromSurface(id: Long): Integer;
I cannot find it with java/lang/Long
in the argument.
Is Kotlin's Long a java long
or a java/lang/Long
? How can I get a Long class?
Solution
Integer
is not the Kotlin-native integer type. Integer
is an alias to java.lang.Integer
. Int
is the Kotlin integer type.
@JvmStatic external fun registerNativeWindowFromSurface(): Int
@JvmStatic external fun registerNativeWindowFromSurface(id: Long): Int
These will compile to functions with signatures
int registerNativeWindowFromSurface();
int registerNativeWindowFromSurface(long id);
And the class instance for the primitive type int
is java.lang.Integer.TYPE
. Likewise for long
and java.lang.Long.TYPE
.
If you actually intend to use Java boxed types, you can reference them with their fully qualified names.
@JvmStatic external fun registerNativeWindowFromSurface(): java.lang.Integer
@JvmStatic external fun registerNativeWindowFromSurface(id: java.lang.Long): java.lang.Integer
Answered By - Silvio Mayolo
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.