Extending a class with 'public static void main' no longer allows you to run it

In previous a IntelliJ version, it was possible to run a class which extended another with a `psvm` method. For example:

 

abstract class RunClass {
    static RunClass rc
    static void main(String[] args) {
         rc.run()
    }
    abstract void run() 
}

// Before, the IDE allowed you to run this class (green triangle on the left of the class name). 
class Test extends RunClass {
     static {  rc = new Test() }
     void run() {
          println “Hello World”
     }
}

I understand that the ‘main’ method is static and it should be executed from `RunClass` only, but I have an implementation in a library, in which an instance is passed to allow using a non-static method to be executed instead. 

Perhaps previous versions were mistaken (and current is the correct expectation) ?

0

请先登录再写评论。