ClassCastException retrieving default value from ThreadLocal in JRuby
Brought to you by:
jfrijters
When booting JRuby 1.7, I get the following ClassCastException:
system ~/projects/jruby-1.7 $ mono ~/Downloads/ikvm/bin/ikvm.exe -Djruby.home=`pwd` -jar lib/jruby.jar -d -e "puts 'hello'" java.lang.ClassCastException: Cannot cast from source type to destination type. at org.joni.StackMachine.fetchStack(StackMachine.java:77) at org.joni.StackMachine.<init>(StackMachine.java:44) at org.joni.ByteCodeMachine.<init>(ByteCodeMachine.java:55) at org.joni.MatcherFactory$1.create(MatcherFactory.java:28) at org.joni.Regex.matcher(Regex.java:172) at org.jruby.lexer.yacc.RubyYaccLexer.handleFileEncodingComment(RubyYaccLexer.java:827)
I'm not sure how to get Maven to run tests using ikvm, but I suspect the Joni tests would fail in a similar way.
The code that fails is here: https://github.com/jruby/joni/blob/master/src/org/joni/StackMachine.java#L77
Seems like it might be a bug in ThreadLocal, since a few lines above this it seems to be allocating the right type of value. It's not clear why the implicit cast fails at this line.
This is probably a Mono bug. I have JRuby 1.7.0 running fine on the .NET Framework.
Interesting. Unfortunately that dies limit my ability to get and keep JRuby
running on ikvm. What are my chances of getting a Mono bug fixed?
On Feb 14, 2014 1:29 AM, "Jeroen Frijters" jfrijters@users.sf.net wrote:
I honestly don't know, but I suspect that unless someone takes the time to boil it down to a small C# repro, they won't bother investigating it (and I can't blame them).
BTW, what versions of Mono and IKVM did you use?
Latest release downloads of both.