Confusing 'main()' method
Reports methods that are named "main", but do not have the public static void main(String[])
signature. Additionally main methods located in anonymous or local classes are reported. Anonymous and local classes do not have a fully qualified name and thus can't be run.
Such methods may be confusing, as methods named "main" are expected to be application entry points.
Example:
class Main {
void main(String[] args) {} // warning here because there are no "public static" modifiers
}
A quick-fix that renames such methods is available only in the editor.
Inspection Details | |
---|---|
Available in: | IntelliJ IDEA 2023.3, Qodana for JVM 2023.3 |
Plugin: | Java, 233.SNAPSHOT |
Last modified: 13 July 2023