mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-09 20:42:52 +07:00
find functional expressions by method type parameter
This commit is contained in:
+11
@@ -0,0 +1,11 @@
|
||||
interface SA<caret>M {
|
||||
void foo();
|
||||
}
|
||||
|
||||
class Test {
|
||||
{
|
||||
SAM sam = bar(() -> {});
|
||||
}
|
||||
|
||||
<T> T bar(T t){ return t;}
|
||||
}
|
||||
+13
-1
@@ -42,7 +42,19 @@ public class FindFunctionalInterfaceTest extends LightCodeInsightFixtureTestCase
|
||||
assertEquals("() -> {}", next.getText());
|
||||
}
|
||||
|
||||
@Bombed(day = 30, month = Calendar.SEPTEMBER)
|
||||
public void testMethodArgumentByTypeParameter() throws Exception {
|
||||
myFixture.configureByFile(getTestName(false) + ".java");
|
||||
final PsiElement elementAtCaret = myFixture.getElementAtCaret();
|
||||
assertNotNull(elementAtCaret);
|
||||
final PsiClass psiClass = PsiTreeUtil.getParentOfType(elementAtCaret, PsiClass.class, false);
|
||||
assertTrue(psiClass != null && psiClass.isInterface());
|
||||
final Collection<PsiFunctionalExpression> expressions = FunctionalExpressionSearch.search(psiClass).findAll();
|
||||
assertTrue(expressions.size() == 1);
|
||||
final PsiFunctionalExpression next = expressions.iterator().next();
|
||||
assertNotNull(next);
|
||||
assertEquals("() -> {}", next.getText());
|
||||
}
|
||||
|
||||
public void testFieldFromAnonymousClassScope() throws Exception {
|
||||
myFixture.configureByFile(getTestName(false) + ".java");
|
||||
final PsiElement elementAtCaret = myFixture.getElementAtCaret();
|
||||
|
||||
Reference in New Issue
Block a user