Fix for class redefinition problem...

Patrick Niemeyer <[email protected]> Tue, 17 Aug 2004 02:16:23 -0500
Newsgroups gmane.comp.java.beanshell.devel
Message-ID <[email protected]>
I've added the code necessary to get the class generation to use the 
BshClassLoader, which allows us to reload the classes when they are 
redefined.  (Previously they were injected directly into the app 
classloader as a hack, which meant that scripts couldn't be run twice 
in the same VM, etc.)

This means that now when a script generates a class we introduce a 
classloader... which should come as no surprise, but is something we 
generally avoid in BeanShell unless required.  I've done basic testing 
and it seems to work.  However I am not sure if this plays well with 
the context classloader or what it might do in other classloading 
environments yet.  The changes are very small, taking advantage of the 
class reloading infrastructure that was already there.  Feedback would 
be appreciated.

CVS is down at the moment, so I've put up a snapshot at:

   http://beanshell.org/bsh-2.0b2-src.jar

Also, I'd just like to remind everybody that all of this only affects 
you if you are actually defining classes or interfaces using the 
standard Java class / interface syntax, which is a new feature in 2.0.  
If you are just scripting interfaces as was possible before, no class 
generation is done and no classloaders are introduced.


thanks,
Pat



-------------------------------------------------------
SF.Net email is sponsored by Shop4tech.com-Lowest price on Blank Media
100pk Sonic DVD-R 4x for only $29 -100pk Sonic DVD+R for only $33
Save 50% off Retail on Ink & Toner - Free Shipping and Free Gift.
http://www.shop4tech.com/z/Inkjet_Cartridges/9_108_r285