method refs: mark method as registered in RefCountHolder

This commit is contained in:
anna
2012-09-27 18:02:08 +02:00
parent 2823a7e108
commit 67d6396df2
3 changed files with 23 additions and 0 deletions
@@ -967,6 +967,16 @@ public class HighlightVisitorImpl extends JavaElementVisitor implements Highligh
@Override
public void visitMethodReferenceExpression(PsiMethodReferenceExpression expression) {
myHolder.add(HighlightUtil.checkMethodReferencesFeature(expression));
JavaResolveResult result;
try {
result = expression.advancedResolve(true);
}
catch (IndexNotReadyException e) {
return;
}
if (myRefCountHolder != null) {
myRefCountHolder.registerReference(expression, result);
}
}
@Override
@@ -0,0 +1,12 @@
class C {
interface Simplest {
void m();
}
private static void simplest1() { }
private static void <warning descr="Private method 'simplest()' is never used">simplest</warning>() { }
public static void main(String[] args) {
Simplest o = C::simplest1;
System.out.println(o);
}
}
@@ -160,5 +160,6 @@ public class LightAdvHighlightingJdk7Test extends LightDaemonAnalyzerTestCase {
public void testClassLiteral() throws Exception { doTest(false, false); }
public void testExtensionMethods() throws Exception { doTest(false, false); }
public void testMethodReferences() throws Exception { doTest(false, true, false); }
public void testUsedMethodsByMethodReferences() throws Exception { doTest(true, true, false); }
public void testLambdaExpressions() throws Exception { doTest(false, true, false); }
}