Can't include interfaces in a synchronized class
------------------------------------------------

                 Key: JRUBY-5168
                 URL: http://jira.codehaus.org/browse/JRUBY-5168
             Project: JRuby
          Issue Type: Bug
            Reporter: Rib Rdb
            Assignee: Thomas E Enebo


If you include a java interface after including JRuby::Synchronized, you get a 
NPE:

{code}$ jruby -r java -r jruby/synchronized -e 'class A;include 
JRuby::Synchronized;include java.lang.Iterable;end'
DynamicMethod.java:320:in `calculateProtectedClass': 
java.lang.NullPointerException
        from DynamicMethod.java:104:in `init'
        from DynamicMethod.java:86:in `<init>'
        from SynchronizedDynamicMethod.java:44:in `<init>'
        from RubyModule.java:936:in `newCacheEntry'
        from RubyModule.java:952:in `addToCache'
        from RubyModule.java:894:in `searchWithCache'
        from RubyModule.java:871:in `searchMethod'
        from RubyModule.java:1278:in `isMethodBound'
        from JavaInterfaceTemplate.java:130:in `initInterfaceImplMethods'
        from JavaInterfaceTemplate.java:99:in `appendFeaturesToClass'
        from JavaInterfaceTemplate.java:79:in `append_features'
        from 
org/jruby/java/proxies/JavaInterfaceTemplate$s_method_1_0$RUBYFRAMEDINVOKER$append_features.gen:65535:in
 `call'
        from JavaMethod.java:319:in `call'
        from RubyClass.java:663:in `finvoke'
        from RuntimeHelpers.java:452:in `invoke'
        from RubyBasicObject.java:332:in `callMethod'
        from RubyModule.java:1901:in `include'
        from org/jruby/RubyModule$i_method_0_0$RUBYINVOKER$include.gen:65535:in 
`call'
        from JavaMethod.java:630:in `call'
        from DynamicMethod.java:186:in `call'
        from CachingCallSite.java:309:in `cacheAndCall'
        from CachingCallSite.java:148:in `call'
        from -e:1:in `class_0$RUBY$A'
        from -e:1:in `__file__'
        from -e:-1:in `load'
        from Ruby.java:686:in `runScript'
        from Ruby.java:569:in `runNormally'
        from Ruby.java:415:in `runFromMain'
        from Main.java:286:in `run'
        from Main.java:128:in `run'
        from Main.java:97:in `main'
{code}

A workaround is to include Synchronized after including the java interface. 
However this means that once you include Synchronized you can't create a 
subclass which includes a new interface.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to