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

Extend @BaseScript so that script bodies can be implemented in a method named something other than run.

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.3.0-beta-1
    • Component/s: None
    • Labels:
      None

      Description

      The @BaseScript annotation allows scripts to be compiled as a class other than a direct subclass of Script. There is a problem though if the new base class wants to control the execution of the script body to do things like setup, teardown, and/or conditional/repeated execution.

      The trouble is that the script body is always a method named "run()" and there is no way for the base class to intercept it. Even GroovyInterceptable won't do the job because Script.run() is called from many contexts that do not honor that marker.

      The solution is for the @BaseScript AST transformation to see whether the base script has an abstract method declared that it should use instead of the default "run()".

        Attachments

          Activity

            People

            • Assignee:
              jimwhite James P. White
              Reporter:
              jimwhite James P. White
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: