Skip to content

Instantly share code, notes, and snippets.

@qmx
Forked from griff/bug_test.rb
Created November 2, 2010 01:06
Show Gist options
  • Save qmx/659137 to your computer and use it in GitHub Desktop.
Save qmx/659137 to your computer and use it in GitHub Desktop.
class BugTest1 < Hash
# Any interface will do
include Java::JavaLang::Runnable
def run
puts "Hello from BugTest1"
end
end
class OrderHash < Hash
end
class BugTest2 < OrderHash
# Any interface will do
include Java::JavaLang::Runnable
def run
puts "Hello from BugTest2"
end
end
# Works just fine
BugTest1.new
# ClassCastException
BugTest2.new
jruby bug_test.rb
org/jruby/RubyHash$i_method_0_1$RUBYFRAMEDINVOKER$initialize.gen:65535:in `call': java.lang.ClassCastException: BugTest2_1366331860 cannot be cast to org.jruby.RubyHash
from RubyClass.java:540:in `finvoke'
from RuntimeHelpers.java:450:in `invoke'
from JavaInterfaceTemplate.java:275:in `call'
from DynamicMethod.java:184:in `call'
from DynamicMethod.java:180:in `call'
from CachingCallSite.java:293:in `cacheAndCall'
from CachingCallSite.java:112:in `call'
from bug_test.rb:28:in `__file__'
from bug_test.rb:-1:in `load'
from Ruby.java:686:in `runScript'
from Ruby.java:569:in `runNormally'
from Ruby.java:412:in `runFromMain'
from Main.java:304:in `run'
from Main.java:144:in `run'
from Main.java:113:in `main'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment