-
-
Notifications
You must be signed in to change notification settings - Fork 942
Closed
Milestone
Description
Environment
First appeared in
- jruby 9.2.8.0 (2.5.3) 2019-08-12 a1ac7ff Java HotSpot(TM) 64-Bit Server VM 25.191-b12 on 1.8.0_191-b12 +jit [darwin-x86_64]
Can be reproduced with a different error message in the latest
- jruby 9.2.11.1 (2.5.7) 2020-03-25 b1f55b1 Java HotSpot(TM) 64-Bit Server VM 25.191-b12 on 1.8.0_191-b12 +jit [darwin-x86_64]
Expected Behavior
Create a file test.rb with a content
for i in [1, 2]
puts i
endAnd compile it and try to load:
jrubyc test.rb
jruby -e "load 'test.class'"
When using JRuby 9.2.7.0 then there are no error messages and expected results are shown.
Actual Behavior
When using JRuby 9.2.8.0 it fails:
$ jrubyc test.rb
$ jruby -e "load 'test.class'"
LoadError: test.class is not compiled Ruby; use java_import to load normal classes
load at org/jruby/RubyKernel.java:1022
<main> at -e:1
When using JRuby 9.2.11.1 it fails with more detailed stack trace:
$ jrubyc test.rb
$ jruby -e "load 'test.class'"
Unhandled Java exception: java.lang.NullPointerException
java.lang.NullPointerException: null
getLocalVariable at org/jruby/ir/IRClosure.java:290
decode at org/jruby/ir/operands/LocalVariable.java:129
decode at org/jruby/ir/persistence/IRReaderStream.java:493
decodeOperand at org/jruby/ir/persistence/IRReaderStream.java:371
decodeVariable at org/jruby/ir/persistence/IRReaderStream.java:380
decode at org/jruby/ir/instructions/ReceivePreReqdArgInstr.java:38
decodeInstr at org/jruby/ir/persistence/IRReaderStream.java:318
decodeInstructionsAt at org/jruby/ir/persistence/IRReaderStream.java:218
lambda$load$0 at org/jruby/ir/persistence/IRReader.java:47
getEngine at org/jruby/ir/interpreter/InterpreterContext.java:74
getInstructions at org/jruby/ir/interpreter/InterpreterContext.java:85
computeScopeFlagsFromInstructions at org/jruby/ir/interpreter/InterpreterContext.java:189
computeScopeFlags at org/jruby/ir/IRScope.java:750
calculateClosureScopeFlags at org/jruby/ir/IRScope.java:680
computeScopeFlags at org/jruby/ir/IRScope.java:753
getEngine at org/jruby/ir/interpreter/InterpreterContext.java:75
INTERPRET_ROOT at org/jruby/ir/interpreter/Interpreter.java:96
execute at org/jruby/ir/interpreter/Interpreter.java:81
execute at org/jruby/ir/interpreter/Interpreter.java:30
execute at org/jruby/ir/IRTranslator.java:42
runInterpreter at org/jruby/Ruby.java:1218
loadScope at org/jruby/Ruby.java:2799
load at org/jruby/runtime/load/LibrarySearcher.java:259
load at org/jruby/runtime/load/LoadService.java:343
loadCommon at org/jruby/RubyKernel.java:1039
load at org/jruby/RubyKernel.java:1009
call at org/jruby/RubyKernel$INVOKER$s$load.gen:-1
call at org/jruby/internal/runtime/methods/JavaMethod.java:417
cacheAndCall at org/jruby/runtime/callsite/CachingCallSite.java:375
call at org/jruby/runtime/callsite/CachingCallSite.java:174
invokeOther0:load at -e:1
<main> at -e:1
invokeWithArguments at java/lang/invoke/MethodHandle.java:627
load at org/jruby/ir/Compiler.java:89
runScript at org/jruby/Ruby.java:1205
runNormally at org/jruby/Ruby.java:1128
runNormally at org/jruby/Ruby.java:1146
runFromMain at org/jruby/Ruby.java:958
doRunFromMain at org/jruby/Main.java:412
internalRun at org/jruby/Main.java:304
run at org/jruby/Main.java:234
main at org/jruby/Main.java:206
As a workaround, we could replace for loops with each loops in our code to avoid this compilation problem.
This is similar to #5740 which was identified in JRuby 9.2.7.0.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels