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

Global transforms should only be executed once in IntelliJ IDEA

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.6-beta-1
    • 1.6-beta-2
    • None
    • None
    • Mac OS 10.5.2
      JDK 1.5.0_13
      IDEA 7.0.3
      JetGroovy 1.5.16023

    Description

      In IntelliJ IDEA, when I build a Groovy project that has a dependency containing a global transform, for some reason the transform is executed twice. When I compile with groovyc or run FileSystemCompiler in IDEA, the transform is only executed once (as expected). I've studied the transform implementation (specifically ASTTransformationVisitor) but haven't found the cause of the problem. All I know is that the transform is invoked twice on the same ModuleNode instance. SourceUnit reports phase "conversion" instead of "semantic analysis", but I guess that's because SourceUnit.phase is no longer incremented after phase conversion.

      To reproduce the problem, I've attached a jar containing a transform that will create a file transformlog.txt in your user home and append "transform invoked\n" every time the transform is invoked. (What's the preferred way to produce debug/info output in a transform, and will this output also be shown in IDEA?)
      In IDEA, add the jar as a dependency to any Groovy project and rebuild. To build with groovyc, type "groovyc -cp ./transformtest.jar:<your_path>/groovy-all-1.6-beta-2-SNAPSHOT.jar <any_groovy_file>". Don't forget to delete transformlog.txt between compiler invocations.

      Attachments

        Activity

          People

            shemnon Daniel Ferrin
            pniederw Peter Niederwieser
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: