Could you add some examples of your abstract class ? In the meantime I think there are a couple of facts that might be helpful:
- If you use BaseScript with your abstract class, the script body becomes the implementation body of the abstract method ( http://docs.groovy-lang.org/next/html/gapi/groovy/transform/BaseScript.html ) - If you use TimeInterrupt annotation, in your abstract class al methods but the abstract one will be checking the time. That only should be a concern if you are concern about the time is taking the method executed just before the foo() implementation. MyBase.groovy --------------------- import groovy.transform.* import java.util.concurrent.TimeUnit @TimedInterrupt(value = 3L, unit = TimeUnit.SECONDS) abstract class MyBase extends Script { def run() { start() foo() end() } abstract void foo() void start() { println "started!" } void end() { println "finished!" } } MyScript.groovy --------------------- @BaseScript(MyBase) import groovy.transform.BaseScript Thread.sleep(5000) println "hello" Execution -------------- started! hello Caught: java.util.concurrent.TimeoutException: Execution timed out after 3 units. Start time: Tue Apr 26 11:32:52 UTC 2016 java.util.concurrent.TimeoutException: Execution timed out after 3 units. Start time: Tue Apr 26 11:32:52 UTC 2016 at MyBase.end(MyBase.groovy) at MyBase.run(MyBase.groovy:10) 2016-04-17 0:48 GMT+02:00 Gregory Golberg <gri...@alum.mit.edu>: > Hi > > I define a certain abstract class in my code, and want groovy scripts to > implement a method in it. I want to ensure that the groovy scripts inherit > constructors and that methods have TimedInterrupt annotation - but I would > like to not depend on script authors to do so. > > I realize annotations are not inheritable unless they have @Inherited, so > I copied these annotations into my code just to add @Inherited to them... > But still no luck. Any ideas? > > -g >