Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add prototype jcall macro #165

Merged
merged 3 commits into from
Aug 15, 2023
Merged

Add prototype jcall macro #165

merged 3 commits into from
Aug 15, 2023

Conversation

mkitti
Copy link
Member

@mkitti mkitti commented Mar 21, 2022

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

@mkitti mkitti marked this pull request as draft March 21, 2022 07:28
@codecov-commenter
Copy link

Codecov Report

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

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
@@            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 Coverage Δ
src/JavaCall.jl 77.77% <ø> (+2.77%) ⬆️
src/core.jl 84.01% <0.00%> (-0.86%) ⬇️
src/jcall_macro.jl 79.31% <79.31%> (ø)

... and 6 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@mkitti mkitti marked this pull request as ready for review August 15, 2023 09:24
@mkitti mkitti merged commit 2b8c3f1 into master Aug 15, 2023
8 of 10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants