Details
-
Improvement
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
-
None
-
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()".