mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-04-19 21:11:28 +07:00
IDEA-220634 Completion suggests finalize() first after @Nullable/@Nonnull, final expected
GitOrigin-RevId: 4c77dc0eeeae84d60d320e13338dc6de1aaf2ec0
This commit is contained in:
committed by
intellij-monorepo-bot
parent
b76ef269a4
commit
476bc6682a
@@ -113,7 +113,8 @@ public class JavaCompletionContributor extends CompletionContributor {
|
||||
if (JavaKeywordCompletion.isDeclarationStart(position) ||
|
||||
JavaKeywordCompletion.isInsideParameterList(position) ||
|
||||
isInsideAnnotationName(position) ||
|
||||
psiElement().inside(PsiReferenceParameterList.class).accepts(position)) {
|
||||
psiElement().inside(PsiReferenceParameterList.class).accepts(position) ||
|
||||
isDefinitelyVariableType(position)) {
|
||||
return new OrFilter(ElementClassFilter.CLASS, ElementClassFilter.PACKAGE);
|
||||
}
|
||||
|
||||
@@ -178,6 +179,10 @@ public class JavaCompletionContributor extends CompletionContributor {
|
||||
return TrueFilter.INSTANCE;
|
||||
}
|
||||
|
||||
private static boolean isDefinitelyVariableType(PsiElement position) {
|
||||
return psiElement().withParents(PsiJavaCodeReferenceElement.class, PsiTypeElement.class, PsiDeclarationStatement.class).afterLeaf(psiElement().inside(psiAnnotation())).accepts(position);
|
||||
}
|
||||
|
||||
private static boolean isInExtendsOrImplementsList(PsiElement position) {
|
||||
PsiClass containingClass = PsiTreeUtil.getParentOfType(
|
||||
position, PsiClass.class, false, PsiCodeBlock.class, PsiMethod.class, PsiExpressionList.class, PsiVariable.class, PsiAnnotation.class);
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
class C {
|
||||
void foo() {
|
||||
@Anno fina<caret>
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
class C {
|
||||
void foo() {
|
||||
@Anno final <caret>
|
||||
}
|
||||
}
|
||||
@@ -1942,4 +1942,6 @@ class Abc {
|
||||
void testRemoveParenthesesWhenReplacingEmptyCallWithConstant() {
|
||||
doTest('\t')
|
||||
}
|
||||
|
||||
void testNoCallsAfterAnnotationInCodeBlock() { doTest() }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user