The JVM spec (5.4.3.3) describes how method resolution is done for method refs. If it cannot find a method in a class or its superclasses, it tries to find the method in the superinterfaces.
What is the reason for this? Wouldn't a method declared by a superinterface be listed in the constant pool as an interface method ref instead of a method ref?
My understanding is that method refs are used in invokevirtual
operations, whereas interface method refs are used in invokeinterface
operations. I don't see how one could invoke an interface method using invokevirtual <methodref>
.