-
Notifications
You must be signed in to change notification settings - Fork 15.6k
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
[Ruby] optional field's presence checker method has_...?
is broken on JRuby and has cosmetic issue on MRI
#18807
Comments
I believe the issue is that the return is The solution would be:
tl;dr |
On the other hands, I also tested @colinbendell's suggestion and it indeed fixes the issue with MRI. @JasonLunn Can you please review PR #19731. |
One more thing about the JRuby bug: new objects that constructed ruby code with From what I see in the java code, the |
Ran it through debugger and I found that during protobuf/ruby/src/main/java/com/google/protobuf/jruby/RubyMessage.java Lines 1219 to 1225 in 2330983
Specifically, So, the bug here is that at line 457, that it forgot to check for the case where
|
What version of protobuf and what language are you using?
Version: 4.28.2
Language: Ruby
What operating system (Linux, Windows, ...) and version?
All operating systems.
What runtime / compiler are you using (e.g., python version or gcc version)
Ruby 3.3.5 / JRuby 9.4.8.0
What did you do?
Protobuf definition: https://github.com/sass/sass/blob/eba0a58b46788b893983c2886c1be3b9c2d260e1/spec/embedded_sass.proto#L807-L834
Test code:
What did you expect to see
What did you see instead?
MRI
.has_...?
returns0
instead oftrue
. Note:0
in ruby is considered as truthy, so this is just a cosmetic issue in MRI.JRuby
.has_...?
always returnfalse
, until.to_s
is called on the object. Somehow calling.to_s
changes behavior of.has_...?
, that after the call.has_...?
returns the expected value.Make sure you include information that can help us debug (full error message, exception listing, stack trace, logs).
Anything else we should know about your project / environment
sass-contrib/sass-embedded-host-ruby#246
The text was updated successfully, but these errors were encountered: