This is a small Ease-of-Development request for Dolphin.
By convention, a java program is started by calling a static "main"
method on a target class.
However, it is inconvenient for the "main" method to only be able to
access static methods and instances in the main class. So it is
common for people to do things like:
public class Main {
public void doit(String argv[]) {
// real code goes here.
}
public static void main(String argv[]) {
(new Main()).doit(argv);
}
}
I would like us to also accept a new pattern. If a class
provides a zero arg constructor (either the default constructor
or a human written zero-arg constructor) and it has an instance
method "public void main(String argv[])" then we should be willing
to treat that main method as the entry method for the program.
This can be implemented by having the runtimes allocate a new instance
of the target class and then call the main instance method.
If a class has both a static "main" and an instance "main" then
we should call the static "main", for compatibility with existing apps.
I believe making this small change will be a welcome small EoD
improvement for many developers!
Thanks - Graham