From f9bd8736643e1346f3f060bb110623214c267f0a Mon Sep 17 00:00:00 2001 From: Mikhail Pyltsin Date: Mon, 20 Jan 2025 19:52:36 +0100 Subject: [PATCH] [java-run] IDEA-365965 Support JEP 495. Filter non-static methods in abstract classes GitOrigin-RevId: e96732d810ae6a0f1ffa44a0d5cc11d4c0f50d06 --- .../src/com/intellij/rt/execution/application/AppMainV2.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/java/java-runtime/src/com/intellij/rt/execution/application/AppMainV2.java b/java/java-runtime/src/com/intellij/rt/execution/application/AppMainV2.java index b1a72f0289f2..f8085121fea6 100644 --- a/java/java-runtime/src/com/intellij/rt/execution/application/AppMainV2.java +++ b/java/java-runtime/src/com/intellij/rt/execution/application/AppMainV2.java @@ -209,6 +209,8 @@ public final class AppMainV2 { Class last = classesToVisit.removeLast(); Method[] declaredMethods = last.getDeclaredMethods(); for (Method method : declaredMethods) { + //it is impossible to call non-static method for abstract class + if (Modifier.isAbstract(aClass.getModifiers()) && !Modifier.isStatic(method.getModifiers())) continue; MainMethodStatus status = getMainMethodStatus(method, java21Preview ? MainMethodSearchMode.NON_STATIC_METHOD : MainMethodSearchMode.ALL_METHOD); if (status == MainMethodStatus.WithArgs) { return method;