mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
switch selector error message (IDEA-123937)
This commit is contained in:
+5
-3
@@ -1323,10 +1323,12 @@ public class HighlightUtil extends HighlightUtilBase {
|
||||
return null;
|
||||
}
|
||||
HighlightInfo errorResult = null;
|
||||
if (!isValidTypeForSwitchSelector(type, PsiUtil.isLanguageLevel7OrHigher(expression))) {
|
||||
final boolean atLeastJava7 = PsiUtil.isLanguageLevel7OrHigher(expression);
|
||||
if (!isValidTypeForSwitchSelector(type, atLeastJava7)) {
|
||||
final String switchSelectorMessage = atLeastJava7 ? JavaErrorMessages.message("valid.switch.17.selector.types")
|
||||
: JavaErrorMessages.message("valid.switch.selector.types");
|
||||
String message =
|
||||
JavaErrorMessages.message("incompatible.types", JavaErrorMessages.message("valid.switch.selector.types"), JavaHighlightUtil.formatType(
|
||||
type));
|
||||
JavaErrorMessages.message("incompatible.types", switchSelectorMessage, JavaHighlightUtil.formatType(type));
|
||||
errorResult = HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(expression).descriptionAndTooltip(message).create();
|
||||
QuickFixAction.registerQuickFixAction(errorResult, QUICK_FIX_FACTORY.createConvertSwitchToIfIntention(statement));
|
||||
if (PsiType.LONG.equals(type) || PsiType.FLOAT.equals(type) || PsiType.DOUBLE.equals(type)) {
|
||||
|
||||
@@ -220,6 +220,7 @@ not.a.statement=Not a statement
|
||||
invalid.statement=Invalid statement
|
||||
incompatible.types=Incompatible types. Found: ''{1}'', required: ''{0}''
|
||||
valid.switch.selector.types=byte, char, short or int
|
||||
valid.switch.17.selector.types=char, byte, short, int, Character, Byte, Short, Integer, String, or an enum
|
||||
dot.expected.after.super.or.this='.' expected
|
||||
unqualified.super.disallowed=Unqualified super reference is not allowed in extension method
|
||||
|
||||
|
||||
Reference in New Issue
Block a user