Review for java launcher CR: 6742159

David Holmes - Sun Microsystems David.Holmes at Sun.COM
Wed Sep 17 23:35:04 UTC 2008


Hi Kumar,

Your signatureDiagnostic method seems to be doing too strong a job - it 
isn't checking for the existence of "public static void main(String[])" 
it is checking that if any method with the name "main" exists then it 
must be: public static void main(String[])

So it would generate an error if a class contains:

   public static void main(String[] args) { ... } // real one

but also:

   public static void main() { ... }
   private static void main(int x) { ... }
   ...

Rather than iterate through all the class methods all you need to do is 
use clazz.getMethod("main", String[].class) and then check for static 
and void (it must already be public and if static then it can't have 
been inherited)

Cheers,
David

Kumar Srinivasan said the following on 09/18/08 00:51:
> Hello,
> 
> This webrev contains some improvements to the java launcher.
> 1. call BootStrap Class loader directly from the launcher.
> 2. refactor native code for sanity checks into java
> 3. port arguments test from shell to java.
> 
> http://webrev.invokedynamic.info/ksrini/6742159/
> 
> Thanks
> 



More information about the core-libs-dev mailing list