Skip to content

jnull not defined #130

@DrChainsaw

Description

@DrChainsaw
julia> jlist = @jimport java.util.ArrayList
JavaObject{Symbol("java.util.ArrayList")}

julia> jcall(jlist(), "add", jboolean, (JObject,), nothing)
ERROR: UndefVarError: jnull not defined
Stacktrace:
 [1] convert at \.julia\packages\JavaCall\CHGwC\src\convert.jl:24 [inlined]
 [2] convert_arg(::Type{JavaObject{Symbol("java.lang.Object")}}, ::Nothing) at \.julia\packages\JavaCall\CHGwC\src\convert.jl:85
 [3] convert_args(::Tuple{DataType}, ::Nothing) at \.julia\packages\JavaCall\CHGwC\src\convert.jl:67
 [4] _jcall(::JavaObject{Symbol("java.util.ArrayList")}, ::Ptr{Nothing}, ::Ptr{Nothing}, ::Type{UInt8}, ::Tuple{DataType}, ::Nothing) at \.julia\packages\JavaCall\CHGwC\src\core.jl:295
 [5] jcall(::JavaObject{Symbol("java.util.ArrayList")}, ::String, ::Type{T} where T, ::Tuple{DataType}, ::Nothing) at \.julia\packages\JavaCall\CHGwC\src\core.jl:231
 [6] top-level scope at REPL[8]:1
 [7] include_string(::Function, ::Module, ::String, ::String) at .\loading.jl:1088

This seems to work as a workaround, but its probably not the right way:

julia> Base.convert(o::Type{JavaObject{T}}, ::Nothing) where T = o(JavaCall.JavaLocalRef(C_NULL))

julia> jcall(jlist(), "add", jboolean, (JObject,), nothing)
0x01

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions