Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-1248

Class reloading of classes through GCL fails when a groovy class is a subclass of another groovy class

    XMLWordPrintableJSON

Details

    • New Feature
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 1.0-JSR-6
    • groovy-jdk
    • 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

      Attachments

        1. class_reloading.patch
          1 kB
          Art Gramlich

        Activity

          People

            blackdrag Jochen Theodorou
            artgramlich Art Gramlich
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: