mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-08-26 15:27:45 +07:00
GitOrigin-RevId: 8b2b63fc6db476ca0c2cfe5cadd84db6c4236d0f
22 lines
852 B
HTML
22 lines
852 B
HTML
<html>
|
|
<body>
|
|
Reports methods that are named "main", but do not have the
|
|
<code>public static void main(String[])</code> signature in Java up to 21.
|
|
Starting from Java 21 Preview, inspection doesn't highlight in case of package-private, protected or instance main methods,
|
|
also without parameters.
|
|
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.
|
|
<p>Such methods may be confusing, as methods named "main"
|
|
are expected to be application entry points.</p>
|
|
<p><b>Example:</b></p>
|
|
<pre><code>
|
|
class Main {
|
|
void main(String[] args) {} // warning here because there are no "public static" modifiers
|
|
}
|
|
</code></pre>
|
|
<p>A quick-fix that renames such methods is available only in the editor.</p>
|
|
<!-- tooltip end -->
|
|
<p>
|
|
|
|
</body>
|
|
</html> |