Details
-
Type:
Improvement
-
Status:
Open
-
Priority:
Minor
-
Resolution: Unresolved
-
Affects Version/s: 1.7-beta-1
-
Fix Version/s: None
-
Component/s: Groovy Console
-
Labels:None
-
Environment:Mac OS 10.5.7
Description
I'd like to be able to define multiple classes in GroovyConsole. When I push the "execute" button, GroovyConsole could either look for a runnable class or ask me for a hint. Here is an example:
class Bar {}
class Foo {
static main(args) {
println "hi"
}
}
I can't run this code because GroovyConsole only looks at Bar and determines that it can't be run. I can solve the problem by defining Foo before Bar. However, if Foo inherits from Bar, this trick no longer works, and there is no way to run Foo.
Issue Links
- is related to
-
GROOVY-1328
cleanup strategy of choosing the class to execute when a file contains multiple classes
-
For this case the workaround is simple. Add the following line:
Obviously some smarts which avoided the workaround altogether might also be nice but I would give Minor priority.
There is also a related issue (not console specific) from a while back. I'll hunt it down and link it.