AnonymousClassLoader and ClassLoader

Charles Oliver Nutter charles.nutter at sun.com
Fri Apr 25 16:00:30 PDT 2008


Rémi Forax wrote:
> The problem is: even if you want to use it lightly, i think you can't 
> control
> the fact that an user can send your closure or any instance of a class 
> loaded
> by the anonymous loader to a lib that relies on getClassLoader().

Generally the purposes I have in mind for anonymously-loaded classes are 
entirely controlled:

- As the body of a newly JITted method, only ever accessed from within 
the JRuby dispatch hierarchy
- As a method handle, only ever accessed from within the JRuby dispatch 
hierarchy
- As a compiled regex, only ever accessed from within the JOni regex library
- As a "more" optimized call site, only ever accessed from the 
interpreter or compiled code

I had never expected that anonymously loaded classes would be a general 
purpose way to create new interface impls or subclasses I'd pass out to 
arbitrary libraries. My interest in them (for now) is purely as 
lightweight "code boxes" for purposes I keep safely tucked away.

- Charlie



More information about the mlvm-dev mailing list