Details
-
New Feature
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
-
None
Description
In order for Grails to support reloading of classes without causing problems with cached instances in application and session scope I need Groovy to support a loadClass method that reloads a class if it has been changed.
Ideally it needs to interact with the GroovyResourceLoader to load resources as Urls if possibly.
Something like
gcl.loadClass(final String name, boolean lookupScriptFiles, boolean preferClassOverScript, boolean resolve, boolean reload)
would be ok.. otherwise maybe a different method
gcl.reloadClassIfNecessary(String name) maybe ?
gcl.reloadClass(String name, boolean force) // for forced reload or false to return current if no changes?
I've attached the test case I used to test this out originally in Grails. It is not Grails specific so you should be able to drop it into groovy and just change the package names