以下是一个Java示例:
`
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$fn1827$fn1828 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 rather than .