Menu

#285 ClassCastException retrieving default value from ThreadLocal in JRuby

v1.0 (example)
open
nobody
None
5
2015-02-20
2014-02-14
No

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.

Discussion

  • Jeroen Frijters

    Jeroen Frijters - 2014-02-14

    This is probably a Mono bug. I have JRuby 1.7.0 running fine on the .NET Framework.

     
    • Charles Oliver Nutter

      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?

      This is probably a Mono bug. I have JRuby 1.7.0 running fine on the .NET
      Framework.


      Status: open
      Created: Fri Feb 14, 2014 02:32 AM UTC by Charles Oliver Nutter
      Last Updated: Fri Feb 14, 2014 02:32 AM UTC
      Owner: nobody

      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.


      Sent from sourceforge.net because you indicated interest in
      https://sourceforge.net/p/ikvm/bugs/285/

      To unsubscribe from further messages, please visit
      https://sourceforge.net/auth/subscriptions/

       
  • Jeroen Frijters

    Jeroen Frijters - 2014-02-17

    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?

     
    • Charles Oliver Nutter

      Latest release downloads of both.

       

Log in to post a comment.