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
In Java, a instance can access a static method, just like a instance method,
but in JRuby, it raise this exception,
JRuby scripts as following :
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
encoding:utf-8
import Java::java.lang.Thread
t = Thread.new()
t.currentThread()
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
the exception is following :
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
Caused by: org.jruby.embed.EvalFailedException: (NoMethodError) undefined method currentThread' for #<Java::JavaLang::Thread:0x8f2fcd8> at org.jruby.embed.internal.EmbedEvalUnitImpl.run(EmbedEvalUnitImpl.java:133) ... 11 more Caused by: org.jruby.exceptions.RaiseException: (NoMethodError) undefined methodcurrentThread' for #Java::JavaLang::Thread:0x8f2fcd8
at $lt_script_gt.(root)(<script>:6)
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
The text was updated successfully, but these errors were encountered:
this is more of a feature instead of a bug - static Java methods get bind at class level (just like in proper Ruby land) thus do: t.class.currentThread or Thread.current_thread
Environment
Expected Behavior
In Java, a instance can access a static method, just like a instance method,
but in JRuby, it raise this exception,
JRuby scripts as following :
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
encoding:utf-8
import Java::java.lang.Thread
t = Thread.new()
t.currentThread()
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
the exception is following :
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
Caused by: org.jruby.embed.EvalFailedException: (NoMethodError) undefined method
currentThread' for #<Java::JavaLang::Thread:0x8f2fcd8> at org.jruby.embed.internal.EmbedEvalUnitImpl.run(EmbedEvalUnitImpl.java:133) ... 11 more Caused by: org.jruby.exceptions.RaiseException: (NoMethodError) undefined method
currentThread' for #Java::JavaLang::Thread:0x8f2fcd8at $lt_script_gt.(root)(<script>:6)
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
The text was updated successfully, but these errors were encountered: