I've been trying to understand exactly how these two statements are
evaluated by tracing execution through Compiler.java, Reflector.java,
etc of tag 1.2.0.

The second form - (.foo bar), expanded to (. bar foo) - eventually
calls Reflector.invokeNoArgInstanceMember.

The first form - (.foo (new Bar)), expanded to (. (new Bar) foo) -
doesn't seem to use any Reflector _invocation_ methods. I also added a
breakpoint to java.lang.reflect.Method.invoke() and it never hits that
breakpoint.

It seems that Reflector.getMethods is actually used to resolve Methods
for placement in the object expression "ObjExpr fexpr" on line 5421 of
Compiler.java. After that poing I'm unable to trace where the actual
invocation takes place.

I am trying to understand how the first form gets evaluated because I
have a case where JRebel instrumentation causes this to work:

(def bar (new foo.core.Bar))
#'user/bar
(.sayAhoj bar)
"Ahoj!"

but this to fail:

(.sayAhoj (new foo.core.Bar))
java.lang.NoSuchMethodError: foo.core.Bar.sayAhojLjava/lang/String;
(NO_SOURCE_FILE:0)

even though the method appears in the stub and can be invoked fine via
reflection. More information here:

http://blog.robert-campbell.com/post/2760935713/clojures-gen-class-and-jrebel

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to