mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-14 09:12:22 +07:00
[java] IDEA-375134 Can't run non-static main method for Java 21 Preview
(cherry picked from commit f9d8a7a3b8b6f24ae8014ffb05b9b5b28ba9d3c0) (cherry picked from commit f0966f81713bd81f4128c2a1c1fbd717dc394682) IJ-MR-169535 GitOrigin-RevId: f9bfafb5e635f684d124d8fd4a7a5a996c6971e7
This commit is contained in:
committed by
intellij-monorepo-bot
parent
5fa62ff23e
commit
bc7eb9f89f
@@ -120,10 +120,12 @@ public final class AppMainV2 {
|
|||||||
* - MainMethodStatus.WithoutArgs: the method is the main method and does not accept any parameters
|
* - MainMethodStatus.WithoutArgs: the method is the main method and does not accept any parameters
|
||||||
*/
|
*/
|
||||||
private static MainMethodStatus getMainMethodStatus(Method method, MainMethodSearchMode mode) {
|
private static MainMethodStatus getMainMethodStatus(Method method, MainMethodSearchMode mode) {
|
||||||
if ("main".equals(method.getName()) ) {
|
if ("main".equals(method.getName())) {
|
||||||
if (!Modifier.isPrivate(method.getModifiers())) {
|
if (!Modifier.isPrivate(method.getModifiers())) {
|
||||||
if (mode == MainMethodSearchMode.ALL_METHOD ||
|
if (mode == MainMethodSearchMode.ALL_METHOD ||
|
||||||
(mode == MainMethodSearchMode.STATIC_METHOD && Modifier.isStatic(method.getModifiers()))) {
|
(mode == MainMethodSearchMode.STATIC_METHOD && Modifier.isStatic(method.getModifiers())) ||
|
||||||
|
(mode == MainMethodSearchMode.NON_STATIC_METHOD && !Modifier.isStatic(method.getModifiers()))
|
||||||
|
) {
|
||||||
Class<?>[] parameterTypes = method.getParameterTypes();
|
Class<?>[] parameterTypes = method.getParameterTypes();
|
||||||
if (parameterTypes.length == 1 && parameterTypes[0] == String[].class) {
|
if (parameterTypes.length == 1 && parameterTypes[0] == String[].class) {
|
||||||
return MainMethodStatus.WithArgs;
|
return MainMethodStatus.WithArgs;
|
||||||
|
|||||||
Reference in New Issue
Block a user