Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-2750 rewrite GroovyScriptEngine
  3. GROOVY-2674

GroovyScriptEngine does not properly handle dependencies

    XMLWordPrintableJSON

Details

    • Sub-task
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.5.4
    • 1.7-beta-1
    • 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

          Activity

            People

              blackdrag Jochen Theodorou
              bnahas Brian Nahas
              Votes:
              1 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: