Including internal interface

Supposing I have a java class and internally has an interface:

package test;

public class Foo
{
public interface Bar
{
double f (double x);
}
}

In JRuby, if I have the following:

class Impl
include Java::test.Foo.Bar

def f (x)
x*x
end
end

Does not find internal interface Bar. Trying with the correct java
mangling:

include Java::test.Foo$Bar

does not work either.

I would prefer not to require that the interface be at the toplevel
(i.e. not internal). How do I include it?

Thanks

Jonathan

To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

On Tue, Feb 2, 2010 at 3:36 PM, Jonathan Shore
[email protected] wrote:

    }
    end
end

Does not find internal interface Bar. Â Â Trying with the correct java mangling:

    include Java::test.Foo$Bar

does not work either.

Try include Java::test.Foo::Bar. Inner classes are treated like
module/class-scoped constants, which are accessed using ::.

  • Charlie

To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs