Modifier and Type | Field and Description |
---|---|
private static final JavaLangAccess |
Access | Constructor and Description |
---|---|
private |
Modifier and Type | Method and Description |
---|---|
public static Method | Returns: the main method if a method found or null if no method is foundReturn the first method that meets the requirements of an application main method 12.1.4. |
JLA | back to summary |
---|---|
private static final JavaLangAccess JLA |
MethodFinder | back to summary |
---|---|
private MethodFinder() |
findMainMethod | back to summary |
---|---|
public static Method findMainMethod(Class<?> cls) Return the first method that meets the requirements of an application main method 12.1.4. The method must:
String[] or String... argument and failing that, once for a main method
with a no arguments. The search itself uses recursion to first look at methods
in this class, then default methods in this class's interface hierarchy and
then repeating these steps with the class's super class.
API Note The method returned may be declared in this class, a super class or as a default method of an interface that the class or super class implements. It is not possible to declare a static main method and instance main method with the same signature in the same class. 8.4.2 states that "It is a compile-time error to declare two methods with override-equivalent signatures in a class."
|