Accessing protected variables from parent class in Jruby

I had posted this on StackOverflow, but it got lost.

I’m trying to get at the protected variables that are defined in the
parent
class I have inherited from.

Is this possible? I can’t find any documentation saying it is. I’ve seen
tickets that have been closed on earlier versions of JRuby.

Any help would be great.

To clarify

public class Something {

protected float somethingelse = 1.0f;

}

I want to get at somethingelse from the class that inherits from
Something.

Thanks!

You can re-open the class that has the field:

class Something
field_reader :somethingelse
end

There is also field_accessor and field_writer. These methods depend
on setAccessible having permission which means in applet or other
restricted environments it may not work. Thankfully, those
environments are the exception and not the rule.

-Tom

On Tue, Oct 19, 2010 at 10:00 PM, Robert R.
[email protected] wrote:

Thanks!


blog: http://blog.enebo.com twitter: tom_enebo
mail: [email protected]