EA-443789 [patterns for switch] - removed @NotNull constraints for highlighting info

Error highlighting could be suppressed by HighlightInfoFilter.
For instance OutsidersPsiFileSupport.HighlightFilter hides highlighting warnings in the files
from a different revision and highlight info will be null then.

GitOrigin-RevId: 0dcf5aec042aac0af90077585f78e32a7db2234c
This commit is contained in:
Ilyas Selimov
2022-02-07 15:56:06 +07:00
committed by intellij-monorepo-bot
parent e6d7eb23aa
commit a49f889442

View File

@@ -278,7 +278,7 @@ public class SwitchBlockHighlightingModel {
}
}
@NotNull
@Nullable
HighlightInfo createDuplicateInfo(@Nullable Object duplicateKey, @NotNull PsiElement duplicateElement) {
String description = duplicateKey == myDefaultValue ? JavaErrorBundle.message("duplicate.default.switch.label") :
JavaErrorBundle.message("duplicate.switch.label", duplicateKey);
@@ -318,6 +318,7 @@ public class SwitchBlockHighlightingModel {
results.add(info);
}
@Nullable
HighlightInfo createCompletenessInfoForSwitch(boolean hasAnyCaseLabels) {
String messageKey;
boolean isSwitchExpr = myBlock instanceof PsiExpression;
@@ -349,6 +350,7 @@ public class SwitchBlockHighlightingModel {
return null;
}
@Nullable
private static HighlightInfo createError(@NotNull PsiElement range, @NlsSafe @NotNull String message) {
return HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(range).descriptionAndTooltip(message).create();
}
@@ -555,7 +557,7 @@ public class SwitchBlockHighlightingModel {
}
@Override
@NotNull
@Nullable
HighlightInfo createDuplicateInfo(@Nullable Object duplicateKey, @NotNull PsiElement duplicateElement) {
String description;
if (duplicateKey == myDefaultValue) {