Calling protected super methods in inheritance heirachy

I recall a while ago some talk around calling protected methods in a
parent
java class from a child ruby class.

The example was in relation to paintComponent and looked something like
this

class Cursor < javax.swing.JLabel

save the superclass method

PaintComp =
javax.swing.JComponent.java_class.declared_method’paintComponent’,

java.awt.Graphics’
#…
def paintComponent(graphics)
# calling super method
PaintComp.invoke(self.java_object, graphics.java_object)
end
end

This approach doesnt seem to work for me, i get errors stating illegal
access, cannot access protected modifier.

Is there an approach recommend, or is the current approach to create my
own
java sub class and change the access modifier to public.

cheers

simon

On Thu, 11 Oct 2007 16:08:11 +0300, simon jenkins [email protected]
wrote:

I recall a while ago some talk around calling protected methods in a
parent
java class from a child ruby class.

Yes. You may want to track this bug:
http://jira.codehaus.org/browse/JRUBY-194

  -Antti-

To unsubscribe from this list please visit:

http://xircles.codehaus.org/manage_email

The code posted in the original workaround didnt work for me, i needed
to
change the accessibility of the method to allow me to call it.

something like this works

    m = Java::

junit.extensions.abbot.ComponentTestFixture.java_class.declared_method’fixtureTearDown’
m.accessible = true
m.invoke(self.java_object)

cheers

simon