1

I am creating a jruby library that has JDI bindings, but when calling a java method, I am getting some weird object inconsistencies that aren't allowing me to call certain methods.

        new_value = @vm.mirrorOf(value)
        puts("New Value: #{new_value.class}")
        puts("Variable: #{variable.java_value.class}")
        object_reference.setValue(variable.java_value, new_value)

outputs:

New Value: Java::ComSunToolsJdi::StringReferenceImpl
Variable: Java::ComSunToolsJdi::StringReferenceImpl
TypeError: cannot convert instance of class org.jruby.java.proxies.ConcreteJavaProxy to interface com.sun.jdi.Field
  set_value at /Users/wuntee/Google Drive/workspace/android_debug/lib/android_debug/event.rb:85
     (root) at hello_world.rb:14
       call at org/jruby/RubyProc.java:249
   on_break at /Users/wuntee/Google Drive/workspace/android_debug/lib/android_debug/debugger.rb:94
         go at /Users/wuntee/Google Drive/workspace/android_debug/lib/android_debug/debugger.rb:63
     (root) at hello_world.rb:18

So, somehow in the setValue call, one of the arguments are cast to ConcreteJavaProxy. Is there a way to force them to stay as their original types? I feel like this is a core JRuby nuance that I dont understand. Any help would be appreciated. Thanks.

wuntee
  • 12,170
  • 26
  • 77
  • 106

0 Answers0