I\'m using Groovy 1.8.4, trying to get the name of the enclosing function...
def myFunction() {
println functionName??
}
I\'ve tried
You can get to it via the stacktrace, I've been able to get it via:
groovy:000> def foo() { println Thread.currentThread().stackTrace[10].methodName }
===> true
groovy:000> foo()
foo
groovy:000> class Foo {
groovy:001> def bar() { println Thread.currentThread().stackTrace[10].methodName }
groovy:002> }
===> true
groovy:000> new Foo().bar()
bar