mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-83969 code completion in switch/case: auto/unboxing not checked with code completion
This commit is contained in:
+2
-2
@@ -96,8 +96,8 @@ public class JavaCompletionContributor extends CompletionContributor {
|
||||
public boolean accepts(@NotNull PsiSwitchStatement psiSwitchStatement, ProcessingContext context) {
|
||||
final PsiExpression expression = psiSwitchStatement.getExpression();
|
||||
if(expression == null) return false;
|
||||
final PsiType type = expression.getType();
|
||||
return type instanceof PsiClassType;
|
||||
PsiClass aClass = PsiUtil.resolveClassInClassTypeOnly(expression.getType());
|
||||
return aClass != null && aClass.isEnum();
|
||||
}
|
||||
})));
|
||||
private static final ElementPattern<PsiElement> AFTER_NUMBER_LITERAL =
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
public class Demo {
|
||||
void foo(Integer i){
|
||||
switch(i) {
|
||||
case Types.CH<caret>
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
interface Types {
|
||||
int CHAR = 2;
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
public class Demo {
|
||||
void foo(Integer i){
|
||||
switch(i) {
|
||||
case Types.CHAR<caret>
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
interface Types {
|
||||
int CHAR = 2;
|
||||
}
|
||||
+1
@@ -773,6 +773,7 @@ public class ListUtils {
|
||||
|
||||
public void testSecondMethodParameter() throws Throwable { doTest(); }
|
||||
public void testReturnInCase() throws Throwable { doTest(); }
|
||||
public void testUnboxedConstantsInCase() throws Throwable { doTest(); }
|
||||
|
||||
public void testAnnotationWithoutValueMethod() throws Throwable {
|
||||
configureByFile(getTestName(false) + ".java");
|
||||
|
||||
Reference in New Issue
Block a user