This turned out to be caused by a large code literal in some test
code.  Java classfiles have certain implementation limits -- in
particular, limits on the size of the bytecode that implements methods
(as well as other elements in classfiles).

Rich discussed this briefly back in November here, where he suggested
that large literals should be moved out to separate files, and brought
into the runtime using read (and its variants):

http://groups.google.com/group/clojure/browse_frm/thread/e556434a382de814

After thinking about this for a while, I decided to file a bug on the
topic:

http://code.google.com/p/clojure/issues/detail?id=74

In short, it seems that Clojure should emit a hard error when it
encounters code while compiling that would result in unloadable
classfiles (and perhaps emit a warning when such code is encountered
when reading, so as to not trip up anyone who is interactively loading
code and compiling down to classfiles).

- Chas

On Feb 8, 4:08 pm, Chas Emerick <cemer...@snowtide.com> wrote:
> I am intermittently getting the following error when I attempt to  
> perform an incremental compilation of a set of Clojure source files.  
> To be clear, I mean "incremental" where I've previously compiled the  
> sources down to classfiles, then changed one or more source files, and  
> then run clojure.lang.Compile over all of the libs in the project,  
> which should only compile the changed source files if I understand  
> correctly.  Cleaning the project (which deletes the classfiles from  
> the old compilation run) and doing a full recompile of all libs works  
> succeeds.
>
> - Chas
>
> Exception in thread "main" java.lang.ClassFormatError: Invalid method  
> Code length 105496 in class file com/foo/MyClass__init
>          at java.lang.ClassLoader.defineClass1(Native Method)
>          at java.lang.ClassLoader.defineClass(ClassLoader.java:675)
>          at  
> java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
>          at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
>          at java.net.URLClassLoader.access$000(URLClassLoader.java:56)
>          at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
>          at java.security.AccessController.doPrivileged(Native Method)
>          at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
>          at java.lang.ClassLoader.loadClass(ClassLoader.java:316)
>          at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:
> 288)
>          at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
>          at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:
> 374)
>          at java.lang.Class.forName0(Native Method)
>          at java.lang.Class.forName(Class.java:247)
>          at clojure.lang.RT.loadClassForName(RT.java:1512)
>          at clojure.lang.RT.load(RT.java:394)
>          at clojure.lang.RT.load(RT.java:374)
>          at clojure.core$load__4911$fn__4913.invoke(core.clj:3623)
>          at clojure.core$load__4911.doInvoke(core.clj:3622)
>          at clojure.lang.RestFn.invoke(RestFn.java:413)
>          at clojure.core$load_one__4863.invoke(core.clj:3467)
>          at clojure.core$compile__4918$fn__4920.invoke(core.clj:3633)
>          at clojure.core$compile__4918.invoke(core.clj:3632)
>          at clojure.lang.Var.invoke(Var.java:336)
>          at clojure.lang.Compile.main(Compile.java:56)
--~--~---------~--~----~------------~-------~--~----~
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 
clojure+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to