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
newInstance on protected/private classes sometimes give an Index OOB Exception #6079
Comments
Very peculiar. I'm not sure why it would only fail some of the time. |
Augh, I missed the fact that there is more than one ctor, and one has 1 argument! |
Yeah there's still a bug here...some arity check must be missing. |
Without an arity check somewhere before it, this code is clearly going to run into trouble: jruby/core/src/main/java/org/jruby/javasupport/JavaUtil.java Lines 550 to 556 in f5b78ad
I'm checking to see if there's any arity check along your error call path, and if not add one. |
If this call were made with the wrong number of arguments, it could easily walk off the type array due to the lack of arity checking in the convertArguments call. Fixes jruby#6079.
Ok, so wrapping this up... The original error happened because sometimes, either randomly on the same JVM or by using a different JVM or sequence of calls, the zero'th element of the The bug was that when calling a JavaConstructor via The fix in #6091 will prevent that error. On your end, you should make sure you have the right Java constructor in hand before invoking it. As a side note, the API you used is supposed to be deprecated; the whole @enebo Two questions...
|
I should say... the fix in #6091 will prevent the opaque |
I was wondering if classloading/timing of Java being mirrored is a possible issue here?
|
|
Oops
|
Provide at least:
Other relevant info you may wish to add:
Expected Behavior
The following code prints every time (excepting object id changes):
Script:
Actual Behavior
Sometimes it works, sometimes it throws an index out of bounds exception:
This is different to #449 as that deals with ruby classes generated at runtime
The text was updated successfully, but these errors were encountered: