Constructors are not setAccessible'd like methods are
-----------------------------------------------------

                 Key: JRUBY-5009
                 URL: http://jira.codehaus.org/browse/JRUBY-5009
             Project: JRuby
          Issue Type: Bug
          Components: Java Integration
    Affects Versions: JRuby 1.5.1
            Reporter: Charles Oliver Nutter
            Assignee: Charles Oliver Nutter
             Fix For: JRuby 1.6


We setAccessible methods when security policies allow it and they might need to 
be accessible (such as when dealing with protected or package-visible members). 
However, it appears we are not doing this for constructors in the same way. We 
should make this logic consistent for constructors as well.

Notice in the following example that the Foo constructor is package-visible and 
can't be invoked, but the blah method is also package-visible and invokes fine:

{noformat}
~/projects/jruby ➔ cat blah/Foo.java
package blah;

public class Foo {
  Foo() {}
  public static Foo getFoo() {
    return new Foo();
  }
  void blah() {
    System.out.println("Hello");
  }
}

~/projects/jruby ➔ jruby -rjava -e "java_import 'blah.Foo'; Foo.new"
-e:1:in `new_proxy': no public constructors for Java::Blah::Foo (TypeError)
        from -e:1

~/projects/jruby ➔ jruby -rjava -e "java_import 'blah.Foo'; Foo.foo.blah"
Hello
{noformat}

-- 
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