JuliaInterop / JavaCall.jl

Call Java from Julia
http://juliainterop.github.io/JavaCall.jl
Other
118 stars 53 forks source link

Add prototype jcall macro #165

Closed mkitti closed 10 months ago

mkitti commented 2 years ago

Prototype @jcall macro:

julia> using JavaCall; JavaCall.init()

julia> System = @jimport java.lang.System
JavaObject{Symbol("java.lang.System")}

julia> @jcall System.out.println("Hello from Java!!"::JString)::Nothing
┌ Info: args: 
│   func = :((:println, System.out))
│   rettype = :Nothing
│   types =
│    1-element Vector{Any}:
│     :JString
│   args =
│    1-element Vector{Any}:
│     "Hello from Java!!"
│   nreq = 0
│   func.head = :tuple
│   func.args =
│    2-element Vector{Any}:
│     :(:println)
└     :(System.out)
Hello from Java!!

julia> Math = @jimport java.lang.Math
JavaObject{Symbol("java.lang.Math")}

julia> @jcall Math.cos(0.0::jdouble)::jdouble
┌ Info: args: 
│   func = :((:cos, Math))
│   rettype = :jdouble
│   types =
│    1-element Vector{Any}:
│     :jdouble
│   args =
│    1-element Vector{Any}:
│     0.0
│   nreq = 0
│   func.head = :tuple
│   func.args =
│    2-element Vector{Any}:
│     :(:cos)
└     :Math
1.0

julia> @jcall Math.acos((-0.0)::jdouble)::jdouble
┌ Info: args: 
│   func = :((:acos, Math))
│   rettype = :jdouble
│   types =
│    1-element Vector{Any}:
│     :jdouble
│   args =
│    1-element Vector{Any}:
│     -0.0
│   nreq = 0
│   func.head = :tuple
│   func.args =
│    2-element Vector{Any}:
│     :(:acos)
└     :Math
1.5707963267948966
codecov-commenter commented 10 months ago

Codecov Report

Patch coverage: 77.96% and project coverage change: +0.85% :tada:

Comparison is base (63026e4) 65.65% compared to head (bfc6165) 66.50%. Report is 1 commits behind head on master.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #165 +/- ## ========================================== + Coverage 65.65% 66.50% +0.85% ========================================== Files 10 11 +1 Lines 984 1051 +67 ========================================== + Hits 646 699 +53 - Misses 338 352 +14 ``` | [Files Changed](https://app.codecov.io/gh/JuliaInterop/JavaCall.jl/pull/165?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=JuliaInterop) | Coverage Δ | | |---|---|---| | [src/JavaCall.jl](https://app.codecov.io/gh/JuliaInterop/JavaCall.jl/pull/165?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=JuliaInterop#diff-c3JjL0phdmFDYWxsLmps) | `77.77% <ø> (+2.77%)` | :arrow_up: | | [src/core.jl](https://app.codecov.io/gh/JuliaInterop/JavaCall.jl/pull/165?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=JuliaInterop#diff-c3JjL2NvcmUuamw=) | `84.01% <0.00%> (-0.86%)` | :arrow_down: | | [src/jcall\_macro.jl](https://app.codecov.io/gh/JuliaInterop/JavaCall.jl/pull/165?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=JuliaInterop#diff-c3JjL2pjYWxsX21hY3JvLmps) | `79.31% <79.31%> (ø)` | | ... and [6 files with indirect coverage changes](https://app.codecov.io/gh/JuliaInterop/JavaCall.jl/pull/165/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=JuliaInterop)

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.