Does the file you are evaluating have more than 65535 characters?  As
far as I can tell, that is the maximum length of a String literal in
Java (see the CONSTANT_Utf8_info struct in
http://java.sun.com/docs/books/jvms/second_edition/html/ClassFile.doc.html).
I've encountered that limit when using Eclipse/CounterClockwise.  The
problem occurs when evaluating a file by doing something like:

(clojure.lang.Compiler/load (java.io.StringReader. "the-whole-file-as-
a-string"))

So the contents of the file ends up as a String literal, and Clojure
will generate a corrupt class if that String is too long.
CounterClockwise calls a function in nREPL (helpers/load-file-command)
that does this.  Perhaps Emacs/Slime is doing something similar.

I hope that helps.
- Pat

On Jul 4, 3:11 am, Peter T <ptaoussa...@gmail.com> wrote:
> Hi all,
>
> Since I started using Clojure (I think from just before 1.0) I have,
> on the odd occasion, received an error message of this form (Unknown
> constant tag X in class file error) while trying to evaluate a
> namespace in Slime/Emacs.
>
> Whenever it cropped up, it was completely random: it never seemed to
> have any specific relation to something I'd done in the code.
> Sometimes it'd get triggered by an arbitrary change like renaming a
> variable or deleting a comment or unused function.
>
> In all cases, recompiling the project from scratch would get past the
> issue.
>
> I'd always figured it was some random quirk of the compiler. Since it
> didn't happen often and could be fixed by a recompile, I just let it
> be.
>
> Today though, I've started running into this error more persistently.
> It'll start appearing consistently -right- after a recompile.
>
> I.e.: I'll compile the project, then try re-evaluate a namespace that
> was just compiled (no changes to the code) and it'll throw the error.
>
> There hasn't been any change to the code in this file and the other
> recent changes are all superficial and syntactically correct (proved
> also by the fact that the source is compiling successfully).
>
> I'm using Clojure 1.2.0.
>
> The best info I could find on this error is here, from 
> 2009:http://www.mail-archive.com/clojure@googlegroups.com/msg19130.html.
>
> I don't have any familiarity with Clojure's compiler (or Java or the
> JVM) so am a little clueless as to where I'd begin trying to get past
> the problem. Any rough idea what might be going on? Am I possibly
> bumping into a Clojure/Java/JVM limitation somewhere? Could this be a
> Slime/Swank issue? The project's about 21,000 LOC right now, including
> lots of comments. This is split into about 40 namespaces/files.
>
> Kind of in the middle of a product launch right now, so the timing's a
> little bit unfortunate: would really appreciate any advice! Thank you!
>
> The full stack trace is below:
>
> Unknown constant tag 32 in class file wusoup/web/responses/profiles
> $eval7347
>   [Thrown class java.lang.ClassFormatError]
>
> Restarts:
>  0: [QUIT] Quit to the SLIME top level
>
> Backtrace:
>   0: java.lang.ClassLoader.defineClass1(Native Method)
>   1: java.lang.ClassLoader.defineClass(ClassLoader.java:634)
>   2: java.lang.ClassLoader.defineClass(ClassLoader.java:480)
>   3:
> clojure.lang.DynamicClassLoader.defineClass(DynamicClassLoader.java:
> 45)
>   4: clojure.lang.Compiler$ObjExpr.getCompiledClass(Compiler.java:
> 3964)
>   5: clojure.lang.Compiler$FnExpr.parse(Compiler.java:3219)
>   6: clojure.lang.Compiler.analyzeSeq(Compiler.java:5367)
>   7: clojure.lang.Compiler.analyze(Compiler.java:5190)
>   8: clojure.lang.Compiler.eval(Compiler.java:5421)
>   9: clojure.lang.Compiler.eval(Compiler.java:5391)
>  10: clojure.core$eval.invoke(core.clj:2382)
>  11: swank.core$eval_in_emacs_package.invoke(core.clj:94)
>  12: swank.core$eval_for_emacs.invoke(core.clj:241)
>  13: clojure.lang.Var.invoke(Var.java:373)
>  14: clojure.lang.AFn.applyToHelper(AFn.java:169)
>  15: clojure.lang.Var.applyTo(Var.java:482)
>  16: clojure.core$apply.invoke(core.clj:540)
>  17: swank.core$eval_from_control.invoke(core.clj:101)
>  18: swank.core$spawn_worker_thread$fn__465$fn__466.invoke(core.clj:
> 300)
>  19: clojure.lang.AFn.applyToHelper(AFn.java:159)
>  20: clojure.lang.AFn.applyTo(AFn.java:151)
>  21: clojure.core$apply.invoke(core.clj:540)
>  22: swank.core$spawn_worker_thread$fn__465.doInvoke(core.clj:296)
>  23: clojure.lang.RestFn.invoke(RestFn.java:398)
>  24: clojure.lang.AFn.run(AFn.java:24)
>  25: java.lang.Thread.run(Thread.java:636)

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