Skip to content

Instantly share code, notes, and snippets.

@jesjos
Created January 7, 2016 08:26
Show Gist options
  • Save jesjos/93b07c8a17aaedf1ff5c to your computer and use it in GitHub Desktop.
Save jesjos/93b07c8a17aaedf1ff5c to your computer and use it in GitHub Desktop.
Jruby max_by
jruby-9.0.1.0 :001 > [].max_by(:foo)
Java::JavaLang::ClassCastException: org.jruby.RubyEnumerator cannot be cast to org.jruby.RubyArray
from org.jruby.RubyEnumerable.max_by(RubyEnumerable.java:1205)
from org.jruby.RubyEnumerable$INVOKER$s$max_by.call(RubyEnumerable$INVOKER$s$max_by.gen)
from org.jruby.internal.runtime.methods.JavaMethod$JavaMethodZeroOrOneOrNBlock.call(JavaMethod.java:324)
from org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:313)
from org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:163)
from org.jruby.ir.interpreter.InterpreterEngine.processCall(InterpreterEngine.java:289)
from org.jruby.ir.interpreter.StartupInterpreterEngine.interpret(StartupInterpreterEngine.java:77)
from org.jruby.ir.interpreter.Interpreter.INTERPRET_EVAL(Interpreter.java:126)
from org.jruby.ir.interpreter.Interpreter.evalCommon(Interpreter.java:181)
from org.jruby.ir.interpreter.Interpreter.evalWithBinding(Interpreter.java:206)
from org.jruby.RubyKernel.evalCommon(RubyKernel.java:1011)
from org.jruby.RubyKernel.eval19(RubyKernel.java:978)
from org.jruby.RubyKernel$INVOKER$s$0$3$eval19.call(RubyKernel$INVOKER$s$0$3$eval19.gen)
from org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:273)
from org.jruby.runtime.callsite.CachingCallSite.callBlock(CachingCallSite.java:79)
from org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:83)
... 103 levels...
from org.jruby.internal.runtime.methods.MixedModeIRMethod.call(MixedModeIRMethod.java:183)
from org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:197)
from org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:313)
from org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:163)
from Users.jesper.$_dot_rvm.rubies.jruby_minus_9_dot_0_dot_1_dot_0.bin.irb.invokeOther4:start(/Users/jesper/.rvm/rubies/jruby-9.0.1.0/bin/irb)
from Users.jesper.$_dot_rvm.rubies.jruby_minus_9_dot_0_dot_1_dot_0.bin.irb.RUBY$script(/Users/jesper/.rvm/rubies/jruby-9.0.1.0/bin/irb:13)
from java.lang.invoke.MethodHandle.invokeWithArguments(MethodHandle.java:625)
from org.jruby.ir.Compiler$1.load(Compiler.java:111)
from org.jruby.Ruby.runScript(Ruby.java:822)
from org.jruby.Ruby.runScript(Ruby.java:814)
from org.jruby.Ruby.runNormally(Ruby.java:752)
from org.jruby.Ruby.runFromMain(Ruby.java:574)
from org.jruby.Main.doRunFromMain(Main.java:409)
from org.jruby.Main.internalRun(Main.java:304)
from org.jruby.Main.run(Main.java:231)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment