Details
-
Sub-task
-
Status: Closed
-
Major
-
Resolution: Fixed
-
1.5.4
-
None
-
None
-
os x 10.4.11 java 1.5.0_13
Description
The GroovyScriptEngine does not properly handle dependencies among groovy files contained in a root passed into it.
If you have two script files in the same root that are dependent on each other (using classes across files), changes in one will not be picked up when you invoke the other script.
The dependency checking in the anonymous GroovyClassLoader in GroovyScriptEngine.initGroovyLoader() does not properly associate the class dependencies passed into it with the file system and stores bad dependencies. For example, if you have A.groovy and B.groovy in a root, and A references a class in B (called BClass), then in the classloader, the dependencies that come into the classloader will be:
- java.lang.BClass
- java.io.BClass
- java.net.BClass
- java.util.BClass
- groovy.lang.BClass
- groovy.util.BClass
- ABeanInfo
All of these dependencies will be stored in the currentCacheEntry even though they seem to be useless (why check for changes in core packages?) and non-existant. The default package, which holds the dependent script file, is never referenced, even though it should be checked first.
Furthermore, if classes or scripts are in subdirectories, the class name the comes into the anonymous class contains '$' in the class name, not ".", so the replace statement has no effect and those files are never checked either.
Attachments
Issue Links
- is related to
-
GROOVY-2588 CLONE -Class reloading does not work with multi-level dependencies
- Closed