Cannot access protected field in Java class from Ruby subclass
--------------------------------------------------------------
Key: JRUBY-965
URL: http://jira.codehaus.org/browse/JRUBY-965
Project: JRuby
Issue Type: Bug
Components: Java Integration
Environment: OS X 10.4.9
java version "1.5.0_07"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_07-164)
Java HotSpot(TM) Client VM (build 1.5.0_07-87, mixed mode, sharing)
Reporter: Benjamin Ortega
ExtendedClass extends Abstract and can't access protected_var, as shown:
package org.jruby.test;
public abstract class Abstract {
protected String protected_var="Java";
//...
}
----
class ExtendedClass < org.jruby.test.Abstract
def get_protected_string_from_superclass
protected_var
end
end
def test_should_return_protected_string_from_superclass
a = ExtendedClass.new
begin
assert_equal "Java", a.get_protected_string_from_superclass
rescue Exception => e
flunk "Exception raised: #{$!}"
end
end
----
junit.framework.AssertionFailedError: Faults encountered running
test/test_java_extension, complete output follows:
Failure:
test_should_return_protected_string_from_superclass(TestJavaExtension)
[./test/test_java_extension.rb:45]:
Exception raised: undefined local variable 'protected_var' for
#<TestJavaExtension::ExtendedClass:0x530392 @[EMAIL PROTECTED]> or inaccessible
local variable or method 'protected_var' for
#<TestJavaExtension::ExtendedClass:0x530392 @[EMAIL PROTECTED]>.
at
org.jruby.test.TestUnitTestSuite$ScriptTest.runTest(TestUnitTestSuite.java:206)
--
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