I did that actually, but it tells me the return type of the run method of Script is Object. Which is expected, if it's just looking at the actual method signature.
But what I was hoping for is that given a script:
it would be able to infer the actual return type is a Double. Now, I can imagine scripts where you randomly pick from any class on the classpath, invoke a no-args constructor, and return that... in that case I don't expect magic. But most scripts have one or two possible return statements (maybe implicit), I'm wondering if there is already code that can statically analyse a method/script and say that there are only one, two or whatever possible return types.
I'll take a look at ReturnAdder, thanks for that.