method refs: allow reference parameters before method name

This commit is contained in:
anna
2012-10-02 18:11:16 +02:00
parent 8e9866900a
commit 0e8ade2f40
3 changed files with 14 additions and 1 deletions

View File

@@ -1265,7 +1265,7 @@ public class GenericsHighlightUtil {
final PsiElement parent = refParamList.getParent();
if (parent instanceof PsiReferenceExpression) {
final PsiElement grandParent = parent.getParent();
if (!(grandParent instanceof PsiMethodCallExpression)) {
if (!(grandParent instanceof PsiMethodCallExpression) && !(parent instanceof PsiMethodReferenceExpression)) {
final String message = JavaErrorMessages.message("generics.reference.parameters.not.allowed");
return HighlightInfo.createHighlightInfo(HighlightInfoType.ERROR, refParamList, message);
}

View File

@@ -0,0 +1,9 @@
class MyTest {
interface I<X> {
X _();
}
static <T> T bar() {return null;}
static {
I i = MyTest::<String>bar;
}
}

View File

@@ -73,6 +73,10 @@ public class MethodRefHighlightingTest extends LightDaemonAnalyzerTestCase {
doTest();
}
public void testReferenceParameters() throws Exception {
doTest();
}
private void doTest() throws Exception {
doTest(BASE_PATH + "/" + getTestName(false) + ".java", false, false);
}