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

Cannot compile two classes that depend on each other

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Critical
    • Resolution: Fixed
    • 1.0-JSR-3
    • 1.0-JSR-4
    • None
    • Debian

    Description

      The two attached classes cannot be compiled since the CircularInvoke2 class refers to a static method on the CircularInvoke class; it is a circular dependency thing. The same code example works fine in java.

      This is the result of the compile is as follows:

      [...] /groovy/bugs$ groovyc -d /tmp CircularInvoke*
      CircularInvoke2.groovy: 5: The variable CircularInvoke is undefined in the current scope
      @ line 5, column 5.
      CircularInvoke.m()
      ^

      1 Error

      The workaround is to comment the above line that gives the failure, recompile, and then uncomment the line again. Now the classloader is able to find the CircularInvoke.m() method (from the target location /tmp) and is then able to compile also the CircularInvoke2 class. However, this process is quite manual and very displeasing.

      Attachments

        1. CircularInvoke.groovy
          0.1 kB
          Hein Meling
        2. CircularInvoke2.groovy
          0.1 kB
          Hein Meling

        Activity

          People

            blackdrag Jochen Theodorou
            meling Hein Meling
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: