mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-04-18 04:21:24 +07:00
static methods of interfaces: accept calls on type parameters with exact one interface bound (IDEA-145269)
This commit is contained in:
@@ -22,4 +22,33 @@ class Bug {
|
||||
|
||||
Function<Integer, Integer> h = IFunction.<error descr="Static method may be invoked on containing interface class only">identity</error>();
|
||||
}
|
||||
}
|
||||
|
||||
class StaticMethodInterfaceExample {
|
||||
|
||||
interface X {}
|
||||
interface MyInterface {
|
||||
static void staticMethod() {}
|
||||
}
|
||||
|
||||
static class MyImplementation implements MyInterface { }
|
||||
|
||||
public static class Usage {
|
||||
|
||||
public <T extends MyInterface> void doStuff() {
|
||||
T.staticMethod();
|
||||
}
|
||||
|
||||
public <T extends MyImplementation> void doStuff1() {
|
||||
<error descr="Static method may be invoked on containing interface class only">T.staticMethod();</error>
|
||||
}
|
||||
|
||||
public <T extends MyInterface & X> void doStuff2() {
|
||||
<error descr="Static method may be invoked on containing interface class only">T.staticMethod();</error>
|
||||
}
|
||||
|
||||
public <T extends MyImplementation & MyInterface> void doStuff3() {
|
||||
<error descr="Static method may be invoked on containing interface class only">T.staticMethod();</error>
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user