From 41beeed92698a45d1ac18063d6e281ffb198fde6 Mon Sep 17 00:00:00 2001 From: peter Date: Fri, 4 Jan 2019 17:59:11 +0100 Subject: [PATCH] java mad testing: don't expect completions on broken case --- .../com/intellij/java/propertyBased/JavaCompletionPolicy.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/java/java-tests/testSrc/com/intellij/java/propertyBased/JavaCompletionPolicy.java b/java/java-tests/testSrc/com/intellij/java/propertyBased/JavaCompletionPolicy.java index 60ee493f0c50..08c26f56ab86 100644 --- a/java/java-tests/testSrc/com/intellij/java/propertyBased/JavaCompletionPolicy.java +++ b/java/java-tests/testSrc/com/intellij/java/propertyBased/JavaCompletionPolicy.java @@ -165,6 +165,9 @@ class JavaCompletionPolicy extends CompletionPolicy { return false; // no modifiers for local classes/variables } } + if (parent instanceof PsiSwitchLabelStatementBase && ((PsiSwitchLabelStatementBase)parent).getEnclosingSwitchBlock() == null) { + return false; // bad syntax + } } if (leaf.textMatches(PsiKeyword.TRUE) || leaf.textMatches(PsiKeyword.FALSE)) { return false; // boolean literal presence depends on expected types, which can be missing in red files