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

Unhandled Java exception in Ripper on inline comments #4792

Closed
zverok opened this issue Sep 20, 2017 · 2 comments
Closed

Unhandled Java exception in Ripper on inline comments #4792

zverok opened this issue Sep 20, 2017 · 2 comments

Comments

@zverok
Copy link

zverok commented Sep 20, 2017

Environment

$jruby -v
jruby 9.1.13.0 (2.3.3) 2017-09-06 8e1c115 OpenJDK 64-Bit Server VM 25.131-b11 on 1.8.0_131-8u131-b11-0ubuntu1.16.10.2-b11 +jit [linux-x86_64]
$ uname -a
Linux platypus 4.8.0-59-generic #64-Ubuntu SMP Thu Jun 29 19:38:34 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

Test file (verbatim):

%w[-1]
  .map(&:to_i) # FIXME
  .select(&:positive?)

Test script:

require 'ripper'
Ripper.sexp(File.read('test.rb'), 'test.rb')

Expected Behavior

No error.

Actual Behavior

Unhandled Java exception: java.lang.NullPointerException
java.lang.NullPointerException: null
  dispatchDelayedToken at org/jruby/ext/ripper/RipperLexer.java:767
                 yylex at org/jruby/ext/ripper/RipperLexer.java:1077
             nextToken at org/jruby/ext/ripper/RipperLexer.java:360
               yyparse at org/jruby/ext/ripper/RipperParser.java:1520
               yyparse at org/jruby/ext/ripper/RipperParser.java:1471
                 parse at org/jruby/ext/ripper/RipperParserBase.java:78
                 parse at org/jruby/ext/ripper/RubyRipper.java:327
                  call at org/jruby/ext/ripper/RubyRipper$INVOKER$i$0$0$parse.gen:-1
          cacheAndCall at org/jruby/runtime/callsite/CachingCallSite.java:318
                  call at org/jruby/runtime/callsite/CachingCallSite.java:131
           processCall at org/jruby/ir/interpreter/InterpreterEngine.java:339
             interpret at org/jruby/ir/interpreter/StartupInterpreterEngine.java:73
             interpret at org/jruby/ir/interpreter/InterpreterEngine.java:89
      INTERPRET_METHOD at org/jruby/internal/runtime/methods/MixedModeIRMethod.java:214
                  call at org/jruby/internal/runtime/methods/MixedModeIRMethod.java:200
                  call at org/jruby/internal/runtime/methods/DynamicMethod.java:208
          cacheAndCall at org/jruby/runtime/callsite/CachingCallSite.java:358
                  call at org/jruby/runtime/callsite/CachingCallSite.java:195
     invokeOther8:sexp at rip.rb:5
                <main> at rip.rb:5
   invokeWithArguments at java/lang/invoke/MethodHandle.java:627
                  load at org/jruby/ir/Compiler.java:95
             runScript at org/jruby/Ruby.java:828
           runNormally at org/jruby/Ruby.java:747
           runNormally at org/jruby/Ruby.java:765
           runFromMain at org/jruby/Ruby.java:578
         doRunFromMain at org/jruby/Main.java:417
           internalRun at org/jruby/Main.java:305
                   run at org/jruby/Main.java:232
                  main at org/jruby/Main.java:204

The exception is gone when I remove # FIXME inline comment.

@headius
Copy link
Member

headius commented Oct 30, 2017

Confirmed on current 9.1 HEAD. Pinging @enebo.

@headius headius added this to the JRuby 9.1.14.0 milestone Oct 30, 2017
@enebo enebo closed this as completed in e701f62 Oct 30, 2017
enebo added a commit that referenced this issue Oct 30, 2017
We assumed all delayed token dispatches would have a valid delayed and we NPE
when we dup'd our ByteList.  MRI does not use an object like us and 0/NULL
ends up being nil.  Added simple check for null since we have no similar magic.
@enebo
Copy link
Member

enebo commented Oct 30, 2017

Actual 9.1 commit hash for this was: eb1151a

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

No branches or pull requests

3 participants