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

OverflowError: value too large to convert to jshort #688

Open
AnEx-ofc opened this issue Oct 21, 2023 · 4 comments
Open

OverflowError: value too large to convert to jshort #688

AnEx-ofc opened this issue Oct 21, 2023 · 4 comments
Labels

Comments

@AnEx-ofc
Copy link

Hi,
I am geting this error:

10-22 00:34:43.056 1595 1894 I python : File "jnius/jnius_export_class.pxi", line 1164, in jnius.jnius.JavaMultipleMethod.call
10-22 00:34:43.056 1595 1894 I python : File "jnius/jnius_export_class.pxi", line 872, in jnius.jnius.JavaMethod.call
10-22 00:34:43.057 1595 1894 I python : File "jnius/jnius_conversion.pxi", line 51, in jnius.jnius.populate_args
10-22 00:34:43.057 1595 1894 I python : OverflowError: value too large to convert to jshort

for this line:
intent.putExtra(name, 1_234_567_890)
Most probably because of:
File "jnius/jnius_utils.pxi", line 321

if r == 'S' or r == 'I':

Both short and integer having same scoring logic, if short is come later in sign_args it got selected even though value not fit inside the short value range

@cmacdonald
Copy link
Contributor

You can specify the signature of the method you want - see example at

inst = ConstructorTest(outputStream, signature="(Ljava/io/OutputStream;)V")

Otherwise, it seems you know the problem here - could you make a test case and try to work on a patch?

@AnEx-ofc
Copy link
Author

@cmacdonald Hi, I have not done anything like that, so I'm not aware of the right way. If you guide a bit, I will gladly do that.
BTW, thanks for the comment.

@Julian-O Julian-O added the bug label Oct 27, 2023
@cmacdonald
Copy link
Contributor

@AnEx-ofc did you try the signature trick?

@AnEx-ofc
Copy link
Author

@cmacdonald i bypass this issue by passing string and convert it to int in java that time, next time i face similar issue ill do that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants