Classes generated by gen-class aren't loadable from remote codebase for mis-implementation of static-initializer

Description

When a genclass'ed object is serialized and sent to a remote system, the remote system throws an exception loading the object:

Reproduce:

Cause:

A gen-classed class (in this case, SampleInterfaceImpl.class) uses a static-initializer for loading SampleInterfaceImpl__init.class like:

RT.load in default uses a context-classloader for loading __init.class but all classes depending on a gen-classed class must be loaded from the same classloader. In this case, RT.load must use a remote URLClassLoader which loads the main class.

Proposed:

Instead produce the equivalent of this in the static initializer:

With this code, RT.load will uses a same classloader which load SampleInterfaceImpl.class.

Patch: clj-1157-v2.diff

Screened by:

Environment

Tested on Mac OS X 10.9.1 and Oracle JVM 1.7.0_51 with Clojure 1.6 master SNAPSHOT

Status

Assignee

Unassigned

Reporter

Tsutomu Yano

Labels

Approval

Ok

Patch

Code

Fix versions

Affects versions

Priority

Minor
Configure