mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-19 01:50:56 +07:00
45 lines
1.1 KiB
Java
45 lines
1.1 KiB
Java
class Test {
|
|
interface I {
|
|
default void f() {}
|
|
}
|
|
|
|
interface J {
|
|
static void f() {}
|
|
}
|
|
|
|
static class IJ implements I, J {}
|
|
static class JI implements J, I {}
|
|
|
|
public static void main(String[] args) {
|
|
new IJ(). f();
|
|
new JI(). f();
|
|
|
|
IJ.<error descr="Non-static method 'f()' cannot be referenced from a static context">f</error>();
|
|
JI.<error descr="Non-static method 'f()' cannot be referenced from a static context">f</error>();
|
|
|
|
J.f();
|
|
}
|
|
}
|
|
|
|
class Test2 {
|
|
interface I {
|
|
static void f(String <warning descr="Parameter 's' is never used">s</warning>) {}
|
|
}
|
|
|
|
interface J<T> {
|
|
default void f(T <warning descr="Parameter 't' is never used">t</warning>) {}
|
|
|
|
//another pair
|
|
default void j(T <warning descr="Parameter 't' is never used">t</warning>) {}
|
|
static void j(String <warning descr="Parameter 's' is never used">s</warning>) {};
|
|
}
|
|
|
|
static class IJ implements I, J<String> {}
|
|
|
|
public static void main(IJ s, J<String> j) {
|
|
s.f("");
|
|
|
|
<error descr="Static method may only be called on its containing interface">j.j("");</error>
|
|
}
|
|
|
|
} |