Skip to content

Commit

Permalink
Warning if super static main
Browse files Browse the repository at this point in the history
  • Loading branch information
JimLaskey committed Apr 12, 2023
1 parent cff3060 commit db76aa4
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/java.base/share/classes/jdk/internal/misc/VM.java
Original file line number Diff line number Diff line change
Expand Up @@ -540,7 +540,13 @@ public static Method findMainMethod(Class<?> mainClass) {
MethodType withArgsMT = MethodType.methodType(void.class, String[].class);
MethodType noArgsMT = MethodType.methodType(void.class);
Method mainMethod = findMainMethod(mainClass, true, true, name, withArgsMT);
if (mainMethod != null) return mainMethod;
if (mainMethod != null) {
if (mainMethod.getDeclaringClass() != mainClass) {
System.err.println("WARNING: static main in super class will be deprecated.");
}

return mainMethod;
}

if (!Runtime.version().pre().orElse("").equals("ea")) {
String[] args = getRuntimeArguments();
Expand Down

0 comments on commit db76aa4

Please sign in to comment.