@@ -101,7 +101,7 @@ jvalue(v::Float64) = jvalue(reinterpret(Int64, v))
101
101
jvalue (v:: Ptr ) = jvalue (Int (v))
102
102
103
103
104
- function _jimport (juliaclass)
104
+ function _jimport (juliaclass)
105
105
for str ∈ [" " , " (" , " )" ]
106
106
juliaclass = replace (juliaclass, str=> " " )
107
107
end
122
122
123
123
124
124
function jnew (T:: Symbol , argtypes:: Tuple , args... )
125
+ assertroottask ()
125
126
sig = method_signature (Nothing, argtypes... )
126
127
jmethodId = ccall (jnifunc. GetMethodID, Ptr{Nothing},
127
128
(Ptr{JNIEnv}, Ptr{Nothing}, Ptr{UInt8}, Ptr{UInt8}), penv, metaclass (T),
135
136
# Call static methods
136
137
function jcall (typ:: Type{JavaObject{T}} , method:: AbstractString , rettype:: Type , argtypes:: Tuple ,
137
138
args... ) where T
139
+ assertroottask ()
138
140
sig = method_signature (rettype, argtypes... )
139
141
jmethodId = ccall (jnifunc. GetStaticMethodID, Ptr{Nothing},
140
142
(Ptr{JNIEnv}, Ptr{Nothing}, Ptr{UInt8}, Ptr{UInt8}), penv, metaclass (T),
145
147
146
148
# Call instance methods
147
149
function jcall (obj:: JavaObject , method:: AbstractString , rettype:: Type , argtypes:: Tuple , args... )
150
+ assertroottask ()
148
151
sig = method_signature (rettype, argtypes... )
149
152
jmethodId = ccall (jnifunc. GetMethodID, Ptr{Nothing},
150
153
(Ptr{JNIEnv}, Ptr{Nothing}, Ptr{UInt8}, Ptr{UInt8}), penv, metaclass (obj),
@@ -154,6 +157,7 @@ function jcall(obj::JavaObject, method::AbstractString, rettype::Type, argtypes:
154
157
end
155
158
156
159
function jfield (typ:: Type{JavaObject{T}} , field:: AbstractString , fieldType:: Type ) where T
160
+ assertroottask ()
157
161
jfieldID = ccall (jnifunc. GetStaticFieldID, Ptr{Nothing},
158
162
(Ptr{JNIEnv}, Ptr{Nothing}, Ptr{UInt8}, Ptr{UInt8}), penv, metaclass (T),
159
163
String (field), signature (fieldType))
@@ -162,6 +166,7 @@ function jfield(typ::Type{JavaObject{T}}, field::AbstractString, fieldType::Type
162
166
end
163
167
164
168
function jfield (obj:: JavaObject , field:: AbstractString , fieldType:: Type )
169
+ assertroottask ()
165
170
jfieldID = ccall (jnifunc. GetFieldID, Ptr{Nothing},
166
171
(Ptr{JNIEnv}, Ptr{Nothing}, Ptr{UInt8}, Ptr{UInt8}), penv, metaclass (obj),
167
172
String (field), signature (fieldType))
0 commit comments