JRuby

Attempting to create a java.lang.reflect.Proxy instance results in StackOverflow

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Fixed
  • Affects Version/s: JRuby 0.9.0
  • Fix Version/s: JRuby 0.9.8
  • Component/s: Interpreter
  • Labels:
    None
  • Environment:
    Windows 2000, JRuby 0.9.0 through jsr223 script engine
  • Number of attachments :
    0

Description

Attempted to create a java.lang.reflect.Proxy using the following code:

require 'java';

include_class('java.lang.reflect.InvocationHandler');
include_class('java.lang.reflect.Proxy') {

x "JProxy"
};

include_class('java.lang.Runnable');
include_class('java.util.concurrent.Callable');
include_class("java.lang.reflect.Array") {

x "JArray"
};

include_class("java.lang.Class") {

x "JClass"
}

class MyRunnable < InvocationHandler
def invoke(obj, name, args)
puts name + " called"
end
end

include_class('java.lang.Runnable')

types = JArray.newInstance(JClass, 2);
types[0] = Runnable
types[1] = Callable

m = MyRunnable.new
r = JProxy.newProxyInstance(nil, types, m);

puts r.kind_of?(Runnable)
puts r.kind_of?(Callable)

---------------

At JProxy.newInstance line "stack level too deep" error is thrown; searched for this string in JRuby 0.9.0 source base - found that in org.jruby.evaluator.EvaluationState class.

Activity

There are no comments yet on this issue.

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: