You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Operating system and platform (e.g. uname -a)
Darwin anchorage.local 23.0.0 Darwin Kernel Version 23.0.0: Fri Sep 15 14:42:42 PDT 2023; root:xnu-10002.1.13~1/RELEASE_X86_64 x86_64
/Users/heinrich/.rvm/gems/jruby-9.4.3.0/gems/activesupport-7.1.1/lib/active_support/testing/time_helpers.rb:62: warning: method redefined; discarding old now
/Users/heinrich/.rvm/gems/jruby-9.4.3.0/gems/activesupport-7.1.1/lib/active_support/testing/time_helpers.rb:174: warning: previous definition of now was here
/Users/heinrich/.rvm/gems/jruby-9.4.3.0/gems/activesupport-7.1.1/lib/active_support/testing/time_helpers.rb:62: warning: method redefined; discarding old new
/Users/heinrich/.rvm/gems/jruby-9.4.3.0/gems/activesupport-7.1.1/lib/active_support/testing/time_helpers.rb:176: warning: previous definition of new was here
/Users/heinrich/.rvm/gems/jruby-9.4.3.0/gems/activesupport-7.1.1/lib/active_support/testing/time_helpers.rb:62: warning: method redefined; discarding old today
/Users/heinrich/.rvm/gems/jruby-9.4.3.0/gems/activesupport-7.1.1/lib/active_support/testing/time_helpers.rb:185: warning: previous definition of today was here
/Users/heinrich/.rvm/gems/jruby-9.4.3.0/gems/activesupport-7.1.1/lib/active_support/testing/time_helpers.rb:62: warning: method redefined; discarding old now
/Users/heinrich/.rvm/gems/jruby-9.4.3.0/gems/activesupport-7.1.1/lib/active_support/testing/time_helpers.rb:186: warning: previous definition of now was here
org.jruby.dist/org.jruby.RubyTime.initialize(RubyTime.java:1723): class org.jruby.RubyFixnum cannot be cast to class org.jruby.RubyHash (org.jruby.RubyFixnum and org.jruby.RubyHash are in module org.jruby.dist of loader 'app') (Java::JavaLang::ClassCastException)
from org.jruby.dist/org.jruby.RubyTime$INVOKER$i$initialize.call(RubyTime$INVOKER$i$initialize.gen)
from org.jruby.dist/org.jruby.internal.runtime.methods.JavaMethod$JavaMethodN.call(JavaMethod.java:847)
from org.jruby.dist/org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:90)
from org.jruby.dist/org.jruby.RubyClass.newInstance(RubyClass.java:931)
from org.jruby.dist/org.jruby.RubyClass$INVOKER$i$newInstance.call(RubyClass$INVOKER$i$newInstance.gen)
from org.jruby.dist/org.jruby.internal.runtime.methods.AliasMethod.call(AliasMethod.java:133)
from org.jruby.dist/org.jruby.RubyClass.finvokeWithRefinements(RubyClass.java:522)
from org.jruby.dist/org.jruby.RubyBasicObject.send(RubyBasicObject.java:1703)
from org.jruby.dist/org.jruby.RubyKernel.send(RubyKernel.java:2355)
from org.jruby.dist/org.jruby.RubyKernel$INVOKER$s$send.call(RubyKernel$INVOKER$s$send.gen)
from org.jruby.dist/org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:446)
from org.jruby.dist/org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:92)
from org.jruby.dist/org.jruby.ir.instructions.CallBase.interpret(CallBase.java:561)
from org.jruby.dist/org.jruby.ir.interpreter.InterpreterEngine.processCall(InterpreterEngine.java:367)
from org.jruby.dist/org.jruby.ir.interpreter.StartupInterpreterEngine.interpret(StartupInterpreterEngine.java:66)
from org.jruby.dist/org.jruby.ir.interpreter.Interpreter.INTERPRET_BLOCK(Interpreter.java:116)
... 197 levels...
The error does not happen with activesupport-7.0.8
The text was updated successfully, but these errors were encountered:
The exception is caused by a blind cast of the last argument passed into Time#initialize, under the assumption that if the thread-local keywords flag was set we can be sure it is a `Hash. For whatever reason, that assumption doesn't hold with this code from Rails:
The intent here was to pass in what might be kwargs if the keyword
flag was set, indicating that kwargs were being passed in. This
assumption seems ok so I'm not sure why it doesn't hold. In any
case, the cast here is unnecessary and the IRubyObject form will
return null for non-RubyHashes.
The code that triggered this does deal directly with kwargs, but
as a kwrest, forwarding it through a block:
https://github.com/rails/rails/blob/v7.1.1/activesupport/lib/active_support/testing/time_helpers.rb#L176-L183
This could indicate JRuby failing to pass along a keyword flag
when forwarding kwrest.
The additional changes here are:
* Fall back on non-kwargs behavior if last arg turns out not to be
a hash.
* Remove a redundant reset of the `callInfo` that governs keyword-
passing.
Fixesjruby#7982
Environment Information
Provide at least:
uname -a
)Darwin anchorage.local 23.0.0 Darwin Kernel Version 23.0.0: Fri Sep 15 14:42:42 PDT 2023; root:xnu-10002.1.13~1/RELEASE_X86_64 x86_64
Other relevant info you may wish to add:
Consider the following script:
Expected Behavior
Result on ruby-3.1.3
Actual Behavior
Result on jruby-9.4.4.0:
The error does not happen with activesupport-7.0.8
The text was updated successfully, but these errors were encountered: