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

NullPointerException with returning null (not nil) #5654

byteit101 opened this Issue Mar 15, 2019 · 2 comments


None yet
2 participants
Copy link

byteit101 commented Mar 15, 2019


  • jruby (2.5.3) 2019-02-11 15ba00b Java HotSpot(TM) 64-Bit Server VM 25.144-b01 on 1.8.0_144-b01 +jit [linux-x86_64]
  • RHEL 7.6 & macOS High Sierra
  • rvm 1.29.7-next (master) by Michal Papis, Piotr Kuczynski, Wayne E. Seguin []

Expected Behavior returns two IO objects
MRI behavior:

2.5.3 :001 > require 'pty'
 => true 
2.5.3 :002 > q =; 5
 => 5 
2.5.3 :003 > q
 => [#<IO:masterpty:/dev/pts/10>, #<File:/dev/pts/10>] 
2.5.3 :004 > 

Actual Behavior returns null (not nil!) and jruby doesn't know how to deal with it
Fresh RVM jruby install:

jruby- :001 > require 'pty'
 => true 
jruby- :002 > q =; 5
 => 5 
jruby- :003 > q
Traceback (most recent call last):
       16: from
       15: from org.jruby.runtime.MixedModeIRBlockBody.commonYieldPath(
       14: from
       13: from
       12: from
       11: from
       10: from org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(
        9: from org.jruby.RubyArray$INVOKER$i$0$0$$INVOKER$i$0$0$inspect.gen)
        8: from org.jruby.RubyArray.inspect(
        7: from org.jruby.specialized.RubyArrayTwoObject.inspectAry(
        6: from org.jruby.RubyObject.inspect(
        5: from org.jruby.RubyBasicObject.rbInspect(
        4: from
        3: from org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(
        2: from org.jruby.RubyFile$INVOKER$i$0$0$$INVOKER$i$0$0$inspect.gen)
        1: from org.jruby.RubyFile.inspect(
Java::JavaLang::NullPointerException ()
jruby- :004 > 

Same thing happens in a file with p

There seems to be two issues here: one is that a null is returned and not properly wrapped in a nil object, blowing up with an actual NPE, and the other is that isn't working and returning correct results. Please split this issue if appropriate.


This comment has been minimized.

Copy link
Member Author

byteit101 commented Mar 15, 2019

Appears to be a regression in as succeeds with:

jruby- :001 > require 'pty'
 => true 
jruby- :002 > q =; 5
 => 5 
jruby- :003 > q
 => [#<IO:fd 16>, #<File:null>] 

(seems to work despite the null inspect result)
and gives the same NPE as originally reported

@kares kares added the regression label Mar 19, 2019

kares added a commit to kares/jruby that referenced this issue Mar 20, 2019


This comment has been minimized.

Copy link

kares commented Mar 20, 2019

the NPE cause is expected to be resolved with: d795d72

@kares kares closed this Mar 20, 2019

@kares kares added this to the JRuby milestone Mar 20, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.