static methods of interfaces: accept calls on type parameters with exact one interface bound (IDEA-145269)

This commit is contained in:
Anna Kozlova
2015-09-18 12:43:08 +03:00
parent 434d9b2ec9
commit 8b322fadb7
3 changed files with 54 additions and 4 deletions

View File

@@ -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>
}
}
}