mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
inline local: fix for outer lambda + nested lambda/class (IDEA-174979)
This commit is contained in:
@@ -84,7 +84,7 @@ public class InlineLocalHandler extends JavaInlineActionHandler {
|
||||
|
||||
final List<PsiElement> innerClassesWithUsages = Collections.synchronizedList(new ArrayList<PsiElement>());
|
||||
final List<PsiElement> innerClassUsages = Collections.synchronizedList(new ArrayList<PsiElement>());
|
||||
final PsiClass containingClass = PsiTreeUtil.getParentOfType(local, PsiClass.class);
|
||||
final PsiElement containingClass = PsiTreeUtil.getParentOfType(local, PsiClass.class, PsiLambdaExpression.class);
|
||||
final Query<PsiReference> query = ReferencesSearch.search(local);
|
||||
if (!ProgressManager.getInstance().runProcessWithProgressSynchronously(() -> {
|
||||
if (query.findFirst() == null){
|
||||
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
class Foo {
|
||||
void foo(String s) {
|
||||
Runnable r = () -> {
|
||||
String s2 = s.toString();
|
||||
Runnable r2 = () -> System.out.println(s<caret>2);
|
||||
};
|
||||
}
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
class Foo {
|
||||
void foo(String s) {
|
||||
Runnable r = () -> {
|
||||
Runnable r2 = () -> System.out.println(s.toString());
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -301,6 +301,10 @@ public class InlineLocalTest extends LightCodeInsightTestCase {
|
||||
doTest(false);
|
||||
}
|
||||
|
||||
public void testLocalInsideLambdaWithNestedLambda() throws Exception {
|
||||
doTest(true);
|
||||
}
|
||||
|
||||
private void doTest(final boolean inlineDef, String conflictMessage) throws Exception {
|
||||
try {
|
||||
doTest(inlineDef);
|
||||
|
||||
Reference in New Issue
Block a user