Uploaded image for project: 'Clojure'
  1. CLJ-978

bean unable to handle non-public classes

    Details

    • Type: Improvement
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects versions: Release 1.4
    • Fix versions: None
    • Labels:
      None
    • Patch:
      Code and Test

      Description

      Take the following Java as an example:

      public interface IFoo {
        String getBar();
      }
      
      class FooImpl {
        String getBar() { return "bar"; }
      }
      

      As presently implemented, (bean my-foo) tries to invoke the following:

      (. #<Method public java.lang.String FooImpl.getBar> (invoke my-foo nil))
      

      However, as FooImpl is not public, this fails:

      java.lang.IllegalAccessException: Class clojure.core$bean$fn__1827$fn__1828 can not access a member of class FooImpl with modifiers "public"
       at sun.reflect.Reflection.ensureMemberAccess (Reflection.java:65)
          java.lang.reflect.Method.invoke (Method.java:588)
          clojure.core$bean$fn__1827$fn__1828.invoke (core_proxy.clj:382)
          clojure.core$bean$v__1832.invoke (core_proxy.clj:388)
          clojure.core$bean$fn__1838$thisfn__1839$fn__1840.invoke (core_proxy.clj:406)
          clojure.lang.LazySeq.sval (LazySeq.java:42)
          clojure.lang.LazySeq.seq (LazySeq.java:60)
          clojure.lang.RT.seq (RT.java:473)
      

      However, the same thing succeeds if we call #<Method public java.lang.String Foo.getBar> rather than #<Method public java.lang.String FooImpl.getBar>.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              charles-dyfis-net Charles Duffy
            • Votes:
              1 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated: