Hi George, That's correct. I briefly mention the JVM's standard "hot swapping" capabilities when running in debug mode. Unfortunately this hot swapping is mostly limited to changing method bodies and not class signatures (add/remove method, etc).
Normally this is not even a problem because - as you mentioned - Clojure compiles _new_ classes on the fly, and these can be loaded fine. The problem is limited to gen-class development when stub classes are generated. During interactive development you'll probably be adding/removing methods or otherwise changing the class signature. This is a problem because the stub was already generated the first time you called (compile) and loaded. Subsequent compiles - which include the class sig changes - don't get reloaded due to JVM limitations. This specific issue is solved via JRebel. Rob On Thu, Feb 10, 2011 at 12:21 AM, George Jahad <[email protected]> wrote: > I studied it a bit more and noticed that the jdi redefineClasses > method can't add new methods, (as you imply in your blog.) That's > what's special about what JRebel offers. > > The redefineClasses method is described here: > http://download.oracle.com/javase/6/docs/jdk/api/jpda/jdi/com/sun/jdi/VirtualMachine.html#redefineClasses(java.util.Map) > > > On Feb 9, 12:38 pm, George Jahad <[email protected]> wrote: >> so i think most java debuggers, even jdb, are capable of reloading >> classes aren't they? >> >> i haven't tried your example, but in the cdt, you use >> the .redefineClasses method to reload a java class >> >> For example, I can hack on one of the classes in clojure compiler and >> reload it, without restarting, like so: >> >> (.redefineClasses >> (vm) >> {(first (find-classes #"clojure.lang.Compiler\$DefExpr\$Parser")) >> (to-byte-array >> (java.io.File. >> "/Users/georgejahad/incoming/clojure/classes/clojure/lang/Compiler >> $DefExpr$Parser.class"))}) >> >> is that what you are talking about, or am i missing something? >> >> On Feb 9, 12:49 am, Robert Campbell <[email protected]> wrote: >> >> > Back in January I found myself writing some gen-class to connect my >> > Clojure library to my Java project. Until now I'd been spoiled by >> > Clojure's dynamic, interactive nature, so running up against the whole >> > "stub class signature can't change w/out jvm reboot" thing hurt a bit. >> >> > I found a partial solution via JRebel, but it only worked with >> > invocations lacking type information and compiled to use reflection. >> > It failed on any invocation with enough type information present in >> > the sexpr to use invokevirtual. I actually met Jevgeni (CTO of ZT) >> > last week and he mentioned he might have some of their guys take a >> > look at the problem. Lo and behold, their latest nightly build fixes >> > the issue and it now seems that everything is working. >> >> > Here's how to set it up:http://blog.robert-campbell.com/post/2760935713 >> >> > The company behind JRebel, ZeroTurnaround, gives out free licenses to >> > OSS and Scala developers. When I spoke with Jevgeni he seemed open to >> > the idea of adding Clojure development to that list provided there was >> > enough demand. While gen-class is a relatively rare/minor part of most >> > Clojure development, I think this tool allows us to smooth out one >> > rough patch in the dev experience. >> >> > > -- > You received this message because you are subscribed to the Google > Groups "Clojure" group. > To post to this group, send email to [email protected] > Note that posts from new members are moderated - please be patient with your > first post. > To unsubscribe from this group, send email to > [email protected] > For more options, visit this group at > http://groups.google.com/group/clojure?hl=en -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to [email protected] Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/clojure?hl=en
