[spellchecker] fix IJPL-772

Relaxed nullability requirement for DictionaryLayer in SaveTo, it already handles null gracefully, and, unfortunately, it is valid situation when we can't find layer by name, since it is stored as localized string value.

GitOrigin-RevId: 46442994aff7248c198d8d23ee0f3a9490521a9f
This commit is contained in:
Denis Mukhametianov
2024-03-11 12:07:49 +01:00
committed by intellij-monorepo-bot
parent a04f5d5dde
commit a280b5208f
2 changed files with 2 additions and 2 deletions

View File

@@ -39,7 +39,7 @@ public final class SaveTo implements SpellCheckerQuickFix, LowPriorityAction {
myWord = word;
}
public SaveTo(String word, @NotNull DictionaryLayer layer) {
public SaveTo(String word, @Nullable DictionaryLayer layer) {
myWord = word;
myLayer = layer;
}

View File

@@ -143,7 +143,7 @@ public class SpellcheckingStrategy {
final SpellCheckerSettings settings = SpellCheckerSettings.getInstance(element.getProject());
if (settings.isUseSingleDictionaryToSave()) {
result.add(new SaveTo(typo, Objects.requireNonNull(DictionaryLayersProvider.getLayer(element.getProject(), settings.getDictionaryToSave()))));
result.add(new SaveTo(typo, DictionaryLayersProvider.getLayer(element.getProject(), settings.getDictionaryToSave())));
return result.toArray(LocalQuickFix.EMPTY_ARRAY);
}