The following produces an error and a warning. The warning is redundant.
public class StaticInvoke {
interface I {
static void m() { m(); } // ok
}
void test(I arg) {
I.m(); // ok
arg.m(); // error
}
}
StaticInvoke.java:9: warning: [static] static method should be qualified by type name, I, instead of by an expression
arg.m(); // error
^
StaticInvoke.java:9: error: illegal static interface method call
arg.m(); // error
^
the receiver expression should be replaced with the type qualifier 'I'
1 error
1 warning
public class StaticInvoke {
interface I {
static void m() { m(); } // ok
}
void test(I arg) {
I.m(); // ok
arg.m(); // error
}
}
StaticInvoke.java:9: warning: [static] static method should be qualified by type name, I, instead of by an expression
arg.m(); // error
^
StaticInvoke.java:9: error: illegal static interface method call
arg.m(); // error
^
the receiver expression should be replaced with the type qualifier 'I'
1 error
1 warning