Update:

I used gen-and-save-class to see what it is complaining about. It is
failing due to the following fields:

    public static final clojure.lang.Var printStackTrace-void__var;
    public static final clojure.lang.Var printStackTrace-PrintWriter__var;
    public static final clojure.lang.Var printStackTrace-PrintStream__var;

The patch seems to be fairly trivial. I patched genclass.clj with:

Index: src/clj/clojure/genclass.clj
===================================================================
--- src/clj/clojure/genclass.clj        (revision 1087)
+++ src/clj/clojure/genclass.clj        (working copy)
@@ -53,9 +53,9 @@

 (defn- overload-name [mname pclasses]
   (if (seq pclasses)
-    (apply str mname (interleave (repeat \-)
+    (apply str mname (interleave (repeat \$)
                                  (map escape-class-name pclasses)))
-    (str mname "-void")))
+    (str mname "$void")))

I am not 100% sure this doesn't haven't any other effects within the
genclass code, but I did a test and it seems to be behave properly.

/mike.

On Thu, Nov 6, 2008 at 1:12 PM, Michael Reid <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I am getting the following error trying to extend java.lang.Exception
> in the latest revision of Clojure:
>
> user=>(defmacro defexception [name]
>  `(try
>    (gen-and-load-class (quote ~name) :extends Exception)
>    (catch java.lang.LinkageError le#
>         (. le# (printStackTrace)))))
>
> user=> (defexception my.Exception)
> java.lang.ClassFormatError: JVMCFRE114 field name is invalid;
> class=my/Exception, offset=0
>        at java.lang.ClassLoader.defineClassImpl(Native Method)
>        at java.lang.ClassLoader.defineClass(ClassLoader.java:265)
>        at java.lang.ClassLoader.defineClass(ClassLoader.java:202)
>        at 
> clojure.lang.DynamicClassLoader.defineClass(DynamicClassLoader.java:39)
>        at clojure.gen_and_load_class__2231.doInvoke(genclass.clj:461)
>        at clojure.lang.RestFn.invoke(RestFn.java:443)
>        at user.fn__2491.invoke(Unknown Source)
>        at clojure.lang.AFn.applyToHelper(AFn.java:182)
>        at clojure.lang.AFn.applyTo(AFn.java:175)
>        at clojure.lang.Compiler$InvokeExpr.eval(Compiler.java:2664)
>        at clojure.lang.Compiler.eval(Compiler.java:4116)
>        at clojure.lang.Repl.main(Repl.java:91)
> nil
> user=>
>
> The 'defexception macro is actually from swank-clojure. I have used
> this successfully in the past, the difference here is that I am using
> the IBM 1.6.0 JRE in this case:
>
>   [EMAIL PROTECTED] trunk]$ java -version
>   java version "1.6.0"
>   Java(TM) SE Runtime Environment (build pxi3260sr2-20080818_01(SR2))
>   IBM J9 VM (build 2.4, J2RE 1.6.0 IBM J9 2.4 Linux x86-32
> jvmxi3260-20080816_22093 (JIT enabled, AOT enabled)
>   J9VM - 20080816_022093_lHdSMr
>   JIT  - r9_20080721_1330ifx2
>   GC   - 20080724_AA)
>   JCL  - 20080808_02
>
> I'm not sure if this is Clojure's bug or IBM's. I don't have the
> luxury of testing this on any other JVMs at the moment. I presume that
> since everyone is able to use swank-clojure at the latest revision
> that this is not happening on other JVMs?
>
> /mike.
>

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

Reply via email to