-
Notifications
You must be signed in to change notification settings - Fork 256
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
varargs don’t seem to work #8
Comments
also if we’d really need it, we could use |
Confirmed, thanks for reporting, looking into how to add this to our method signature lookup :) |
nice. please remember to create tags as soon as bigger features like that (or the upcoming import hook) come in, they help with knowing when to package a new version. |
As an aid for adding this feature (and also as a work around) you can do the following: # Empty vararg
System = autoclass('java.lang.System')
System.out.printf('string' ,[])
# Note: Using python strings does NOT work
String = autoclass('java.lang.String')
System.out.printf('my string is %s', [ String('this') ]) The reason for this is that Java internally converts the varargs into a single array parameter. Also note that in addition to getting printed to stdout/stderr, calling |
Thanks for the list tip, i was there too :) Our parser currently doesn't know if a list in signature is a varargs list or not, seems we are not the first ones to run into this issue, if we can detect that, it should be easy enought to adjust our calculate_score method. For the unability to build a list of python strings directly, i was about to open a bug report, at least to discuss those workarounds and if we can find a better solution (same issue with building lists of numbers and probably other things). edit: found about isVarArgs, that allow at least to know if a method is varargs… :) |
We should convert between python and Java strings always and implicitly. Trying to use autoclass on java.lang.String should yield a warning that you'll be dealing with python strings no matter what you do. Reason is that python strings can do anything Java strings can do, and this change would make anything easier. Btw.: so you already translate |
Ok! sorry it took so long, but we now have at least some basic support of varargs in the |
I'll close this since support has been added, feel free to reopen if support is incomplete. |
The text was updated successfully, but these errors were encountered: