-
Notifications
You must be signed in to change notification settings - Fork 13
/
Runnable.swift
83 lines (50 loc) · 2.64 KB
/
Runnable.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
/// generated by: genswift.java 'java/lang|java/util|java/sql|java/awt|javax/swing' ///
/// interface java.lang.Runnable ///
public protocol Runnable: JavaProtocol {
/// public abstract void java.lang.Runnable.run()
func run()
}
open class RunnableForward: JNIObjectForward, Runnable {
private static var RunnableJNIClass: jclass?
/// public abstract void java.lang.Runnable.run()
private static var run_MethodID_2: jmethodID?
open func run() {
var __locals = [jobject]()
var __args = [jvalue]( repeating: jvalue(), count: 1 )
JNIMethod.CallVoidMethod( object: javaObject, methodName: "run", methodSig: "()V", methodCache: &RunnableForward.run_MethodID_2, args: &__args, locals: &__locals )
}
}
private typealias Runnable_run_0_type = @convention(c) ( _: UnsafeMutablePointer<JNIEnv?>, _: jobject?, _: jlong ) -> ()
private func Runnable_run_0( _ __env: UnsafeMutablePointer<JNIEnv?>, _ __this: jobject?, _ __swiftObject: jlong ) -> () {
RunnableLocal_.swiftObject( jniEnv: __env, javaObject: __this, swiftObject: __swiftObject ).run( )
}
fileprivate class RunnableLocal_: JNILocalProxy<Runnable, Any> {
fileprivate static let _proxyClass: jclass = {
var natives = [JNINativeMethod]()
let Runnable_run_0_thunk: Runnable_run_0_type = Runnable_run_0
natives.append( JNINativeMethod( name: strdup("__run"), signature: strdup("(J)V"), fnPtr: unsafeBitCast( Runnable_run_0_thunk, to: UnsafeMutableRawPointer.self ) ) )
natives.append( JNINativeMethod( name: strdup("__finalize"), signature: strdup("(J)V"), fnPtr: unsafeBitCast( JNIReleasableProxy__finalize_thunk, to: UnsafeMutableRawPointer.self ) ) )
let clazz = JNI.FindClass( proxyClassName() )
natives.withUnsafeBufferPointer {
nativesPtr in
if JNI.api.RegisterNatives( JNI.env, clazz, nativesPtr.baseAddress, jint(nativesPtr.count) ) != jint(JNI_OK) {
JNI.report( "Unable to register java natives" )
}
}
defer { JNI.DeleteLocalRef( clazz ) }
return JNI.api.NewGlobalRef( JNI.env, clazz )!
}()
override open class func proxyClassName() -> String { return "org/swiftjava/java_swift/RunnableProxy" }
override open class func proxyClass() -> jclass? { return _proxyClass }
}
extension Runnable {
public func localJavaObject( _ locals: UnsafeMutablePointer<[jobject]> ) -> jobject? {
return RunnableLocal_( owned: self, proto: self ).localJavaObject( locals )
}
}
open class RunnableBase: Runnable {
public init() {}
/// public abstract void java.lang.Runnable.run()
open func run() /**/ {
}
}