cleanup - sort modifiers

GitOrigin-RevId: 05b9b893105b42be7bfb8e4df3a39f5800329f00
This commit is contained in:
Vladimir Krivosheev
2024-02-12 17:42:21 +01:00
committed by intellij-monorepo-bot
parent e317447ff1
commit 03b68c5c0f
25 changed files with 74 additions and 260 deletions

View File

@@ -1,6 +1,4 @@
/*
* Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
*/
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.spellchecker;
import com.intellij.openapi.fileTypes.FileType;
@@ -17,27 +15,23 @@ public class DictionaryFileType implements FileType {
private DictionaryFileType() {
}
@NotNull
@Override
public String getName() {
public @NotNull String getName() {
return "Dictionary";
}
@NotNull
@Override
public String getDescription() {
public @NotNull String getDescription() {
return SpellCheckerBundle.message("filetype.dictionary.description");
}
@Nls
@Override
public @NotNull String getDisplayName() {
public @Nls @NotNull String getDisplayName() {
return SpellCheckerBundle.message("filetype.dictionary.display.name");
}
@NotNull
@Override
public String getDefaultExtension() {
public @NotNull String getDefaultExtension() {
return "dic";
}

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.spellchecker.dictionary;
import com.intellij.openapi.extensions.ExtensionPointName;
@@ -15,9 +15,7 @@ public interface CustomDictionaryProvider {
boolean isApplicable(@NotNull String path);
@NotNull
@Nls(capitalization = Nls.Capitalization.Sentence)
default String getDictionaryType() {
default @NotNull @Nls(capitalization = Nls.Capitalization.Sentence) String getDictionaryType() {
return "";
}
}

View File

@@ -26,8 +26,7 @@ public final class UserDictionary implements EditableDictionary {
@Override
public @Nullable Boolean contains(@NotNull String word) {
boolean contains = words.contains(word);
if (contains) return true;
return null;
return contains ? true : null;
}
@Override

View File

@@ -1,18 +1,4 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.spellchecker.engine;
import com.intellij.openapi.util.text.StringUtil;
@@ -24,8 +10,7 @@ import java.util.Set;
public class Transformation {
@Nullable
public String transform(@Nullable String word) {
public @Nullable String transform(@Nullable String word) {
if (word == null) return null;
word = word.trim();
if (word.length() < 3) {
@@ -35,8 +20,7 @@ public class Transformation {
return StringUtil.toLowerCase(word);
}
@Nullable
public Set<String> transform(@Nullable Collection<String> words) {
public @Nullable Set<String> transform(@Nullable Collection<String> words) {
if (words == null || words.isEmpty()) {
return null;
}

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.spellchecker.generator;
import com.intellij.lang.Language;
@@ -147,7 +147,7 @@ public abstract class SpellCheckerDictionaryGenerator {
protected abstract void processFile(PsiFile file, HashSet<String> seenNames);
protected void process(@NotNull final PsiElement element, @NotNull final HashSet<String> seenNames) {
protected void process(final @NotNull PsiElement element, final @NotNull HashSet<String> seenNames) {
final int endOffset = element.getTextRange().getEndOffset();
// collect leafs (spell checker inspection works with leafs)
@@ -170,7 +170,7 @@ public abstract class SpellCheckerDictionaryGenerator {
}
}
protected void processLeafsNames(@NotNull final PsiElement leafElement, @NotNull final HashSet<String> seenNames) {
protected void processLeafsNames(final @NotNull PsiElement leafElement, final @NotNull HashSet<String> seenNames) {
final Language language = leafElement.getLanguage();
SpellCheckingInspection.tokenize(leafElement, language, new TokenConsumer() {
@Override

View File

@@ -1,18 +1,4 @@
/*
* Copyright 2000-2015 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.spellchecker.inspections;
import com.intellij.openapi.application.ApplicationManager;
@@ -67,18 +53,15 @@ public abstract class BaseSplitter implements Splitter {
return false;
}
@NotNull
protected static TextRange matcherRange(@NotNull TextRange range, @NotNull Matcher matcher) {
protected static @NotNull TextRange matcherRange(@NotNull TextRange range, @NotNull Matcher matcher) {
return subRange(range, matcher.start(), matcher.end());
}
@NotNull
protected static TextRange matcherRange(@NotNull TextRange range, @NotNull Matcher matcher, int group) {
protected static @NotNull TextRange matcherRange(@NotNull TextRange range, @NotNull Matcher matcher, int group) {
return subRange(range, matcher.start(group), matcher.end(group));
}
@NotNull
protected static TextRange subRange(@NotNull TextRange range, int start, int end) {
protected static @NotNull TextRange subRange(@NotNull TextRange range, int start, int end) {
return TextRange.from(range.getStartOffset() + start, end - start);
}
@@ -87,8 +70,7 @@ public abstract class BaseSplitter implements Splitter {
return l <= MIN_RANGE_LENGTH;
}
@NotNull
static protected List<TextRange> excludeByPattern(String text, TextRange range, @NotNull Pattern toExclude, int groupToInclude) {
protected static @NotNull List<TextRange> excludeByPattern(String text, TextRange range, @NotNull Pattern toExclude, int groupToInclude) {
List<TextRange> toCheck = new SmartList<>();
int from = range.getStartOffset();
int till;

View File

@@ -1,18 +1,4 @@
/*
* Copyright 2000-2010 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.spellchecker.inspections;
import com.intellij.openapi.progress.ProcessCanceledException;
@@ -35,12 +21,10 @@ public class IdentifierSplitter extends BaseSplitter {
return INSTANCE;
}
@NonNls
private static final Pattern WORD = Pattern.compile("\\b\\p{L}*'?\\p{L}*");
private static final @NonNls Pattern WORD = Pattern.compile("\\b\\p{L}*'?\\p{L}*");
@NonNls
private static final Pattern WORD_IN_QUOTES = Pattern.compile("'([^']*)'");
private static final @NonNls Pattern WORD_IN_QUOTES = Pattern.compile("'([^']*)'");
@Override
public void split(@Nullable String text, @NotNull TextRange range, Consumer<TextRange> consumer) {
@@ -88,8 +72,7 @@ public class IdentifierSplitter extends BaseSplitter {
}
}
@NotNull
private static List<TextRange> splitByCase(@NotNull String text, @NotNull TextRange range) {
private static @NotNull List<TextRange> splitByCase(@NotNull String text, @NotNull TextRange range) {
//System.out.println("text = " + text + " range = " + range);
List<TextRange> result = new ArrayList<>();
int i = range.getStartOffset();

View File

@@ -1,18 +1,4 @@
/*
* Copyright 2000-2013 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.spellchecker.inspections;
import com.intellij.openapi.progress.ProcessCanceledException;
@@ -61,14 +47,14 @@ public class PlainTextSplitter extends BaseSplitter {
private static final int SHA384_BASE64_LENGTH = 64;
private static final String SHA384_PREFIX = "sha384-";
private final static Pattern SHA384_PREFIXED_VALUE_PATTERN = Pattern.compile("sha384-[A-Za-z0-9+=/]{" + SHA384_BASE64_LENGTH + "}");
private static final Pattern SHA384_PREFIXED_VALUE_PATTERN = Pattern.compile("sha384-[A-Za-z0-9+=/]{" + SHA384_BASE64_LENGTH + "}");
private static final int SHA512_BASE64_LENGTH = 88;
private static final String SHA512_PREFIX = "sha512-";
private final static Pattern SHA512_PREFIXED_VALUE_PATTERN = Pattern.compile("sha512-[A-Za-z0-9+=/]{" + SHA512_BASE64_LENGTH + "}");
private static final Pattern SHA512_PREFIXED_VALUE_PATTERN = Pattern.compile("sha512-[A-Za-z0-9+=/]{" + SHA512_BASE64_LENGTH + "}");
private final static String JWT_COMMON_PREFIX = "eyJhbGci"; // Base64 of `{"alg":` in JWT header
private final static Pattern JWT_PATTERN = Pattern.compile("[A-Za-z0-9+=/_\\-.]+");
private static final String JWT_COMMON_PREFIX = "eyJhbGci"; // Base64 of `{"alg":` in JWT header
private static final Pattern JWT_PATTERN = Pattern.compile("[A-Za-z0-9+=/_\\-.]+");
@Override
public void split(@Nullable String text, @NotNull TextRange range, Consumer<TextRange> consumer) {
@@ -149,8 +135,7 @@ public class PlainTextSplitter extends BaseSplitter {
}
}
@NotNull
protected Splitter getTextSplitter() {
protected @NotNull Splitter getTextSplitter() {
return TextSplitter.getInstance();
}

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.spellchecker.inspections;
import com.intellij.codeInspection.*;
@@ -63,15 +63,12 @@ public final class SpellCheckingInspection extends LocalInspectionTool {
}
@Override
@NonNls
@NotNull
public String getShortName() {
public @NonNls @NotNull String getShortName() {
return SPELL_CHECKING_INSPECTION_TOOL_NAME;
}
@Override
@NotNull
public PsiElementVisitor buildVisitor(@NotNull final ProblemsHolder holder, final boolean isOnTheFly) {
public @NotNull PsiElementVisitor buildVisitor(final @NotNull ProblemsHolder holder, final boolean isOnTheFly) {
if (!Registry.is("spellchecker.inspection.enabled", true)) {
return PsiElementVisitor.EMPTY_VISITOR;
}
@@ -79,7 +76,7 @@ public final class SpellCheckingInspection extends LocalInspectionTool {
return new PsiElementVisitor() {
@Override
public void visitElement(@NotNull final PsiElement element) {
public void visitElement(final @NotNull PsiElement element) {
if (holder.getResultCount() > 1000) return;
final ASTNode node = element.getNode();
@@ -126,7 +123,7 @@ public final class SpellCheckingInspection extends LocalInspectionTool {
* @param language Usually element.getLanguage()
* @param consumer the consumer of tokens
*/
public static void tokenize(@NotNull final PsiElement element, @NotNull final Language language, TokenConsumer consumer) {
public static void tokenize(final @NotNull PsiElement element, final @NotNull Language language, TokenConsumer consumer) {
SpellcheckingStrategy factoryByLanguage = getSpellcheckingStrategy(element, language);
if (factoryByLanguage == null) {
return;

View File

@@ -1,18 +1,4 @@
/*
* Copyright 2000-2013 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.spellchecker.inspections;
import com.intellij.openapi.progress.ProcessCanceledException;
@@ -67,9 +53,8 @@ public class TextSplitter extends BaseSplitter {
}
}
@NotNull
@Contract(pure = true)
protected Pattern getExtendedWordAndSpecial() {
protected @NotNull Pattern getExtendedWordAndSpecial() {
return EXTENDED_WORD_AND_SPECIAL;
}
}

View File

@@ -1,24 +1,9 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.spellchecker.quickfixes;
import com.intellij.codeInspection.ProblemDescriptor;
import com.intellij.codeInspection.ProblemDescriptorUtil;
import com.intellij.icons.AllIcons;
import com.intellij.openapi.actionSystem.Anchor;
import com.intellij.openapi.project.Project;
import com.intellij.spellchecker.SpellCheckerManager;
import com.intellij.spellchecker.util.SpellCheckerBundle;
@@ -43,14 +28,12 @@ public class AcceptWordAsCorrect implements SpellCheckerQuickFix {
}
@Override
@NotNull
public String getName() {
public @NotNull String getName() {
return myWord != null ? SpellCheckerBundle.message("add.0.to.dictionary", myWord) : SpellCheckerBundle.message("add.to.dictionary");
}
@Override
@NotNull
public String getFamilyName() {
public @NotNull String getFamilyName() {
return SpellCheckerBundle.message("add.to.dictionary");
}

View File

@@ -1,18 +1,4 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.spellchecker.quickfixes;
import com.intellij.openapi.project.Project;
@@ -30,8 +16,7 @@ public abstract class LazySuggestions {
this.typo = typo;
}
@NotNull
public List<String> getSuggestions(Project project) {
public @NotNull List<String> getSuggestions(Project project) {
if (!processed) {
suggestions = SpellCheckerManager.getInstance(project).getSuggestions(typo);
processed = true;

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.spellchecker.quickfixes;
import com.intellij.modcommand.ModPsiUpdater;
@@ -21,8 +21,7 @@ import java.util.List;
public class RenameTo extends PsiUpdateModCommandQuickFix implements Iconable {
@Override
@NotNull
public String getFamilyName() {
public @NotNull String getFamilyName() {
return getFixName();
}
@@ -39,8 +38,7 @@ public class RenameTo extends PsiUpdateModCommandQuickFix implements Iconable {
updater.rename(named, psiElement, names);
}
@Nls
public static String getFixName() {
public static @Nls String getFixName() {
return SpellCheckerBundle.message("rename.to");
}

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.spellchecker.quickfixes;
import com.intellij.codeInsight.daemon.impl.UpdateHighlightersUtil;
@@ -47,14 +47,12 @@ public final class SaveTo implements SpellCheckerQuickFix, LowPriorityAction {
}
@Override
@NotNull
public String getName() {
public @NotNull String getName() {
return SpellCheckerBundle.message("save.0.to.1", myWord != null ? SpellCheckerBundle.message("0.in.quotes", myWord) : "");
}
@Override
@NotNull
public String getFamilyName() {
public @NotNull String getFamilyName() {
final String dictionary = myLevel != DictionaryLevel.NOT_SPECIFIED ? myLevel.getName() + DICTIONARY : DOTS;
return SpellCheckerBundle.message("save.0.to.1", "", dictionary);
}

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.spellchecker.settings;
import com.intellij.openapi.fileChooser.FileChooser;
@@ -31,7 +31,7 @@ import static java.util.Arrays.asList;
public final class CustomDictionariesPanel extends JPanel {
private final SpellCheckerSettings mySettings;
@NotNull private final SpellCheckerManager myManager;
private final @NotNull SpellCheckerManager myManager;
private final CustomDictionariesTableView myCustomDictionariesTableView;
private final List<String> removedDictionaries = new ArrayList<>();
private final List<String> defaultDictionaries;
@@ -199,9 +199,8 @@ public final class CustomDictionariesPanel extends JPanel {
return info;
}
@Nullable
@Override
public TableCellRenderer getRenderer(String s) {
public @Nullable TableCellRenderer getRenderer(String s) {
return myTypeRenderer;
}
}

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.spellchecker.settings;
import com.intellij.openapi.application.ApplicationManager;
@@ -45,8 +45,7 @@ public final class SpellCheckerSettings implements PersistentStateComponent<Elem
private boolean myUseSingleDictionaryToSave = DEFAULT_USE_SINGLE_DICT;
private boolean mySettingsTransferred;
@NlsSafe
public String getDictionaryToSave() {
public @NlsSafe String getDictionaryToSave() {
//This is NLS safe since dictionary names are NLS
return myDictionaryToSave;
}
@@ -133,7 +132,7 @@ public final class SpellCheckerSettings implements PersistentStateComponent<Elem
@Override
public void loadState(@NotNull final Element element) {
public void loadState(final @NotNull Element element) {
myRuntimeDisabledDictionariesNames.clear();
myCustomDictionariesPaths.clear();
myOldDictionaryFoldersPaths.clear();

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.spellchecker.settings;
import com.intellij.openapi.extensions.BaseExtensionPointName;
@@ -27,20 +27,17 @@ public class SpellCheckerSettingsManager implements SearchableConfigurable, Conf
}
@Override
@Nls
public String getDisplayName() {
public @Nls String getDisplayName() {
return SpellCheckerBundle.message("spelling");
}
@Override
@NonNls
public @NotNull String getHelpTopic() {
public @NonNls @NotNull String getHelpTopic() {
return "reference.settings.ide.settings.spelling";
}
@Override
@NotNull
public String getId() {
public @NotNull String getId() {
return getHelpTopic();
}

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.spellchecker.settings;
import com.intellij.ide.DataManager;
@@ -254,8 +254,7 @@ public final class SpellCheckerSettingsPane implements Disposable {
myListModel.removeAllElements();
}
@NotNull
public List<String> getWords() {
public @NotNull List<String> getWords() {
Object[] pairs = getListItems();
if (pairs == null) {
return new ArrayList<>();

View File

@@ -1,18 +1,4 @@
/*
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.spellchecker.state;
import com.intellij.openapi.components.StateSplitterEx;
@@ -26,9 +12,8 @@ import java.util.List;
* @author shkate@jetbrains.com
*/
public class ProjectDictionarySplitter extends StateSplitterEx {
@NotNull
@Override
public List<Pair<Element, String>> splitState(@NotNull Element state) {
public @NotNull List<Pair<Element, String>> splitState(@NotNull Element state) {
return splitState(state, DictionaryState.NAME_ATTRIBUTE);
}
}

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.spellchecker.tokenizer;
import com.intellij.openapi.util.Key;
@@ -20,8 +20,7 @@ public abstract class EscapeSequenceTokenizer<T extends PsiElement> extends Toke
}
@Override
@NotNull
public TextRange getHighlightingRange(PsiElement element, int offset, TextRange range) {
public @NotNull TextRange getHighlightingRange(PsiElement element, int offset, TextRange range) {
final int[] offsets = element.getUserData(ESCAPE_OFFSETS);
if (offsets != null) {
int start = offsets[range.getStartOffset()];

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.spellchecker.tokenizer;
import com.intellij.codeInspection.LocalQuickFix;
@@ -53,8 +53,7 @@ public class SpellcheckingStrategy {
/**
* @return {@link #EMPTY_TOKENIZER} to skip spellchecking, {@link #TEXT_TOKENIZER} for full element text or custom Tokenizer implementation.
*/
@NotNull
public Tokenizer getTokenizer(PsiElement element) {
public @NotNull Tokenizer getTokenizer(PsiElement element) {
if (element instanceof PsiWhiteSpace) {
return EMPTY_TOKENIZER;
}

View File

@@ -1,18 +1,4 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.spellchecker.tokenizer;
import com.intellij.openapi.util.TextRange;
@@ -76,8 +62,7 @@ public class Token<T extends PsiElement> {
return offset;
}
@NotNull
public TextRange getRange() {
public @NotNull TextRange getRange() {
if (range == null) {
range = new TextRange(0, (text != null ? text.length() : 0));
}

View File

@@ -1,18 +1,4 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.spellchecker.tokenizer;
import com.intellij.openapi.util.TextRange;
@@ -23,8 +9,7 @@ public abstract class Tokenizer<T extends PsiElement> {
public abstract void tokenize(@NotNull T element, @NotNull TokenConsumer consumer);
@NotNull
public TextRange getHighlightingRange(PsiElement element, int offset, TextRange textRange) {
public @NotNull TextRange getHighlightingRange(PsiElement element, int offset, TextRange textRange) {
return TextRange.from(offset + textRange.getStartOffset(), textRange.getLength());
}
}

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.spellchecker.ui;
import com.intellij.codeInsight.daemon.DaemonCodeAnalyzer;
@@ -9,7 +9,6 @@ import com.intellij.codeInspection.LocalInspectionTool;
import com.intellij.codeInspection.ex.InspectionProfileImpl;
import com.intellij.codeInspection.ex.InspectionProfileWrapper;
import com.intellij.codeInspection.ex.LocalInspectionToolWrapper;
import com.intellij.execution.dashboard.actions.RunAction;
import com.intellij.openapi.application.ReadAction;
import com.intellij.openapi.editor.ex.EditorEx;
import com.intellij.openapi.project.Project;
@@ -116,9 +115,8 @@ public class SpellCheckingEditorCustomization extends SimpleEditorCustomization
= CollectionFactory.createConcurrentWeakKeySoftValueMap();
private boolean myUseSpellCheck;
@NotNull
@Override
public InspectionProfileWrapper apply(@NotNull InspectionProfile profile) {
public @NotNull InspectionProfileWrapper apply(@NotNull InspectionProfile profile) {
if (!READY) {
return new InspectionProfileWrapper((InspectionProfileImpl)profile);
}

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.spellchecker.ui;
import com.intellij.openapi.editor.SpellCheckingEditorCustomizationProvider;
@@ -14,15 +14,13 @@ final class SpellCheckingEditorCustomizationProviderImpl extends SpellCheckingEd
private static final NotNullLazyValue<SpellCheckingEditorCustomization> DISABLED =
NotNullLazyValue.createValue(() -> new SpellCheckingEditorCustomization(false));
@NotNull
@Override
public EditorCustomization getEnabledCustomization() {
public @NotNull EditorCustomization getEnabledCustomization() {
return ENABLED.getValue();
}
@NotNull
@Override
public EditorCustomization getDisabledCustomization() {
public @NotNull EditorCustomization getDisabledCustomization() {
return DISABLED.getValue();
}