@@ -285,3 +285,122 @@ extension Int64: JavaValue {
285285 0
286286 }
287287}
288+
289+ #if _pointerBitWidth(_32)
290+ extension Int : JavaValue {
291+
292+ public typealias JNIType = jint
293+
294+ public static var jvalueKeyPath : WritableKeyPath < jvalue , JNIType > { \. i }
295+
296+ public func getJNIValue( in environment: JNIEnvironment ) -> JNIType { JNIType ( self ) }
297+
298+ public init ( fromJNI value: JNIType , in environment: JNIEnvironment ) {
299+ self = Int ( value)
300+ }
301+
302+ public static var javaType : JavaType { . int }
303+
304+ public static func jniMethodCall(
305+ in environment: JNIEnvironment
306+ ) -> ( ( JNIEnvironment , jobject , jmethodID , UnsafePointer < jvalue > ? ) -> JNIType ) {
307+ environment. interface. CallIntMethodA
308+ }
309+
310+ public static func jniFieldGet( in environment: JNIEnvironment ) -> JNIFieldGet < JNIType > {
311+ environment. interface. GetIntField
312+ }
313+
314+ public static func jniFieldSet( in environment: JNIEnvironment ) -> JNIFieldSet < JNIType > {
315+ environment. interface. SetIntField
316+ }
317+
318+ public static func jniStaticMethodCall(
319+ in environment: JNIEnvironment
320+ ) -> ( ( JNIEnvironment , jobject , jmethodID , UnsafePointer < jvalue > ? ) -> JNIType ) {
321+ environment. interface. CallStaticIntMethodA
322+ }
323+
324+ public static func jniStaticFieldGet( in environment: JNIEnvironment ) -> JNIStaticFieldGet < JNIType > {
325+ environment. interface. GetStaticIntField
326+ }
327+
328+ public static func jniStaticFieldSet( in environment: JNIEnvironment ) -> JNIStaticFieldSet < JNIType > {
329+ environment. interface. SetStaticIntField
330+ }
331+
332+ public static func jniNewArray( in environment: JNIEnvironment ) -> JNINewArray {
333+ environment. interface. NewIntArray
334+ }
335+
336+ public static func jniGetArrayRegion( in environment: JNIEnvironment ) -> JNIGetArrayRegion < JNIType > {
337+ environment. interface. GetIntArrayRegion
338+ }
339+
340+ public static func jniSetArrayRegion( in environment: JNIEnvironment ) -> JNISetArrayRegion < JNIType > {
341+ environment. interface. SetIntArrayRegion
342+ }
343+
344+ public static var jniPlaceholderValue : jint {
345+ 0
346+ }
347+ }
348+ #elseif _pointerBitWidth(_64)
349+ extension Int : JavaValue {
350+ public typealias JNIType = jlong
351+
352+ public static var jvalueKeyPath : WritableKeyPath < jvalue , JNIType > { \. j }
353+
354+ public func getJNIValue( in environment: JNIEnvironment ) -> JNIType { JNIType ( self ) }
355+
356+ public init ( fromJNI value: JNIType , in environment: JNIEnvironment ) {
357+ self = Int ( value)
358+ }
359+
360+ public static var javaType : JavaType { . long }
361+
362+ public static func jniMethodCall(
363+ in environment: JNIEnvironment
364+ ) -> ( ( JNIEnvironment , jobject , jmethodID , UnsafePointer < jvalue > ? ) -> JNIType ) {
365+ environment. interface. CallLongMethodA
366+ }
367+
368+ public static func jniFieldGet( in environment: JNIEnvironment ) -> JNIFieldGet < JNIType > {
369+ environment. interface. GetLongField
370+ }
371+
372+ public static func jniFieldSet( in environment: JNIEnvironment ) -> JNIFieldSet < JNIType > {
373+ environment. interface. SetLongField
374+ }
375+
376+ public static func jniStaticMethodCall(
377+ in environment: JNIEnvironment
378+ ) -> ( ( JNIEnvironment , jobject , jmethodID , UnsafePointer < jvalue > ? ) -> JNIType ) {
379+ environment. interface. CallStaticLongMethodA
380+ }
381+
382+ public static func jniStaticFieldGet( in environment: JNIEnvironment ) -> JNIStaticFieldGet < JNIType > {
383+ environment. interface. GetStaticLongField
384+ }
385+
386+ public static func jniStaticFieldSet( in environment: JNIEnvironment ) -> JNIStaticFieldSet < JNIType > {
387+ environment. interface. SetStaticLongField
388+ }
389+
390+ public static func jniNewArray( in environment: JNIEnvironment ) -> JNINewArray {
391+ environment. interface. NewLongArray
392+ }
393+
394+ public static func jniGetArrayRegion( in environment: JNIEnvironment ) -> JNIGetArrayRegion < JNIType > {
395+ environment. interface. GetLongArrayRegion
396+ }
397+
398+ public static func jniSetArrayRegion( in environment: JNIEnvironment ) -> JNISetArrayRegion < JNIType > {
399+ environment. interface. SetLongArrayRegion
400+ }
401+
402+ public static var jniPlaceholderValue : jlong {
403+ 0
404+ }
405+ }
406+ #endif
0 commit comments