Stack overflow in initializers

Hi all. Wasn’t sure if this was a bug or not…

The following code results in a stack overflow

require’java’

module M
include_package “javax.swing”
include_package “javax.awt”
include_package “javax.net

class ShowImage < JFrame

def initialize
  getClass
  # or getToolkit -- same result
end

end
ShowImage.new
end

Is this expected? (if not answer I’ll assume it isn’t and file a JIRA).

Thanks!
-r

On Sep 23, 2010, at 16:10 , Roger P. wrote:

Is this expected? (if not answer I’ll assume it isn’t and file a JIRA).
Check JIRA, I think there might already be a long-standing bug on this.
The basic problem is that you’re not calling super() to invoke the Java
class constructor.

/Nick


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

Is this expected? (if not answer I’ll assume it isn’t and file a JIRA).
Check JIRA, I think there might already be a long-standing bug on this.
The basic problem is that you’re not calling super() to invoke the Java
class constructor.

Anybody know if this is on jira?

Here are a couple example traces:

C:\dev\ruby\family-history-screen-saver>D:\installs\jruby-1.5.1\bin\jruby
jtest.crashes.jruby.2.rb
JavaProxy.java:94:in getJavaClass': java.lang.NullPointerException from CallableSelector.java:401:inclassHashCode’
from CallableSelector.java:394:in argsHashCode' from CallableSelector.java:40:inmatchingCallableArityN’
from RubyToJavaInvoker.java:180:in findCallable' from InstanceMethodInvoker.java:28:incall’
from CachingCallSite.java:279:in cacheAndCall' from CachingCallSite.java:68:incall’
from jtest.crashes.jruby.2.rb:28:in method__3$RUBY$initialize' from jtest_dot_crashes_dot_jruby_dot_2Invokermethod__3$RUBY$initializeFixed0#initialize:65535:incall’
from CachingCallSite.java:299:in cacheAndCall' from CachingCallSite.java:117:incallBlock’
from CachingCallSite.java:122:in call' from RubyClass.java:793:incall’
from DynamicMethod.java:178:in call' from ConcreteJavaProxy.java:132:incall’
from CachingCallSite.java:289:in cacheAndCall' from CachingCallSite.java:108:incall’
from jtest.crashes.jruby.2.rb:64:in __file__' from jtest.crashes.jruby.2.rb:-1:inload’
from Ruby.java:685:in runScript' from Ruby.java:568:inrunNormally’
from Ruby.java:414:in runFromMain' from Main.java:286:inrun’
from Main.java:128:in run' from Main.java:97:inmain’

and


at java.lang.StringBuilder.append(StringBuilder.java:115)
at org.jruby.java.proxies.JavaProxy.getObject(JavaProxy.java:69)
at
org.jruby.javasupport.JavaProxyMethods.to_s(JavaProxyMethods.java:53)
at
org.jruby.javasupport.JavaProxyMethods$s_method_0_0$RUBYINVOKER$to_s.call(org/jruby/javasupport/JavaProxyMethods$s_method_0_0$RUBYINVOKER$to_s.gen:65535)
at org.jruby.RubyClass.finvoke(RubyClass.java:598)
at
org.jruby.javasupport.util.RuntimeHelpers.invoke(RuntimeHelpers.java:449)
at org.jruby.RubyObject.toString(RubyObject.java:223)
at java.lang.String.valueOf(String.java:2826)
at java.lang.StringBuilder.append(StringBuilder.java:115)
at org.jruby.java.proxies.JavaProxy.getObject(JavaProxy.java:69)
at
org.jruby.javasupport.JavaProxyMethods.to_s(JavaProxyMethods.java:53)
at
org.jruby.javasupport.JavaProxyMethods$s_method_0_0$RUBYINVOKER$to_s.call(org/jruby/javasupport/JavaProxyMethods$s_method_0_0$RUBYINVOKER$to_s.gen:65535)
at org.jruby.RubyClass.finvoke(RubyClass.java:598)
at
org.jruby.javasupport.util.RuntimeHelpers.invoke(RuntimeHelpers.java:449)
at org.jruby.RubyObject.toString(RubyObject.java:223)
at java.lang.String.valueOf(String.java:2826)
at java.lang.StringBuilder.append(StringBuilder.java:115)
at org.jruby.java.proxies.JavaProxy.getObject(JavaProxy.java:69)
at
org.jruby.javasupport.JavaProxyMethods.to_s(JavaProxyMethods.java:53)
at
org.jruby.javasupport.JavaProxyMethods$s_method_0_0$RUBYINVOKER$to_s.call(org/jruby/javasupport/JavaProxyMethods$s_method_0_0$RUBYINVOKER$to_s.gen:65535)
at org.jruby.RubyClass.finvoke(RubyClass.java:598)
at
org.jruby.javasupport.util.RuntimeHelpers.invoke(RuntimeHelpers.java:449)
at org.jruby.RubyObject.toString(RubyObject.java:223)
at java.lang.String.valueOf(String.java:2826)

Thanks!
-r