mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-175870 No "final" completion in a variable in a lambda
This commit is contained in:
@@ -402,10 +402,7 @@ public class JavaKeywordCompletion {
|
||||
}
|
||||
|
||||
private void addFinal() {
|
||||
PsiStatement statement = PsiTreeUtil.getParentOfType(myPosition, PsiExpressionStatement.class);
|
||||
if (statement == null) {
|
||||
statement = PsiTreeUtil.getParentOfType(myPosition, PsiDeclarationStatement.class);
|
||||
}
|
||||
PsiStatement statement = PsiTreeUtil.getParentOfType(myPosition, PsiExpressionStatement.class, PsiDeclarationStatement.class);
|
||||
if (statement != null && statement.getTextRange().getStartOffset() == myPosition.getTextRange().getStartOffset()) {
|
||||
if (!psiElement().withSuperParent(2, PsiSwitchStatement.class).afterLeaf("{").accepts(statement)) {
|
||||
PsiTryStatement tryStatement = PsiTreeUtil.getParentOfType(myPrevLeaf, PsiTryStatement.class);
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
public class Util {
|
||||
void foo() {
|
||||
runAction(() -> {
|
||||
f<caret>inal Object action;
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
+1
@@ -133,6 +133,7 @@ public class KeywordCompletionTest extends LightCompletionTestCase {
|
||||
public void testFinalInCatch() { doTest(1, "final"); }
|
||||
public void testFinalInIncompleteCatch() { doTest(1, "final"); }
|
||||
public void testFinalInTryWithResources() { doTest(1, "final", "float", "class"); }
|
||||
public void testFinalInLambda() { doTest(2, "final", "float"); }
|
||||
public void testNoFinalAfterTryBody() { doTest(1, "final", "finally"); }
|
||||
public void testClassInMethod() { doTest(2, "class", "char"); }
|
||||
public void testIntInClassArray() { doTest(2, "int", "char", "final"); }
|
||||
|
||||
Reference in New Issue
Block a user