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

Support extension methods inside the same compilation unit

    XMLWordPrintableJSON

Details

    Description

      Currently, the Groovy compiler supports extension methods only if they are previously compiled and provided to the current compilation run on the classpath. I have several projects where using extension methods to make project-specific micro-DSLs would substantially improve readability/maintainability, but because the extension methods need to refer to business objects, I would have to slice up the project into a pile of micro-projects.

      It would be very useful to be able to have a "bootstrap" mechanism to declare extension methods within the same project they're applied to, in the same way that annotations can be declared inside the same project. Either having an annotation @ProvidesExtensionMethods or providing a META-INF file (maybe being able to employ the usual mechanism for "forward extension declarations"?) would accomplish what I think I'm looking for.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              chrylis Christopher Smith
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated: