简体   繁体   中英

Eclipse - Why interface method consider as Open Super Implementation

Following an interface and an implementation class:

public interface MyI
     void test();
}

public MyImpl implements MyI {
     //@Override with or without @Override 
     public void test() {
     }
}

When pressing Ctrl and clicking on implementation test() method in Eclipse It display a menu offering Open Super Implementation

When choosing Open Super Implementation it goes to the interface's method which has no implementation

Is it intentional or just an extra feature to get to interface method although naming is confusing/seems wrong?

It seems something informative to do on the go-to-implementation (io of an error). As there stands (can stand) an @Override that is almost regular/to be expected: the first declaration.

For abstract methods in an abstract super class that is likely the same.

"Implementation" hence is a bit misleading, but then there is Override. It should be noted that the first implementation of an interface method originally could not have an @Override . A java change to be able to prevent errors (indeed see that the abstract method was implemented with correct signature).

That's an IDE feature. As the menu entry indicates it takes you to the super method. At run-time the implementing method will be called. So it's just a feature of the IDE.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM