If there is a most specific method declaration for a method invocation, it is called the compile-time declaration for the method invocation. Two further checks must be made on the compile-time declaration:
static method, a static initializer, or the initializer for a static variable, then the compile-time declaration must be static. If, instead, the compile-time declaration for the method invocation is for an instance method, then a compile-time error occurs. (The reason is that a method invocation of this form cannot be used to invoke an instance method in places where this (§15.7.2) is not defined.)
. Identifier, then the compile-time declaration should be static. If the compile-time declaration for the method invocation is for an instance method, then a compile-time error occurs. (The reason is that a method invocation of this form does not specify a reference to an object that can serve as this within the instance method.)
void, then the method invocation must be a top-level expression, that is, the Expression in an expression statement (§14.7) or in the ForInit or ForUpdate part of a for statement (§14.12), or a compile-time error occurs. (The reason is that such a method invocation produces no value and so must be used only in a situation where a value is not needed.)
The following compile-time information is then associated with the method invocation for use at run time:
void, as declared in the compile-time declaration.
static modifier, then the invocation mode is static.
private modifier, then the invocation mode is nonvirtual.
super . Identifier, then the invocation mode is super.
interface.
virtual.
If the compile-time declaration for the method invocation is not void, then the type of the method invocation expression is the result type specified in the compile-time declaration.